@pluno/product-agent-web 0.1.28 → 0.1.30
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/product-agent-widget.js +769 -678
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
1
|
+
import { PlunoProductAgent as rn } from "./product-agent-sdk.js";
|
|
2
|
+
const ln = "#7c3aed";
|
|
3
|
+
function pn(e) {
|
|
4
|
+
const t = gn(e);
|
|
5
5
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
6
6
|
<defs>
|
|
7
7
|
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
@@ -75,23 +75,23 @@ function Yt(e) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function sn(e) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(pn(e))}`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const t =
|
|
84
|
-
if (
|
|
81
|
+
const re = "#2c2a1e", nt = [253, 250, 241], ot = 3.5;
|
|
82
|
+
function Lt(e) {
|
|
83
|
+
const t = Pt(e);
|
|
84
|
+
if (at(he(t), nt) >= ot)
|
|
85
85
|
return t;
|
|
86
|
-
let o =
|
|
87
|
-
const a =
|
|
86
|
+
let o = he(t);
|
|
87
|
+
const a = he(re);
|
|
88
88
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
89
|
+
if (o = hn(o, a, 0.22), at(o, nt) >= ot)
|
|
90
|
+
return Oe(o);
|
|
91
|
+
return Oe(o);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const t =
|
|
93
|
+
function dn(e) {
|
|
94
|
+
const t = Lt(e), n = "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";
|
|
95
95
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
96
|
<defs>
|
|
97
97
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,26 +104,26 @@ function Zt(e) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${un()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
108
|
</g>
|
|
109
|
-
<path d="${n}" fill="none" stroke="${
|
|
109
|
+
<path d="${n}" fill="none" stroke="${re}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
110
|
<g transform="rotate(-2 528 463)">
|
|
111
|
-
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${
|
|
112
|
-
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${
|
|
111
|
+
<ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${re}" stroke-width="13"/>
|
|
112
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${re}"/>
|
|
113
113
|
<circle cx="557" cy="447" r="16" fill="#ffffff"/>
|
|
114
114
|
</g>
|
|
115
115
|
<g transform="rotate(2 717 462)">
|
|
116
|
-
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${
|
|
117
|
-
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${
|
|
116
|
+
<ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${re}" stroke-width="13"/>
|
|
117
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${re}"/>
|
|
118
118
|
<circle cx="728" cy="447" r="16" fill="#ffffff"/>
|
|
119
119
|
</g>
|
|
120
120
|
</g>
|
|
121
121
|
</svg>`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
123
|
+
function cn(e) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(dn(e))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function un() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
128
|
for (let i = 150; i <= 1170; i += 62) {
|
|
129
129
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -131,8 +131,8 @@ function Qt() {
|
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
134
|
+
function gn(e) {
|
|
135
|
+
const t = Pt(e), n = Be(he(t));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -156,90 +156,90 @@ function en(e) {
|
|
|
156
156
|
inner: "#4b4b4b",
|
|
157
157
|
shadow: "#000000"
|
|
158
158
|
} : {
|
|
159
|
-
top:
|
|
160
|
-
middle:
|
|
161
|
-
bottom:
|
|
162
|
-
edgeStart:
|
|
163
|
-
edgeMiddle:
|
|
164
|
-
edgeEnd:
|
|
165
|
-
glow:
|
|
166
|
-
highlight:
|
|
167
|
-
inner:
|
|
168
|
-
shadow:
|
|
159
|
+
top: z(t, 0.28, -0.03),
|
|
160
|
+
middle: z(t, 0.08, 0.04),
|
|
161
|
+
bottom: z(t, -0.1, 0.02),
|
|
162
|
+
edgeStart: z(t, 0.08, 0.08),
|
|
163
|
+
edgeMiddle: z(t, -0.08, 0.08),
|
|
164
|
+
edgeEnd: z(t, -0.18, 0.05),
|
|
165
|
+
glow: z(t, 0.32, -0.12),
|
|
166
|
+
highlight: z(t, 0.38, -0.18),
|
|
167
|
+
inner: z(t, 0.24, -0.1),
|
|
168
|
+
shadow: z(t, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Pt(e) {
|
|
172
172
|
const t = e.trim();
|
|
173
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
173
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ln;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function he(e) {
|
|
176
176
|
return [
|
|
177
177
|
Number.parseInt(e.slice(1, 3), 16),
|
|
178
178
|
Number.parseInt(e.slice(3, 5), 16),
|
|
179
179
|
Number.parseInt(e.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Oe([e, t, n]) {
|
|
183
183
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
184
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Be([e, t, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
188
|
const i = a / 255;
|
|
189
189
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
191
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
193
|
+
function at(e, t) {
|
|
194
|
+
const n = Be(e), o = Be(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
195
|
return (a + 0.05) / (i + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
197
|
+
function hn(e, t, n) {
|
|
198
|
+
const o = Fe(n);
|
|
199
199
|
return [
|
|
200
200
|
e[0] + (t[0] - e[0]) * o,
|
|
201
201
|
e[1] + (t[1] - e[1]) * o,
|
|
202
202
|
e[2] + (t[2] - e[2]) * o
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const [o, a, i] =
|
|
207
|
-
return
|
|
205
|
+
function z(e, t, n) {
|
|
206
|
+
const [o, a, i] = mn(he(e));
|
|
207
|
+
return Oe(fn(o, Fe(a + n), Fe(i + t)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function mn([e, t, n]) {
|
|
210
210
|
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
212
|
return [0, 0, c];
|
|
213
213
|
const d = l - p, s = c > 0.5 ? d / (2 - l - p) : d / (l + p);
|
|
214
214
|
return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, s, c];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function fn(e, t, n) {
|
|
217
217
|
if (t === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
219
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
Ne(a, o, e + 1 / 3) * 255,
|
|
222
|
+
Ne(a, o, e) * 255,
|
|
223
|
+
Ne(a, o, e - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Ne(e, t, n) {
|
|
227
227
|
let o = n;
|
|
228
228
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Fe(e) {
|
|
231
231
|
return Math.max(0, Math.min(1, e));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
233
|
+
const At = "suggest_share_on_socials";
|
|
234
|
+
function bn(e) {
|
|
235
235
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
236
236
|
const n = e[t];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== At)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = it(e, t, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = it(e, o.index, "user");
|
|
243
243
|
return a ? {
|
|
244
244
|
id: `share:${n.callId ?? n.id}`,
|
|
245
245
|
userPrompt: a.content,
|
|
@@ -248,13 +248,13 @@ function an(e) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
252
|
-
const t = await
|
|
251
|
+
async function wn(e) {
|
|
252
|
+
const t = await _n(e);
|
|
253
253
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
254
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
255
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function it(e, t, n) {
|
|
258
258
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
259
259
|
const a = e[o];
|
|
260
260
|
if (a.role === n && a.content.trim())
|
|
@@ -262,73 +262,73 @@ function Ye(e, t, n) {
|
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function
|
|
265
|
+
async function _n(e) {
|
|
266
266
|
return await (await fetch(e)).blob();
|
|
267
267
|
}
|
|
268
|
-
const
|
|
269
|
-
function
|
|
268
|
+
const xn = "https://app.pluno.ai", vn = "/api/product-agent/embed/active-users", yn = 1800, Cn = 15e3, En = 250, Sn = 1e3, kn = 3e4;
|
|
269
|
+
function Ln(e, t = {}) {
|
|
270
270
|
let n = !1, o = null, a = null, i = null;
|
|
271
271
|
const l = () => {
|
|
272
272
|
i !== null && (window.clearInterval(i), i = null);
|
|
273
273
|
}, p = (s) => {
|
|
274
274
|
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
275
275
|
d();
|
|
276
|
-
},
|
|
276
|
+
}, Tn(s)));
|
|
277
277
|
}, c = (s) => {
|
|
278
278
|
if (l(), o === null) {
|
|
279
279
|
o = s, e(s);
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
const
|
|
282
|
+
const b = o, y = performance.now();
|
|
283
283
|
i = window.setInterval(() => {
|
|
284
284
|
if (n) {
|
|
285
285
|
l();
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
|
-
const
|
|
289
|
-
o = Math.round(
|
|
290
|
-
},
|
|
288
|
+
const S = Math.min(1, (performance.now() - y) / yn);
|
|
289
|
+
o = Math.round(b + (s - b) * Nn(S)), e(o), S >= 1 && (o = s, e(s), l());
|
|
290
|
+
}, En);
|
|
291
291
|
}, d = async () => {
|
|
292
292
|
try {
|
|
293
|
-
const s = await
|
|
293
|
+
const s = await Pn(t);
|
|
294
294
|
if (n)
|
|
295
295
|
return;
|
|
296
296
|
c(s.count), p(s.refreshAfterMs);
|
|
297
297
|
} catch {
|
|
298
|
-
p(
|
|
298
|
+
p(Cn);
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
301
|
return d(), () => {
|
|
302
302
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
async function
|
|
305
|
+
async function Pn(e) {
|
|
306
306
|
if (e.loader)
|
|
307
307
|
return e.loader();
|
|
308
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
308
|
+
const n = await (e.fetcher ?? fetch)(new URL(vn, An(e.backendUrl ?? xn)).toString(), {
|
|
309
309
|
cache: "no-store",
|
|
310
310
|
credentials: "omit"
|
|
311
311
|
});
|
|
312
312
|
if (!n.ok)
|
|
313
313
|
throw new Error("Failed to load active users");
|
|
314
|
-
const o = await n.json(), a =
|
|
314
|
+
const o = await n.json(), a = rt(o.count), i = rt(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
315
315
|
if (a === null || i === null)
|
|
316
316
|
throw new Error("Invalid active users response");
|
|
317
317
|
return { count: a, refreshAfterMs: i };
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function rt(e) {
|
|
320
320
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function An(e) {
|
|
323
323
|
return e.endsWith("/") ? e : `${e}/`;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
return Math.min(
|
|
325
|
+
function Tn(e) {
|
|
326
|
+
return Math.min(kn, Math.max(Sn, e));
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Nn(e) {
|
|
329
329
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
330
330
|
}
|
|
331
|
-
const
|
|
331
|
+
const Tt = 100, Dn = "product-agent:sdk-preview-socket-connect", In = "product-agent:sdk-preview-socket-send", Mn = "product-agent:sdk-preview-socket-close", Rn = "product-agent:sdk-preview-socket-open", On = "product-agent:sdk-preview-socket-message", Bn = "product-agent:sdk-preview-socket-error", Fn = "product-agent:sdk-preview-socket-closed", lt = "product-agent:sdk-preview-socket-id", Un = "product-agent:preview-diagnostic", Nt = "pluno.productAgent.sharePromptsDisabled", ye = 10, zn = 10 * 1024 * 1024, Gn = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), W = {
|
|
332
332
|
launcherLabel: "Ask for anything...",
|
|
333
333
|
accentColor: "#7c3aed",
|
|
334
334
|
colorScheme: "light",
|
|
@@ -336,19 +336,19 @@ const xt = 100, xn = "product-agent:sdk-preview-socket-connect", vn = "product-a
|
|
|
336
336
|
scribbleStyle: !1,
|
|
337
337
|
position: "bottom-right",
|
|
338
338
|
movableLauncher: !1
|
|
339
|
-
},
|
|
340
|
-
function
|
|
341
|
-
return (t) => new
|
|
339
|
+
}, pt = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', $n = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', st = "pluno-pa-scribble-font", Dt = 190, It = 41, Hn = 48, Wn = 420, Vn = 520, jn = 0.24, qn = 680, Kn = 800, Yn = 0.76, B = 8, Ue = 50, Xn = "http://www.w3.org/2000/svg", Zn = 11, Jn = 13, dt = 4, Qn = 10, eo = 40, to = "movable-launcher-position-v2", Mt = "pluno-pa-widget-styles", Rt = "data-pluno-pa-widget-styles";
|
|
340
|
+
function no(e) {
|
|
341
|
+
return (t) => new V(t, e);
|
|
342
342
|
}
|
|
343
|
-
async function
|
|
343
|
+
async function oo(e = {}) {
|
|
344
344
|
const t = {
|
|
345
|
-
launcherLabel: e.launcherLabel ??
|
|
346
|
-
accentColor: e.accentColor ??
|
|
347
|
-
colorScheme: e.colorScheme ??
|
|
348
|
-
fontFamily: e.fontFamily ??
|
|
349
|
-
scribbleStyle: e.scribbleStyle ??
|
|
350
|
-
position: e.position ??
|
|
351
|
-
movableLauncher: e.movableLauncher ??
|
|
345
|
+
launcherLabel: e.launcherLabel ?? W.launcherLabel,
|
|
346
|
+
accentColor: e.accentColor ?? W.accentColor,
|
|
347
|
+
colorScheme: e.colorScheme ?? W.colorScheme,
|
|
348
|
+
fontFamily: e.fontFamily ?? W.fontFamily,
|
|
349
|
+
scribbleStyle: e.scribbleStyle ?? W.scribbleStyle,
|
|
350
|
+
position: e.position ?? W.position,
|
|
351
|
+
movableLauncher: e.movableLauncher ?? W.movableLauncher,
|
|
352
352
|
token: e.token,
|
|
353
353
|
tokenProvider: e.tokenProvider,
|
|
354
354
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -370,7 +370,7 @@ async function Vn(e = {}) {
|
|
|
370
370
|
loadSharePromptsDisabled: e.loadSharePromptsDisabled,
|
|
371
371
|
persistSharePromptsDisabled: e.persistSharePromptsDisabled
|
|
372
372
|
};
|
|
373
|
-
|
|
373
|
+
Q("web-sdk.widget", "Mounting widget with merged options", {
|
|
374
374
|
accentColor: t.accentColor,
|
|
375
375
|
colorScheme: t.colorScheme,
|
|
376
376
|
fontFamily: t.fontFamily,
|
|
@@ -385,32 +385,32 @@ async function Vn(e = {}) {
|
|
|
385
385
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
386
386
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
387
387
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
388
|
-
let i =
|
|
389
|
-
|
|
390
|
-
const l = await
|
|
391
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
388
|
+
let i = ct(t.accentColor, t.scribbleStyle);
|
|
389
|
+
mo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
390
|
+
const l = await aa(), p = l.ownerDocument;
|
|
391
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Ct(o, t.accentColor), ut(a, i, {
|
|
392
392
|
accentColor: t.accentColor,
|
|
393
393
|
colorScheme: t.colorScheme,
|
|
394
394
|
fontFamily: t.fontFamily,
|
|
395
395
|
scribbleStyle: t.scribbleStyle
|
|
396
|
-
}),
|
|
396
|
+
}), Q("web-sdk.widget", "Applied initial widget appearance", {
|
|
397
397
|
accentColor: t.accentColor,
|
|
398
398
|
colorScheme: t.colorScheme,
|
|
399
399
|
fontFamily: t.fontFamily,
|
|
400
400
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
401
401
|
});
|
|
402
|
-
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"),
|
|
403
|
-
if (!c || !s || !
|
|
402
|
+
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), y = a.querySelector(".pluno-pa-widget__close"), S = a.querySelector(".pluno-pa-widget__composer"), w = a.querySelector(".pluno-pa-widget__attachment-error"), I = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), u = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), C = a.querySelector(".pluno-pa-widget__new-chat"), _ = a.querySelector(".pluno-pa-widget__timeline-jump"), N = a.querySelector(".pluno-pa-widget__active-users-counter"), k = a.querySelector(".pluno-pa-widget__timeline"), ee = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
403
|
+
if (!c || !s || !b || !y || !S || !w || !I || !v || !u || !h || !C || !_ || !N || !k || !ee)
|
|
404
404
|
throw new Error("Failed to mount Pluno widget");
|
|
405
405
|
if (t.movableLauncher && !d)
|
|
406
406
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
407
|
-
|
|
408
|
-
let
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
mt(s), mt(u);
|
|
408
|
+
let E = [], m = null;
|
|
409
|
+
const x = () => {
|
|
410
|
+
Lo(v, E, (r) => {
|
|
411
|
+
E = E.filter((g, L) => L !== r), x(), O(f.getState()), U();
|
|
412
412
|
});
|
|
413
|
-
},
|
|
413
|
+
}, M = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
414
414
|
if (!t.tokenEndpoint)
|
|
415
415
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
416
416
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -421,19 +421,19 @@ async function Vn(e = {}) {
|
|
|
421
421
|
});
|
|
422
422
|
if (!r.ok)
|
|
423
423
|
throw new Error("Failed to load Pluno token");
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
424
|
+
const g = await r.json();
|
|
425
|
+
if (!g.token)
|
|
426
426
|
throw new Error("Pluno token endpoint did not return a token");
|
|
427
|
-
return
|
|
427
|
+
return g.token;
|
|
428
428
|
}), R = window.fetch.bind(window);
|
|
429
|
-
let
|
|
430
|
-
|
|
429
|
+
let f;
|
|
430
|
+
f = await rn.init({
|
|
431
431
|
token: t.token,
|
|
432
|
-
tokenProvider:
|
|
432
|
+
tokenProvider: M,
|
|
433
433
|
backendUrl: t.backendUrl,
|
|
434
434
|
metadata: () => ({
|
|
435
435
|
...t.metadata ?? {},
|
|
436
|
-
...!
|
|
436
|
+
...!f.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
437
437
|
}),
|
|
438
438
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
439
439
|
clientId: t.clientId,
|
|
@@ -442,32 +442,42 @@ async function Vn(e = {}) {
|
|
|
442
442
|
webSocketFactory: t.webSocketFactory,
|
|
443
443
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
444
444
|
});
|
|
445
|
-
const
|
|
446
|
-
let
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
445
|
+
const A = ia(t), te = new Set(A.openToolGroupKeys), ne = new Set(A.seenShareCandidateIds), me = new Set(ne);
|
|
446
|
+
let Ce = A.sharePromptsDisabled || await ra(t), G = t.movableLauncher ? A.launcherPosition : null, Ve = G !== null, j = null, Ee = !1, Y = !1, X = {
|
|
447
|
+
enabled: !0
|
|
448
|
+
}, Z = 0, je = "";
|
|
449
|
+
const $ = (r, g) => {
|
|
450
|
+
X = { enabled: r, reason: g };
|
|
451
|
+
}, H = () => {
|
|
452
|
+
_.hidden = !0;
|
|
453
|
+
}, Yt = () => {
|
|
454
|
+
_.hidden = !1;
|
|
455
|
+
}, Xt = (r = "jump") => {
|
|
456
|
+
$(!0, r), H(), ge(k, () => X.enabled), Z = k.scrollTop;
|
|
457
|
+
}, Zt = () => {
|
|
458
|
+
Ee || typeof document > "u" || (Ct(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
459
|
+
}, qe = new MutationObserver(Zt);
|
|
460
|
+
qe.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
461
|
+
const Se = (r = !0) => {
|
|
462
|
+
const g = ze(a, r);
|
|
463
|
+
return gt(
|
|
454
464
|
a,
|
|
455
|
-
|
|
456
|
-
|
|
465
|
+
G ?? ro(a, t.position, g),
|
|
466
|
+
g
|
|
457
467
|
);
|
|
458
|
-
},
|
|
459
|
-
|
|
468
|
+
}, F = () => {
|
|
469
|
+
pa(t, {
|
|
460
470
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
461
|
-
composerValue:
|
|
462
|
-
openToolGroupKeys: [...
|
|
463
|
-
launcherPosition:
|
|
464
|
-
seenShareCandidateIds: [...
|
|
465
|
-
sharePromptsDisabled:
|
|
471
|
+
composerValue: u.value,
|
|
472
|
+
openToolGroupKeys: [...te],
|
|
473
|
+
launcherPosition: Ve ? G : null,
|
|
474
|
+
seenShareCandidateIds: [...ne].slice(-Tt),
|
|
475
|
+
sharePromptsDisabled: Ce
|
|
466
476
|
});
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
debugVersion:
|
|
470
|
-
launcherPosition:
|
|
477
|
+
}, J = (r, g = {}) => {
|
|
478
|
+
uo(r, {
|
|
479
|
+
debugVersion: to,
|
|
480
|
+
launcherPosition: G,
|
|
471
481
|
rootClasses: a.className,
|
|
472
482
|
rootStyle: {
|
|
473
483
|
left: a.style.left,
|
|
@@ -475,131 +485,142 @@ async function Vn(e = {}) {
|
|
|
475
485
|
right: a.style.right,
|
|
476
486
|
bottom: a.style.bottom
|
|
477
487
|
},
|
|
478
|
-
rootRect:
|
|
479
|
-
launcherRect:
|
|
480
|
-
panelRect:
|
|
481
|
-
viewport:
|
|
482
|
-
panelHidden:
|
|
483
|
-
closeHidden:
|
|
484
|
-
...
|
|
488
|
+
rootRect: De(a),
|
|
489
|
+
launcherRect: De(c),
|
|
490
|
+
panelRect: De(b),
|
|
491
|
+
viewport: pe(),
|
|
492
|
+
panelHidden: b.hidden,
|
|
493
|
+
closeHidden: y.hidden,
|
|
494
|
+
...g
|
|
485
495
|
});
|
|
486
|
-
},
|
|
487
|
-
if (!
|
|
488
|
-
return
|
|
489
|
-
const
|
|
490
|
-
return
|
|
491
|
-
},
|
|
492
|
-
if (!r || !
|
|
493
|
-
|
|
496
|
+
}, fe = (r = !0) => {
|
|
497
|
+
if (!G)
|
|
498
|
+
return we(a, null), Se(r);
|
|
499
|
+
const g = Se(r);
|
|
500
|
+
return we(a, g), J("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
|
|
501
|
+
}, Ke = (r, g) => {
|
|
502
|
+
if (!r || !g) {
|
|
503
|
+
co(a);
|
|
494
504
|
return;
|
|
495
505
|
}
|
|
496
|
-
|
|
497
|
-
x: r.x -
|
|
498
|
-
y: r.y -
|
|
506
|
+
so(a, {
|
|
507
|
+
x: r.x - g.x,
|
|
508
|
+
y: r.y - g.y
|
|
499
509
|
});
|
|
500
|
-
},
|
|
501
|
-
const r =
|
|
510
|
+
}, Ye = () => {
|
|
511
|
+
const r = fe();
|
|
502
512
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
503
|
-
const
|
|
504
|
-
|
|
505
|
-
} else
|
|
513
|
+
const g = ht(a, r, t.position);
|
|
514
|
+
Ke(g, r), J("Applied open panel position after viewport resize", { openPanelPosition: g });
|
|
515
|
+
} else G && J("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
506
516
|
};
|
|
507
|
-
let
|
|
517
|
+
let Xe = () => {
|
|
508
518
|
};
|
|
509
|
-
window.addEventListener("resize",
|
|
519
|
+
window.addEventListener("resize", Ye), t.movableLauncher && d ? (fe(), Xe = io({
|
|
510
520
|
root: a,
|
|
511
521
|
launcher: c,
|
|
512
522
|
launcherDragHandle: d,
|
|
513
|
-
getPosition: () =>
|
|
523
|
+
getPosition: () => Se(),
|
|
514
524
|
setPosition: (r) => {
|
|
515
|
-
const
|
|
516
|
-
|
|
525
|
+
const g = r;
|
|
526
|
+
G = gt(a, r, ze(a)), we(a, G), J("Dragging closed launcher", { requestedPosition: g });
|
|
517
527
|
},
|
|
518
528
|
persist: () => {
|
|
519
|
-
|
|
529
|
+
Ve = !0, F(), J("Persisted closed launcher drag position");
|
|
520
530
|
}
|
|
521
|
-
})) :
|
|
522
|
-
let
|
|
523
|
-
const
|
|
524
|
-
if (!(!t.billingStatusLoader ||
|
|
525
|
-
|
|
531
|
+
})) : we(a, null);
|
|
532
|
+
let ke = !1;
|
|
533
|
+
const Ze = async () => {
|
|
534
|
+
if (!(!t.billingStatusLoader || ke)) {
|
|
535
|
+
ke = !0;
|
|
526
536
|
try {
|
|
527
537
|
const r = await t.billingStatusLoader();
|
|
528
|
-
|
|
538
|
+
bt(t.billingStatus, r, f.getState().lastErrorCode) && (t.billingStatus = r, Re(I, t.billingStatus, f.getState().lastErrorCode), U());
|
|
529
539
|
} finally {
|
|
530
|
-
|
|
540
|
+
ke = !1;
|
|
531
541
|
}
|
|
532
542
|
}
|
|
533
|
-
},
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (
|
|
543
|
+
}, oe = (r = "", g = !0) => {
|
|
544
|
+
Ze(), j !== null && (window.clearTimeout(j), j = null), b.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
545
|
+
const L = fe(), q = ht(a, L, t.position);
|
|
546
|
+
if (Ke(q, L), J("Opening launcher at clamped open panel position", { openPanelPosition: q, visibleLauncherPosition: L }), $(!0, "open"), H(), !g) {
|
|
547
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (u.value = r, ue(u)), ge(k, () => X.enabled), Z = k.scrollTop, u.focus(), u.setSelectionRange(u.value.length, u.value.length), F();
|
|
538
548
|
return;
|
|
539
549
|
}
|
|
540
550
|
window.requestAnimationFrame(() => {
|
|
541
|
-
a.classList.add("pluno-pa-widget--open"), r && (
|
|
542
|
-
c.hidden = !0,
|
|
551
|
+
a.classList.add("pluno-pa-widget--open"), r && (u.value = r, ue(u)), ge(k, () => X.enabled), Z = k.scrollTop, u.focus(), u.setSelectionRange(u.value.length, u.value.length), F(), j = window.setTimeout(() => {
|
|
552
|
+
c.hidden = !0, ge(k, () => X.enabled), Z = k.scrollTop;
|
|
543
553
|
}, 220);
|
|
544
554
|
});
|
|
545
|
-
},
|
|
546
|
-
|
|
547
|
-
|
|
555
|
+
}, Jt = () => {
|
|
556
|
+
j !== null && (window.clearTimeout(j), j = null), c.hidden = !1, G && (fe(!1), J("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), j = window.setTimeout(() => {
|
|
557
|
+
b.hidden = !0, y.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
548
558
|
}, 220);
|
|
549
559
|
};
|
|
550
560
|
c.addEventListener("submit", (r) => {
|
|
551
|
-
r.preventDefault(),
|
|
561
|
+
r.preventDefault(), oe(s.value), s.value = "";
|
|
552
562
|
}), d?.addEventListener("click", (r) => {
|
|
553
563
|
r.preventDefault(), r.stopPropagation();
|
|
554
564
|
}), c.addEventListener("click", (r) => {
|
|
555
|
-
r.target === s && !d || (
|
|
565
|
+
r.target === s && !d || (oe(s.value), s.value = "");
|
|
556
566
|
}), s.addEventListener("focus", () => {
|
|
557
|
-
|
|
567
|
+
oe(s.value), s.value = "";
|
|
558
568
|
}), s.addEventListener("input", () => {
|
|
559
569
|
if (!s.value)
|
|
560
570
|
return;
|
|
561
571
|
const r = s.value;
|
|
562
|
-
|
|
563
|
-
}),
|
|
564
|
-
|
|
565
|
-
|
|
572
|
+
oe(r), s.value = "";
|
|
573
|
+
}), y.addEventListener("click", Jt), k.addEventListener("scroll", () => {
|
|
574
|
+
k.scrollTop < Z - 1 && $(!1, "userScroll"), Z = k.scrollTop;
|
|
575
|
+
}), _.addEventListener("click", () => {
|
|
576
|
+
Xt();
|
|
577
|
+
});
|
|
578
|
+
const Je = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
579
|
+
([r]) => {
|
|
580
|
+
r?.isIntersecting && ($(!0, "bottom"), H());
|
|
581
|
+
},
|
|
582
|
+
{ root: k, threshold: 0 }
|
|
583
|
+
);
|
|
584
|
+
Je?.observe(ee);
|
|
585
|
+
const U = () => {
|
|
586
|
+
h.disabled = K(t.billingStatus) || !f.getState().isThinking && u.value.trim().length === 0 && E.length === 0;
|
|
566
587
|
};
|
|
567
|
-
t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel,
|
|
588
|
+
t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, u.placeholder = t.loginButtonLabel, S.hidden = !0), S.addEventListener("submit", (r) => {
|
|
568
589
|
if (r.preventDefault(), t.loginRequired) {
|
|
569
590
|
t.onLoginClick?.();
|
|
570
591
|
return;
|
|
571
592
|
}
|
|
572
|
-
|
|
593
|
+
K(t.billingStatus) || (Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U());
|
|
573
594
|
});
|
|
574
|
-
let
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
},
|
|
578
|
-
|
|
579
|
-
|
|
595
|
+
let de = 0;
|
|
596
|
+
const Qt = () => {
|
|
597
|
+
de = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
598
|
+
}, en = (r) => {
|
|
599
|
+
m !== null && window.clearTimeout(m), w.textContent = r, w.hidden = !1, m = window.setTimeout(() => {
|
|
600
|
+
w.textContent = "", w.hidden = !0, m = null;
|
|
580
601
|
}, 3e3);
|
|
581
|
-
},
|
|
582
|
-
|
|
583
|
-
},
|
|
602
|
+
}, tn = () => {
|
|
603
|
+
m !== null && (window.clearTimeout(m), m = null), w.textContent = "", w.hidden = !0;
|
|
604
|
+
}, nn = async (r) => {
|
|
584
605
|
if (r.length === 0)
|
|
585
606
|
return;
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
588
|
-
throw new Error(`Attach up to ${
|
|
589
|
-
|
|
607
|
+
const g = await No(r);
|
|
608
|
+
if (E.length + g.length > ye)
|
|
609
|
+
throw new Error(`Attach up to ${ye} files per message.`);
|
|
610
|
+
E = [...E, ...g], x(), tn(), U(), O(f.getState());
|
|
590
611
|
};
|
|
591
612
|
a.addEventListener("dragenter", (r) => {
|
|
592
|
-
!
|
|
613
|
+
!_e(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), de += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
593
614
|
}), a.addEventListener("dragover", (r) => {
|
|
594
|
-
const
|
|
595
|
-
!
|
|
615
|
+
const g = r.dataTransfer;
|
|
616
|
+
!_e(g) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), g.dropEffect = "copy");
|
|
596
617
|
}), a.addEventListener("dragleave", (r) => {
|
|
597
|
-
|
|
618
|
+
_e(r.dataTransfer) && (r.stopPropagation(), de = Math.max(0, de - 1), de === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
598
619
|
}), a.addEventListener("drop", (r) => {
|
|
599
|
-
const
|
|
600
|
-
!
|
|
601
|
-
|
|
602
|
-
message:
|
|
620
|
+
const g = r.dataTransfer;
|
|
621
|
+
!_e(g) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Qt(), nn(g.files).catch((L) => {
|
|
622
|
+
en(L instanceof Error ? L.message : "Failed to attach file"), Q("web-sdk.widget", "Attachment failed", {
|
|
623
|
+
message: L instanceof Error ? L.message : String(L)
|
|
603
624
|
});
|
|
604
625
|
}));
|
|
605
626
|
}), h.addEventListener("click", () => {
|
|
@@ -607,154 +628,160 @@ async function Vn(e = {}) {
|
|
|
607
628
|
t.onLoginClick?.();
|
|
608
629
|
return;
|
|
609
630
|
}
|
|
610
|
-
if (
|
|
611
|
-
|
|
631
|
+
if (f.getState().isThinking) {
|
|
632
|
+
f.stop();
|
|
612
633
|
return;
|
|
613
634
|
}
|
|
614
|
-
|
|
615
|
-
}),
|
|
616
|
-
|
|
617
|
-
}),
|
|
618
|
-
|
|
619
|
-
}),
|
|
635
|
+
Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U(), O(f.getState());
|
|
636
|
+
}), C.addEventListener("click", () => {
|
|
637
|
+
Y = !0, $(!0, "newSession"), H(), f.startNewSession(), te.clear(), u.value = "", E = [], x(), ue(u), F(), U(), u.focus(), O(f.getState());
|
|
638
|
+
}), u.addEventListener("input", () => {
|
|
639
|
+
ue(u), F(), U(), O(f.getState());
|
|
640
|
+
}), u.addEventListener("keydown", (r) => {
|
|
620
641
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
621
642
|
if (r.preventDefault(), t.loginRequired) {
|
|
622
643
|
t.onLoginClick?.();
|
|
623
644
|
return;
|
|
624
645
|
}
|
|
625
|
-
|
|
646
|
+
Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U(), O(f.getState());
|
|
626
647
|
}
|
|
627
648
|
}), a.addEventListener("click", (r) => {
|
|
628
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
629
|
-
}),
|
|
630
|
-
const
|
|
631
|
-
let
|
|
649
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
|
|
650
|
+
}), A.composerValue && (u.value = A.composerValue, ue(u)), A.isOpen && oe(u.value, !1);
|
|
651
|
+
const Qe = () => i;
|
|
652
|
+
let Le = f.getState().appearance !== null, be = null, ce = null, ae = null, et = f.getState().isThinking, ie = null, Pe = null, tt = () => {
|
|
632
653
|
};
|
|
633
|
-
const
|
|
634
|
-
if (
|
|
635
|
-
|
|
654
|
+
const on = !!t.socialPostDraftHandler, O = (r) => {
|
|
655
|
+
if (We(r.lastErrorCode) ? ie = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !K(t.billingStatus) && (ie = null), Re(I, t.billingStatus, ie), t.loginRequired) {
|
|
656
|
+
Wo(k, h, C, Qe, t.loginButtonLabel, t.onLoginClick);
|
|
636
657
|
return;
|
|
637
658
|
}
|
|
638
|
-
|
|
639
|
-
|
|
659
|
+
const g = go(r), L = g !== je;
|
|
660
|
+
je = g;
|
|
661
|
+
const q = Y || X.enabled;
|
|
662
|
+
Y = !1, Ho(
|
|
663
|
+
k,
|
|
664
|
+
ee,
|
|
640
665
|
h,
|
|
641
|
-
|
|
642
|
-
|
|
666
|
+
C,
|
|
667
|
+
N,
|
|
643
668
|
r,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
669
|
+
Pe,
|
|
670
|
+
Pe !== null && _t(r, u.value.trim().length > 0 || E.length > 0),
|
|
671
|
+
q,
|
|
672
|
+
() => X.enabled,
|
|
673
|
+
te,
|
|
674
|
+
F,
|
|
675
|
+
Qe,
|
|
676
|
+
(D) => {
|
|
677
|
+
Y = !0, $(!0, "send"), H(), f.sendMessage(D);
|
|
651
678
|
},
|
|
652
|
-
|
|
653
|
-
dismissedCandidateIds:
|
|
654
|
-
draftingCandidateId:
|
|
655
|
-
error:
|
|
656
|
-
onSeen: (
|
|
657
|
-
|
|
679
|
+
on && !Ce ? {
|
|
680
|
+
dismissedCandidateIds: me,
|
|
681
|
+
draftingCandidateId: be,
|
|
682
|
+
error: ce,
|
|
683
|
+
onSeen: (D) => {
|
|
684
|
+
ne.add(D.id), F();
|
|
658
685
|
},
|
|
659
|
-
onDraft: (
|
|
660
|
-
|
|
686
|
+
onDraft: (D) => {
|
|
687
|
+
an(D);
|
|
661
688
|
},
|
|
662
|
-
onDismiss: (
|
|
663
|
-
|
|
689
|
+
onDismiss: (D) => {
|
|
690
|
+
ne.add(D.id), me.add(D.id), F(), ce = null, O(f.getState());
|
|
664
691
|
},
|
|
665
|
-
onDisable: (
|
|
666
|
-
|
|
692
|
+
onDisable: (D) => {
|
|
693
|
+
Ce = !0, ne.add(D.id), me.add(D.id), F(), la(t, !0), ce = null, O(f.getState());
|
|
667
694
|
}
|
|
668
695
|
} : void 0
|
|
669
|
-
);
|
|
696
|
+
), q ? (Z = k.scrollTop, H()) : L && ho(r) && Yt();
|
|
670
697
|
};
|
|
671
|
-
return
|
|
672
|
-
|
|
673
|
-
}, { backendUrl: t.backendUrl, fetcher: R, loader: t.activeUsersLoader }),
|
|
674
|
-
const
|
|
675
|
-
|
|
698
|
+
return tt = Ln((r) => {
|
|
699
|
+
Pe = r, !Ee && _t(f.getState(), u.value.trim().length > 0 || E.length > 0) && O(f.getState());
|
|
700
|
+
}, { backendUrl: t.backendUrl, fetcher: R, loader: t.activeUsersLoader }), f.on("state", (r) => {
|
|
701
|
+
const g = et && !r.isThinking;
|
|
702
|
+
et = r.isThinking, r.appearance ? (Le = !0, Q("web-sdk.widget", "Agent state supplied appearance", {
|
|
676
703
|
appearance: r.appearance
|
|
677
|
-
}),
|
|
704
|
+
}), Ae(r.appearance, "agent.state.appearance")) : Le && (Le = !1, Q("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
678
705
|
fallbackAccentColor: t.accentColor,
|
|
679
706
|
fallbackColorScheme: t.colorScheme,
|
|
680
707
|
fallbackFontFamily: t.fontFamily
|
|
681
|
-
}),
|
|
682
|
-
}),
|
|
683
|
-
agent:
|
|
708
|
+
}), Ae({}, "agent.state.appearance-cleared")), O(r), U(), g && Ze();
|
|
709
|
+
}), O(f.getState()), U(), {
|
|
710
|
+
agent: f,
|
|
684
711
|
updateAppearance: (r) => {
|
|
685
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
712
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ae(r, "widgetHandle.updateAppearance");
|
|
686
713
|
},
|
|
687
714
|
updateBillingStatus: (r) => {
|
|
688
|
-
const
|
|
689
|
-
|
|
715
|
+
const g = r ?? null;
|
|
716
|
+
bt(t.billingStatus, g, ie) && (t.billingStatus = g, t.billingStatus?.creditsUsed !== null && !K(t.billingStatus) && (ie = null), Re(
|
|
690
717
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
691
718
|
t.billingStatus,
|
|
692
|
-
|
|
693
|
-
),
|
|
719
|
+
ie
|
|
720
|
+
), U());
|
|
694
721
|
},
|
|
695
722
|
openPanel: () => {
|
|
696
|
-
|
|
723
|
+
oe(u.value, !1);
|
|
697
724
|
},
|
|
698
725
|
destroy: () => {
|
|
699
|
-
|
|
726
|
+
Ee = !0, qe.disconnect(), Je?.disconnect(), window.removeEventListener("resize", Ye), Xe(), m !== null && window.clearTimeout(m), tt(), ae?.remove(), f.destroy(), n.remove();
|
|
700
727
|
}
|
|
701
728
|
};
|
|
702
|
-
async function
|
|
703
|
-
if (!
|
|
704
|
-
|
|
729
|
+
async function an(r) {
|
|
730
|
+
if (!be) {
|
|
731
|
+
be = r.id, ce = null, O(f.getState());
|
|
705
732
|
try {
|
|
706
733
|
if (!t.socialPostDraftHandler)
|
|
707
734
|
throw new Error("Social post drafting is not available here.");
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
735
|
+
const g = await t.socialPostDraftHandler(r);
|
|
736
|
+
if (!g.linkedinPost || !g.xPost)
|
|
710
737
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
711
|
-
|
|
738
|
+
ne.add(r.id), me.add(r.id), F(), ae?.remove(), ae = qo(g, {
|
|
712
739
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
713
740
|
onClose: () => {
|
|
714
|
-
|
|
741
|
+
ae?.remove(), ae = null;
|
|
715
742
|
}
|
|
716
|
-
}), a.appendChild(
|
|
717
|
-
} catch (
|
|
718
|
-
|
|
743
|
+
}), a.appendChild(ae);
|
|
744
|
+
} catch (g) {
|
|
745
|
+
ce = g instanceof Error ? g.message : "Could not draft social post.";
|
|
719
746
|
} finally {
|
|
720
|
-
|
|
747
|
+
be = null, O(f.getState());
|
|
721
748
|
}
|
|
722
749
|
}
|
|
723
750
|
}
|
|
724
|
-
function
|
|
725
|
-
const
|
|
726
|
-
i =
|
|
727
|
-
accentColor:
|
|
728
|
-
colorScheme:
|
|
729
|
-
fontFamily:
|
|
730
|
-
scribbleStyle:
|
|
731
|
-
}),
|
|
732
|
-
source:
|
|
751
|
+
function Ae(r, g) {
|
|
752
|
+
const L = r.accentColor ?? t.accentColor, q = r.colorScheme ?? t.colorScheme, D = r.fontFamily ?? t.fontFamily, Te = r.scribbleStyle ?? t.scribbleStyle;
|
|
753
|
+
i = ct(L, Te), ut(a, i, {
|
|
754
|
+
accentColor: L,
|
|
755
|
+
colorScheme: q,
|
|
756
|
+
fontFamily: D,
|
|
757
|
+
scribbleStyle: Te
|
|
758
|
+
}), Q("web-sdk.widget", "Updated widget appearance", {
|
|
759
|
+
source: g,
|
|
733
760
|
inputAppearance: r,
|
|
734
|
-
appliedAccentColor:
|
|
735
|
-
appliedColorScheme:
|
|
736
|
-
appliedFontFamily:
|
|
737
|
-
appliedScribbleStyle:
|
|
761
|
+
appliedAccentColor: L,
|
|
762
|
+
appliedColorScheme: q,
|
|
763
|
+
appliedFontFamily: D,
|
|
764
|
+
appliedScribbleStyle: Te,
|
|
738
765
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
739
766
|
});
|
|
740
767
|
}
|
|
741
768
|
}
|
|
742
|
-
function
|
|
743
|
-
return t ?
|
|
769
|
+
function ct(e, t) {
|
|
770
|
+
return t ? cn(e) : sn(e);
|
|
744
771
|
}
|
|
745
|
-
function
|
|
772
|
+
function ut(e, t, n) {
|
|
746
773
|
e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
747
|
-
const o = n.scribbleStyle ?
|
|
748
|
-
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ?
|
|
774
|
+
const o = n.scribbleStyle ? Lt(n.accentColor) : n.accentColor;
|
|
775
|
+
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? $n : n.fontFamily, n.scribbleStyle && ao(e.ownerDocument);
|
|
749
776
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
750
777
|
for (const i of a)
|
|
751
778
|
i.src = t;
|
|
752
779
|
}
|
|
753
|
-
function
|
|
754
|
-
if (e.getElementById(
|
|
780
|
+
function ao(e) {
|
|
781
|
+
if (e.getElementById(st))
|
|
755
782
|
return;
|
|
756
783
|
const t = e.createElement("style");
|
|
757
|
-
t.id =
|
|
784
|
+
t.id = st, t.textContent = `@font-face {
|
|
758
785
|
font-family: "Architects Daughter";
|
|
759
786
|
font-style: normal;
|
|
760
787
|
font-weight: 400;
|
|
@@ -762,7 +789,7 @@ function jn(e) {
|
|
|
762
789
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
763
790
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
764
791
|
}
|
|
765
|
-
function
|
|
792
|
+
function io({
|
|
766
793
|
root: e,
|
|
767
794
|
launcher: t,
|
|
768
795
|
launcherDragHandle: n,
|
|
@@ -771,117 +798,117 @@ function qn({
|
|
|
771
798
|
persist: i
|
|
772
799
|
}) {
|
|
773
800
|
let l = null, p = null, c = null, d = !1, s = null;
|
|
774
|
-
const
|
|
801
|
+
const b = () => {
|
|
775
802
|
l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
776
|
-
},
|
|
803
|
+
}, y = (h) => {
|
|
777
804
|
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 = o(), d = !1, t.setPointerCapture?.(h.pointerId));
|
|
778
|
-
},
|
|
805
|
+
}, S = (h) => {
|
|
779
806
|
if (l !== h.pointerId || !p || !c)
|
|
780
807
|
return;
|
|
781
808
|
h.preventDefault();
|
|
782
|
-
const
|
|
783
|
-
!d && Math.hypot(
|
|
784
|
-
},
|
|
785
|
-
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()),
|
|
786
|
-
},
|
|
787
|
-
l === h.pointerId && (h.preventDefault(),
|
|
788
|
-
},
|
|
809
|
+
const C = h.clientX - p.x, _ = h.clientY - p.y;
|
|
810
|
+
!d && Math.hypot(C, _) < dt || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + C, y: c.y + _ }));
|
|
811
|
+
}, w = (h) => {
|
|
812
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), b());
|
|
813
|
+
}, I = (h) => {
|
|
814
|
+
l === h.pointerId && (h.preventDefault(), b());
|
|
815
|
+
}, v = (h) => {
|
|
789
816
|
if (!s)
|
|
790
817
|
return;
|
|
791
|
-
const
|
|
792
|
-
s = null,
|
|
793
|
-
},
|
|
818
|
+
const C = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= dt;
|
|
819
|
+
s = null, C && (h.preventDefault(), h.stopPropagation());
|
|
820
|
+
}, u = (h) => {
|
|
794
821
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
795
822
|
return;
|
|
796
|
-
const
|
|
797
|
-
let
|
|
798
|
-
h.key === "ArrowUp" ?
|
|
823
|
+
const C = h.shiftKey ? eo : Qn, _ = o();
|
|
824
|
+
let N = null;
|
|
825
|
+
h.key === "ArrowUp" ? N = { x: _.x, y: _.y - C } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + C } : h.key === "ArrowLeft" ? N = { x: _.x - C, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + C, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
|
|
799
826
|
};
|
|
800
|
-
return t.addEventListener("pointerdown",
|
|
801
|
-
t.removeEventListener("pointerdown",
|
|
827
|
+
return t.addEventListener("pointerdown", y), t.addEventListener("pointermove", S), t.addEventListener("pointerup", w), t.addEventListener("pointercancel", I), t.addEventListener("click", v, !0), n.addEventListener("keydown", u), () => {
|
|
828
|
+
t.removeEventListener("pointerdown", y), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", w), t.removeEventListener("pointercancel", I), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", u);
|
|
802
829
|
};
|
|
803
830
|
}
|
|
804
|
-
function
|
|
805
|
-
const n =
|
|
831
|
+
function ze(e, t = !0) {
|
|
832
|
+
const n = pe(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
806
833
|
return {
|
|
807
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
808
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
834
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Dt, n.width - 36),
|
|
835
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Hn : It
|
|
809
836
|
};
|
|
810
837
|
}
|
|
811
|
-
function
|
|
812
|
-
const e =
|
|
838
|
+
function Ot() {
|
|
839
|
+
const e = pe();
|
|
813
840
|
return {
|
|
814
841
|
width: Math.min(
|
|
815
|
-
|
|
816
|
-
e.width -
|
|
842
|
+
le(e.width * jn, Wn, Vn),
|
|
843
|
+
e.width - B * 2
|
|
817
844
|
),
|
|
818
845
|
height: Math.min(
|
|
819
|
-
|
|
820
|
-
e.height -
|
|
846
|
+
le(e.height * Yn, qn, Kn),
|
|
847
|
+
e.height - Ue - B
|
|
821
848
|
)
|
|
822
849
|
};
|
|
823
850
|
}
|
|
824
|
-
function
|
|
851
|
+
function ro(e, t, n) {
|
|
825
852
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
826
853
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
827
854
|
return { x: o, y: a };
|
|
828
855
|
const i = e.getBoundingClientRect();
|
|
829
856
|
if (i.width > 0 || i.height > 0)
|
|
830
857
|
return { x: i.left, y: i.top };
|
|
831
|
-
const l =
|
|
858
|
+
const l = pe();
|
|
832
859
|
return {
|
|
833
860
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
834
861
|
y: l.height - 24 - n.height
|
|
835
862
|
};
|
|
836
863
|
}
|
|
837
|
-
function
|
|
838
|
-
const o =
|
|
864
|
+
function gt(e, t, n) {
|
|
865
|
+
const o = pe(), a = B + lo(e);
|
|
839
866
|
return {
|
|
840
|
-
x:
|
|
841
|
-
y:
|
|
867
|
+
x: le(t.x, B, Math.max(B, o.width - n.width - B)),
|
|
868
|
+
y: le(t.y, a, Math.max(a, o.height - n.height - B))
|
|
842
869
|
};
|
|
843
870
|
}
|
|
844
|
-
function
|
|
845
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
871
|
+
function lo(e) {
|
|
872
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? Jn : Zn;
|
|
846
873
|
}
|
|
847
|
-
function
|
|
848
|
-
const o =
|
|
874
|
+
function ht(e, t, n) {
|
|
875
|
+
const o = ze(e), a = Ot(), i = {
|
|
849
876
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
850
877
|
y: t.y + o.height - a.height
|
|
851
878
|
};
|
|
852
|
-
return
|
|
879
|
+
return po(i);
|
|
853
880
|
}
|
|
854
|
-
function
|
|
855
|
-
const t =
|
|
881
|
+
function po(e) {
|
|
882
|
+
const t = pe(), n = Ot();
|
|
856
883
|
return {
|
|
857
|
-
x:
|
|
858
|
-
y:
|
|
884
|
+
x: le(e.x, B, Math.max(B, t.width - n.width - B)),
|
|
885
|
+
y: le(
|
|
859
886
|
e.y,
|
|
860
|
-
|
|
861
|
-
Math.max(
|
|
887
|
+
Ue,
|
|
888
|
+
Math.max(Ue, t.height - n.height - B)
|
|
862
889
|
)
|
|
863
890
|
};
|
|
864
891
|
}
|
|
865
|
-
function
|
|
892
|
+
function we(e, t) {
|
|
866
893
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
867
894
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
868
895
|
return;
|
|
869
896
|
}
|
|
870
897
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
871
898
|
}
|
|
872
|
-
function
|
|
899
|
+
function so(e, t) {
|
|
873
900
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
874
901
|
}
|
|
875
|
-
function
|
|
902
|
+
function co(e) {
|
|
876
903
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
877
904
|
}
|
|
878
|
-
function
|
|
905
|
+
function pe() {
|
|
879
906
|
return {
|
|
880
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
881
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
907
|
+
width: window.innerWidth || document.documentElement.clientWidth || Dt + B * 2,
|
|
908
|
+
height: window.innerHeight || document.documentElement.clientHeight || It + B * 2
|
|
882
909
|
};
|
|
883
910
|
}
|
|
884
|
-
function
|
|
911
|
+
function De(e) {
|
|
885
912
|
const t = e.getBoundingClientRect();
|
|
886
913
|
return {
|
|
887
914
|
x: Math.round(t.x),
|
|
@@ -890,10 +917,10 @@ function Ce(e) {
|
|
|
890
917
|
height: Math.round(t.height)
|
|
891
918
|
};
|
|
892
919
|
}
|
|
893
|
-
function
|
|
920
|
+
function le(e, t, n) {
|
|
894
921
|
return Math.min(Math.max(e, t), n);
|
|
895
922
|
}
|
|
896
|
-
function
|
|
923
|
+
function Q(e, t, n) {
|
|
897
924
|
if (typeof window > "u")
|
|
898
925
|
return;
|
|
899
926
|
const o = window, a = {
|
|
@@ -902,44 +929,67 @@ function V(e, t, n) {
|
|
|
902
929
|
message: t,
|
|
903
930
|
details: n
|
|
904
931
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
905
|
-
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(
|
|
932
|
+
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Un, { detail: a }));
|
|
906
933
|
}
|
|
907
|
-
function
|
|
908
|
-
|
|
934
|
+
function uo(e, t) {
|
|
935
|
+
Q("web-sdk.widget.position", e, t);
|
|
909
936
|
}
|
|
910
|
-
function
|
|
937
|
+
function Ie(e, t, n) {
|
|
911
938
|
const o = t.value.trim();
|
|
912
939
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
913
940
|
}
|
|
914
|
-
function
|
|
941
|
+
function ue(e) {
|
|
915
942
|
e.style.height = "0px";
|
|
916
943
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
917
944
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
918
945
|
}
|
|
919
|
-
function
|
|
920
|
-
e.
|
|
946
|
+
function ge(e, t = () => !0) {
|
|
947
|
+
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
948
|
+
t() && (e.scrollTop = e.scrollHeight);
|
|
949
|
+
});
|
|
921
950
|
}
|
|
922
|
-
function
|
|
951
|
+
function go(e) {
|
|
952
|
+
const t = e.messages[e.messages.length - 1];
|
|
953
|
+
return [
|
|
954
|
+
e.messages.length,
|
|
955
|
+
t?.id ?? "",
|
|
956
|
+
t?.content.length ?? 0,
|
|
957
|
+
e.assistantDraft.length,
|
|
958
|
+
e.isThinking ? "thinking" : "idle",
|
|
959
|
+
e.lastError ?? ""
|
|
960
|
+
].join(":");
|
|
961
|
+
}
|
|
962
|
+
function ho(e) {
|
|
963
|
+
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
964
|
+
}
|
|
965
|
+
function mo(e, t, n, o) {
|
|
966
|
+
e.appendChild(vo()), e.appendChild(fo(t, n, o)), e.appendChild(Ut("pluno-pa-widget__close", "Close", yo(16), !0)), e.appendChild(bo(n));
|
|
967
|
+
}
|
|
968
|
+
function fo(e, t, n) {
|
|
923
969
|
const o = document.createElement("form");
|
|
924
970
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
925
971
|
const i = document.createElement("button");
|
|
926
972
|
i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
|
|
927
973
|
}
|
|
928
|
-
o.appendChild(
|
|
974
|
+
o.appendChild(Ft("pluno-pa-widget__character--launcher", t));
|
|
929
975
|
const a = document.createElement("input");
|
|
930
976
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
931
977
|
}
|
|
932
|
-
function
|
|
978
|
+
function bo(e) {
|
|
933
979
|
const t = document.createElement("section");
|
|
934
980
|
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
935
981
|
const n = document.createElement("div");
|
|
936
982
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
937
983
|
const o = document.createElement("main");
|
|
938
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
984
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(_o(e));
|
|
939
985
|
const a = document.createElement("div");
|
|
940
|
-
|
|
986
|
+
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
987
|
+
const i = document.createElement("div");
|
|
988
|
+
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
989
|
+
const l = document.createElement("button");
|
|
990
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ut("pluno-pa-widget__new-chat", "New chat", Co(), !0)), t.appendChild(n), t.appendChild(wo()), t;
|
|
941
991
|
}
|
|
942
|
-
function
|
|
992
|
+
function wo() {
|
|
943
993
|
const e = document.createElement("form");
|
|
944
994
|
e.className = "pluno-pa-widget__composer";
|
|
945
995
|
const t = document.createElement("div");
|
|
@@ -953,7 +1003,7 @@ function oo() {
|
|
|
953
1003
|
const i = document.createElement("textarea");
|
|
954
1004
|
i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
|
|
955
1005
|
const l = document.createElement("button");
|
|
956
|
-
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(
|
|
1006
|
+
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(zt()), a.appendChild(l), e.appendChild(a);
|
|
957
1007
|
const p = document.createElement("div");
|
|
958
1008
|
p.className = "pluno-pa-widget__composer-meta";
|
|
959
1009
|
const c = document.createElement("a");
|
|
@@ -961,41 +1011,41 @@ function oo() {
|
|
|
961
1011
|
const d = document.createElement("span");
|
|
962
1012
|
return d.className = "pluno-pa-widget__ai-disclaimer", d.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(d), e.appendChild(p), e;
|
|
963
1013
|
}
|
|
964
|
-
function
|
|
1014
|
+
function _o(e) {
|
|
965
1015
|
const t = document.createElement("div");
|
|
966
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1016
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ft("pluno-pa-widget__character--empty", e)), t.appendChild(Bt()), t;
|
|
967
1017
|
}
|
|
968
|
-
function
|
|
1018
|
+
function Bt() {
|
|
969
1019
|
const e = document.createElement("div");
|
|
970
1020
|
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;
|
|
971
1021
|
}
|
|
972
|
-
function
|
|
1022
|
+
function xo(e, t) {
|
|
973
1023
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
974
1024
|
const n = document.createElement("span");
|
|
975
1025
|
n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
|
|
976
1026
|
}
|
|
977
|
-
function
|
|
1027
|
+
function Ft(e, t) {
|
|
978
1028
|
const n = document.createElement("img");
|
|
979
1029
|
return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
980
1030
|
}
|
|
981
|
-
function
|
|
1031
|
+
function Ut(e, t, n, o) {
|
|
982
1032
|
const a = document.createElement("button");
|
|
983
1033
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
984
1034
|
}
|
|
985
|
-
function
|
|
986
|
-
const e =
|
|
1035
|
+
function vo() {
|
|
1036
|
+
const e = P("svg", {
|
|
987
1037
|
class: "pluno-pa-widget__scribble-defs",
|
|
988
1038
|
"aria-hidden": "true",
|
|
989
1039
|
focusable: "false",
|
|
990
1040
|
width: "0",
|
|
991
1041
|
height: "0"
|
|
992
|
-
}), t =
|
|
993
|
-
return t.appendChild(
|
|
1042
|
+
}), t = P("defs");
|
|
1043
|
+
return t.appendChild(Me("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Me("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Me("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
994
1044
|
}
|
|
995
|
-
function
|
|
996
|
-
const o =
|
|
1045
|
+
function Me(e, t, n) {
|
|
1046
|
+
const o = P("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
997
1047
|
return o.appendChild(
|
|
998
|
-
|
|
1048
|
+
P("feTurbulence", {
|
|
999
1049
|
type: "fractalNoise",
|
|
1000
1050
|
baseFrequency: "0.012 0.028",
|
|
1001
1051
|
numOctaves: "3",
|
|
@@ -1003,7 +1053,7 @@ function Se(e, t, n) {
|
|
|
1003
1053
|
result: "stroke-noise"
|
|
1004
1054
|
})
|
|
1005
1055
|
), o.appendChild(
|
|
1006
|
-
|
|
1056
|
+
P("feDisplacementMap", {
|
|
1007
1057
|
in: "SourceGraphic",
|
|
1008
1058
|
in2: "stroke-noise",
|
|
1009
1059
|
scale: "3.5",
|
|
@@ -1012,7 +1062,7 @@ function Se(e, t, n) {
|
|
|
1012
1062
|
result: "warped"
|
|
1013
1063
|
})
|
|
1014
1064
|
), o.appendChild(
|
|
1015
|
-
|
|
1065
|
+
P("feTurbulence", {
|
|
1016
1066
|
type: "fractalNoise",
|
|
1017
1067
|
baseFrequency: "0.7",
|
|
1018
1068
|
numOctaves: "1",
|
|
@@ -1020,7 +1070,7 @@ function Se(e, t, n) {
|
|
|
1020
1070
|
result: "ink-noise"
|
|
1021
1071
|
})
|
|
1022
1072
|
), o.appendChild(
|
|
1023
|
-
|
|
1073
|
+
P("feDisplacementMap", {
|
|
1024
1074
|
in: "warped",
|
|
1025
1075
|
in2: "ink-noise",
|
|
1026
1076
|
scale: "0.9",
|
|
@@ -1029,31 +1079,31 @@ function Se(e, t, n) {
|
|
|
1029
1079
|
})
|
|
1030
1080
|
), o;
|
|
1031
1081
|
}
|
|
1032
|
-
function
|
|
1033
|
-
const t =
|
|
1034
|
-
return t.appendChild(
|
|
1082
|
+
function yo(e) {
|
|
1083
|
+
const t = se("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1084
|
+
return t.appendChild(P("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1035
1085
|
}
|
|
1036
|
-
function
|
|
1037
|
-
const e =
|
|
1038
|
-
return e.appendChild(
|
|
1086
|
+
function Co() {
|
|
1087
|
+
const e = se("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1088
|
+
return e.appendChild(P("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(P("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1039
1089
|
}
|
|
1040
|
-
function
|
|
1041
|
-
const e =
|
|
1042
|
-
return e.appendChild(
|
|
1090
|
+
function zt() {
|
|
1091
|
+
const e = se("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1092
|
+
return e.appendChild(P("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(P("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1043
1093
|
}
|
|
1044
|
-
function
|
|
1045
|
-
const e =
|
|
1046
|
-
return e.appendChild(
|
|
1094
|
+
function Eo() {
|
|
1095
|
+
const e = se("0 0 24 24", 18, 18, "currentColor");
|
|
1096
|
+
return e.appendChild(P("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1047
1097
|
}
|
|
1048
|
-
function
|
|
1049
|
-
const e =
|
|
1050
|
-
return e.appendChild(
|
|
1098
|
+
function So() {
|
|
1099
|
+
const e = se("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1100
|
+
return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
|
|
1051
1101
|
}
|
|
1052
|
-
function
|
|
1053
|
-
const e =
|
|
1054
|
-
return e.appendChild(
|
|
1102
|
+
function ko() {
|
|
1103
|
+
const e = se("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1104
|
+
return e.appendChild(P("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(P("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1055
1105
|
}
|
|
1056
|
-
function
|
|
1106
|
+
function se(e, t, n, o, a, i) {
|
|
1057
1107
|
const l = {
|
|
1058
1108
|
viewBox: e,
|
|
1059
1109
|
width: String(t),
|
|
@@ -1061,41 +1111,41 @@ function Q(e, t, n, o, a, i) {
|
|
|
1061
1111
|
fill: o,
|
|
1062
1112
|
"aria-hidden": "true"
|
|
1063
1113
|
};
|
|
1064
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i),
|
|
1114
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), P("svg", l);
|
|
1065
1115
|
}
|
|
1066
|
-
function
|
|
1067
|
-
const n = document.createElementNS(
|
|
1116
|
+
function P(e, t = {}) {
|
|
1117
|
+
const n = document.createElementNS(Xn, e);
|
|
1068
1118
|
for (const [o, a] of Object.entries(t))
|
|
1069
1119
|
n.setAttribute(o, a);
|
|
1070
1120
|
return n;
|
|
1071
1121
|
}
|
|
1072
|
-
function
|
|
1122
|
+
function mt(e) {
|
|
1073
1123
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1074
1124
|
e.addEventListener(t, (n) => {
|
|
1075
1125
|
n.stopPropagation();
|
|
1076
1126
|
});
|
|
1077
1127
|
}
|
|
1078
|
-
function
|
|
1128
|
+
function Lo(e, t, n) {
|
|
1079
1129
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1080
1130
|
for (const [o, a] of t.entries()) {
|
|
1081
1131
|
const i = document.createElement("div");
|
|
1082
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1132
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Po(a));
|
|
1083
1133
|
const l = document.createElement("span");
|
|
1084
1134
|
l.textContent = a.name, i.appendChild(l);
|
|
1085
1135
|
const p = document.createElement("button");
|
|
1086
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1136
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(So()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1087
1137
|
}
|
|
1088
1138
|
}
|
|
1089
|
-
function
|
|
1090
|
-
if (
|
|
1139
|
+
function Po(e) {
|
|
1140
|
+
if (Gt(e)) {
|
|
1091
1141
|
const n = document.createElement("img");
|
|
1092
1142
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1093
1143
|
}
|
|
1094
1144
|
const t = document.createElement("span");
|
|
1095
1145
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1096
1146
|
}
|
|
1097
|
-
function
|
|
1098
|
-
if (
|
|
1147
|
+
function Ao(e) {
|
|
1148
|
+
if (Gt(e)) {
|
|
1099
1149
|
const a = document.createElement("img");
|
|
1100
1150
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1101
1151
|
}
|
|
@@ -1106,51 +1156,51 @@ function mo(e) {
|
|
|
1106
1156
|
const o = document.createElement("strong");
|
|
1107
1157
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1108
1158
|
}
|
|
1109
|
-
function
|
|
1159
|
+
function Gt(e) {
|
|
1110
1160
|
return e.mimeType.startsWith("image/");
|
|
1111
1161
|
}
|
|
1112
|
-
function
|
|
1162
|
+
function To(e) {
|
|
1113
1163
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1114
1164
|
}
|
|
1115
|
-
async function
|
|
1165
|
+
async function No(e) {
|
|
1116
1166
|
if (!e)
|
|
1117
1167
|
return [];
|
|
1118
1168
|
const t = Array.from(e);
|
|
1119
|
-
if (t.length >
|
|
1120
|
-
throw new Error(`Attach up to ${
|
|
1169
|
+
if (t.length > ye)
|
|
1170
|
+
throw new Error(`Attach up to ${ye} files per message.`);
|
|
1121
1171
|
return Promise.all(
|
|
1122
1172
|
t.map(async (n) => {
|
|
1123
|
-
const o =
|
|
1173
|
+
const o = Do(n);
|
|
1124
1174
|
if (!o)
|
|
1125
1175
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1126
|
-
if (n.size >
|
|
1176
|
+
if (n.size > zn)
|
|
1127
1177
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1128
1178
|
if (o === "image/gif") {
|
|
1129
|
-
const a = new Uint8Array(await
|
|
1130
|
-
if (
|
|
1179
|
+
const a = new Uint8Array(await Go(n));
|
|
1180
|
+
if (Mo(a))
|
|
1131
1181
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1132
1182
|
}
|
|
1133
1183
|
return {
|
|
1134
|
-
name: n.name ||
|
|
1184
|
+
name: n.name || To(o),
|
|
1135
1185
|
mimeType: o,
|
|
1136
1186
|
sizeBytes: n.size,
|
|
1137
|
-
dataUrl:
|
|
1187
|
+
dataUrl: Io(await $o(n), o)
|
|
1138
1188
|
};
|
|
1139
1189
|
})
|
|
1140
1190
|
);
|
|
1141
1191
|
}
|
|
1142
|
-
function
|
|
1143
|
-
if (
|
|
1192
|
+
function Do(e) {
|
|
1193
|
+
if (Gn.has(e.type))
|
|
1144
1194
|
return e.type;
|
|
1145
1195
|
const t = e.name.toLowerCase();
|
|
1146
1196
|
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;
|
|
1147
1197
|
}
|
|
1148
|
-
function
|
|
1198
|
+
function Io(e, t) {
|
|
1149
1199
|
const n = `data:${t};base64,`;
|
|
1150
1200
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1151
1201
|
}
|
|
1152
|
-
function
|
|
1153
|
-
if (e.length < 14 || !
|
|
1202
|
+
function Mo(e) {
|
|
1203
|
+
if (e.length < 14 || !Ro(e))
|
|
1154
1204
|
return !1;
|
|
1155
1205
|
const t = e[10];
|
|
1156
1206
|
let n = 13;
|
|
@@ -1161,7 +1211,7 @@ function xo(e) {
|
|
|
1161
1211
|
if (n += 1, a === 59)
|
|
1162
1212
|
return !1;
|
|
1163
1213
|
if (a === 33) {
|
|
1164
|
-
n += 1, n =
|
|
1214
|
+
n += 1, n = ft(e, n);
|
|
1165
1215
|
continue;
|
|
1166
1216
|
}
|
|
1167
1217
|
if (a !== 44)
|
|
@@ -1173,14 +1223,14 @@ function xo(e) {
|
|
|
1173
1223
|
const i = e[n + 8];
|
|
1174
1224
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1175
1225
|
return !1;
|
|
1176
|
-
n += 1, n =
|
|
1226
|
+
n += 1, n = ft(e, n);
|
|
1177
1227
|
}
|
|
1178
1228
|
return !1;
|
|
1179
1229
|
}
|
|
1180
|
-
function
|
|
1230
|
+
function Ro(e) {
|
|
1181
1231
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1182
1232
|
}
|
|
1183
|
-
function
|
|
1233
|
+
function ft(e, t) {
|
|
1184
1234
|
for (; t < e.length; ) {
|
|
1185
1235
|
const n = e[t];
|
|
1186
1236
|
if (t += 1, n === 0)
|
|
@@ -1189,69 +1239,69 @@ function rt(e, t) {
|
|
|
1189
1239
|
}
|
|
1190
1240
|
return t;
|
|
1191
1241
|
}
|
|
1192
|
-
function
|
|
1242
|
+
function _e(e) {
|
|
1193
1243
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1194
1244
|
}
|
|
1195
|
-
function
|
|
1196
|
-
if (!e || !
|
|
1245
|
+
function Re(e, t, n = null) {
|
|
1246
|
+
if (!e || !Ge(t, n)) {
|
|
1197
1247
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1198
1248
|
return;
|
|
1199
1249
|
}
|
|
1200
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1250
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", K(t) || We(n) ? e.appendChild(Oo(t, n)) : $t(t) && e.appendChild(Bo(t));
|
|
1201
1251
|
}
|
|
1202
|
-
function
|
|
1252
|
+
function Oo(e, t) {
|
|
1203
1253
|
const n = document.createElement("div");
|
|
1204
1254
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1205
1255
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1206
1256
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1207
1257
|
const i = document.createElement("span");
|
|
1208
|
-
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(
|
|
1258
|
+
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Ht(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1209
1259
|
}
|
|
1210
|
-
function
|
|
1260
|
+
function Bo(e) {
|
|
1211
1261
|
const t = document.createElement("div");
|
|
1212
1262
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1213
1263
|
const n = document.createElement("strong");
|
|
1214
1264
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1215
1265
|
const o = document.createElement("span");
|
|
1216
|
-
return o.textContent =
|
|
1266
|
+
return o.textContent = Uo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Ht(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1217
1267
|
}
|
|
1218
|
-
function
|
|
1219
|
-
return e !== null && (
|
|
1268
|
+
function Ge(e, t) {
|
|
1269
|
+
return e !== null && (K(e) || $t(e) || We(t));
|
|
1220
1270
|
}
|
|
1221
|
-
function
|
|
1222
|
-
return
|
|
1271
|
+
function bt(e, t, n) {
|
|
1272
|
+
return Ge(t, n) || Fo(t) ? !0 : !Ge(e, n);
|
|
1223
1273
|
}
|
|
1224
|
-
function
|
|
1225
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1274
|
+
function Fo(e) {
|
|
1275
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || K(e));
|
|
1226
1276
|
}
|
|
1227
|
-
function
|
|
1277
|
+
function K(e) {
|
|
1228
1278
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1229
1279
|
}
|
|
1230
|
-
function
|
|
1280
|
+
function We(e) {
|
|
1231
1281
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1232
1282
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1283
|
+
function $t(e) {
|
|
1284
|
+
return !K(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1235
1285
|
}
|
|
1236
|
-
function
|
|
1237
|
-
return e.creditsRemaining === null ? null : `${
|
|
1286
|
+
function Uo(e) {
|
|
1287
|
+
return e.creditsRemaining === null ? null : `${zo(e.creditsRemaining)} credits left`;
|
|
1238
1288
|
}
|
|
1239
|
-
function
|
|
1289
|
+
function zo(e) {
|
|
1240
1290
|
return new Intl.NumberFormat("en-US", {
|
|
1241
1291
|
maximumFractionDigits: 0
|
|
1242
1292
|
}).format(Math.ceil(e));
|
|
1243
1293
|
}
|
|
1244
|
-
function
|
|
1294
|
+
function Ht(e, t, n) {
|
|
1245
1295
|
const o = document.createElement("div");
|
|
1246
|
-
return o.className = n, o.appendChild(
|
|
1296
|
+
return o.className = n, o.appendChild(wt(t, e.pricingUrl)), o.appendChild(wt("Earn credits", e.earnCreditsUrl)), o;
|
|
1247
1297
|
}
|
|
1248
|
-
function
|
|
1298
|
+
function wt(e, t) {
|
|
1249
1299
|
const n = document.createElement("button");
|
|
1250
1300
|
return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
|
|
1251
1301
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1252
1302
|
}), n;
|
|
1253
1303
|
}
|
|
1254
|
-
function
|
|
1304
|
+
function Go(e) {
|
|
1255
1305
|
return new Promise((t, n) => {
|
|
1256
1306
|
const o = new FileReader();
|
|
1257
1307
|
o.addEventListener("load", () => {
|
|
@@ -1265,7 +1315,7 @@ function Lo(e) {
|
|
|
1265
1315
|
}), o.readAsArrayBuffer(e);
|
|
1266
1316
|
});
|
|
1267
1317
|
}
|
|
1268
|
-
function
|
|
1318
|
+
function $o(e) {
|
|
1269
1319
|
return new Promise((t, n) => {
|
|
1270
1320
|
const o = new FileReader();
|
|
1271
1321
|
o.addEventListener("load", () => {
|
|
@@ -1279,94 +1329,94 @@ function Po(e) {
|
|
|
1279
1329
|
}), o.readAsDataURL(e);
|
|
1280
1330
|
});
|
|
1281
1331
|
}
|
|
1282
|
-
function
|
|
1283
|
-
return e.messages.filter((o) => !
|
|
1332
|
+
function _t(e, t) {
|
|
1333
|
+
return e.messages.filter((o) => !Wt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1284
1334
|
}
|
|
1285
|
-
function
|
|
1286
|
-
const
|
|
1287
|
-
e.replaceChildren(),
|
|
1288
|
-
const
|
|
1289
|
-
if (
|
|
1335
|
+
function Ho(e, t, n, o, a, i, l, p, c, d, s, b, y, S, w) {
|
|
1336
|
+
const I = [...i.messages], v = I.filter((m) => !Wt(m)), u = e.scrollTop;
|
|
1337
|
+
e.replaceChildren(), jt(n, i.isThinking), a.hidden = !p, p && l !== null && xo(a, l);
|
|
1338
|
+
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1339
|
+
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1290
1340
|
const m = document.createElement("div");
|
|
1291
1341
|
m.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1298
|
-
for (const
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
}),
|
|
1303
|
-
}
|
|
1304
|
-
m.appendChild(
|
|
1342
|
+
const x = document.createElement("div");
|
|
1343
|
+
x.className = "pluno-pa-widget__empty-hero";
|
|
1344
|
+
const M = document.createElement("img");
|
|
1345
|
+
M.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", M.src = y(), M.alt = "", M.setAttribute("aria-hidden", "true"), x.appendChild(M), m.appendChild(x), m.appendChild(Bt());
|
|
1346
|
+
const R = document.createElement("div");
|
|
1347
|
+
R.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && R.setAttribute("aria-hidden", "true");
|
|
1348
|
+
for (const f of i.starterPrompts) {
|
|
1349
|
+
const A = document.createElement("button");
|
|
1350
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
|
|
1351
|
+
S(f);
|
|
1352
|
+
}), R.appendChild(A);
|
|
1353
|
+
}
|
|
1354
|
+
m.appendChild(R), e.appendChild(m), e.appendChild(t);
|
|
1305
1355
|
return;
|
|
1306
1356
|
}
|
|
1307
|
-
let
|
|
1308
|
-
const
|
|
1309
|
-
if (
|
|
1357
|
+
let C = null, _ = null, N = [];
|
|
1358
|
+
const k = () => {
|
|
1359
|
+
if (N.length === 0)
|
|
1310
1360
|
return !1;
|
|
1311
|
-
const m =
|
|
1312
|
-
return e.appendChild(m),
|
|
1361
|
+
const m = Jo(N, s, b, y());
|
|
1362
|
+
return e.appendChild(m), C = null, _ = m, N = [], !0;
|
|
1313
1363
|
};
|
|
1314
|
-
for (let m = 0; m <
|
|
1315
|
-
const
|
|
1316
|
-
if (
|
|
1317
|
-
|
|
1364
|
+
for (let m = 0; m < v.length; m += 1) {
|
|
1365
|
+
const x = v[m];
|
|
1366
|
+
if (x.role === "tool") {
|
|
1367
|
+
N.push(x);
|
|
1318
1368
|
continue;
|
|
1319
1369
|
}
|
|
1320
|
-
if (
|
|
1370
|
+
if (x.role === "system")
|
|
1321
1371
|
continue;
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1324
|
-
const
|
|
1325
|
-
e.appendChild(
|
|
1372
|
+
const M = k(), R = vt(x.content);
|
|
1373
|
+
if (x.role === "assistant" && !M) {
|
|
1374
|
+
const te = $e(y());
|
|
1375
|
+
e.appendChild(te), C = null, _ = te;
|
|
1326
1376
|
}
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1377
|
+
const f = document.createElement("div");
|
|
1378
|
+
f.className = `pluno-pa-widget__message pluno-pa-widget__message--${x.role}`, x.role === "assistant" ? yt(f, R) : f.textContent = R, x.role === "user" && x.attachments?.length && f.appendChild(Vo(x.attachments));
|
|
1379
|
+
const A = document.createElement("div");
|
|
1380
|
+
A.className = "pluno-pa-widget__message-actions", A.appendChild(xt(R)), f.appendChild(A), e.appendChild(f), C = f, _ = null;
|
|
1331
1381
|
}
|
|
1332
|
-
const
|
|
1333
|
-
if (
|
|
1334
|
-
if (!
|
|
1335
|
-
const
|
|
1336
|
-
e.appendChild(
|
|
1337
|
-
}
|
|
1338
|
-
const m =
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1382
|
+
const ee = k();
|
|
1383
|
+
if (i.assistantDraft) {
|
|
1384
|
+
if (!ee) {
|
|
1385
|
+
const R = $e(y());
|
|
1386
|
+
e.appendChild(R), C = null, _ = R;
|
|
1387
|
+
}
|
|
1388
|
+
const m = vt(i.assistantDraft), x = document.createElement("div");
|
|
1389
|
+
x.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", yt(x, m);
|
|
1390
|
+
const M = document.createElement("div");
|
|
1391
|
+
M.className = "pluno-pa-widget__message-actions", M.appendChild(xt(m)), x.appendChild(M), e.appendChild(x), C = x, _ = null;
|
|
1342
1392
|
}
|
|
1343
|
-
if (
|
|
1344
|
-
if (
|
|
1345
|
-
const m =
|
|
1346
|
-
e.appendChild(m),
|
|
1393
|
+
if (i.isThinking && !i.assistantDraft)
|
|
1394
|
+
if (ee) {
|
|
1395
|
+
const m = Vt();
|
|
1396
|
+
e.appendChild(m), C = null, _ = m;
|
|
1347
1397
|
} else {
|
|
1348
|
-
const m =
|
|
1349
|
-
e.appendChild(m),
|
|
1398
|
+
const m = Qo(y());
|
|
1399
|
+
e.appendChild(m), C = null, _ = m;
|
|
1350
1400
|
}
|
|
1351
|
-
if (
|
|
1401
|
+
if (i.lastError) {
|
|
1352
1402
|
const m = document.createElement("div");
|
|
1353
|
-
m.className = "pluno-pa-widget__error", m.textContent =
|
|
1403
|
+
m.className = "pluno-pa-widget__error", m.textContent = i.lastError, e.appendChild(m), C = m, _ = null;
|
|
1354
1404
|
}
|
|
1355
|
-
const E =
|
|
1356
|
-
if (
|
|
1357
|
-
const m =
|
|
1358
|
-
isDrafting:
|
|
1359
|
-
error:
|
|
1360
|
-
onDraft:
|
|
1361
|
-
onDismiss:
|
|
1362
|
-
onDisable:
|
|
1405
|
+
const E = w && !i.isThinking ? bn(I) : null;
|
|
1406
|
+
if (w && E && !w.dismissedCandidateIds.has(E.id)) {
|
|
1407
|
+
const m = jo(E, {
|
|
1408
|
+
isDrafting: w.draftingCandidateId === E.id,
|
|
1409
|
+
error: w.error,
|
|
1410
|
+
onDraft: w.onDraft,
|
|
1411
|
+
onDismiss: w.onDismiss,
|
|
1412
|
+
onDisable: w.onDisable
|
|
1363
1413
|
});
|
|
1364
|
-
e.appendChild(m),
|
|
1414
|
+
e.appendChild(m), w.onSeen(E), C = null, _ = m;
|
|
1365
1415
|
}
|
|
1366
|
-
|
|
1416
|
+
C?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? ge(e, d) : e.scrollTop = u;
|
|
1367
1417
|
}
|
|
1368
|
-
function
|
|
1369
|
-
e.replaceChildren(),
|
|
1418
|
+
function Wo(e, t, n, o, a, i) {
|
|
1419
|
+
e.replaceChildren(), jt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1370
1420
|
const l = document.createElement("div");
|
|
1371
1421
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1372
1422
|
const p = document.createElement("img");
|
|
@@ -1376,20 +1426,20 @@ function No(e, t, n, o, a, i) {
|
|
|
1376
1426
|
const d = document.createElement("button");
|
|
1377
1427
|
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1378
1428
|
}
|
|
1379
|
-
function
|
|
1429
|
+
function Vo(e) {
|
|
1380
1430
|
const t = document.createElement("div");
|
|
1381
1431
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1382
1432
|
for (const n of e)
|
|
1383
|
-
t.appendChild(
|
|
1433
|
+
t.appendChild(Ao(n));
|
|
1384
1434
|
return t;
|
|
1385
1435
|
}
|
|
1386
|
-
function
|
|
1436
|
+
function xt(e) {
|
|
1387
1437
|
const t = document.createElement("button");
|
|
1388
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1438
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ko()), t.addEventListener("click", (n) => {
|
|
1389
1439
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1390
1440
|
}), t;
|
|
1391
1441
|
}
|
|
1392
|
-
function
|
|
1442
|
+
function jo(e, t) {
|
|
1393
1443
|
const n = document.createElement("article");
|
|
1394
1444
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1395
1445
|
const o = document.createElement("div");
|
|
@@ -1411,24 +1461,24 @@ function Do(e, t) {
|
|
|
1411
1461
|
const d = document.createElement("button");
|
|
1412
1462
|
if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
|
|
1413
1463
|
t.onDraft(e);
|
|
1414
|
-
}), t.isDrafting ? (d.appendChild(
|
|
1464
|
+
}), t.isDrafting ? (d.appendChild(He()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
|
|
1415
1465
|
p.appendChild(c);
|
|
1416
1466
|
else {
|
|
1417
1467
|
const s = document.createElement("button");
|
|
1418
1468
|
s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
|
|
1419
1469
|
t.onDismiss(e);
|
|
1420
1470
|
}), c.appendChild(s), p.appendChild(c);
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1471
|
+
const b = document.createElement("button");
|
|
1472
|
+
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1423
1473
|
t.onDisable(e);
|
|
1424
|
-
}), p.appendChild(
|
|
1474
|
+
}), p.appendChild(b);
|
|
1425
1475
|
}
|
|
1426
1476
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1427
1477
|
}
|
|
1428
|
-
function
|
|
1478
|
+
function qo(e, t) {
|
|
1429
1479
|
const n = document.createElement("div");
|
|
1430
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1431
|
-
|
|
1480
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1481
|
+
v.target === n && t.onClose();
|
|
1432
1482
|
});
|
|
1433
1483
|
const o = document.createElement("section");
|
|
1434
1484
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
@@ -1444,49 +1494,49 @@ function Io(e, t) {
|
|
|
1444
1494
|
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1445
1495
|
const s = document.createElement("strong");
|
|
1446
1496
|
s.textContent = "1) Copy Screenshot", d.appendChild(s);
|
|
1447
|
-
const
|
|
1497
|
+
const b = Ko("Copy Screenshot", async () => {
|
|
1448
1498
|
try {
|
|
1449
|
-
return await
|
|
1499
|
+
return await wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1450
1500
|
} catch {
|
|
1451
1501
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1452
1502
|
}
|
|
1453
1503
|
});
|
|
1454
|
-
if (d.appendChild(
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1504
|
+
if (d.appendChild(b), c.appendChild(d), e.screenshotDataUrl) {
|
|
1505
|
+
const v = document.createElement("div");
|
|
1506
|
+
v.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1507
|
+
const u = document.createElement("img");
|
|
1508
|
+
u.src = e.screenshotDataUrl, u.alt = "Product page with Pluno open", v.appendChild(u), c.appendChild(v);
|
|
1459
1509
|
}
|
|
1460
1510
|
o.appendChild(c), o.appendChild(p);
|
|
1461
|
-
const
|
|
1462
|
-
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
const
|
|
1466
|
-
|
|
1467
|
-
const
|
|
1468
|
-
|
|
1469
|
-
for (const
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1511
|
+
const y = document.createElement("div");
|
|
1512
|
+
y.className = "pluno-pa-widget__share-dialog-step";
|
|
1513
|
+
const S = document.createElement("strong");
|
|
1514
|
+
S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", y.appendChild(S);
|
|
1515
|
+
const w = document.createElement("p");
|
|
1516
|
+
w.className = "pluno-pa-widget__share-dialog-hint", w.textContent = "Post draft opens prefilled on supported platforms.", y.appendChild(w);
|
|
1517
|
+
const I = document.createElement("footer");
|
|
1518
|
+
I.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1519
|
+
for (const v of Yo(e)) {
|
|
1520
|
+
const u = document.createElement("a");
|
|
1521
|
+
u.href = v.href, u.target = "_blank", u.rel = "noopener noreferrer", u.title = v.label, u.setAttribute("aria-label", `Open ${v.label}`), u.appendChild(Xo(v.id)), I.appendChild(u);
|
|
1472
1522
|
}
|
|
1473
|
-
if (
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1523
|
+
if (y.appendChild(I), o.appendChild(y), t.socialPostRewardsUrl) {
|
|
1524
|
+
const v = document.createElement("div");
|
|
1525
|
+
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1526
|
+
const u = document.createElement("strong");
|
|
1527
|
+
u.className = "pluno-pa-widget__share-dialog-step-title", u.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(u);
|
|
1478
1528
|
const h = document.createElement("a");
|
|
1479
|
-
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(
|
|
1529
|
+
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(Zo()), v.appendChild(h), o.appendChild(v);
|
|
1480
1530
|
}
|
|
1481
1531
|
return n.appendChild(o), n;
|
|
1482
1532
|
}
|
|
1483
|
-
function
|
|
1533
|
+
function Ko(e, t) {
|
|
1484
1534
|
const n = document.createElement("button");
|
|
1485
1535
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1486
1536
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1487
1537
|
}), n;
|
|
1488
1538
|
}
|
|
1489
|
-
function
|
|
1539
|
+
function Yo(e) {
|
|
1490
1540
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1491
1541
|
return [
|
|
1492
1542
|
{
|
|
@@ -1506,60 +1556,60 @@ function Ro(e) {
|
|
|
1506
1556
|
}
|
|
1507
1557
|
];
|
|
1508
1558
|
}
|
|
1509
|
-
function
|
|
1559
|
+
function Xo(e) {
|
|
1510
1560
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1511
|
-
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (
|
|
1561
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (T(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), T(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), T(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), T(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), T(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (T(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), T(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), T(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (T(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), T(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), T(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), T(t, "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"), t);
|
|
1512
1562
|
}
|
|
1513
|
-
function
|
|
1563
|
+
function T(e, t, n) {
|
|
1514
1564
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1515
1565
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1516
1566
|
}
|
|
1517
|
-
function
|
|
1567
|
+
function Zo() {
|
|
1518
1568
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1519
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
1569
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), T(e, "M14 5h5v5"), T(e, "M19 5l-8 8"), T(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1520
1570
|
}
|
|
1521
|
-
function
|
|
1522
|
-
return e.role === "tool" && e.toolName ===
|
|
1571
|
+
function Wt(e) {
|
|
1572
|
+
return e.role === "tool" && e.toolName === At;
|
|
1523
1573
|
}
|
|
1524
|
-
function
|
|
1574
|
+
function vt(e) {
|
|
1525
1575
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1526
1576
|
}
|
|
1527
|
-
function
|
|
1577
|
+
function Jo(e, t, n, o) {
|
|
1528
1578
|
const a = document.createElement("article");
|
|
1529
1579
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1530
1580
|
const i = document.createElement("img");
|
|
1531
1581
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1532
|
-
const l = document.createElement("details"), p =
|
|
1533
|
-
l.open = t.has(p), l.addEventListener("toggle", () => {
|
|
1534
|
-
l.open ? t.add(p) : t.delete(p), n();
|
|
1582
|
+
const l = document.createElement("details"), p = ea(e);
|
|
1583
|
+
l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
|
|
1584
|
+
a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
|
|
1535
1585
|
});
|
|
1536
1586
|
const c = document.createElement("summary");
|
|
1537
|
-
c.className = "pluno-pa-widget__tool-summary", e.some((
|
|
1587
|
+
c.className = "pluno-pa-widget__tool-summary", e.some((b) => b.loading) && c.appendChild(He());
|
|
1538
1588
|
const s = document.createElement("span");
|
|
1539
1589
|
if (s.className = "pluno-pa-widget__tool-summary-title", s.textContent = e[e.length - 1].content || "Run tool", c.appendChild(s), l.appendChild(c), e.length > 0) {
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
for (const
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1547
|
-
}
|
|
1548
|
-
l.appendChild(
|
|
1590
|
+
const b = document.createElement("div");
|
|
1591
|
+
b.className = "pluno-pa-widget__tool-lines";
|
|
1592
|
+
for (const y of e) {
|
|
1593
|
+
const S = document.createElement("div");
|
|
1594
|
+
S.className = "pluno-pa-widget__tool-line", y.loading && S.appendChild(He());
|
|
1595
|
+
const w = document.createElement("span");
|
|
1596
|
+
w.textContent = y.content || "Run tool", S.appendChild(w), b.appendChild(S);
|
|
1597
|
+
}
|
|
1598
|
+
l.appendChild(b);
|
|
1549
1599
|
}
|
|
1550
1600
|
return a.appendChild(l), a;
|
|
1551
1601
|
}
|
|
1552
|
-
function
|
|
1602
|
+
function $e(e) {
|
|
1553
1603
|
const t = document.createElement("article");
|
|
1554
1604
|
t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1555
1605
|
const n = document.createElement("img");
|
|
1556
1606
|
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), t.appendChild(n), t;
|
|
1557
1607
|
}
|
|
1558
|
-
function
|
|
1559
|
-
const t =
|
|
1560
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
1608
|
+
function Qo(e) {
|
|
1609
|
+
const t = $e(e);
|
|
1610
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Vt()), t;
|
|
1561
1611
|
}
|
|
1562
|
-
function
|
|
1612
|
+
function Vt() {
|
|
1563
1613
|
const e = document.createElement("div");
|
|
1564
1614
|
e.className = "pluno-pa-widget__status";
|
|
1565
1615
|
const t = document.createElement("span");
|
|
@@ -1567,17 +1617,17 @@ function Rt() {
|
|
|
1567
1617
|
const n = document.createElement("span");
|
|
1568
1618
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1569
1619
|
}
|
|
1570
|
-
function
|
|
1571
|
-
return `tools:${e
|
|
1620
|
+
function ea(e) {
|
|
1621
|
+
return `tools:${e[0]?.id ?? ""}`;
|
|
1572
1622
|
}
|
|
1573
|
-
function
|
|
1623
|
+
function He() {
|
|
1574
1624
|
const e = document.createElement("span");
|
|
1575
1625
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1576
1626
|
}
|
|
1577
|
-
function
|
|
1578
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1627
|
+
function jt(e, t) {
|
|
1628
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Eo() : zt());
|
|
1579
1629
|
}
|
|
1580
|
-
function
|
|
1630
|
+
function yt(e, t) {
|
|
1581
1631
|
const n = t.replace(/\r\n/g, `
|
|
1582
1632
|
`).split(`
|
|
1583
1633
|
`);
|
|
@@ -1593,22 +1643,22 @@ function ut(e, t) {
|
|
|
1593
1643
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1594
1644
|
d.push(n[o]), o += 1;
|
|
1595
1645
|
o += o < n.length ? 1 : 0;
|
|
1596
|
-
const s = document.createElement("pre"),
|
|
1597
|
-
|
|
1598
|
-
`), s.appendChild(
|
|
1646
|
+
const s = document.createElement("pre"), b = document.createElement("code");
|
|
1647
|
+
b.textContent = d.join(`
|
|
1648
|
+
`), s.appendChild(b), e.appendChild(s);
|
|
1599
1649
|
continue;
|
|
1600
1650
|
}
|
|
1601
1651
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1602
1652
|
if (l) {
|
|
1603
1653
|
const d = document.createElement(`h${l[1].length + 2}`);
|
|
1604
|
-
|
|
1654
|
+
xe(d, l[2]), e.appendChild(d), o += 1;
|
|
1605
1655
|
continue;
|
|
1606
1656
|
}
|
|
1607
1657
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1608
1658
|
const d = document.createElement("ul");
|
|
1609
1659
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1610
1660
|
const s = document.createElement("li");
|
|
1611
|
-
|
|
1661
|
+
xe(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
|
|
1612
1662
|
}
|
|
1613
1663
|
e.appendChild(d);
|
|
1614
1664
|
continue;
|
|
@@ -1617,7 +1667,7 @@ function ut(e, t) {
|
|
|
1617
1667
|
const d = document.createElement("ol");
|
|
1618
1668
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1619
1669
|
const s = document.createElement("li");
|
|
1620
|
-
|
|
1670
|
+
xe(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
|
|
1621
1671
|
}
|
|
1622
1672
|
e.appendChild(d);
|
|
1623
1673
|
continue;
|
|
@@ -1627,11 +1677,11 @@ function ut(e, t) {
|
|
|
1627
1677
|
p.push(n[o]), o += 1;
|
|
1628
1678
|
const c = document.createElement("p");
|
|
1629
1679
|
p.forEach((d, s) => {
|
|
1630
|
-
s > 0 && c.appendChild(document.createElement("br")),
|
|
1680
|
+
s > 0 && c.appendChild(document.createElement("br")), xe(c, d);
|
|
1631
1681
|
}), e.appendChild(c);
|
|
1632
1682
|
}
|
|
1633
1683
|
}
|
|
1634
|
-
function
|
|
1684
|
+
function xe(e, t) {
|
|
1635
1685
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1636
1686
|
let o = 0;
|
|
1637
1687
|
for (const a of t.matchAll(n)) {
|
|
@@ -1649,7 +1699,7 @@ function de(e, t) {
|
|
|
1649
1699
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
1650
1700
|
} else {
|
|
1651
1701
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1652
|
-
if (p &&
|
|
1702
|
+
if (p && ta(p[2])) {
|
|
1653
1703
|
const c = document.createElement("a");
|
|
1654
1704
|
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
1655
1705
|
} else
|
|
@@ -1659,7 +1709,7 @@ function de(e, t) {
|
|
|
1659
1709
|
}
|
|
1660
1710
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1661
1711
|
}
|
|
1662
|
-
function
|
|
1712
|
+
function ta(e) {
|
|
1663
1713
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1664
1714
|
return !0;
|
|
1665
1715
|
try {
|
|
@@ -1669,8 +1719,8 @@ function Go(e) {
|
|
|
1669
1719
|
return !1;
|
|
1670
1720
|
}
|
|
1671
1721
|
}
|
|
1672
|
-
function
|
|
1673
|
-
if (
|
|
1722
|
+
function Ct(e, t) {
|
|
1723
|
+
if (na(e))
|
|
1674
1724
|
return;
|
|
1675
1725
|
const n = `
|
|
1676
1726
|
:host {
|
|
@@ -1723,7 +1773,7 @@ function gt(e, t) {
|
|
|
1723
1773
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1724
1774
|
position: fixed;
|
|
1725
1775
|
z-index: 2147483645;
|
|
1726
|
-
font-family: ${
|
|
1776
|
+
font-family: ${W.fontFamily};
|
|
1727
1777
|
font-size: 14px;
|
|
1728
1778
|
color: var(--pluno-pa-text);
|
|
1729
1779
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -1978,6 +2028,41 @@ function gt(e, t) {
|
|
|
1978
2028
|
scrollbar-color: var(--pluno-pa-divider) transparent;
|
|
1979
2029
|
scrollbar-width: thin;
|
|
1980
2030
|
}
|
|
2031
|
+
.pluno-pa-widget__timeline-bottom-sentinel {
|
|
2032
|
+
flex: 0 0 1px;
|
|
2033
|
+
height: 1px;
|
|
2034
|
+
pointer-events: none;
|
|
2035
|
+
}
|
|
2036
|
+
.pluno-pa-widget__timeline-jump {
|
|
2037
|
+
position: absolute;
|
|
2038
|
+
left: 50%;
|
|
2039
|
+
bottom: 16px;
|
|
2040
|
+
z-index: 3;
|
|
2041
|
+
transform: translateX(-50%);
|
|
2042
|
+
border: 1px solid color-mix(in srgb, var(--pluno-pa-accent) 34%, var(--pluno-pa-divider));
|
|
2043
|
+
border-radius: 999px;
|
|
2044
|
+
background: color-mix(in srgb, var(--pluno-pa-bg) 94%, transparent);
|
|
2045
|
+
color: var(--pluno-pa-text);
|
|
2046
|
+
box-shadow: 0 8px 18px rgba(24, 24, 27, 0.12);
|
|
2047
|
+
cursor: pointer;
|
|
2048
|
+
font: inherit;
|
|
2049
|
+
font-size: 12px;
|
|
2050
|
+
font-weight: 600;
|
|
2051
|
+
line-height: 1;
|
|
2052
|
+
padding: 8px 12px;
|
|
2053
|
+
transition:
|
|
2054
|
+
background 120ms ease,
|
|
2055
|
+
transform 120ms ease,
|
|
2056
|
+
box-shadow 120ms ease;
|
|
2057
|
+
}
|
|
2058
|
+
.pluno-pa-widget__timeline-jump:hover {
|
|
2059
|
+
background: var(--pluno-pa-surface);
|
|
2060
|
+
box-shadow: 0 10px 22px rgba(24, 24, 27, 0.14);
|
|
2061
|
+
transform: translateX(-50%) translateY(-1px);
|
|
2062
|
+
}
|
|
2063
|
+
.pluno-pa-widget__timeline-jump:active {
|
|
2064
|
+
transform: translateX(-50%) scale(0.98);
|
|
2065
|
+
}
|
|
1981
2066
|
.pluno-pa-widget__new-chat {
|
|
1982
2067
|
position: absolute;
|
|
1983
2068
|
right: 14px;
|
|
@@ -2429,7 +2514,7 @@ function gt(e, t) {
|
|
|
2429
2514
|
place-items: center;
|
|
2430
2515
|
padding: 18px;
|
|
2431
2516
|
background: rgba(24, 24, 27, 0.28);
|
|
2432
|
-
font-family: var(--pluno-pa-font, ${
|
|
2517
|
+
font-family: var(--pluno-pa-font, ${W.fontFamily});
|
|
2433
2518
|
color: var(--pluno-pa-text);
|
|
2434
2519
|
}
|
|
2435
2520
|
.pluno-pa-widget__share-dialog {
|
|
@@ -3098,7 +3183,7 @@ function gt(e, t) {
|
|
|
3098
3183
|
right: 16px;
|
|
3099
3184
|
height: 36px;
|
|
3100
3185
|
z-index: 3;
|
|
3101
|
-
background-image: url('${
|
|
3186
|
+
background-image: url('${pt}');
|
|
3102
3187
|
background-repeat: repeat-x;
|
|
3103
3188
|
background-size: 104px 36px;
|
|
3104
3189
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3151,6 +3236,12 @@ function gt(e, t) {
|
|
|
3151
3236
|
align-items: center;
|
|
3152
3237
|
margin-bottom: -8px;
|
|
3153
3238
|
}
|
|
3239
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__assistant-marker:not(.pluno-pa-widget__thinking-marker) {
|
|
3240
|
+
margin-bottom: -12px;
|
|
3241
|
+
}
|
|
3242
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__tool-group.pluno-pa-widget__tool-group--open {
|
|
3243
|
+
align-items: flex-start;
|
|
3244
|
+
}
|
|
3154
3245
|
.pluno-pa-widget--scribble .pluno-pa-widget__tool-group details {
|
|
3155
3246
|
transform: translateY(-3px);
|
|
3156
3247
|
}
|
|
@@ -3345,7 +3436,7 @@ function gt(e, t) {
|
|
|
3345
3436
|
right: 12px;
|
|
3346
3437
|
height: 22px;
|
|
3347
3438
|
z-index: 1;
|
|
3348
|
-
background-image: url('${
|
|
3439
|
+
background-image: url('${pt}');
|
|
3349
3440
|
background-repeat: repeat-x;
|
|
3350
3441
|
background-size: 62px 21.5px;
|
|
3351
3442
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3358,28 +3449,28 @@ function gt(e, t) {
|
|
|
3358
3449
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3359
3450
|
}
|
|
3360
3451
|
`;
|
|
3361
|
-
if (
|
|
3452
|
+
if (oa(e, n))
|
|
3362
3453
|
return;
|
|
3363
3454
|
const o = e.ownerDocument.createElement("style");
|
|
3364
|
-
o.id =
|
|
3455
|
+
o.id = Mt, o.textContent = n, e.appendChild(o), qt(e);
|
|
3365
3456
|
}
|
|
3366
|
-
function
|
|
3367
|
-
return e.getElementById(
|
|
3457
|
+
function na(e) {
|
|
3458
|
+
return e.getElementById(Mt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Rt) === "true";
|
|
3368
3459
|
}
|
|
3369
|
-
function
|
|
3370
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
3460
|
+
function qt(e) {
|
|
3461
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Rt, "true");
|
|
3371
3462
|
}
|
|
3372
|
-
function
|
|
3463
|
+
function oa(e, t) {
|
|
3373
3464
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3374
3465
|
return !1;
|
|
3375
3466
|
try {
|
|
3376
3467
|
const n = new CSSStyleSheet();
|
|
3377
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
3468
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], qt(e), !0;
|
|
3378
3469
|
} catch {
|
|
3379
3470
|
return !1;
|
|
3380
3471
|
}
|
|
3381
3472
|
}
|
|
3382
|
-
async function
|
|
3473
|
+
async function aa() {
|
|
3383
3474
|
return document.body ? document.body : await new Promise((e) => {
|
|
3384
3475
|
const t = new MutationObserver(() => {
|
|
3385
3476
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3387,49 +3478,49 @@ async function Wo() {
|
|
|
3387
3478
|
t.observe(document.documentElement, { childList: !0 });
|
|
3388
3479
|
});
|
|
3389
3480
|
}
|
|
3390
|
-
function
|
|
3481
|
+
function Kt(e) {
|
|
3391
3482
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3392
3483
|
}
|
|
3393
|
-
function
|
|
3484
|
+
function ia(e) {
|
|
3394
3485
|
try {
|
|
3395
|
-
const t = window.localStorage.getItem(
|
|
3486
|
+
const t = window.localStorage.getItem(Kt(e));
|
|
3396
3487
|
if (!t)
|
|
3397
|
-
return
|
|
3488
|
+
return Et();
|
|
3398
3489
|
const n = JSON.parse(t);
|
|
3399
3490
|
return {
|
|
3400
3491
|
isOpen: n.isOpen === !0,
|
|
3401
3492
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3402
3493
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3403
|
-
launcherPosition:
|
|
3404
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3494
|
+
launcherPosition: sa(n.launcherPosition) ? n.launcherPosition : null,
|
|
3495
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Tt) : [],
|
|
3405
3496
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3406
3497
|
};
|
|
3407
3498
|
} catch {
|
|
3408
|
-
return
|
|
3499
|
+
return Et();
|
|
3409
3500
|
}
|
|
3410
3501
|
}
|
|
3411
|
-
async function
|
|
3502
|
+
async function ra(e) {
|
|
3412
3503
|
if (e.loadSharePromptsDisabled)
|
|
3413
3504
|
return e.loadSharePromptsDisabled();
|
|
3414
3505
|
try {
|
|
3415
|
-
return window.localStorage.getItem(
|
|
3506
|
+
return window.localStorage.getItem(Nt) === "true";
|
|
3416
3507
|
} catch {
|
|
3417
3508
|
return !1;
|
|
3418
3509
|
}
|
|
3419
3510
|
}
|
|
3420
|
-
function
|
|
3511
|
+
function la(e, t) {
|
|
3421
3512
|
if (e.persistSharePromptsDisabled) {
|
|
3422
3513
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3423
3514
|
});
|
|
3424
3515
|
return;
|
|
3425
3516
|
}
|
|
3426
3517
|
try {
|
|
3427
|
-
t && window.localStorage.setItem(
|
|
3518
|
+
t && window.localStorage.setItem(Nt, "true");
|
|
3428
3519
|
} catch {
|
|
3429
3520
|
return;
|
|
3430
3521
|
}
|
|
3431
3522
|
}
|
|
3432
|
-
function
|
|
3523
|
+
function Et() {
|
|
3433
3524
|
return {
|
|
3434
3525
|
isOpen: !1,
|
|
3435
3526
|
composerValue: "",
|
|
@@ -3439,43 +3530,43 @@ function ht() {
|
|
|
3439
3530
|
sharePromptsDisabled: !1
|
|
3440
3531
|
};
|
|
3441
3532
|
}
|
|
3442
|
-
function
|
|
3533
|
+
function pa(e, t) {
|
|
3443
3534
|
try {
|
|
3444
|
-
window.localStorage.setItem(
|
|
3535
|
+
window.localStorage.setItem(Kt(e), JSON.stringify(t));
|
|
3445
3536
|
} catch {
|
|
3446
3537
|
return;
|
|
3447
3538
|
}
|
|
3448
3539
|
}
|
|
3449
|
-
function
|
|
3540
|
+
function sa(e) {
|
|
3450
3541
|
if (!e || typeof e != "object")
|
|
3451
3542
|
return !1;
|
|
3452
3543
|
const t = e;
|
|
3453
3544
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3454
3545
|
}
|
|
3455
|
-
const
|
|
3456
|
-
function
|
|
3546
|
+
const St = /* @__PURE__ */ new WeakSet();
|
|
3547
|
+
function da(e) {
|
|
3457
3548
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3458
3549
|
}
|
|
3459
|
-
function
|
|
3550
|
+
function kt(e) {
|
|
3460
3551
|
const t = e.pathname.split("/");
|
|
3461
3552
|
return t[t.length - 1] ?? "";
|
|
3462
3553
|
}
|
|
3463
|
-
function
|
|
3554
|
+
function ca(e, t) {
|
|
3464
3555
|
const n = new URL(e.src, document.baseURI);
|
|
3465
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
3556
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : kt(n) === kt(t);
|
|
3466
3557
|
}
|
|
3467
|
-
class
|
|
3558
|
+
class V extends EventTarget {
|
|
3468
3559
|
constructor(t, n) {
|
|
3469
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3470
|
-
this.readyState =
|
|
3471
|
-
}), this.addPreviewListener(
|
|
3560
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Rn, () => {
|
|
3561
|
+
this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
|
|
3562
|
+
}), this.addPreviewListener(On, (o) => {
|
|
3472
3563
|
const a = o;
|
|
3473
3564
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3474
|
-
}), this.addPreviewListener(
|
|
3475
|
-
this.readyState =
|
|
3476
|
-
}), this.addPreviewListener(
|
|
3565
|
+
}), this.addPreviewListener(Bn, () => {
|
|
3566
|
+
this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3567
|
+
}), this.addPreviewListener(Fn, (o) => {
|
|
3477
3568
|
const a = o;
|
|
3478
|
-
this.readyState =
|
|
3569
|
+
this.readyState = V.CLOSED, this.dispatchEvent(
|
|
3479
3570
|
new CloseEvent("close", {
|
|
3480
3571
|
code: a.detail?.code ?? 1e3,
|
|
3481
3572
|
reason: a.detail?.reason ?? "",
|
|
@@ -3483,7 +3574,7 @@ class z extends EventTarget {
|
|
|
3483
3574
|
})
|
|
3484
3575
|
), this.cleanup();
|
|
3485
3576
|
}), window.dispatchEvent(
|
|
3486
|
-
new CustomEvent(
|
|
3577
|
+
new CustomEvent(ve(Dn, this.channelId), {
|
|
3487
3578
|
detail: { socketId: this.socketId, url: t }
|
|
3488
3579
|
})
|
|
3489
3580
|
);
|
|
@@ -3498,27 +3589,27 @@ class z extends EventTarget {
|
|
|
3498
3589
|
extensions = "";
|
|
3499
3590
|
binaryType = "blob";
|
|
3500
3591
|
bufferedAmount = 0;
|
|
3501
|
-
readyState =
|
|
3502
|
-
socketId =
|
|
3592
|
+
readyState = V.CONNECTING;
|
|
3593
|
+
socketId = ua();
|
|
3503
3594
|
listeners = /* @__PURE__ */ new Map();
|
|
3504
3595
|
send(t) {
|
|
3505
|
-
if (this.readyState !==
|
|
3596
|
+
if (this.readyState !== V.OPEN)
|
|
3506
3597
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3507
3598
|
window.dispatchEvent(
|
|
3508
|
-
new CustomEvent(
|
|
3599
|
+
new CustomEvent(ve(In, this.channelId), {
|
|
3509
3600
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3510
3601
|
})
|
|
3511
3602
|
);
|
|
3512
3603
|
}
|
|
3513
3604
|
close(t, n) {
|
|
3514
|
-
this.readyState !==
|
|
3515
|
-
new CustomEvent(
|
|
3605
|
+
this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
|
|
3606
|
+
new CustomEvent(ve(Mn, this.channelId), {
|
|
3516
3607
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3517
3608
|
})
|
|
3518
3609
|
), this.cleanup());
|
|
3519
3610
|
}
|
|
3520
3611
|
addPreviewListener(t, n) {
|
|
3521
|
-
const o =
|
|
3612
|
+
const o = ve(t, this.channelId), a = (i) => {
|
|
3522
3613
|
i.detail?.socketId === this.socketId && n(i);
|
|
3523
3614
|
};
|
|
3524
3615
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -3529,36 +3620,36 @@ class z extends EventTarget {
|
|
|
3529
3620
|
this.listeners.clear();
|
|
3530
3621
|
}
|
|
3531
3622
|
}
|
|
3532
|
-
function
|
|
3533
|
-
const e = window.sessionStorage.getItem(
|
|
3623
|
+
function ua() {
|
|
3624
|
+
const e = window.sessionStorage.getItem(lt);
|
|
3534
3625
|
if (e)
|
|
3535
3626
|
return e;
|
|
3536
3627
|
const t = crypto.randomUUID();
|
|
3537
|
-
return window.sessionStorage.setItem(
|
|
3628
|
+
return window.sessionStorage.setItem(lt, t), t;
|
|
3538
3629
|
}
|
|
3539
|
-
function
|
|
3630
|
+
function ve(e, t) {
|
|
3540
3631
|
return `${e}:${t}`;
|
|
3541
3632
|
}
|
|
3542
|
-
function
|
|
3633
|
+
function ga(e) {
|
|
3543
3634
|
const t = document.currentScript;
|
|
3544
3635
|
if (t instanceof HTMLScriptElement)
|
|
3545
3636
|
return [t];
|
|
3546
3637
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3547
3638
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3548
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3639
|
+
(a) => a instanceof HTMLScriptElement && da(a) && ca(a, o)
|
|
3549
3640
|
);
|
|
3550
3641
|
}
|
|
3551
|
-
function
|
|
3552
|
-
for (const t of
|
|
3553
|
-
if (
|
|
3642
|
+
function ha(e) {
|
|
3643
|
+
for (const t of ga(e)) {
|
|
3644
|
+
if (St.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3554
3645
|
continue;
|
|
3555
|
-
|
|
3646
|
+
St.add(t);
|
|
3556
3647
|
const n = t.dataset.plunoPreviewChannel;
|
|
3557
|
-
|
|
3648
|
+
oo({
|
|
3558
3649
|
token: t.dataset.plunoToken,
|
|
3559
3650
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3560
3651
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3561
|
-
webSocketFactory: n ?
|
|
3652
|
+
webSocketFactory: n ? no(n) : void 0,
|
|
3562
3653
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3563
3654
|
accentColor: t.dataset.plunoAccentColor,
|
|
3564
3655
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3570,8 +3661,8 @@ function ea(e) {
|
|
|
3570
3661
|
});
|
|
3571
3662
|
}
|
|
3572
3663
|
}
|
|
3573
|
-
|
|
3664
|
+
ha(import.meta.url);
|
|
3574
3665
|
export {
|
|
3575
|
-
|
|
3576
|
-
|
|
3666
|
+
no as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3667
|
+
oo as mountPlunoProductAgentWidget
|
|
3577
3668
|
};
|