@pluno/product-agent-web 0.1.62 → 0.1.64
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 +529 -496
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as So } from "./product-agent-sdk.js";
|
|
2
|
+
const Eo = "#7c3aed", nt = "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", ot = "#2c2a1e", en = [253, 250, 241], tn = 3.5;
|
|
3
|
+
function Rn(e) {
|
|
4
|
+
const t = Mn(e);
|
|
5
|
+
if (nn(Ge(t), en) >= tn)
|
|
6
6
|
return t;
|
|
7
7
|
let n = Ge(t);
|
|
8
8
|
const i = Ge(ot);
|
|
9
9
|
for (let r = 0; r < 6; r += 1)
|
|
10
|
-
if (n =
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (n = Io(n, i, 0.22), nn(n, en) >= tn)
|
|
11
|
+
return At(n);
|
|
12
|
+
return At(n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ko() {
|
|
15
15
|
let o = "M 280 120", n = !1, i = 0;
|
|
16
16
|
for (let r = 150; r <= 1170; r += 62) {
|
|
17
17
|
const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
|
|
@@ -19,8 +19,8 @@ function Eo() {
|
|
|
19
19
|
}
|
|
20
20
|
return o;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function Lo(e) {
|
|
23
|
+
const t = Mn(e), o = Nt(Ge(t));
|
|
24
24
|
return o > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -56,9 +56,9 @@ function ko(e) {
|
|
|
56
56
|
shadow: J(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Mn(e) {
|
|
60
60
|
const t = e.trim();
|
|
61
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` :
|
|
61
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : Eo;
|
|
62
62
|
}
|
|
63
63
|
function Ge(e) {
|
|
64
64
|
return [
|
|
@@ -67,23 +67,23 @@ function Ge(e) {
|
|
|
67
67
|
Number.parseInt(e.slice(5, 7), 16)
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function At([e, t, o]) {
|
|
71
71
|
const n = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
|
|
72
72
|
return `#${n(e)}${n(t)}${n(o)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function Nt([e, t, o]) {
|
|
75
75
|
const n = (i) => {
|
|
76
76
|
const r = i / 255;
|
|
77
77
|
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
79
|
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const o =
|
|
81
|
+
function nn(e, t) {
|
|
82
|
+
const o = Nt(e), n = Nt(t), [i, r] = o > n ? [o, n] : [n, o];
|
|
83
83
|
return (i + 0.05) / (r + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const n =
|
|
85
|
+
function Io(e, t, o) {
|
|
86
|
+
const n = Tt(o);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * n,
|
|
89
89
|
e[1] + (t[1] - e[1]) * n,
|
|
@@ -91,10 +91,10 @@ function Lo(e, t, o) {
|
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
93
|
function J(e, t, o) {
|
|
94
|
-
const [n, i, r] =
|
|
95
|
-
return
|
|
94
|
+
const [n, i, r] = Ao(Ge(e));
|
|
95
|
+
return At(No(n, Tt(i + o), Tt(r + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Ao([e, t, o]) {
|
|
98
98
|
const n = e / 255, i = t / 255, r = o / 255, l = Math.max(n, i, r), p = Math.min(n, i, r), d = (l + p) / 2;
|
|
99
99
|
if (l === p)
|
|
100
100
|
return [0, 0, d];
|
|
@@ -115,19 +115,19 @@ function vt(e, t, o) {
|
|
|
115
115
|
let n = o;
|
|
116
116
|
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function Tt(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const zn = "suggest_share_on_socials";
|
|
122
122
|
function To(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
124
|
const o = e[t];
|
|
125
|
-
if (o.role !== "tool" || o.toolName !==
|
|
125
|
+
if (o.role !== "tool" || o.toolName !== zn)
|
|
126
126
|
continue;
|
|
127
|
-
const n =
|
|
127
|
+
const n = on(e, t, "assistant");
|
|
128
128
|
if (!n)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = on(e, n.index, "user");
|
|
131
131
|
return i ? {
|
|
132
132
|
id: `share:${o.callId ?? o.id}`,
|
|
133
133
|
userPrompt: i.content,
|
|
@@ -136,13 +136,13 @@ function To(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function Po(e) {
|
|
140
|
+
const t = await Do(e);
|
|
141
141
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
142
142
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
143
143
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function on(e, t, o) {
|
|
146
146
|
for (let n = t - 1; n >= 0; n -= 1) {
|
|
147
147
|
const i = e[n];
|
|
148
148
|
if (i.role === o && i.content.trim())
|
|
@@ -150,18 +150,18 @@ function nn(e, t, o) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function Do(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
156
|
+
const Ro = "https://app.pluno.ai", Mo = "/api/product-agent/embed/active-users", zo = 1800, Oo = 15e3, Uo = 250, Bo = 1e3, Fo = 3e4;
|
|
157
|
+
function Ho(e, t = {}) {
|
|
158
158
|
let o = !1, n = null, i = null, r = null;
|
|
159
159
|
const l = () => {
|
|
160
160
|
r !== null && (window.clearInterval(r), r = null);
|
|
161
161
|
}, p = (c) => {
|
|
162
162
|
o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
|
|
163
163
|
u();
|
|
164
|
-
},
|
|
164
|
+
}, $o(c)));
|
|
165
165
|
}, d = (c) => {
|
|
166
166
|
if (l(), n === null) {
|
|
167
167
|
n = c, e(c);
|
|
@@ -173,50 +173,50 @@ function Fo(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const w = Math.min(1, (performance.now() - S) /
|
|
177
|
-
n = Math.round(g + (c - g) *
|
|
178
|
-
},
|
|
176
|
+
const w = Math.min(1, (performance.now() - S) / zo);
|
|
177
|
+
n = Math.round(g + (c - g) * qo(w)), e(n), w >= 1 && (n = c, e(c), l());
|
|
178
|
+
}, Uo);
|
|
179
179
|
}, u = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const c = await
|
|
181
|
+
const c = await Wo(t);
|
|
182
182
|
if (o)
|
|
183
183
|
return;
|
|
184
184
|
d(c.count), p(c.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(Oo);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return u(), () => {
|
|
190
190
|
o = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function Wo(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const o = await (e.fetcher ?? fetch)(new URL(
|
|
196
|
+
const o = await (e.fetcher ?? fetch)(new URL(Mo, Go(e.backendUrl ?? Ro)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
200
200
|
if (!o.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const n = await o.json(), i =
|
|
202
|
+
const n = await o.json(), i = an(n.count), r = an(n.refreshAfterMs ?? n.refresh_after_ms);
|
|
203
203
|
if (i === null || r === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: i, refreshAfterMs: r };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function an(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function Wo(e) {
|
|
211
|
-
return e.endsWith("/") ? e : `${e}/`;
|
|
212
|
-
}
|
|
213
210
|
function Go(e) {
|
|
214
|
-
return
|
|
211
|
+
return e.endsWith("/") ? e : `${e}/`;
|
|
215
212
|
}
|
|
216
213
|
function $o(e) {
|
|
214
|
+
return Math.min(Fo, Math.max(Bo, e));
|
|
215
|
+
}
|
|
216
|
+
function qo(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
219
|
+
const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-connect", Yo = "product-agent:sdk-preview-socket-send", Xo = "product-agent:sdk-preview-socket-close", Zo = "product-agent:sdk-preview-socket-open", Jo = "product-agent:sdk-preview-socket-message", Qo = "product-agent:sdk-preview-socket-error", ei = "product-agent:sdk-preview-socket-closed", rn = "product-agent:sdk-preview-socket-id", ti = "data-pluno-sdk-preview-channel", ni = "product-agent:preview-diagnostic", Un = "pluno.productAgent.sharePromptsDisabled", oi = 3, ln = 'dialog[open], [aria-modal="true"], [role="dialog"]', ii = 400, ai = 5e3, ri = 500, pn = "Close the page's popup to chat", li = "No recent chats for this page yet.", Q = {
|
|
220
220
|
launcherLabel: "Ask for anything...",
|
|
221
221
|
accentColor: "#7c3aed",
|
|
222
222
|
colorScheme: "light",
|
|
@@ -224,7 +224,7 @@ const zn = 100, qo = 1e4, jo = "product-agent:sdk-preview-socket-connect", Vo =
|
|
|
224
224
|
scribbleStyle: !1,
|
|
225
225
|
position: "bottom-right",
|
|
226
226
|
movableLauncher: !1
|
|
227
|
-
},
|
|
227
|
+
}, pi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', sn = "pluno-pa-scribble-font", Bn = 190, Fn = 41, dn = 22, si = 16, di = 24, ci = 1, ui = 48, gi = 420, hi = 520, mi = 0.24, fi = 680, wi = 800, bi = 0.76, W = 8, Pt = 50, Hn = "http://www.w3.org/2000/svg", cn = 26, un = 8, _i = 36, gn = [
|
|
228
228
|
{
|
|
229
229
|
ellipseCx: "17.5",
|
|
230
230
|
ellipseCy: "24.5",
|
|
@@ -261,12 +261,12 @@ const zn = 100, qo = 1e4, jo = "product-agent:sdk-preview-socket-connect", Vo =
|
|
|
261
261
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
262
262
|
pathStrokeWidth: "2.45"
|
|
263
263
|
}
|
|
264
|
-
],
|
|
265
|
-
let
|
|
266
|
-
function
|
|
264
|
+
], xi = 11, yi = 13, hn = 4, vi = 10, Ci = 40, Si = "movable-launcher-position-v2", Wn = "pluno-pa-widget-styles", Gn = "data-pluno-pa-widget-styles";
|
|
265
|
+
let mn = 0;
|
|
266
|
+
function Ei(e) {
|
|
267
267
|
return (t) => new re(t, e);
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function ki(e = {}) {
|
|
270
270
|
const t = {
|
|
271
271
|
launcherLabel: e.launcherLabel ?? Q.launcherLabel,
|
|
272
272
|
accentColor: e.accentColor ?? Q.accentColor,
|
|
@@ -325,23 +325,23 @@ async function Si(e = {}) {
|
|
|
325
325
|
);
|
|
326
326
|
const o = document.createElement("div");
|
|
327
327
|
o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
|
|
328
|
-
|
|
328
|
+
ti,
|
|
329
329
|
t.sdkPreviewChannelId
|
|
330
330
|
);
|
|
331
331
|
const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
332
332
|
i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
333
|
-
let r =
|
|
333
|
+
let r = fn(
|
|
334
334
|
t.accentColor,
|
|
335
335
|
t.scribbleStyle
|
|
336
336
|
);
|
|
337
|
-
|
|
337
|
+
Ki(
|
|
338
338
|
i,
|
|
339
339
|
t.launcherLabel,
|
|
340
340
|
r,
|
|
341
341
|
t.movableLauncher,
|
|
342
342
|
t.showLauncherMinimizeButton
|
|
343
343
|
), n.appendChild(i);
|
|
344
|
-
const l =
|
|
344
|
+
const l = $a(t);
|
|
345
345
|
let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null;
|
|
346
346
|
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), xe(
|
|
347
347
|
i,
|
|
@@ -350,13 +350,13 @@ async function Si(e = {}) {
|
|
|
350
350
|
p,
|
|
351
351
|
t.position
|
|
352
352
|
)
|
|
353
|
-
)), Nn(n, t.accentColor),
|
|
353
|
+
)), Nn(n, t.accentColor), wn(i, r, {
|
|
354
354
|
accentColor: t.accentColor,
|
|
355
355
|
colorScheme: t.colorScheme,
|
|
356
356
|
fontFamily: t.fontFamily,
|
|
357
357
|
scribbleStyle: t.scribbleStyle
|
|
358
358
|
});
|
|
359
|
-
const u = await
|
|
359
|
+
const u = await Ga(), c = u.ownerDocument;
|
|
360
360
|
u.appendChild(o), K(
|
|
361
361
|
"web-sdk.widget",
|
|
362
362
|
"Applied initial widget appearance",
|
|
@@ -373,7 +373,7 @@ async function Si(e = {}) {
|
|
|
373
373
|
".pluno-pa-widget__launcher-drag-handle"
|
|
374
374
|
), w = i.querySelector(
|
|
375
375
|
".pluno-pa-widget__launcher-input"
|
|
376
|
-
),
|
|
376
|
+
), H = i.querySelector(
|
|
377
377
|
".pluno-pa-widget__launcher-minimize"
|
|
378
378
|
), k = i.querySelector(".pluno-pa-widget__panel"), y = i.querySelector(
|
|
379
379
|
".pluno-pa-widget__close"
|
|
@@ -381,7 +381,7 @@ async function Si(e = {}) {
|
|
|
381
381
|
".pluno-pa-widget__composer"
|
|
382
382
|
), h = i.querySelector(
|
|
383
383
|
".pluno-pa-widget__attachment-error"
|
|
384
|
-
),
|
|
384
|
+
), N = i.querySelector(
|
|
385
385
|
".pluno-pa-widget__billing-status"
|
|
386
386
|
), D = i.querySelector(
|
|
387
387
|
".pluno-pa-widget__attachments"
|
|
@@ -413,32 +413,32 @@ async function Si(e = {}) {
|
|
|
413
413
|
".pluno-pa-widget__timeline"
|
|
414
414
|
), $ = i.querySelector(
|
|
415
415
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
416
|
-
), N = i.querySelector(
|
|
417
|
-
".pluno-pa-widget__notify-suggestion"
|
|
418
416
|
), A = i.querySelector(
|
|
417
|
+
".pluno-pa-widget__notify-suggestion"
|
|
418
|
+
), T = i.querySelector(
|
|
419
419
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
420
420
|
), ge = i.querySelector(
|
|
421
421
|
".pluno-pa-widget__notify-suggestion-later"
|
|
422
|
-
),
|
|
422
|
+
), ao = i.querySelector(
|
|
423
423
|
".pluno-pa-widget__notify-suggestion-never"
|
|
424
424
|
);
|
|
425
|
-
if (!g || !w || !k || !y || !v || !h || !
|
|
425
|
+
if (!g || !w || !k || !y || !v || !h || !N || !D || !L || !Pe || !f || !R || !ce || !ue || !ye || !G || !$e || !Y || !x || !z || !I || !$)
|
|
426
426
|
throw new Error("Failed to mount Pluno widget");
|
|
427
427
|
if (t.movableLauncher && !S)
|
|
428
428
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
429
|
-
|
|
430
|
-
let
|
|
429
|
+
vn(w), vn(f);
|
|
430
|
+
let B = [], ie = null;
|
|
431
431
|
const ve = () => {
|
|
432
|
-
|
|
432
|
+
ga(
|
|
433
433
|
D,
|
|
434
|
-
|
|
434
|
+
B,
|
|
435
435
|
(a) => {
|
|
436
|
-
|
|
436
|
+
B = B.filter(
|
|
437
437
|
(s, _) => _ !== a
|
|
438
|
-
), ve(),
|
|
438
|
+
), ve(), F(b.getState()), q();
|
|
439
439
|
}
|
|
440
440
|
);
|
|
441
|
-
},
|
|
441
|
+
}, ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
442
442
|
if (!t.tokenEndpoint)
|
|
443
443
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
444
444
|
const a = await fetch(t.tokenEndpoint, {
|
|
@@ -456,11 +456,11 @@ async function Si(e = {}) {
|
|
|
456
456
|
if (!s.token)
|
|
457
457
|
throw new Error("Pluno token endpoint did not return a token");
|
|
458
458
|
return s.token;
|
|
459
|
-
}),
|
|
459
|
+
}), lo = window.fetch.bind(window);
|
|
460
460
|
let b;
|
|
461
|
-
b = await
|
|
461
|
+
b = await So.init({
|
|
462
462
|
token: t.token,
|
|
463
|
-
tokenProvider:
|
|
463
|
+
tokenProvider: ro,
|
|
464
464
|
backendUrl: t.backendUrl,
|
|
465
465
|
metadata: () => ({
|
|
466
466
|
...t.metadata ?? {},
|
|
@@ -477,18 +477,18 @@ async function Si(e = {}) {
|
|
|
477
477
|
const lt = new Set(l.openToolGroupKeys), Ce = new Set(
|
|
478
478
|
l.seenShareCandidateIds
|
|
479
479
|
), qe = new Set(Ce);
|
|
480
|
-
let pt = l.sharePromptsDisabled || await
|
|
480
|
+
let pt = l.sharePromptsDisabled || await qa(t), V = null, Se = !1, he = !1, me = {
|
|
481
481
|
enabled: !0
|
|
482
482
|
}, fe = 0, Ft = "", le = !1, ae = !1, pe = [], st = null, De = null;
|
|
483
483
|
const X = (a, s) => {
|
|
484
484
|
me = { enabled: a, reason: s };
|
|
485
485
|
}, Z = () => {
|
|
486
486
|
x.hidden = !0;
|
|
487
|
-
},
|
|
487
|
+
}, po = () => {
|
|
488
488
|
x.hidden = !1;
|
|
489
|
-
},
|
|
489
|
+
}, so = (a = "jump") => {
|
|
490
490
|
X(!0, a), Z(), We(I, () => me.enabled), fe = I.scrollTop;
|
|
491
|
-
},
|
|
491
|
+
}, we = () => {
|
|
492
492
|
if (ue.hidden = t.loginRequired, ye.hidden = !le, ue.setAttribute("aria-expanded", String(le)), G.classList.toggle(
|
|
493
493
|
"pluno-pa-widget__history-list--center",
|
|
494
494
|
ae && pe.length === 0
|
|
@@ -500,15 +500,15 @@ async function Si(e = {}) {
|
|
|
500
500
|
const s = document.createElement("button");
|
|
501
501
|
s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ae;
|
|
502
502
|
const _ = document.createElement("span");
|
|
503
|
-
_.className = "pluno-pa-widget__history-item-title", _.textContent =
|
|
503
|
+
_.className = "pluno-pa-widget__history-item-title", _.textContent = qi(a);
|
|
504
504
|
const E = document.createElement("time");
|
|
505
|
-
E.className = "pluno-pa-widget__history-time", E.dateTime = a.lastActiveAt, E.textContent =
|
|
505
|
+
E.className = "pluno-pa-widget__history-time", E.dateTime = a.lastActiveAt, E.textContent = Vi(
|
|
506
506
|
a.lastActiveAt,
|
|
507
507
|
Date.now()
|
|
508
508
|
);
|
|
509
509
|
const P = document.createElement("small");
|
|
510
|
-
P.className = "pluno-pa-widget__history-path", P.textContent =
|
|
511
|
-
le = !1, De = null,
|
|
510
|
+
P.className = "pluno-pa-widget__history-path", P.textContent = ji(a), s.append(_, E, P), s.addEventListener("click", () => {
|
|
511
|
+
le = !1, De = null, we(), X(!0, "newSession"), Z(), b.loadSession(a.id), F(b.getState());
|
|
512
512
|
}), G.appendChild(s);
|
|
513
513
|
}
|
|
514
514
|
if (ae && pe.length > 0) {
|
|
@@ -518,7 +518,7 @@ async function Si(e = {}) {
|
|
|
518
518
|
Y.textContent = De ?? (!ae && pe.length === 0 ? "No recent chats for this page yet." : ""), Y.hidden = Y.textContent.length === 0;
|
|
519
519
|
}, Ht = async (a) => {
|
|
520
520
|
if (!ae) {
|
|
521
|
-
ae = !0, De = null,
|
|
521
|
+
ae = !0, De = null, we();
|
|
522
522
|
try {
|
|
523
523
|
const s = await b.listSessions({ cursor: a, limit: 20 });
|
|
524
524
|
pe = a ? [...pe, ...s.sessions] : s.sessions, st = s.nextCursor;
|
|
@@ -529,16 +529,16 @@ async function Si(e = {}) {
|
|
|
529
529
|
{
|
|
530
530
|
message: s instanceof Error ? s.message : String(s)
|
|
531
531
|
}
|
|
532
|
-
), De =
|
|
532
|
+
), De = li;
|
|
533
533
|
} finally {
|
|
534
|
-
ae = !1,
|
|
534
|
+
ae = !1, we();
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
}, so = () => {
|
|
538
|
-
!st || ae || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && Ht(st);
|
|
539
537
|
}, co = () => {
|
|
538
|
+
!st || ae || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && Ht(st);
|
|
539
|
+
}, uo = () => {
|
|
540
540
|
Se || typeof document > "u" || (Nn(n, t.accentColor), o.isConnected || c.body?.appendChild(o));
|
|
541
|
-
}, Wt = new MutationObserver(
|
|
541
|
+
}, Wt = new MutationObserver(uo);
|
|
542
542
|
Wt.observe(c.documentElement, {
|
|
543
543
|
childList: !0,
|
|
544
544
|
subtree: !0
|
|
@@ -547,21 +547,24 @@ async function Si(e = {}) {
|
|
|
547
547
|
const s = it(i, a);
|
|
548
548
|
return Dt(
|
|
549
549
|
i,
|
|
550
|
-
p ?
|
|
550
|
+
p ? qn(p, s) : Pi(
|
|
551
551
|
i,
|
|
552
552
|
t.position,
|
|
553
553
|
s
|
|
554
554
|
),
|
|
555
555
|
s
|
|
556
556
|
);
|
|
557
|
-
},
|
|
558
|
-
|
|
557
|
+
}, O = () => {
|
|
558
|
+
const a = Fi(n, w, f);
|
|
559
|
+
Va(t, {
|
|
559
560
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
560
561
|
composerValue: f.value,
|
|
562
|
+
focusedInput: a,
|
|
563
|
+
focusedInputAt: a ? Date.now() : null,
|
|
561
564
|
openToolGroupKeys: [...lt],
|
|
562
565
|
launcherPosition: d ? p : null,
|
|
563
566
|
seenShareCandidateIds: [...Ce].slice(
|
|
564
|
-
-
|
|
567
|
+
-On
|
|
565
568
|
),
|
|
566
569
|
sharePromptsDisabled: pt
|
|
567
570
|
});
|
|
@@ -579,10 +582,10 @@ async function Si(e = {}) {
|
|
|
579
582
|
p,
|
|
580
583
|
t.position
|
|
581
584
|
)
|
|
582
|
-
),
|
|
583
|
-
},
|
|
584
|
-
|
|
585
|
-
debugVersion:
|
|
585
|
+
), _n(i), O(), s && je("minimized");
|
|
586
|
+
}, be = (a, s = {}) => {
|
|
587
|
+
Bi(a, {
|
|
588
|
+
debugVersion: Si,
|
|
586
589
|
launcherPosition: p,
|
|
587
590
|
rootClasses: i.className,
|
|
588
591
|
rootStyle: {
|
|
@@ -603,15 +606,15 @@ async function Si(e = {}) {
|
|
|
603
606
|
if (!p)
|
|
604
607
|
return xe(i, null), dt(a);
|
|
605
608
|
const s = dt(a);
|
|
606
|
-
return xe(i, s),
|
|
609
|
+
return xe(i, s), be("Applied stored closed launcher position", {
|
|
607
610
|
visibleLauncherPosition: s
|
|
608
611
|
}), s;
|
|
609
612
|
}, Gt = (a, s) => {
|
|
610
613
|
if (!a || !s) {
|
|
611
|
-
|
|
614
|
+
_n(i);
|
|
612
615
|
return;
|
|
613
616
|
}
|
|
614
|
-
|
|
617
|
+
Ui(i, {
|
|
615
618
|
x: a.x - s.x,
|
|
616
619
|
y: a.y - s.y
|
|
617
620
|
});
|
|
@@ -634,18 +637,18 @@ async function Si(e = {}) {
|
|
|
634
637
|
a,
|
|
635
638
|
t.position
|
|
636
639
|
);
|
|
637
|
-
Gt(s, a),
|
|
640
|
+
Gt(s, a), be(
|
|
638
641
|
"Applied open panel position after viewport resize",
|
|
639
642
|
{ openPanelPosition: s }
|
|
640
643
|
);
|
|
641
|
-
} else p &&
|
|
644
|
+
} else p && be(
|
|
642
645
|
"Applied visible launcher position after viewport resize",
|
|
643
646
|
{ visibleLauncherPosition: a }
|
|
644
647
|
);
|
|
645
648
|
};
|
|
646
649
|
let qt = () => {
|
|
647
650
|
};
|
|
648
|
-
window.addEventListener("resize", $t), t.movableLauncher && S ? (Me(), qt =
|
|
651
|
+
window.addEventListener("resize", $t), t.movableLauncher && S ? (Me(), qt = Ti({
|
|
649
652
|
root: i,
|
|
650
653
|
launcher: g,
|
|
651
654
|
launcherDragHandle: S,
|
|
@@ -656,15 +659,15 @@ async function Si(e = {}) {
|
|
|
656
659
|
a,
|
|
657
660
|
_
|
|
658
661
|
);
|
|
659
|
-
p =
|
|
662
|
+
p = Ri(
|
|
660
663
|
E,
|
|
661
664
|
_
|
|
662
|
-
), xe(i, E),
|
|
665
|
+
), xe(i, E), be("Dragging closed launcher", {
|
|
663
666
|
requestedPosition: s
|
|
664
667
|
});
|
|
665
668
|
},
|
|
666
669
|
persist: () => {
|
|
667
|
-
d = !0,
|
|
670
|
+
d = !0, O(), be("Persisted closed launcher drag position");
|
|
668
671
|
}
|
|
669
672
|
})) : xe(i, null);
|
|
670
673
|
let ct = !1;
|
|
@@ -673,12 +676,12 @@ async function Si(e = {}) {
|
|
|
673
676
|
ct = !0;
|
|
674
677
|
try {
|
|
675
678
|
const a = await t.billingStatusLoader();
|
|
676
|
-
|
|
679
|
+
Sn(
|
|
677
680
|
t.billingStatus,
|
|
678
681
|
a,
|
|
679
682
|
b.getState().lastErrorCode
|
|
680
683
|
) && (t.billingStatus = a, Lt(
|
|
681
|
-
|
|
684
|
+
N,
|
|
682
685
|
t.billingStatus,
|
|
683
686
|
b.getState().lastErrorCode
|
|
684
687
|
), q());
|
|
@@ -693,20 +696,20 @@ async function Si(e = {}) {
|
|
|
693
696
|
_,
|
|
694
697
|
t.position
|
|
695
698
|
);
|
|
696
|
-
if (Gt(E, _),
|
|
699
|
+
if (Gt(E, _), be("Opening launcher at clamped open panel position", {
|
|
697
700
|
openPanelPosition: E,
|
|
698
701
|
visibleLauncherPosition: _
|
|
699
702
|
}), X(!0, "open"), Z(), !s) {
|
|
700
|
-
i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length),
|
|
703
|
+
i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0);
|
|
701
704
|
return;
|
|
702
705
|
}
|
|
703
706
|
window.requestAnimationFrame(() => {
|
|
704
|
-
i.classList.add("pluno-pa-widget--open"), a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length),
|
|
707
|
+
i.classList.add("pluno-pa-widget--open"), a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
|
|
705
708
|
g.hidden = !0, We(I, () => me.enabled), fe = I.scrollTop;
|
|
706
709
|
}, 220);
|
|
707
710
|
});
|
|
708
|
-
},
|
|
709
|
-
V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1),
|
|
711
|
+
}, go = () => {
|
|
712
|
+
V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1), be("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), O(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
|
|
710
713
|
k.hidden = !0, y.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
|
|
711
714
|
}, 220);
|
|
712
715
|
};
|
|
@@ -725,20 +728,20 @@ async function Si(e = {}) {
|
|
|
725
728
|
se(a), w.value = "";
|
|
726
729
|
});
|
|
727
730
|
let ut = null, Ve = null, _e = null;
|
|
728
|
-
const Vt = (a) => a === w || a === f,
|
|
731
|
+
const Vt = (a) => a === w || a === f, ho = (a) => {
|
|
729
732
|
if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
|
|
730
733
|
return null;
|
|
731
734
|
let s = a;
|
|
732
735
|
for (; s; ) {
|
|
733
|
-
const _ = s.closest(
|
|
736
|
+
const _ = s.closest(ln);
|
|
734
737
|
if (_)
|
|
735
738
|
return _;
|
|
736
739
|
const E = s.getRootNode();
|
|
737
740
|
s = E instanceof ShadowRoot ? E.host : null;
|
|
738
741
|
}
|
|
739
742
|
return null;
|
|
740
|
-
},
|
|
741
|
-
if (!a.isConnected || !a.matches(
|
|
743
|
+
}, mo = (a) => {
|
|
744
|
+
if (!a.isConnected || !a.matches(ln))
|
|
742
745
|
return !1;
|
|
743
746
|
if (!(a instanceof HTMLElement))
|
|
744
747
|
return !0;
|
|
@@ -751,38 +754,38 @@ async function Si(e = {}) {
|
|
|
751
754
|
}, Kt = (a) => {
|
|
752
755
|
ze !== a && (ze = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ye(), a !== null ? _e = window.setInterval(() => {
|
|
753
756
|
const s = ze;
|
|
754
|
-
(!s || !
|
|
755
|
-
},
|
|
756
|
-
},
|
|
757
|
+
(!s || !mo(s)) && Kt(null);
|
|
758
|
+
}, ri) : _e !== null && (window.clearInterval(_e), _e = null, Ve = null));
|
|
759
|
+
}, fo = () => {
|
|
757
760
|
_e !== null && (window.clearInterval(_e), _e = null);
|
|
758
761
|
};
|
|
759
762
|
i.addEventListener("focusin", (a) => {
|
|
760
|
-
Vt(a.target) && (ut = Date.now());
|
|
763
|
+
Vt(a.target) && (ut = Date.now(), O());
|
|
761
764
|
}), i.addEventListener("focusout", (a) => {
|
|
762
765
|
if (!Vt(a.target) || ze !== null)
|
|
763
766
|
return;
|
|
764
767
|
const s = ut;
|
|
765
|
-
if (ut = null, s === null || Date.now() - s >
|
|
768
|
+
if (ut = null, s === null || Date.now() - s > ii)
|
|
766
769
|
return;
|
|
767
|
-
const _ =
|
|
770
|
+
const _ = ho(a.relatedTarget);
|
|
768
771
|
if (!_)
|
|
769
772
|
return;
|
|
770
773
|
const E = Date.now();
|
|
771
|
-
if (Ve !== null && E - Ve <=
|
|
774
|
+
if (Ve !== null && E - Ve <= ai) {
|
|
772
775
|
Kt(_);
|
|
773
776
|
return;
|
|
774
777
|
}
|
|
775
778
|
Ve = E;
|
|
776
779
|
}), g.addEventListener("keydown", (a) => {
|
|
777
780
|
!i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), se());
|
|
778
|
-
}),
|
|
781
|
+
}), H?.addEventListener("pointerdown", (a) => {
|
|
779
782
|
a.stopPropagation();
|
|
780
|
-
}),
|
|
783
|
+
}), H?.addEventListener("click", (a) => {
|
|
781
784
|
a.preventDefault(), a.stopPropagation(), Re("minimized");
|
|
782
|
-
}), y.addEventListener("click",
|
|
785
|
+
}), y.addEventListener("click", go), I.addEventListener("scroll", () => {
|
|
783
786
|
I.scrollTop < fe - 1 && X(!1, "userScroll"), fe = I.scrollTop;
|
|
784
787
|
}), x.addEventListener("click", () => {
|
|
785
|
-
|
|
788
|
+
so();
|
|
786
789
|
});
|
|
787
790
|
const Yt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
788
791
|
([a]) => {
|
|
@@ -795,9 +798,9 @@ async function Si(e = {}) {
|
|
|
795
798
|
let ze = null, Oe = !1;
|
|
796
799
|
const Ye = () => {
|
|
797
800
|
const a = Ke(), s = ze !== null;
|
|
798
|
-
w.readOnly = a || s, f.readOnly = s, w.placeholder = s ?
|
|
801
|
+
w.readOnly = a || s, f.readOnly = s, w.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Oe ? "New update" : t.launcherLabel, f.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = a;
|
|
799
802
|
}, q = () => {
|
|
800
|
-
R.disabled = te(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 &&
|
|
803
|
+
R.disabled = te(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && B.length === 0, Pe.disabled = Ke() || te(t.billingStatus);
|
|
801
804
|
};
|
|
802
805
|
Ye();
|
|
803
806
|
const gt = () => {
|
|
@@ -816,14 +819,14 @@ async function Si(e = {}) {
|
|
|
816
819
|
t.onSignupClick?.();
|
|
817
820
|
return;
|
|
818
821
|
}
|
|
819
|
-
te(t.billingStatus) || (he = !0, X(!0, "send"), Z(),
|
|
822
|
+
te(t.billingStatus) || (he = !0, X(!0, "send"), Z(), B = Et(
|
|
820
823
|
b,
|
|
821
824
|
f,
|
|
822
|
-
|
|
825
|
+
B
|
|
823
826
|
), ve(), q());
|
|
824
827
|
});
|
|
825
828
|
let Ue = 0;
|
|
826
|
-
const
|
|
829
|
+
const wo = () => {
|
|
827
830
|
Ue = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
828
831
|
}, ht = (a) => {
|
|
829
832
|
ie !== null && window.clearTimeout(ie), h.textContent = a, h.hidden = !1, ie = window.setTimeout(() => {
|
|
@@ -834,8 +837,8 @@ async function Si(e = {}) {
|
|
|
834
837
|
}, mt = async (a) => {
|
|
835
838
|
if (a.length === 0)
|
|
836
839
|
return;
|
|
837
|
-
const s =
|
|
838
|
-
|
|
840
|
+
const s = fa(b, a);
|
|
841
|
+
B = [...B, ...s], ve(), bo(), q(), F(b.getState()), i.classList.contains("pluno-pa-widget--open") || se();
|
|
839
842
|
};
|
|
840
843
|
Pe.addEventListener("click", () => {
|
|
841
844
|
t.loginRequired || te(t.billingStatus) || L.click();
|
|
@@ -857,7 +860,7 @@ async function Si(e = {}) {
|
|
|
857
860
|
Qe(a.dataTransfer) && (a.stopPropagation(), Ue = Math.max(0, Ue - 1), Ue === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
858
861
|
}), i.addEventListener("drop", (a) => {
|
|
859
862
|
const s = a.dataTransfer;
|
|
860
|
-
!Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(),
|
|
863
|
+
!Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), wo(), mt(s.files).catch((_) => {
|
|
861
864
|
ht(
|
|
862
865
|
_ instanceof Error ? _.message : "Failed to attach file"
|
|
863
866
|
), K("web-sdk.widget", "Attachment failed", {
|
|
@@ -882,32 +885,32 @@ async function Si(e = {}) {
|
|
|
882
885
|
b.stop();
|
|
883
886
|
return;
|
|
884
887
|
}
|
|
885
|
-
he = !0, X(!0, "send"), Z(),
|
|
888
|
+
he = !0, X(!0, "send"), Z(), B = Et(
|
|
886
889
|
b,
|
|
887
890
|
f,
|
|
888
|
-
|
|
889
|
-
), ve(), q(),
|
|
891
|
+
B
|
|
892
|
+
), ve(), q(), F(b.getState());
|
|
890
893
|
}), ue.addEventListener("click", () => {
|
|
891
|
-
le = !le, De = null,
|
|
894
|
+
le = !le, De = null, we(), le && pe.length === 0 && Ht(null);
|
|
892
895
|
}), $e.addEventListener("click", () => {
|
|
893
|
-
le = !1,
|
|
894
|
-
}), G.addEventListener("scroll",
|
|
895
|
-
He(f),
|
|
896
|
+
le = !1, we();
|
|
897
|
+
}), G.addEventListener("scroll", co), f.addEventListener("input", () => {
|
|
898
|
+
He(f), O(), q(), yo();
|
|
896
899
|
}), f.addEventListener("keydown", (a) => {
|
|
897
900
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
898
901
|
if (a.preventDefault(), t.loginRequired) {
|
|
899
902
|
t.onLoginClick?.();
|
|
900
903
|
return;
|
|
901
904
|
}
|
|
902
|
-
he = !0, X(!0, "send"), Z(),
|
|
905
|
+
he = !0, X(!0, "send"), Z(), B = Et(
|
|
903
906
|
b,
|
|
904
907
|
f,
|
|
905
|
-
|
|
906
|
-
), ve(), q(),
|
|
908
|
+
B
|
|
909
|
+
), ve(), q(), F(b.getState());
|
|
907
910
|
}
|
|
908
911
|
}), i.addEventListener("click", (a) => {
|
|
909
|
-
(a.target instanceof Element ? a.target : null)?.closest("a[href]") &&
|
|
910
|
-
}), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1);
|
|
912
|
+
(a.target instanceof Element ? a.target : null)?.closest("a[href]") && O();
|
|
913
|
+
}), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1), Hi(l, i, w, f);
|
|
911
914
|
const Xe = () => r;
|
|
912
915
|
let ft = b.getState().appearance !== null, Ze = null, Be = null, Ee = null, Xt = b.getState().isThinking, ke = null;
|
|
913
916
|
const Fe = t.taskNotifications;
|
|
@@ -915,9 +918,9 @@ async function Si(e = {}) {
|
|
|
915
918
|
const Zt = () => {
|
|
916
919
|
Le !== null && (window.clearTimeout(Le), Le = null);
|
|
917
920
|
}, Je = () => {
|
|
918
|
-
|
|
919
|
-
},
|
|
920
|
-
if (!Fe || !
|
|
921
|
+
A && (A.hidden = !0);
|
|
922
|
+
}, Jt = () => b.getState().assistantDraft.trim().length > 0, _o = async () => {
|
|
923
|
+
if (!Fe || !A || Ie || Se || !b.getState().isThinking || Jt())
|
|
921
924
|
return;
|
|
922
925
|
let a;
|
|
923
926
|
try {
|
|
@@ -925,44 +928,44 @@ async function Si(e = {}) {
|
|
|
925
928
|
} catch {
|
|
926
929
|
return;
|
|
927
930
|
}
|
|
928
|
-
a.enabled || a.neverSuggest || !b.getState().isThinking || Ie || Se || (
|
|
931
|
+
a.enabled || a.neverSuggest || !b.getState().isThinking || Jt() || Ie || Se || (A.hidden = !1);
|
|
929
932
|
};
|
|
930
|
-
|
|
933
|
+
T?.addEventListener("click", () => {
|
|
931
934
|
Ie = !0, Je(), Fe?.enable().catch(() => {
|
|
932
935
|
});
|
|
933
936
|
}), ge?.addEventListener("click", () => {
|
|
934
937
|
Ie = !0, Je();
|
|
935
|
-
}),
|
|
938
|
+
}), ao?.addEventListener("click", () => {
|
|
936
939
|
Ie = !0, Je(), Fe?.dismissForever().catch(() => {
|
|
937
940
|
});
|
|
938
941
|
});
|
|
939
|
-
let
|
|
942
|
+
let Ae = null, Qt = () => {
|
|
940
943
|
};
|
|
941
|
-
const
|
|
942
|
-
const a =
|
|
943
|
-
z.hidden = !a, a &&
|
|
944
|
+
const xo = !!t.socialPostDraftHandler, wt = /* @__PURE__ */ new Map(), bt = () => f.value.trim().length > 0 || B.length > 0, yo = () => {
|
|
945
|
+
const a = Ae !== null && It(b.getState(), bt());
|
|
946
|
+
z.hidden = !a, a && Ae !== null && Vn(z, Ae);
|
|
944
947
|
};
|
|
945
|
-
let
|
|
946
|
-
const
|
|
947
|
-
he = !0, X(!0, "newSession"), Z(), le = !1,
|
|
948
|
+
let Ne = null;
|
|
949
|
+
const vo = () => {
|
|
950
|
+
he = !0, X(!0, "newSession"), Z(), le = !1, we(), b.startNewSession(), lt.clear(), f.value = "", B = [], ve(), He(f), O(), q(), f.focus(), F(b.getState());
|
|
948
951
|
}, _t = (a) => {
|
|
949
952
|
if (!a) {
|
|
950
|
-
|
|
953
|
+
Ne?.remove(), Ne = null;
|
|
951
954
|
return;
|
|
952
955
|
}
|
|
953
|
-
|
|
956
|
+
Ne || (Ne = rt(
|
|
954
957
|
"pluno-pa-widget__new-chat",
|
|
955
958
|
"New chat",
|
|
956
|
-
|
|
959
|
+
aa(),
|
|
957
960
|
!1
|
|
958
|
-
),
|
|
959
|
-
},
|
|
960
|
-
if (
|
|
961
|
-
|
|
961
|
+
), Ne.addEventListener("click", vo), ce.insertBefore(Ne, ue));
|
|
962
|
+
}, F = (a) => {
|
|
963
|
+
if (we(), Bt(a.lastErrorCode) ? ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
|
|
964
|
+
N,
|
|
962
965
|
t.billingStatus,
|
|
963
966
|
ke
|
|
964
967
|
), t.loginRequired) {
|
|
965
|
-
|
|
968
|
+
wt.clear(), In(
|
|
966
969
|
I,
|
|
967
970
|
R,
|
|
968
971
|
_t,
|
|
@@ -975,7 +978,7 @@ async function Si(e = {}) {
|
|
|
975
978
|
return;
|
|
976
979
|
}
|
|
977
980
|
if (t.signupRequired) {
|
|
978
|
-
|
|
981
|
+
wt.clear(), In(
|
|
979
982
|
I,
|
|
980
983
|
R,
|
|
981
984
|
_t,
|
|
@@ -987,61 +990,61 @@ async function Si(e = {}) {
|
|
|
987
990
|
);
|
|
988
991
|
return;
|
|
989
992
|
}
|
|
990
|
-
const s =
|
|
993
|
+
const s = Gi(a), _ = s !== Ft;
|
|
991
994
|
Ft = s;
|
|
992
995
|
const E = he || me.enabled;
|
|
993
|
-
he = !1,
|
|
996
|
+
he = !1, Ca(
|
|
994
997
|
I,
|
|
995
998
|
$,
|
|
996
999
|
R,
|
|
997
1000
|
_t,
|
|
998
1001
|
z,
|
|
999
1002
|
a,
|
|
1000
|
-
|
|
1001
|
-
|
|
1003
|
+
Ae,
|
|
1004
|
+
Ae !== null && It(a, bt()),
|
|
1002
1005
|
E,
|
|
1003
1006
|
() => me.enabled,
|
|
1004
1007
|
lt,
|
|
1005
|
-
|
|
1006
|
-
|
|
1008
|
+
wt,
|
|
1009
|
+
O,
|
|
1007
1010
|
Xe,
|
|
1008
1011
|
(P) => {
|
|
1009
1012
|
he = !0, X(!0, "send"), Z(), b.sendMessage(P);
|
|
1010
1013
|
},
|
|
1011
|
-
|
|
1014
|
+
xo && !pt ? {
|
|
1012
1015
|
dismissedCandidateIds: qe,
|
|
1013
1016
|
draftingCandidateId: Ze,
|
|
1014
1017
|
error: Be,
|
|
1015
1018
|
characterIconOptions: Xe(),
|
|
1016
1019
|
onSeen: (P) => {
|
|
1017
|
-
Ce.add(P.id),
|
|
1020
|
+
Ce.add(P.id), O();
|
|
1018
1021
|
},
|
|
1019
1022
|
onDraft: (P) => {
|
|
1020
|
-
|
|
1023
|
+
Co(P);
|
|
1021
1024
|
},
|
|
1022
1025
|
onDismiss: (P) => {
|
|
1023
|
-
Ce.add(P.id), qe.add(P.id),
|
|
1026
|
+
Ce.add(P.id), qe.add(P.id), O(), Be = null, F(b.getState());
|
|
1024
1027
|
},
|
|
1025
1028
|
onDisable: (P) => {
|
|
1026
|
-
pt = !0, Ce.add(P.id), qe.add(P.id),
|
|
1029
|
+
pt = !0, Ce.add(P.id), qe.add(P.id), O(), ja(t, !0), Be = null, F(b.getState());
|
|
1027
1030
|
}
|
|
1028
1031
|
} : void 0
|
|
1029
|
-
), E ? (fe = I.scrollTop, Z()) : _ &&
|
|
1032
|
+
), E ? (fe = I.scrollTop, Z()) : _ && $i(a) && po();
|
|
1030
1033
|
};
|
|
1031
|
-
return
|
|
1034
|
+
return Qt = Ho(
|
|
1032
1035
|
(a) => {
|
|
1033
|
-
|
|
1036
|
+
Ae = a, !Se && It(b.getState(), bt()) && F(b.getState());
|
|
1034
1037
|
},
|
|
1035
1038
|
{
|
|
1036
1039
|
backendUrl: t.backendUrl,
|
|
1037
|
-
fetcher:
|
|
1040
|
+
fetcher: lo,
|
|
1038
1041
|
loader: t.activeUsersLoader
|
|
1039
1042
|
}
|
|
1040
1043
|
), b.on("state", (a) => {
|
|
1041
1044
|
const s = Xt && !a.isThinking;
|
|
1042
|
-
Xt = a.isThinking, a.isThinking && Fe && !Ie && Le === null &&
|
|
1043
|
-
Le = null,
|
|
1044
|
-
},
|
|
1045
|
+
Xt = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Fe && !Ie && Le === null && A?.hidden !== !1 && (Le = window.setTimeout(() => {
|
|
1046
|
+
Le = null, _o();
|
|
1047
|
+
}, jo)), (!a.isThinking || a.assistantDraft.trim()) && (Zt(), Je()), s && !i.classList.contains("pluno-pa-widget--open") && (Oe = !0), gt(), a.appearance ? (ft = !0, K(
|
|
1045
1048
|
"web-sdk.widget",
|
|
1046
1049
|
"Agent state supplied appearance",
|
|
1047
1050
|
{
|
|
@@ -1055,15 +1058,15 @@ async function Si(e = {}) {
|
|
|
1055
1058
|
fallbackColorScheme: t.colorScheme,
|
|
1056
1059
|
fallbackFontFamily: t.fontFamily
|
|
1057
1060
|
}
|
|
1058
|
-
), xt({}, "agent.state.appearance-cleared")),
|
|
1059
|
-
}),
|
|
1061
|
+
), xt({}, "agent.state.appearance-cleared")), F(a), q(), s && jt();
|
|
1062
|
+
}), F(b.getState()), q(), {
|
|
1060
1063
|
agent: b,
|
|
1061
1064
|
updateAppearance: (a) => {
|
|
1062
1065
|
a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), xt(a, "widgetHandle.updateAppearance");
|
|
1063
1066
|
},
|
|
1064
1067
|
updateBillingStatus: (a) => {
|
|
1065
1068
|
const s = a ?? null;
|
|
1066
|
-
|
|
1069
|
+
Sn(
|
|
1067
1070
|
t.billingStatus,
|
|
1068
1071
|
s,
|
|
1069
1072
|
ke
|
|
@@ -1075,7 +1078,7 @@ async function Si(e = {}) {
|
|
|
1075
1078
|
},
|
|
1076
1079
|
updateAuthGate: (a) => {
|
|
1077
1080
|
const s = Ke();
|
|
1078
|
-
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(),
|
|
1081
|
+
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), F(b.getState()), q(), s && !Ke() && b.connect().catch((_) => {
|
|
1079
1082
|
K(
|
|
1080
1083
|
"web-sdk.widget",
|
|
1081
1084
|
"Failed to connect after auth gate cleared",
|
|
@@ -1096,19 +1099,19 @@ async function Si(e = {}) {
|
|
|
1096
1099
|
Re("minimized", !1);
|
|
1097
1100
|
},
|
|
1098
1101
|
destroy: () => {
|
|
1099
|
-
Se || (Se = !0, Wt.disconnect(), Yt?.disconnect(),
|
|
1102
|
+
Se || (O(), Se = !0, Wt.disconnect(), Yt?.disconnect(), fo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Qt(), Ee?.remove(), b.destroy(), o.remove());
|
|
1100
1103
|
}
|
|
1101
1104
|
};
|
|
1102
|
-
async function
|
|
1105
|
+
async function Co(a) {
|
|
1103
1106
|
if (!Ze) {
|
|
1104
|
-
Ze = a.id, Be = null,
|
|
1107
|
+
Ze = a.id, Be = null, F(b.getState());
|
|
1105
1108
|
try {
|
|
1106
1109
|
if (!t.socialPostDraftHandler)
|
|
1107
1110
|
throw new Error("Social post drafting is not available here.");
|
|
1108
1111
|
const s = await t.socialPostDraftHandler(a);
|
|
1109
1112
|
if (!s.linkedinPost || !s.xPost)
|
|
1110
1113
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1111
|
-
Ce.add(a.id), qe.add(a.id),
|
|
1114
|
+
Ce.add(a.id), qe.add(a.id), O(), Ee?.remove(), Ee = Ta(s, {
|
|
1112
1115
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1113
1116
|
onClose: () => {
|
|
1114
1117
|
Ee?.remove(), Ee = null;
|
|
@@ -1117,16 +1120,16 @@ async function Si(e = {}) {
|
|
|
1117
1120
|
} catch (s) {
|
|
1118
1121
|
Be = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1119
1122
|
} finally {
|
|
1120
|
-
Ze = null,
|
|
1123
|
+
Ze = null, F(b.getState());
|
|
1121
1124
|
}
|
|
1122
1125
|
}
|
|
1123
1126
|
}
|
|
1124
1127
|
function xt(a, s) {
|
|
1125
1128
|
const _ = a.accentColor ?? t.accentColor, E = a.colorScheme ?? t.colorScheme, P = a.fontFamily ?? t.fontFamily, yt = a.scribbleStyle ?? t.scribbleStyle;
|
|
1126
|
-
r =
|
|
1129
|
+
r = fn(
|
|
1127
1130
|
_,
|
|
1128
1131
|
yt
|
|
1129
|
-
),
|
|
1132
|
+
), wn(i, r, {
|
|
1130
1133
|
accentColor: _,
|
|
1131
1134
|
colorScheme: E,
|
|
1132
1135
|
fontFamily: P,
|
|
@@ -1142,14 +1145,14 @@ async function Si(e = {}) {
|
|
|
1142
1145
|
});
|
|
1143
1146
|
}
|
|
1144
1147
|
}
|
|
1145
|
-
function
|
|
1148
|
+
function fn(e, t) {
|
|
1146
1149
|
return { accentColor: e, scribbleStyle: t };
|
|
1147
1150
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const t =
|
|
1150
|
-
return t === null ? "#fafafa" :
|
|
1151
|
+
function Li(e) {
|
|
1152
|
+
const t = Ii(e);
|
|
1153
|
+
return t === null ? "#fafafa" : Ai(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1151
1154
|
}
|
|
1152
|
-
function
|
|
1155
|
+
function Ii(e) {
|
|
1153
1156
|
const t = e.trim();
|
|
1154
1157
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1155
1158
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1161,14 +1164,14 @@ function ki(e) {
|
|
|
1161
1164
|
Number.parseInt(t[3] + t[3], 16)
|
|
1162
1165
|
] : null;
|
|
1163
1166
|
}
|
|
1164
|
-
function
|
|
1167
|
+
function Ai([e, t, o]) {
|
|
1165
1168
|
const n = (i) => {
|
|
1166
1169
|
const r = i / 255;
|
|
1167
1170
|
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
1168
1171
|
};
|
|
1169
1172
|
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
1170
1173
|
}
|
|
1171
|
-
function
|
|
1174
|
+
function wn(e, t, o) {
|
|
1172
1175
|
e.classList.toggle(
|
|
1173
1176
|
"pluno-pa-widget--dark",
|
|
1174
1177
|
o.colorScheme === "dark"
|
|
@@ -1176,11 +1179,11 @@ function fn(e, t, o) {
|
|
|
1176
1179
|
"pluno-pa-widget--light",
|
|
1177
1180
|
o.colorScheme !== "dark"
|
|
1178
1181
|
), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
|
|
1179
|
-
const n = o.scribbleStyle ?
|
|
1182
|
+
const n = o.scribbleStyle ? Rn(o.accentColor) : o.accentColor;
|
|
1180
1183
|
e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
|
|
1181
1184
|
"--pluno-pa-accent-contrast",
|
|
1182
|
-
|
|
1183
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ?
|
|
1185
|
+
Li(n)
|
|
1186
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? pi : o.fontFamily, o.scribbleStyle && Ni(e.ownerDocument);
|
|
1184
1187
|
const i = Array.from(
|
|
1185
1188
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1186
1189
|
);
|
|
@@ -1192,11 +1195,11 @@ function fn(e, t, o) {
|
|
|
1192
1195
|
)
|
|
1193
1196
|
);
|
|
1194
1197
|
}
|
|
1195
|
-
function
|
|
1196
|
-
if (e.getElementById(
|
|
1198
|
+
function Ni(e) {
|
|
1199
|
+
if (e.getElementById(sn))
|
|
1197
1200
|
return;
|
|
1198
1201
|
const t = e.createElement("style");
|
|
1199
|
-
t.id =
|
|
1202
|
+
t.id = sn, t.textContent = `@font-face {
|
|
1200
1203
|
font-family: "Architects Daughter";
|
|
1201
1204
|
font-style: normal;
|
|
1202
1205
|
font-weight: 400;
|
|
@@ -1204,7 +1207,7 @@ function Ii(e) {
|
|
|
1204
1207
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1205
1208
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1206
1209
|
}
|
|
1207
|
-
function
|
|
1210
|
+
function Ti({
|
|
1208
1211
|
root: e,
|
|
1209
1212
|
launcher: t,
|
|
1210
1213
|
launcherDragHandle: o,
|
|
@@ -1221,66 +1224,66 @@ function Ni({
|
|
|
1221
1224
|
if (l !== h.pointerId || !p || !d)
|
|
1222
1225
|
return;
|
|
1223
1226
|
h.preventDefault();
|
|
1224
|
-
const
|
|
1225
|
-
!u && Math.hypot(
|
|
1226
|
-
},
|
|
1227
|
+
const N = h.clientX - p.x, D = h.clientY - p.y;
|
|
1228
|
+
!u && Math.hypot(N, D) < hn || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + N, y: d.y + D }));
|
|
1229
|
+
}, H = (h) => {
|
|
1227
1230
|
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (c = { x: h.clientX, y: h.clientY }, r()), g());
|
|
1228
1231
|
}, k = (h) => {
|
|
1229
1232
|
l === h.pointerId && (h.preventDefault(), g());
|
|
1230
1233
|
}, y = (h) => {
|
|
1231
1234
|
if (!c)
|
|
1232
1235
|
return;
|
|
1233
|
-
const
|
|
1236
|
+
const N = Math.hypot(
|
|
1234
1237
|
h.clientX - c.x,
|
|
1235
1238
|
h.clientY - c.y
|
|
1236
|
-
) <=
|
|
1237
|
-
c = null,
|
|
1239
|
+
) <= hn;
|
|
1240
|
+
c = null, N && (h.preventDefault(), h.stopPropagation());
|
|
1238
1241
|
}, v = (h) => {
|
|
1239
1242
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1240
1243
|
return;
|
|
1241
|
-
const
|
|
1244
|
+
const N = h.shiftKey ? Ci : vi, D = n();
|
|
1242
1245
|
let L = null;
|
|
1243
|
-
h.key === "ArrowUp" ? L = { x: D.x, y: D.y -
|
|
1246
|
+
h.key === "ArrowUp" ? L = { x: D.x, y: D.y - N } : h.key === "ArrowDown" ? L = { x: D.x, y: D.y + N } : h.key === "ArrowLeft" ? L = { x: D.x - N, y: D.y } : h.key === "ArrowRight" && (L = { x: D.x + N, y: D.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
|
|
1244
1247
|
};
|
|
1245
|
-
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", w), t.addEventListener("pointerup",
|
|
1246
|
-
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", w), t.removeEventListener("pointerup",
|
|
1248
|
+
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", w), t.addEventListener("pointerup", H), t.addEventListener("pointercancel", k), t.addEventListener("click", y, !0), o.addEventListener("keydown", v), () => {
|
|
1249
|
+
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", w), t.removeEventListener("pointerup", H), t.removeEventListener("pointercancel", k), t.removeEventListener("click", y, !0), o.removeEventListener("keydown", v);
|
|
1247
1250
|
};
|
|
1248
1251
|
}
|
|
1249
1252
|
function it(e, t = !0) {
|
|
1250
1253
|
const o = ne();
|
|
1251
1254
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1252
1255
|
return e.classList.contains("pluno-pa-widget--scribble") ? {
|
|
1253
|
-
width:
|
|
1254
|
-
height:
|
|
1255
|
-
} : { width:
|
|
1256
|
+
width: si,
|
|
1257
|
+
height: di
|
|
1258
|
+
} : { width: dn, height: dn };
|
|
1256
1259
|
const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1257
1260
|
return {
|
|
1258
|
-
width: t && i && n.width > 0 ? n.width : Math.min(
|
|
1259
|
-
height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1261
|
+
width: t && i && n.width > 0 ? n.width : Math.min(Bn, o.width - 36),
|
|
1262
|
+
height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? ui : Fn
|
|
1260
1263
|
};
|
|
1261
1264
|
}
|
|
1262
|
-
function
|
|
1265
|
+
function $n() {
|
|
1263
1266
|
const e = ne();
|
|
1264
1267
|
return {
|
|
1265
1268
|
width: Math.min(
|
|
1266
|
-
|
|
1267
|
-
e.width *
|
|
1268
|
-
|
|
1269
|
-
|
|
1269
|
+
Te(
|
|
1270
|
+
e.width * mi,
|
|
1271
|
+
gi,
|
|
1272
|
+
hi
|
|
1270
1273
|
),
|
|
1271
1274
|
e.width - W * 2
|
|
1272
1275
|
),
|
|
1273
1276
|
height: Math.min(
|
|
1274
|
-
|
|
1275
|
-
e.height *
|
|
1276
|
-
|
|
1277
|
-
|
|
1277
|
+
Te(
|
|
1278
|
+
e.height * bi,
|
|
1279
|
+
fi,
|
|
1280
|
+
wi
|
|
1278
1281
|
),
|
|
1279
1282
|
e.height - Pt - W
|
|
1280
1283
|
)
|
|
1281
1284
|
};
|
|
1282
1285
|
}
|
|
1283
|
-
function
|
|
1286
|
+
function Pi(e, t, o) {
|
|
1284
1287
|
const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1285
1288
|
if (Number.isFinite(n) && Number.isFinite(i))
|
|
1286
1289
|
return { x: n, y: i };
|
|
@@ -1297,11 +1300,11 @@ function Ct(e, t, o) {
|
|
|
1297
1300
|
const n = it(e, !1);
|
|
1298
1301
|
return t ? Dt(
|
|
1299
1302
|
e,
|
|
1300
|
-
|
|
1303
|
+
qn(t, n),
|
|
1301
1304
|
n
|
|
1302
|
-
) :
|
|
1305
|
+
) : Di(o === "bottom-left" ? "bottom-left" : "bottom-right", n, ci);
|
|
1303
1306
|
}
|
|
1304
|
-
function
|
|
1307
|
+
function Di(e, t, o) {
|
|
1305
1308
|
const n = ne();
|
|
1306
1309
|
return {
|
|
1307
1310
|
x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
|
|
@@ -1309,9 +1312,9 @@ function Ai(e, t, o) {
|
|
|
1309
1312
|
};
|
|
1310
1313
|
}
|
|
1311
1314
|
function Dt(e, t, o) {
|
|
1312
|
-
const n = ne(), i = W +
|
|
1315
|
+
const n = ne(), i = W + zi(e);
|
|
1313
1316
|
return {
|
|
1314
|
-
x:
|
|
1317
|
+
x: Te(
|
|
1315
1318
|
t.x,
|
|
1316
1319
|
W,
|
|
1317
1320
|
Math.max(
|
|
@@ -1319,7 +1322,7 @@ function Dt(e, t, o) {
|
|
|
1319
1322
|
n.width - o.width - W
|
|
1320
1323
|
)
|
|
1321
1324
|
),
|
|
1322
|
-
y:
|
|
1325
|
+
y: Te(
|
|
1323
1326
|
t.y,
|
|
1324
1327
|
i,
|
|
1325
1328
|
Math.max(
|
|
@@ -1329,39 +1332,39 @@ function Dt(e, t, o) {
|
|
|
1329
1332
|
)
|
|
1330
1333
|
};
|
|
1331
1334
|
}
|
|
1332
|
-
function
|
|
1335
|
+
function qn(e, t) {
|
|
1333
1336
|
const o = ne();
|
|
1334
1337
|
return {
|
|
1335
1338
|
x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
|
|
1336
1339
|
y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
|
|
1337
1340
|
};
|
|
1338
1341
|
}
|
|
1339
|
-
function
|
|
1340
|
-
const o =
|
|
1342
|
+
function Ri(e, t) {
|
|
1343
|
+
const o = Mi(e, t), n = ne();
|
|
1341
1344
|
return {
|
|
1342
1345
|
anchor: o,
|
|
1343
1346
|
x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
|
|
1344
1347
|
y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
|
|
1345
1348
|
};
|
|
1346
1349
|
}
|
|
1347
|
-
function
|
|
1350
|
+
function Mi(e, t) {
|
|
1348
1351
|
const o = ne(), n = e.x + t.width / 2, r = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
|
|
1349
1352
|
return `${r}-${l}`;
|
|
1350
1353
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1354
|
+
function zi(e) {
|
|
1355
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? yi : xi;
|
|
1353
1356
|
}
|
|
1354
1357
|
function bn(e, t, o) {
|
|
1355
|
-
const n = it(e), i =
|
|
1358
|
+
const n = it(e), i = $n(), r = {
|
|
1356
1359
|
x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
|
|
1357
1360
|
y: t.y + n.height - i.height
|
|
1358
1361
|
};
|
|
1359
|
-
return
|
|
1362
|
+
return Oi(r);
|
|
1360
1363
|
}
|
|
1361
|
-
function
|
|
1362
|
-
const t = ne(), o =
|
|
1364
|
+
function Oi(e) {
|
|
1365
|
+
const t = ne(), o = $n();
|
|
1363
1366
|
return {
|
|
1364
|
-
x:
|
|
1367
|
+
x: Te(
|
|
1365
1368
|
e.x,
|
|
1366
1369
|
W,
|
|
1367
1370
|
Math.max(
|
|
@@ -1369,7 +1372,7 @@ function Mi(e) {
|
|
|
1369
1372
|
t.width - o.width - W
|
|
1370
1373
|
)
|
|
1371
1374
|
),
|
|
1372
|
-
y:
|
|
1375
|
+
y: Te(
|
|
1373
1376
|
e.y,
|
|
1374
1377
|
Pt,
|
|
1375
1378
|
Math.max(
|
|
@@ -1386,16 +1389,16 @@ function xe(e, t) {
|
|
|
1386
1389
|
}
|
|
1387
1390
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1388
1391
|
}
|
|
1389
|
-
function
|
|
1392
|
+
function Ui(e, t) {
|
|
1390
1393
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1391
1394
|
}
|
|
1392
|
-
function
|
|
1395
|
+
function _n(e) {
|
|
1393
1396
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1394
1397
|
}
|
|
1395
1398
|
function ne() {
|
|
1396
1399
|
return {
|
|
1397
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1398
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1400
|
+
width: window.innerWidth || document.documentElement.clientWidth || Bn + W * 2,
|
|
1401
|
+
height: window.innerHeight || document.documentElement.clientHeight || Fn + W * 2
|
|
1399
1402
|
};
|
|
1400
1403
|
}
|
|
1401
1404
|
function St(e) {
|
|
@@ -1407,7 +1410,7 @@ function St(e) {
|
|
|
1407
1410
|
height: Math.round(t.height)
|
|
1408
1411
|
};
|
|
1409
1412
|
}
|
|
1410
|
-
function
|
|
1413
|
+
function Te(e, t, o) {
|
|
1411
1414
|
return Math.min(Math.max(e, t), o);
|
|
1412
1415
|
}
|
|
1413
1416
|
function K(e, t, o) {
|
|
@@ -1420,19 +1423,31 @@ function K(e, t, o) {
|
|
|
1420
1423
|
details: o
|
|
1421
1424
|
}, r = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
1422
1425
|
r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
|
|
1423
|
-
new CustomEvent(
|
|
1426
|
+
new CustomEvent(ni, { detail: i })
|
|
1424
1427
|
);
|
|
1425
1428
|
}
|
|
1426
|
-
function
|
|
1429
|
+
function Bi(e, t) {
|
|
1427
1430
|
K("web-sdk.widget.position", e, t);
|
|
1428
1431
|
}
|
|
1429
1432
|
function Et(e, t, o) {
|
|
1430
1433
|
const n = t.value.trim();
|
|
1431
1434
|
return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
|
|
1432
|
-
attachments: o.length > 0 ? o.map(
|
|
1435
|
+
attachments: o.length > 0 ? o.map(Wi) : void 0
|
|
1433
1436
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1434
1437
|
}
|
|
1435
|
-
function
|
|
1438
|
+
function Fi(e, t, o) {
|
|
1439
|
+
const n = e.activeElement;
|
|
1440
|
+
return n === o ? "composer" : n === t ? "launcher" : null;
|
|
1441
|
+
}
|
|
1442
|
+
function Hi(e, t, o, n) {
|
|
1443
|
+
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Vo)
|
|
1444
|
+
return;
|
|
1445
|
+
const i = e.focusedInput === "composer" ? n : o;
|
|
1446
|
+
i === n && !t.classList.contains("pluno-pa-widget--open") || i === o && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
|
|
1447
|
+
!i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
function Wi(e) {
|
|
1436
1451
|
return e;
|
|
1437
1452
|
}
|
|
1438
1453
|
function He(e) {
|
|
@@ -1445,7 +1460,7 @@ function We(e, t = () => !0) {
|
|
|
1445
1460
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1446
1461
|
});
|
|
1447
1462
|
}
|
|
1448
|
-
function
|
|
1463
|
+
function Gi(e) {
|
|
1449
1464
|
const t = e.messages[e.messages.length - 1];
|
|
1450
1465
|
return [
|
|
1451
1466
|
e.messages.length,
|
|
@@ -1456,13 +1471,13 @@ function Bi(e) {
|
|
|
1456
1471
|
e.lastError ?? ""
|
|
1457
1472
|
].join(":");
|
|
1458
1473
|
}
|
|
1459
|
-
function
|
|
1474
|
+
function $i(e) {
|
|
1460
1475
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1461
1476
|
}
|
|
1462
|
-
function
|
|
1477
|
+
function qi(e) {
|
|
1463
1478
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1464
1479
|
}
|
|
1465
|
-
function
|
|
1480
|
+
function ji(e) {
|
|
1466
1481
|
const t = e.currentPage;
|
|
1467
1482
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1468
1483
|
try {
|
|
@@ -1473,7 +1488,7 @@ function Wi(e) {
|
|
|
1473
1488
|
}
|
|
1474
1489
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1475
1490
|
}
|
|
1476
|
-
function
|
|
1491
|
+
function Vi(e, t) {
|
|
1477
1492
|
const o = new Date(e).getTime();
|
|
1478
1493
|
if (!Number.isFinite(o))
|
|
1479
1494
|
return "now";
|
|
@@ -1489,9 +1504,9 @@ function Gi(e, t) {
|
|
|
1489
1504
|
}
|
|
1490
1505
|
return "now";
|
|
1491
1506
|
}
|
|
1492
|
-
function
|
|
1493
|
-
e.appendChild(
|
|
1494
|
-
|
|
1507
|
+
function Ki(e, t, o, n, i) {
|
|
1508
|
+
e.appendChild(oa()), e.appendChild(
|
|
1509
|
+
Yi(
|
|
1495
1510
|
t,
|
|
1496
1511
|
o,
|
|
1497
1512
|
n,
|
|
@@ -1501,19 +1516,19 @@ function $i(e, t, o, n, i) {
|
|
|
1501
1516
|
rt(
|
|
1502
1517
|
"pluno-pa-widget__close",
|
|
1503
1518
|
"Close",
|
|
1504
|
-
|
|
1519
|
+
ia(16),
|
|
1505
1520
|
!0
|
|
1506
1521
|
)
|
|
1507
|
-
), e.appendChild(
|
|
1522
|
+
), e.appendChild(Xi(o));
|
|
1508
1523
|
}
|
|
1509
|
-
function
|
|
1524
|
+
function Yi(e, t, o, n) {
|
|
1510
1525
|
const i = document.createElement("form");
|
|
1511
1526
|
if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
|
|
1512
1527
|
const d = document.createElement("button");
|
|
1513
1528
|
d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", i.appendChild(d);
|
|
1514
1529
|
}
|
|
1515
1530
|
i.appendChild(
|
|
1516
|
-
|
|
1531
|
+
Yn(
|
|
1517
1532
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1518
1533
|
10
|
|
1519
1534
|
)
|
|
@@ -1534,15 +1549,15 @@ function qi(e, t, o, n) {
|
|
|
1534
1549
|
}
|
|
1535
1550
|
return i;
|
|
1536
1551
|
}
|
|
1537
|
-
function
|
|
1552
|
+
function Xi(e) {
|
|
1538
1553
|
const t = document.createElement("section");
|
|
1539
1554
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1540
|
-
|
|
1555
|
+
Yn("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1541
1556
|
);
|
|
1542
1557
|
const o = document.createElement("div");
|
|
1543
1558
|
o.className = "pluno-pa-widget__timeline-wrap";
|
|
1544
1559
|
const n = document.createElement("main");
|
|
1545
|
-
n.className = "pluno-pa-widget__timeline", n.appendChild(
|
|
1560
|
+
n.className = "pluno-pa-widget__timeline", n.appendChild(ea(e));
|
|
1546
1561
|
const i = document.createElement("div");
|
|
1547
1562
|
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
|
|
1548
1563
|
const r = document.createElement("div");
|
|
@@ -1554,12 +1569,12 @@ function ji(e) {
|
|
|
1554
1569
|
rt(
|
|
1555
1570
|
"pluno-pa-widget__history",
|
|
1556
1571
|
Rt(),
|
|
1557
|
-
|
|
1572
|
+
ra(),
|
|
1558
1573
|
!0
|
|
1559
1574
|
)
|
|
1560
|
-
), o.appendChild(p), o.appendChild(
|
|
1575
|
+
), o.appendChild(p), o.appendChild(Qi()), t.appendChild(o), t.appendChild(Zi()), t.appendChild(Ji()), t;
|
|
1561
1576
|
}
|
|
1562
|
-
function
|
|
1577
|
+
function Zi() {
|
|
1563
1578
|
const e = document.createElement("div");
|
|
1564
1579
|
e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
|
|
1565
1580
|
const t = document.createElement("span");
|
|
@@ -1573,7 +1588,7 @@ function Vi() {
|
|
|
1573
1588
|
const r = document.createElement("button");
|
|
1574
1589
|
return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", o.append(n, i, r), e.append(t, o), e;
|
|
1575
1590
|
}
|
|
1576
|
-
function
|
|
1591
|
+
function Ji() {
|
|
1577
1592
|
const e = document.createElement("form");
|
|
1578
1593
|
e.className = "pluno-pa-widget__composer";
|
|
1579
1594
|
const t = document.createElement("div");
|
|
@@ -1587,11 +1602,11 @@ function Ki() {
|
|
|
1587
1602
|
const r = document.createElement("input");
|
|
1588
1603
|
r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
|
|
1589
1604
|
const l = document.createElement("button");
|
|
1590
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1605
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(pa()), l.appendChild(sa()), i.appendChild(l);
|
|
1591
1606
|
const p = document.createElement("textarea");
|
|
1592
1607
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1593
1608
|
const d = document.createElement("button");
|
|
1594
|
-
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(
|
|
1609
|
+
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(Xn()), i.appendChild(d), e.appendChild(i);
|
|
1595
1610
|
const u = document.createElement("div");
|
|
1596
1611
|
u.className = "pluno-pa-widget__composer-meta";
|
|
1597
1612
|
const c = document.createElement("a");
|
|
@@ -1602,7 +1617,7 @@ function Ki() {
|
|
|
1602
1617
|
function Rt() {
|
|
1603
1618
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
1604
1619
|
}
|
|
1605
|
-
function
|
|
1620
|
+
function Qi() {
|
|
1606
1621
|
const e = document.createElement("section");
|
|
1607
1622
|
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Rt());
|
|
1608
1623
|
const t = document.createElement("div");
|
|
@@ -1612,7 +1627,7 @@ function Yi() {
|
|
|
1612
1627
|
const n = rt(
|
|
1613
1628
|
"pluno-pa-widget__history-close",
|
|
1614
1629
|
"Close recent chats",
|
|
1615
|
-
|
|
1630
|
+
la(),
|
|
1616
1631
|
!1
|
|
1617
1632
|
);
|
|
1618
1633
|
t.append(o, n);
|
|
@@ -1621,20 +1636,20 @@ function Yi() {
|
|
|
1621
1636
|
const r = document.createElement("p");
|
|
1622
1637
|
return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
|
|
1623
1638
|
}
|
|
1624
|
-
function
|
|
1639
|
+
function ea(e) {
|
|
1625
1640
|
const t = document.createElement("div");
|
|
1626
1641
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1627
1642
|
de(
|
|
1628
1643
|
"pluno-pa-widget__character--empty",
|
|
1629
1644
|
e
|
|
1630
1645
|
)
|
|
1631
|
-
), t.appendChild(
|
|
1646
|
+
), t.appendChild(jn()), t;
|
|
1632
1647
|
}
|
|
1633
|
-
function
|
|
1648
|
+
function jn() {
|
|
1634
1649
|
const e = document.createElement("div");
|
|
1635
1650
|
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;
|
|
1636
1651
|
}
|
|
1637
|
-
function
|
|
1652
|
+
function Vn(e, t) {
|
|
1638
1653
|
e.replaceChildren(), e.setAttribute(
|
|
1639
1654
|
"aria-label",
|
|
1640
1655
|
`${t.toLocaleString("en-US")} users currently active`
|
|
@@ -1647,16 +1662,16 @@ function jn(e, t) {
|
|
|
1647
1662
|
);
|
|
1648
1663
|
}
|
|
1649
1664
|
function de(e, t) {
|
|
1650
|
-
const o = `pluno-pa-character-${
|
|
1651
|
-
|
|
1652
|
-
const n = t.scribbleStyle ?
|
|
1665
|
+
const o = `pluno-pa-character-${mn}`;
|
|
1666
|
+
mn += 1;
|
|
1667
|
+
const n = t.scribbleStyle ? na(t.accentColor, o) : ta(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
|
|
1653
1668
|
return n.setAttribute(
|
|
1654
1669
|
"class",
|
|
1655
1670
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1656
1671
|
), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
|
|
1657
1672
|
}
|
|
1658
|
-
function
|
|
1659
|
-
const o =
|
|
1673
|
+
function ta(e, t) {
|
|
1674
|
+
const o = Lo(e), n = {
|
|
1660
1675
|
boltFill: `${t}-boltFill`,
|
|
1661
1676
|
boltEdge: `${t}-boltEdge`,
|
|
1662
1677
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1667,7 +1682,7 @@ function Zi(e, t) {
|
|
|
1667
1682
|
eyeShadow: `${t}-eyeShadow`,
|
|
1668
1683
|
pupilGloss: `${t}-pupilGloss`,
|
|
1669
1684
|
boltClip: `${t}-boltClip`
|
|
1670
|
-
}, i =
|
|
1685
|
+
}, i = Kn(), r = m(i, "defs"), l = m(r, "linearGradient", {
|
|
1671
1686
|
id: n.boltFill,
|
|
1672
1687
|
x1: "420",
|
|
1673
1688
|
y1: "180",
|
|
@@ -1769,7 +1784,7 @@ function Zi(e, t) {
|
|
|
1769
1784
|
"flood-color": o.shadow,
|
|
1770
1785
|
"flood-opacity": "0.3"
|
|
1771
1786
|
});
|
|
1772
|
-
const
|
|
1787
|
+
const H = m(r, "filter", {
|
|
1773
1788
|
id: n.pupilGloss,
|
|
1774
1789
|
x: "-15%",
|
|
1775
1790
|
y: "-15%",
|
|
@@ -1777,7 +1792,7 @@ function Zi(e, t) {
|
|
|
1777
1792
|
height: "130%",
|
|
1778
1793
|
"color-interpolation-filters": "sRGB"
|
|
1779
1794
|
});
|
|
1780
|
-
m(
|
|
1795
|
+
m(H, "feDropShadow", {
|
|
1781
1796
|
dx: "0",
|
|
1782
1797
|
dy: "3",
|
|
1783
1798
|
stdDeviation: "3",
|
|
@@ -1829,9 +1844,9 @@ function Zi(e, t) {
|
|
|
1829
1844
|
"stroke-linecap": "round",
|
|
1830
1845
|
opacity: "0.48"
|
|
1831
1846
|
});
|
|
1832
|
-
const
|
|
1833
|
-
return
|
|
1834
|
-
|
|
1847
|
+
const N = m(i, "g", { filter: j(n.eyeShadow) });
|
|
1848
|
+
return xn(
|
|
1849
|
+
N,
|
|
1835
1850
|
"rotate(-2 528 463)",
|
|
1836
1851
|
"528",
|
|
1837
1852
|
"463",
|
|
@@ -1840,8 +1855,8 @@ function Zi(e, t) {
|
|
|
1840
1855
|
"557",
|
|
1841
1856
|
"447",
|
|
1842
1857
|
n
|
|
1843
|
-
),
|
|
1844
|
-
|
|
1858
|
+
), xn(
|
|
1859
|
+
N,
|
|
1845
1860
|
"rotate(2 717 462)",
|
|
1846
1861
|
"717",
|
|
1847
1862
|
"462",
|
|
@@ -1852,11 +1867,11 @@ function Zi(e, t) {
|
|
|
1852
1867
|
n
|
|
1853
1868
|
), i;
|
|
1854
1869
|
}
|
|
1855
|
-
function
|
|
1856
|
-
const o =
|
|
1870
|
+
function na(e, t) {
|
|
1871
|
+
const o = Rn(e), n = {
|
|
1857
1872
|
clip: `${t}-scribbleBoltClip`,
|
|
1858
1873
|
wobble: `${t}-scribbleBoltWobble`
|
|
1859
|
-
}, i =
|
|
1874
|
+
}, i = Kn(), r = m(i, "defs"), l = m(r, "clipPath", { id: n.clip });
|
|
1860
1875
|
m(l, "path", { d: nt });
|
|
1861
1876
|
const p = m(r, "filter", {
|
|
1862
1877
|
id: n.wobble,
|
|
@@ -1883,7 +1898,7 @@ function Ji(e, t) {
|
|
|
1883
1898
|
"clip-path": j(n.clip)
|
|
1884
1899
|
});
|
|
1885
1900
|
return m(u, "path", {
|
|
1886
|
-
d:
|
|
1901
|
+
d: ko(),
|
|
1887
1902
|
fill: "none",
|
|
1888
1903
|
stroke: o,
|
|
1889
1904
|
"stroke-width": "56",
|
|
@@ -1897,7 +1912,7 @@ function Ji(e, t) {
|
|
|
1897
1912
|
stroke: ot,
|
|
1898
1913
|
"stroke-width": "18",
|
|
1899
1914
|
"stroke-linejoin": "round"
|
|
1900
|
-
}),
|
|
1915
|
+
}), yn(
|
|
1901
1916
|
d,
|
|
1902
1917
|
"rotate(-2 528 463)",
|
|
1903
1918
|
"528",
|
|
@@ -1906,7 +1921,7 @@ function Ji(e, t) {
|
|
|
1906
1921
|
"473",
|
|
1907
1922
|
"557",
|
|
1908
1923
|
"447"
|
|
1909
|
-
),
|
|
1924
|
+
), yn(
|
|
1910
1925
|
d,
|
|
1911
1926
|
"rotate(2 717 462)",
|
|
1912
1927
|
"717",
|
|
@@ -1917,13 +1932,13 @@ function Ji(e, t) {
|
|
|
1917
1932
|
"447"
|
|
1918
1933
|
), i;
|
|
1919
1934
|
}
|
|
1920
|
-
function
|
|
1935
|
+
function Kn() {
|
|
1921
1936
|
return C("svg", {
|
|
1922
|
-
xmlns:
|
|
1937
|
+
xmlns: Hn,
|
|
1923
1938
|
viewBox: "0 0 1254 1254"
|
|
1924
1939
|
});
|
|
1925
1940
|
}
|
|
1926
|
-
function
|
|
1941
|
+
function xn(e, t, o, n, i, r, l, p, d) {
|
|
1927
1942
|
const u = m(e, "g", { transform: t });
|
|
1928
1943
|
m(u, "ellipse", {
|
|
1929
1944
|
cx: o,
|
|
@@ -1945,7 +1960,7 @@ function _n(e, t, o, n, i, r, l, p, d) {
|
|
|
1945
1960
|
fill: "#ffffff"
|
|
1946
1961
|
});
|
|
1947
1962
|
}
|
|
1948
|
-
function
|
|
1963
|
+
function yn(e, t, o, n, i, r, l, p) {
|
|
1949
1964
|
const d = m(e, "g", { transform: t });
|
|
1950
1965
|
m(d, "ellipse", {
|
|
1951
1966
|
cx: o,
|
|
@@ -1983,7 +1998,7 @@ function rt(e, t, o, n) {
|
|
|
1983
1998
|
const i = document.createElement("button");
|
|
1984
1999
|
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
|
|
1985
2000
|
}
|
|
1986
|
-
function
|
|
2001
|
+
function oa() {
|
|
1987
2002
|
const e = C("svg", {
|
|
1988
2003
|
class: "pluno-pa-widget__scribble-defs",
|
|
1989
2004
|
"aria-hidden": "true",
|
|
@@ -1997,17 +2012,17 @@ function Qi() {
|
|
|
1997
2012
|
kt("pluno-pa-scribble-wobble-3", "9", "19")
|
|
1998
2013
|
), e.appendChild(t), e;
|
|
1999
2014
|
}
|
|
2000
|
-
function
|
|
2001
|
-
const o = t *
|
|
2015
|
+
function Yn(e, t) {
|
|
2016
|
+
const o = t * cn + un * 2, n = C("svg", {
|
|
2002
2017
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
2003
|
-
viewBox: `0 0 ${o} ${
|
|
2018
|
+
viewBox: `0 0 ${o} ${_i}`,
|
|
2004
2019
|
preserveAspectRatio: "xMidYMid meet",
|
|
2005
2020
|
"aria-hidden": "true",
|
|
2006
2021
|
focusable: "false"
|
|
2007
2022
|
});
|
|
2008
2023
|
for (let i = 0; i < t; i += 1) {
|
|
2009
|
-
const r =
|
|
2010
|
-
transform: `translate(${
|
|
2024
|
+
const r = gn[i % gn.length], l = C("g", {
|
|
2025
|
+
transform: `translate(${un + i * cn} 0)`
|
|
2011
2026
|
});
|
|
2012
2027
|
l.appendChild(
|
|
2013
2028
|
C("ellipse", {
|
|
@@ -2075,7 +2090,7 @@ function kt(e, t, o) {
|
|
|
2075
2090
|
})
|
|
2076
2091
|
), n;
|
|
2077
2092
|
}
|
|
2078
|
-
function
|
|
2093
|
+
function ia(e) {
|
|
2079
2094
|
const t = oe(
|
|
2080
2095
|
"0 0 24 24",
|
|
2081
2096
|
e,
|
|
@@ -2086,7 +2101,7 @@ function ea(e) {
|
|
|
2086
2101
|
);
|
|
2087
2102
|
return t.appendChild(C("path", { d: "m6 9 6 6 6-6" })), t;
|
|
2088
2103
|
}
|
|
2089
|
-
function
|
|
2104
|
+
function aa() {
|
|
2090
2105
|
const e = oe(
|
|
2091
2106
|
"0 0 24 24",
|
|
2092
2107
|
17,
|
|
@@ -2105,7 +2120,7 @@ function ta() {
|
|
|
2105
2120
|
})
|
|
2106
2121
|
), e;
|
|
2107
2122
|
}
|
|
2108
|
-
function
|
|
2123
|
+
function ra() {
|
|
2109
2124
|
const e = oe(
|
|
2110
2125
|
"0 0 24 24",
|
|
2111
2126
|
17,
|
|
@@ -2116,7 +2131,7 @@ function na() {
|
|
|
2116
2131
|
);
|
|
2117
2132
|
return e.appendChild(C("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(C("path", { d: "M3 4v5h5" })), e.appendChild(C("path", { d: "M12 7v5l3 2" })), e;
|
|
2118
2133
|
}
|
|
2119
|
-
function
|
|
2134
|
+
function la() {
|
|
2120
2135
|
const e = oe(
|
|
2121
2136
|
"0 0 24 24",
|
|
2122
2137
|
15,
|
|
@@ -2127,7 +2142,7 @@ function oa() {
|
|
|
2127
2142
|
);
|
|
2128
2143
|
return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
|
|
2129
2144
|
}
|
|
2130
|
-
function
|
|
2145
|
+
function Xn() {
|
|
2131
2146
|
const e = oe(
|
|
2132
2147
|
"0 0 24 24",
|
|
2133
2148
|
14,
|
|
@@ -2140,7 +2155,7 @@ function Yn() {
|
|
|
2140
2155
|
C("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2141
2156
|
), e.appendChild(C("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2142
2157
|
}
|
|
2143
|
-
function
|
|
2158
|
+
function pa() {
|
|
2144
2159
|
const e = oe(
|
|
2145
2160
|
"0 0 24 24",
|
|
2146
2161
|
16,
|
|
@@ -2158,7 +2173,7 @@ function ia() {
|
|
|
2158
2173
|
})
|
|
2159
2174
|
), e;
|
|
2160
2175
|
}
|
|
2161
|
-
function
|
|
2176
|
+
function sa() {
|
|
2162
2177
|
const e = oe("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2163
2178
|
return e.setAttribute(
|
|
2164
2179
|
"class",
|
|
@@ -2173,7 +2188,7 @@ function aa() {
|
|
|
2173
2188
|
})
|
|
2174
2189
|
), e;
|
|
2175
2190
|
}
|
|
2176
|
-
function
|
|
2191
|
+
function da() {
|
|
2177
2192
|
const e = oe("0 0 24 24", 18, 18, "currentColor");
|
|
2178
2193
|
return e.appendChild(
|
|
2179
2194
|
C("rect", {
|
|
@@ -2185,7 +2200,7 @@ function ra() {
|
|
|
2185
2200
|
})
|
|
2186
2201
|
), e;
|
|
2187
2202
|
}
|
|
2188
|
-
function
|
|
2203
|
+
function ca() {
|
|
2189
2204
|
const e = oe(
|
|
2190
2205
|
"0 0 24 24",
|
|
2191
2206
|
12,
|
|
@@ -2196,7 +2211,7 @@ function la() {
|
|
|
2196
2211
|
);
|
|
2197
2212
|
return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
|
|
2198
2213
|
}
|
|
2199
|
-
function
|
|
2214
|
+
function ua() {
|
|
2200
2215
|
const e = oe(
|
|
2201
2216
|
"0 0 24 24",
|
|
2202
2217
|
13,
|
|
@@ -2231,30 +2246,30 @@ function oe(e, t, o, n, i, r) {
|
|
|
2231
2246
|
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), C("svg", l);
|
|
2232
2247
|
}
|
|
2233
2248
|
function C(e, t = {}) {
|
|
2234
|
-
const o = document.createElementNS(
|
|
2249
|
+
const o = document.createElementNS(Hn, e);
|
|
2235
2250
|
for (const [n, i] of Object.entries(t))
|
|
2236
2251
|
o.setAttribute(n, i);
|
|
2237
2252
|
return o;
|
|
2238
2253
|
}
|
|
2239
|
-
function
|
|
2254
|
+
function vn(e) {
|
|
2240
2255
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2241
2256
|
e.addEventListener(t, (o) => {
|
|
2242
2257
|
o.stopPropagation();
|
|
2243
2258
|
});
|
|
2244
2259
|
}
|
|
2245
|
-
function
|
|
2260
|
+
function ga(e, t, o) {
|
|
2246
2261
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2247
2262
|
for (const [n, i] of t.entries()) {
|
|
2248
2263
|
const r = document.createElement("div");
|
|
2249
|
-
r.className = "pluno-pa-widget__attachment", r.appendChild(
|
|
2264
|
+
r.className = "pluno-pa-widget__attachment", r.appendChild(ha(i));
|
|
2250
2265
|
const l = document.createElement("span");
|
|
2251
2266
|
l.textContent = i.name, r.appendChild(l);
|
|
2252
2267
|
const p = document.createElement("button");
|
|
2253
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2268
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(ca()), p.addEventListener("click", () => o(n)), r.appendChild(p), e.appendChild(r);
|
|
2254
2269
|
}
|
|
2255
2270
|
}
|
|
2256
|
-
function
|
|
2257
|
-
const t = Ut(e), o =
|
|
2271
|
+
function ha(e) {
|
|
2272
|
+
const t = Ut(e), o = Zn(e);
|
|
2258
2273
|
if (t === "image" && o) {
|
|
2259
2274
|
const n = document.createElement("img");
|
|
2260
2275
|
return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n;
|
|
@@ -2265,8 +2280,8 @@ function da(e) {
|
|
|
2265
2280
|
}
|
|
2266
2281
|
return ee(e);
|
|
2267
2282
|
}
|
|
2268
|
-
function
|
|
2269
|
-
const t = Ut(e), o =
|
|
2283
|
+
function ma(e) {
|
|
2284
|
+
const t = Ut(e), o = Zn(e);
|
|
2270
2285
|
if (t === "image" && o) {
|
|
2271
2286
|
const n = document.createElement("img");
|
|
2272
2287
|
return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n;
|
|
@@ -2284,32 +2299,32 @@ function ca(e) {
|
|
|
2284
2299
|
function ee(e, t = "composer") {
|
|
2285
2300
|
if (t === "composer") {
|
|
2286
2301
|
const r = document.createElement("span");
|
|
2287
|
-
return r.className = "pluno-pa-widget__attachment-file", r.textContent =
|
|
2302
|
+
return r.className = "pluno-pa-widget__attachment-file", r.textContent = Cn(e), r;
|
|
2288
2303
|
}
|
|
2289
2304
|
const o = document.createElement("div");
|
|
2290
2305
|
o.className = "pluno-pa-widget__message-attachment-file";
|
|
2291
2306
|
const n = document.createElement("span");
|
|
2292
|
-
n.textContent =
|
|
2307
|
+
n.textContent = Cn(e);
|
|
2293
2308
|
const i = document.createElement("strong");
|
|
2294
2309
|
return i.textContent = e.name, o.append(n, i), o;
|
|
2295
2310
|
}
|
|
2296
2311
|
function Ut(e) {
|
|
2297
2312
|
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2298
2313
|
}
|
|
2299
|
-
function
|
|
2314
|
+
function Zn(e) {
|
|
2300
2315
|
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2301
2316
|
}
|
|
2302
|
-
function
|
|
2317
|
+
function Cn(e) {
|
|
2303
2318
|
const t = Ut(e);
|
|
2304
2319
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2305
2320
|
}
|
|
2306
|
-
function
|
|
2321
|
+
function fa(e, t) {
|
|
2307
2322
|
return t ? Array.from(t).map((n) => ({
|
|
2308
2323
|
...e.createLocalAttachment(n),
|
|
2309
|
-
previewUrl:
|
|
2324
|
+
previewUrl: wa(n)
|
|
2310
2325
|
})) : [];
|
|
2311
2326
|
}
|
|
2312
|
-
function
|
|
2327
|
+
function wa(e) {
|
|
2313
2328
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2314
2329
|
}
|
|
2315
2330
|
function Qe(e) {
|
|
@@ -2321,31 +2336,31 @@ function Lt(e, t, o = null) {
|
|
|
2321
2336
|
return;
|
|
2322
2337
|
}
|
|
2323
2338
|
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || Bt(o) ? e.appendChild(
|
|
2324
|
-
|
|
2325
|
-
) :
|
|
2339
|
+
ba(t, o)
|
|
2340
|
+
) : Jn(t) && e.appendChild(_a(t));
|
|
2326
2341
|
}
|
|
2327
|
-
function
|
|
2342
|
+
function ba(e, t) {
|
|
2328
2343
|
const o = document.createElement("div");
|
|
2329
2344
|
o.className = "pluno-pa-widget__billing-action-card";
|
|
2330
2345
|
const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2331
2346
|
i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
|
|
2332
2347
|
const r = document.createElement("span");
|
|
2333
2348
|
return r.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(r), o.appendChild(
|
|
2334
|
-
|
|
2349
|
+
Qn(
|
|
2335
2350
|
e,
|
|
2336
2351
|
"Upgrade plan",
|
|
2337
2352
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2338
2353
|
)
|
|
2339
2354
|
), o;
|
|
2340
2355
|
}
|
|
2341
|
-
function
|
|
2356
|
+
function _a(e) {
|
|
2342
2357
|
const t = document.createElement("div");
|
|
2343
2358
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2344
2359
|
const o = document.createElement("strong");
|
|
2345
2360
|
o.textContent = "Credits running low", t.appendChild(o);
|
|
2346
2361
|
const n = document.createElement("span");
|
|
2347
|
-
return n.textContent =
|
|
2348
|
-
|
|
2362
|
+
return n.textContent = ya(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
|
|
2363
|
+
Qn(
|
|
2349
2364
|
e,
|
|
2350
2365
|
"Upgrade",
|
|
2351
2366
|
"pluno-pa-widget__billing-action-card-actions"
|
|
@@ -2353,12 +2368,12 @@ function ma(e) {
|
|
|
2353
2368
|
), t;
|
|
2354
2369
|
}
|
|
2355
2370
|
function Mt(e, t) {
|
|
2356
|
-
return e !== null && (te(e) ||
|
|
2371
|
+
return e !== null && (te(e) || Jn(e) || Bt(t));
|
|
2357
2372
|
}
|
|
2358
|
-
function
|
|
2359
|
-
return Mt(t, o) ||
|
|
2373
|
+
function Sn(e, t, o) {
|
|
2374
|
+
return Mt(t, o) || xa(t) ? !0 : !Mt(e, o);
|
|
2360
2375
|
}
|
|
2361
|
-
function
|
|
2376
|
+
function xa(e) {
|
|
2362
2377
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || te(e));
|
|
2363
2378
|
}
|
|
2364
2379
|
function te(e) {
|
|
@@ -2367,26 +2382,26 @@ function te(e) {
|
|
|
2367
2382
|
function Bt(e) {
|
|
2368
2383
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2369
2384
|
}
|
|
2370
|
-
function
|
|
2385
|
+
function Jn(e) {
|
|
2371
2386
|
return !te(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2372
2387
|
}
|
|
2373
|
-
function
|
|
2374
|
-
return e.creditsRemaining === null ? null : `${
|
|
2388
|
+
function ya(e) {
|
|
2389
|
+
return e.creditsRemaining === null ? null : `${va(e.creditsRemaining)} credits left`;
|
|
2375
2390
|
}
|
|
2376
|
-
function
|
|
2391
|
+
function va(e) {
|
|
2377
2392
|
return new Intl.NumberFormat("en-US", {
|
|
2378
2393
|
maximumFractionDigits: 0
|
|
2379
2394
|
}).format(Math.ceil(e));
|
|
2380
2395
|
}
|
|
2381
|
-
function
|
|
2396
|
+
function Qn(e, t, o) {
|
|
2382
2397
|
const n = document.createElement("div");
|
|
2383
2398
|
return n.className = o, n.appendChild(
|
|
2384
|
-
|
|
2399
|
+
En(t, e.pricingUrl)
|
|
2385
2400
|
), n.appendChild(
|
|
2386
|
-
|
|
2401
|
+
En("Earn credits", e.earnCreditsUrl)
|
|
2387
2402
|
), n;
|
|
2388
2403
|
}
|
|
2389
|
-
function
|
|
2404
|
+
function En(e, t) {
|
|
2390
2405
|
const o = document.createElement("button");
|
|
2391
2406
|
if (o.type = "button", e === "Earn credits") {
|
|
2392
2407
|
const n = document.createElement("span");
|
|
@@ -2399,16 +2414,16 @@ function Sn(e, t) {
|
|
|
2399
2414
|
}
|
|
2400
2415
|
function It(e, t) {
|
|
2401
2416
|
return e.messages.filter(
|
|
2402
|
-
(n) => !
|
|
2417
|
+
(n) => !eo(n)
|
|
2403
2418
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2404
2419
|
}
|
|
2405
|
-
function
|
|
2406
|
-
const y =
|
|
2407
|
-
(x) => !
|
|
2408
|
-
), h = e.scrollTop,
|
|
2409
|
-
|
|
2420
|
+
function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, w, H, k) {
|
|
2421
|
+
const y = La(r), v = y.filter(
|
|
2422
|
+
(x) => !eo(x)
|
|
2423
|
+
), h = e.scrollTop, N = [], D = /* @__PURE__ */ new Set(), L = (x) => {
|
|
2424
|
+
N.push(x);
|
|
2410
2425
|
};
|
|
2411
|
-
|
|
2426
|
+
no(o, r.isThinking), i.hidden = !p, p && l !== null && Vn(i, l);
|
|
2412
2427
|
const Pe = v.length > 0 || !!r.assistantDraft || r.isThinking;
|
|
2413
2428
|
if (n(Pe), v.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
|
|
2414
2429
|
const x = document.createElement("div");
|
|
@@ -2419,31 +2434,31 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
|
|
|
2419
2434
|
"pluno-pa-widget__character--empty",
|
|
2420
2435
|
w()
|
|
2421
2436
|
);
|
|
2422
|
-
z.appendChild(I), x.appendChild(z), x.appendChild(
|
|
2437
|
+
z.appendChild(I), x.appendChild(z), x.appendChild(jn());
|
|
2423
2438
|
const $ = document.createElement("div");
|
|
2424
2439
|
if ($.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && $.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
|
|
2425
|
-
for (const
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
}), $.appendChild(
|
|
2440
|
+
for (const A of r.starterPrompts) {
|
|
2441
|
+
const T = document.createElement("button");
|
|
2442
|
+
T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${A}"`, T.addEventListener("click", () => {
|
|
2443
|
+
H(A);
|
|
2444
|
+
}), $.appendChild(T);
|
|
2430
2445
|
}
|
|
2431
2446
|
else if (r.starterPromptsLoading) {
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2447
|
+
const A = document.createElement("button");
|
|
2448
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", A.disabled = !0, A.tabIndex = -1, A.textContent = "Generating example tasks...", $.appendChild(A);
|
|
2434
2449
|
} else
|
|
2435
|
-
for (let
|
|
2436
|
-
const
|
|
2437
|
-
|
|
2450
|
+
for (let A = 0; A < oi; A += 1) {
|
|
2451
|
+
const T = document.createElement("button");
|
|
2452
|
+
T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.textContent = "", $.appendChild(T);
|
|
2438
2453
|
}
|
|
2439
|
-
x.appendChild($), g.clear(), L(x), L(t),
|
|
2454
|
+
x.appendChild($), g.clear(), L(x), L(t), kn(e, N);
|
|
2440
2455
|
return;
|
|
2441
2456
|
}
|
|
2442
2457
|
let f = null, R = null, ce = [];
|
|
2443
2458
|
const ue = v.some(zt), ye = () => {
|
|
2444
2459
|
if (ce.length === 0)
|
|
2445
2460
|
return !1;
|
|
2446
|
-
const x =
|
|
2461
|
+
const x = Oa(
|
|
2447
2462
|
ce,
|
|
2448
2463
|
c,
|
|
2449
2464
|
S,
|
|
@@ -2462,20 +2477,20 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
|
|
|
2462
2477
|
const ge = at();
|
|
2463
2478
|
L(ge), f = null, R = ge;
|
|
2464
2479
|
} else {
|
|
2465
|
-
const ge =
|
|
2480
|
+
const ge = An(w());
|
|
2466
2481
|
L(ge), f = null, R = ge;
|
|
2467
2482
|
}
|
|
2468
2483
|
continue;
|
|
2469
2484
|
}
|
|
2470
2485
|
if (z.role === "system")
|
|
2471
2486
|
continue;
|
|
2472
|
-
const I = ye(), $ =
|
|
2487
|
+
const I = ye(), $ = za(z.content);
|
|
2473
2488
|
if (z.role === "assistant" && !I) {
|
|
2474
|
-
const
|
|
2475
|
-
L(
|
|
2489
|
+
const T = to(w());
|
|
2490
|
+
L(T), f = null, R = T;
|
|
2476
2491
|
}
|
|
2477
|
-
const
|
|
2478
|
-
L(
|
|
2492
|
+
const A = Sa(z, $, g, D);
|
|
2493
|
+
L(A), f = A, R = null;
|
|
2479
2494
|
}
|
|
2480
2495
|
const G = ye(), $e = v[v.length - 1]?.id === "assistant-draft";
|
|
2481
2496
|
if (r.isThinking && !$e && !ue)
|
|
@@ -2483,7 +2498,7 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
|
|
|
2483
2498
|
const x = at();
|
|
2484
2499
|
L(x), f = null, R = x;
|
|
2485
2500
|
} else {
|
|
2486
|
-
const x =
|
|
2501
|
+
const x = An(w());
|
|
2487
2502
|
L(x), f = null, R = x;
|
|
2488
2503
|
}
|
|
2489
2504
|
if (r.lastError) {
|
|
@@ -2492,7 +2507,7 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
|
|
|
2492
2507
|
}
|
|
2493
2508
|
const Y = k && !r.isThinking ? To(y) : null;
|
|
2494
2509
|
if (k && Y && !k.dismissedCandidateIds.has(Y.id)) {
|
|
2495
|
-
const x =
|
|
2510
|
+
const x = Na(Y, {
|
|
2496
2511
|
isDrafting: k.draftingCandidateId === Y.id,
|
|
2497
2512
|
error: k.error,
|
|
2498
2513
|
characterIconOptions: k.characterIconOptions,
|
|
@@ -2502,18 +2517,18 @@ function _a(e, t, o, n, i, r, l, p, d, u, c, g, S, w, F, k) {
|
|
|
2502
2517
|
});
|
|
2503
2518
|
L(x), k.onSeen(Y), f = null, R = x;
|
|
2504
2519
|
}
|
|
2505
|
-
f?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t),
|
|
2520
|
+
f?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t), ka(g, D), kn(e, N), d ? We(e, u) : e.scrollTop = h;
|
|
2506
2521
|
}
|
|
2507
|
-
function
|
|
2508
|
-
const i =
|
|
2522
|
+
function Sa(e, t, o, n) {
|
|
2523
|
+
const i = Ea(e, t), r = i ? o.get(i) : void 0;
|
|
2509
2524
|
if (i && r)
|
|
2510
2525
|
return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), r;
|
|
2511
2526
|
const l = document.createElement("div");
|
|
2512
|
-
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ?
|
|
2527
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Ba(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Ia(e.attachments));
|
|
2513
2528
|
const p = document.createElement("div");
|
|
2514
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
2529
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(Aa(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
|
|
2515
2530
|
}
|
|
2516
|
-
function
|
|
2531
|
+
function Ea(e, t) {
|
|
2517
2532
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2518
2533
|
id: e.id,
|
|
2519
2534
|
content: t,
|
|
@@ -2531,11 +2546,11 @@ function ya(e, t) {
|
|
|
2531
2546
|
})
|
|
2532
2547
|
});
|
|
2533
2548
|
}
|
|
2534
|
-
function
|
|
2549
|
+
function ka(e, t) {
|
|
2535
2550
|
for (const o of e.keys())
|
|
2536
2551
|
t.has(o) || e.delete(o);
|
|
2537
2552
|
}
|
|
2538
|
-
function
|
|
2553
|
+
function kn(e, t) {
|
|
2539
2554
|
let o = e.firstChild;
|
|
2540
2555
|
for (const n of t) {
|
|
2541
2556
|
if (n === o) {
|
|
@@ -2549,7 +2564,7 @@ function En(e, t) {
|
|
|
2549
2564
|
o = o.nextSibling, e.removeChild(n);
|
|
2550
2565
|
}
|
|
2551
2566
|
}
|
|
2552
|
-
function
|
|
2567
|
+
function La(e) {
|
|
2553
2568
|
if (!e.assistantDraft)
|
|
2554
2569
|
return [...e.messages];
|
|
2555
2570
|
const t = {
|
|
@@ -2569,7 +2584,7 @@ function Ca(e) {
|
|
|
2569
2584
|
if (o === -1)
|
|
2570
2585
|
return [...e.messages, t];
|
|
2571
2586
|
const n = e.messages.findIndex(
|
|
2572
|
-
(r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2587
|
+
(r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Ln(r, t) && zt(r)
|
|
2573
2588
|
);
|
|
2574
2589
|
if (n !== -1)
|
|
2575
2590
|
return [
|
|
@@ -2578,7 +2593,7 @@ function Ca(e) {
|
|
|
2578
2593
|
...e.messages.slice(n + 1)
|
|
2579
2594
|
];
|
|
2580
2595
|
let i = o + 1;
|
|
2581
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2596
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Ln(e.messages[i], t); )
|
|
2582
2597
|
i += 1;
|
|
2583
2598
|
return [
|
|
2584
2599
|
...e.messages.slice(0, i),
|
|
@@ -2589,11 +2604,11 @@ function Ca(e) {
|
|
|
2589
2604
|
function zt(e) {
|
|
2590
2605
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2591
2606
|
}
|
|
2592
|
-
function
|
|
2607
|
+
function Ln(e, t) {
|
|
2593
2608
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2594
2609
|
}
|
|
2595
|
-
function
|
|
2596
|
-
e.replaceChildren(),
|
|
2610
|
+
function In(e, t, o, n, i, r, l, p) {
|
|
2611
|
+
e.replaceChildren(), no(t, !1), t.disabled = !0, o(!1);
|
|
2597
2612
|
const d = document.createElement("div");
|
|
2598
2613
|
d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2599
2614
|
const u = de(
|
|
@@ -2611,20 +2626,20 @@ function Ln(e, t, o, n, i, r, l, p) {
|
|
|
2611
2626
|
}
|
|
2612
2627
|
e.appendChild(d);
|
|
2613
2628
|
}
|
|
2614
|
-
function
|
|
2629
|
+
function Ia(e) {
|
|
2615
2630
|
const t = document.createElement("div");
|
|
2616
2631
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2617
2632
|
for (const o of e)
|
|
2618
|
-
t.appendChild(
|
|
2633
|
+
t.appendChild(ma(o));
|
|
2619
2634
|
return t;
|
|
2620
2635
|
}
|
|
2621
|
-
function
|
|
2636
|
+
function Aa(e) {
|
|
2622
2637
|
const t = document.createElement("button");
|
|
2623
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
2638
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ua()), t.addEventListener("click", (o) => {
|
|
2624
2639
|
o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
|
|
2625
2640
|
}), t;
|
|
2626
2641
|
}
|
|
2627
|
-
function
|
|
2642
|
+
function Na(e, t) {
|
|
2628
2643
|
const o = document.createElement("article");
|
|
2629
2644
|
o.className = "pluno-pa-widget__share-prompt";
|
|
2630
2645
|
const n = document.createElement("div");
|
|
@@ -2665,7 +2680,7 @@ function ka(e, t) {
|
|
|
2665
2680
|
}
|
|
2666
2681
|
return n.appendChild(p), o.appendChild(n), o;
|
|
2667
2682
|
}
|
|
2668
|
-
function
|
|
2683
|
+
function Ta(e, t) {
|
|
2669
2684
|
const o = document.createElement("div");
|
|
2670
2685
|
o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (y) => {
|
|
2671
2686
|
y.target === o && t.onClose();
|
|
@@ -2684,11 +2699,11 @@ function La(e, t) {
|
|
|
2684
2699
|
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
2685
2700
|
const c = document.createElement("strong");
|
|
2686
2701
|
c.textContent = "1) Copy Screenshot", u.appendChild(c);
|
|
2687
|
-
const g =
|
|
2702
|
+
const g = Pa(
|
|
2688
2703
|
"Copy Screenshot",
|
|
2689
2704
|
async () => {
|
|
2690
2705
|
try {
|
|
2691
|
-
return await
|
|
2706
|
+
return await Po(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
2692
2707
|
} catch {
|
|
2693
2708
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
2694
2709
|
}
|
|
@@ -2705,13 +2720,13 @@ function La(e, t) {
|
|
|
2705
2720
|
S.className = "pluno-pa-widget__share-dialog-step";
|
|
2706
2721
|
const w = document.createElement("strong");
|
|
2707
2722
|
w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "2) Share on", S.appendChild(w);
|
|
2708
|
-
const
|
|
2709
|
-
|
|
2723
|
+
const H = document.createElement("p");
|
|
2724
|
+
H.className = "pluno-pa-widget__share-dialog-hint", H.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(H);
|
|
2710
2725
|
const k = document.createElement("footer");
|
|
2711
2726
|
k.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2712
|
-
for (const y of
|
|
2727
|
+
for (const y of Da(e)) {
|
|
2713
2728
|
const v = document.createElement("a");
|
|
2714
|
-
v.href = y.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = y.label, v.setAttribute("aria-label", `Open ${y.label}`), v.appendChild(
|
|
2729
|
+
v.href = y.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = y.label, v.setAttribute("aria-label", `Open ${y.label}`), v.appendChild(Ra(y.id)), k.appendChild(v);
|
|
2715
2730
|
}
|
|
2716
2731
|
if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
|
|
2717
2732
|
const y = document.createElement("div");
|
|
@@ -2719,17 +2734,17 @@ function La(e, t) {
|
|
|
2719
2734
|
const v = document.createElement("strong");
|
|
2720
2735
|
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(v);
|
|
2721
2736
|
const h = document.createElement("a");
|
|
2722
|
-
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(
|
|
2737
|
+
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(Ma()), y.appendChild(h), n.appendChild(y);
|
|
2723
2738
|
}
|
|
2724
2739
|
return o.appendChild(n), o;
|
|
2725
2740
|
}
|
|
2726
|
-
function
|
|
2741
|
+
function Pa(e, t) {
|
|
2727
2742
|
const o = document.createElement("button");
|
|
2728
2743
|
return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
|
|
2729
2744
|
n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
|
|
2730
2745
|
}), o;
|
|
2731
2746
|
}
|
|
2732
|
-
function
|
|
2747
|
+
function Da(e) {
|
|
2733
2748
|
const t = e.linkedinPost.trim(), o = e.xPost.trim();
|
|
2734
2749
|
return [
|
|
2735
2750
|
{
|
|
@@ -2749,47 +2764,47 @@ function Na(e) {
|
|
|
2749
2764
|
}
|
|
2750
2765
|
];
|
|
2751
2766
|
}
|
|
2752
|
-
function
|
|
2767
|
+
function Ra(e) {
|
|
2753
2768
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2754
|
-
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" ? (
|
|
2769
|
+
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" ? (U(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), U(
|
|
2755
2770
|
t,
|
|
2756
2771
|
"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"
|
|
2757
|
-
),
|
|
2772
|
+
), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(
|
|
2758
2773
|
t,
|
|
2759
2774
|
"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"
|
|
2760
|
-
),
|
|
2775
|
+
), U(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (U(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), U(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), U(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (U(
|
|
2761
2776
|
t,
|
|
2762
2777
|
"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"
|
|
2763
|
-
),
|
|
2778
|
+
), U(
|
|
2764
2779
|
t,
|
|
2765
2780
|
"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",
|
|
2766
2781
|
"0.48"
|
|
2767
|
-
),
|
|
2782
|
+
), U(
|
|
2768
2783
|
t,
|
|
2769
2784
|
"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"
|
|
2770
|
-
),
|
|
2785
|
+
), U(
|
|
2771
2786
|
t,
|
|
2772
2787
|
"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"
|
|
2773
2788
|
), t);
|
|
2774
2789
|
}
|
|
2775
|
-
function
|
|
2790
|
+
function U(e, t, o) {
|
|
2776
2791
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2777
2792
|
n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
|
|
2778
2793
|
}
|
|
2779
|
-
function
|
|
2794
|
+
function Ma() {
|
|
2780
2795
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2781
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
2796
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), U(e, "M14 5h5v5"), U(e, "M19 5l-8 8"), U(
|
|
2782
2797
|
e,
|
|
2783
2798
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
2784
2799
|
), e;
|
|
2785
2800
|
}
|
|
2786
|
-
function
|
|
2787
|
-
return e.role === "tool" && e.toolName ===
|
|
2801
|
+
function eo(e) {
|
|
2802
|
+
return e.role === "tool" && e.toolName === zn;
|
|
2788
2803
|
}
|
|
2789
|
-
function
|
|
2804
|
+
function za(e) {
|
|
2790
2805
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
2791
2806
|
}
|
|
2792
|
-
function
|
|
2807
|
+
function Oa(e, t, o, n) {
|
|
2793
2808
|
const i = document.createElement("article");
|
|
2794
2809
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
2795
2810
|
e[e.length - 1].createdAt
|
|
@@ -2799,7 +2814,7 @@ function Da(e, t, o, n) {
|
|
|
2799
2814
|
n
|
|
2800
2815
|
)
|
|
2801
2816
|
);
|
|
2802
|
-
const r = document.createElement("details"), l =
|
|
2817
|
+
const r = document.createElement("details"), l = Ua(e);
|
|
2803
2818
|
r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
|
|
2804
2819
|
i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), o();
|
|
2805
2820
|
});
|
|
@@ -2819,7 +2834,7 @@ function Da(e, t, o, n) {
|
|
|
2819
2834
|
}
|
|
2820
2835
|
return i.appendChild(r), i;
|
|
2821
2836
|
}
|
|
2822
|
-
function
|
|
2837
|
+
function to(e) {
|
|
2823
2838
|
const t = document.createElement("article");
|
|
2824
2839
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
2825
2840
|
de(
|
|
@@ -2828,8 +2843,8 @@ function eo(e) {
|
|
|
2828
2843
|
)
|
|
2829
2844
|
), t;
|
|
2830
2845
|
}
|
|
2831
|
-
function
|
|
2832
|
-
const t =
|
|
2846
|
+
function An(e) {
|
|
2847
|
+
const t = to(e);
|
|
2833
2848
|
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(at()), t;
|
|
2834
2849
|
}
|
|
2835
2850
|
function at(e = "Thinking...") {
|
|
@@ -2840,17 +2855,17 @@ function at(e = "Thinking...") {
|
|
|
2840
2855
|
const n = document.createElement("span");
|
|
2841
2856
|
return n.textContent = e, t.appendChild(n), t;
|
|
2842
2857
|
}
|
|
2843
|
-
function
|
|
2858
|
+
function Ua(e) {
|
|
2844
2859
|
return `tools:${e[0]?.id ?? ""}`;
|
|
2845
2860
|
}
|
|
2846
2861
|
function Ot() {
|
|
2847
2862
|
const e = document.createElement("span");
|
|
2848
2863
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
2849
2864
|
}
|
|
2850
|
-
function
|
|
2851
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
2865
|
+
function no(e, t) {
|
|
2866
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? da() : Xn());
|
|
2852
2867
|
}
|
|
2853
|
-
function
|
|
2868
|
+
function Ba(e, t) {
|
|
2854
2869
|
const o = t.replace(/\r\n/g, `
|
|
2855
2870
|
`).split(`
|
|
2856
2871
|
`);
|
|
@@ -2924,7 +2939,7 @@ function et(e, t) {
|
|
|
2924
2939
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
2925
2940
|
} else {
|
|
2926
2941
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
2927
|
-
if (p &&
|
|
2942
|
+
if (p && Fa(p[2])) {
|
|
2928
2943
|
const d = document.createElement("a");
|
|
2929
2944
|
d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
|
|
2930
2945
|
} else
|
|
@@ -2934,7 +2949,7 @@ function et(e, t) {
|
|
|
2934
2949
|
}
|
|
2935
2950
|
n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
|
|
2936
2951
|
}
|
|
2937
|
-
function
|
|
2952
|
+
function Fa(e) {
|
|
2938
2953
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
2939
2954
|
return !0;
|
|
2940
2955
|
try {
|
|
@@ -2945,7 +2960,7 @@ function za(e) {
|
|
|
2945
2960
|
}
|
|
2946
2961
|
}
|
|
2947
2962
|
function Nn(e, t) {
|
|
2948
|
-
if (
|
|
2963
|
+
if (Ha(e))
|
|
2949
2964
|
return;
|
|
2950
2965
|
const o = `
|
|
2951
2966
|
:host {
|
|
@@ -4234,18 +4249,25 @@ function Nn(e, t) {
|
|
|
4234
4249
|
font-size: 12px;
|
|
4235
4250
|
line-height: 1.4;
|
|
4236
4251
|
}
|
|
4252
|
+
.pluno-pa-widget__notify-suggestion-label {
|
|
4253
|
+
min-width: 0;
|
|
4254
|
+
}
|
|
4237
4255
|
.pluno-pa-widget__notify-suggestion-actions {
|
|
4256
|
+
flex: 0 0 auto;
|
|
4238
4257
|
display: inline-flex;
|
|
4239
4258
|
align-items: center;
|
|
4240
4259
|
gap: 10px;
|
|
4260
|
+
white-space: nowrap;
|
|
4241
4261
|
}
|
|
4242
4262
|
.pluno-pa-widget__notify-suggestion-actions button {
|
|
4243
4263
|
border: none;
|
|
4244
4264
|
background: none;
|
|
4245
4265
|
padding: 0;
|
|
4266
|
+
font: inherit;
|
|
4246
4267
|
font-size: 12px;
|
|
4247
4268
|
cursor: pointer;
|
|
4248
4269
|
color: var(--pluno-pa-muted);
|
|
4270
|
+
white-space: nowrap;
|
|
4249
4271
|
}
|
|
4250
4272
|
.pluno-pa-widget__notify-suggestion-enable {
|
|
4251
4273
|
color: var(--pluno-pa-accent) !important;
|
|
@@ -4688,6 +4710,9 @@ function Nn(e, t) {
|
|
|
4688
4710
|
padding: 2px 0;
|
|
4689
4711
|
text-align: left;
|
|
4690
4712
|
}
|
|
4713
|
+
.pluno-pa-widget__thinking-marker .pluno-pa-widget__status {
|
|
4714
|
+
align-self: center;
|
|
4715
|
+
}
|
|
4691
4716
|
.pluno-pa-widget__thinking-dot {
|
|
4692
4717
|
flex: 0 0 auto;
|
|
4693
4718
|
width: 6px;
|
|
@@ -4801,6 +4826,10 @@ function Nn(e, t) {
|
|
|
4801
4826
|
.pluno-pa-widget--scribble .pluno-pa-widget__message {
|
|
4802
4827
|
font-size: 17px;
|
|
4803
4828
|
}
|
|
4829
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__notify-suggestion,
|
|
4830
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__notify-suggestion-actions button {
|
|
4831
|
+
font-size: 17px;
|
|
4832
|
+
}
|
|
4804
4833
|
.pluno-pa-widget--scribble .pluno-pa-widget__input {
|
|
4805
4834
|
font-size: 17px;
|
|
4806
4835
|
line-height: 26px;
|
|
@@ -5124,28 +5153,28 @@ function Nn(e, t) {
|
|
|
5124
5153
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
5125
5154
|
}
|
|
5126
5155
|
`;
|
|
5127
|
-
if (
|
|
5156
|
+
if (Wa(e, o))
|
|
5128
5157
|
return;
|
|
5129
5158
|
const n = e.ownerDocument.createElement("style");
|
|
5130
|
-
n.id =
|
|
5159
|
+
n.id = Wn, n.textContent = o, e.appendChild(n), oo(e);
|
|
5131
5160
|
}
|
|
5132
|
-
function
|
|
5133
|
-
return e.getElementById(
|
|
5161
|
+
function Ha(e) {
|
|
5162
|
+
return e.getElementById(Wn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gn) === "true";
|
|
5134
5163
|
}
|
|
5135
|
-
function
|
|
5136
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
5164
|
+
function oo(e) {
|
|
5165
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Gn, "true");
|
|
5137
5166
|
}
|
|
5138
|
-
function
|
|
5167
|
+
function Wa(e, t) {
|
|
5139
5168
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5140
5169
|
return !1;
|
|
5141
5170
|
try {
|
|
5142
5171
|
const o = new CSSStyleSheet();
|
|
5143
|
-
return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o],
|
|
5172
|
+
return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], oo(e), !0;
|
|
5144
5173
|
} catch {
|
|
5145
5174
|
return !1;
|
|
5146
5175
|
}
|
|
5147
5176
|
}
|
|
5148
|
-
async function
|
|
5177
|
+
async function Ga() {
|
|
5149
5178
|
return document.body ? document.body : await new Promise((e) => {
|
|
5150
5179
|
const t = new MutationObserver(() => {
|
|
5151
5180
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -5153,39 +5182,41 @@ async function Ba() {
|
|
|
5153
5182
|
t.observe(document.documentElement, { childList: !0 });
|
|
5154
5183
|
});
|
|
5155
5184
|
}
|
|
5156
|
-
function
|
|
5185
|
+
function io(e) {
|
|
5157
5186
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5158
5187
|
}
|
|
5159
|
-
function
|
|
5188
|
+
function $a(e) {
|
|
5160
5189
|
try {
|
|
5161
|
-
const t = window.localStorage.getItem(
|
|
5190
|
+
const t = window.localStorage.getItem(io(e));
|
|
5162
5191
|
if (!t)
|
|
5163
5192
|
return Tn();
|
|
5164
5193
|
const o = JSON.parse(t);
|
|
5165
5194
|
return {
|
|
5166
5195
|
isOpen: o.isOpen === !0,
|
|
5167
5196
|
composerValue: typeof o.composerValue == "string" ? o.composerValue : "",
|
|
5197
|
+
focusedInput: o.focusedInput === "composer" || o.focusedInput === "launcher" ? o.focusedInput : null,
|
|
5198
|
+
focusedInputAt: typeof o.focusedInputAt == "number" ? o.focusedInputAt : null,
|
|
5168
5199
|
openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
|
|
5169
5200
|
(n) => typeof n == "string"
|
|
5170
5201
|
) : [],
|
|
5171
|
-
launcherPosition:
|
|
5172
|
-
seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-
|
|
5202
|
+
launcherPosition: Ka(o.launcherPosition) ? o.launcherPosition : null,
|
|
5203
|
+
seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-On) : [],
|
|
5173
5204
|
sharePromptsDisabled: o.sharePromptsDisabled === !0
|
|
5174
5205
|
};
|
|
5175
5206
|
} catch {
|
|
5176
5207
|
return Tn();
|
|
5177
5208
|
}
|
|
5178
5209
|
}
|
|
5179
|
-
async function
|
|
5210
|
+
async function qa(e) {
|
|
5180
5211
|
if (e.loadSharePromptsDisabled)
|
|
5181
5212
|
return e.loadSharePromptsDisabled();
|
|
5182
5213
|
try {
|
|
5183
|
-
return window.localStorage.getItem(
|
|
5214
|
+
return window.localStorage.getItem(Un) === "true";
|
|
5184
5215
|
} catch {
|
|
5185
5216
|
return !1;
|
|
5186
5217
|
}
|
|
5187
5218
|
}
|
|
5188
|
-
function
|
|
5219
|
+
function ja(e, t) {
|
|
5189
5220
|
if (e.persistSharePromptsDisabled) {
|
|
5190
5221
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
5191
5222
|
() => {
|
|
@@ -5194,7 +5225,7 @@ function Wa(e, t) {
|
|
|
5194
5225
|
return;
|
|
5195
5226
|
}
|
|
5196
5227
|
try {
|
|
5197
|
-
t && window.localStorage.setItem(
|
|
5228
|
+
t && window.localStorage.setItem(Un, "true");
|
|
5198
5229
|
} catch {
|
|
5199
5230
|
return;
|
|
5200
5231
|
}
|
|
@@ -5203,52 +5234,54 @@ function Tn() {
|
|
|
5203
5234
|
return {
|
|
5204
5235
|
isOpen: !1,
|
|
5205
5236
|
composerValue: "",
|
|
5237
|
+
focusedInput: null,
|
|
5238
|
+
focusedInputAt: null,
|
|
5206
5239
|
openToolGroupKeys: [],
|
|
5207
5240
|
launcherPosition: null,
|
|
5208
5241
|
seenShareCandidateIds: [],
|
|
5209
5242
|
sharePromptsDisabled: !1
|
|
5210
5243
|
};
|
|
5211
5244
|
}
|
|
5212
|
-
function
|
|
5245
|
+
function Va(e, t) {
|
|
5213
5246
|
try {
|
|
5214
5247
|
window.localStorage.setItem(
|
|
5215
|
-
|
|
5248
|
+
io(e),
|
|
5216
5249
|
JSON.stringify(t)
|
|
5217
5250
|
);
|
|
5218
5251
|
} catch {
|
|
5219
5252
|
return;
|
|
5220
5253
|
}
|
|
5221
5254
|
}
|
|
5222
|
-
function
|
|
5255
|
+
function Ka(e) {
|
|
5223
5256
|
if (!e || typeof e != "object")
|
|
5224
5257
|
return !1;
|
|
5225
5258
|
const t = e;
|
|
5226
5259
|
return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
|
|
5227
5260
|
}
|
|
5228
|
-
const
|
|
5229
|
-
function
|
|
5261
|
+
const Pn = /* @__PURE__ */ new WeakSet();
|
|
5262
|
+
function Ya(e) {
|
|
5230
5263
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5231
5264
|
}
|
|
5232
|
-
function
|
|
5265
|
+
function Dn(e) {
|
|
5233
5266
|
const t = e.pathname.split("/");
|
|
5234
5267
|
return t[t.length - 1] ?? "";
|
|
5235
5268
|
}
|
|
5236
|
-
function
|
|
5269
|
+
function Xa(e, t) {
|
|
5237
5270
|
const o = new URL(e.src, document.baseURI);
|
|
5238
|
-
return o.href === t.href || o.pathname === t.pathname ? !0 :
|
|
5271
|
+
return o.href === t.href || o.pathname === t.pathname ? !0 : Dn(o) === Dn(t);
|
|
5239
5272
|
}
|
|
5240
5273
|
class re extends EventTarget {
|
|
5241
5274
|
constructor(t, o) {
|
|
5242
|
-
super(), this.channelId = o, this.url = t, this.addPreviewListener(
|
|
5275
|
+
super(), this.channelId = o, this.url = t, this.addPreviewListener(Zo, () => {
|
|
5243
5276
|
this.readyState = re.OPEN, this.dispatchEvent(new Event("open"));
|
|
5244
|
-
}), this.addPreviewListener(
|
|
5277
|
+
}), this.addPreviewListener(Jo, (n) => {
|
|
5245
5278
|
const i = n;
|
|
5246
5279
|
this.dispatchEvent(
|
|
5247
5280
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5248
5281
|
);
|
|
5249
|
-
}), this.addPreviewListener(
|
|
5282
|
+
}), this.addPreviewListener(Qo, () => {
|
|
5250
5283
|
this.readyState = re.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5251
|
-
}), this.addPreviewListener(
|
|
5284
|
+
}), this.addPreviewListener(ei, (n) => {
|
|
5252
5285
|
const i = n;
|
|
5253
5286
|
this.readyState = re.CLOSED, this.dispatchEvent(
|
|
5254
5287
|
new CloseEvent("close", {
|
|
@@ -5260,7 +5293,7 @@ class re extends EventTarget {
|
|
|
5260
5293
|
}), window.dispatchEvent(
|
|
5261
5294
|
new CustomEvent(
|
|
5262
5295
|
tt(
|
|
5263
|
-
|
|
5296
|
+
Ko,
|
|
5264
5297
|
this.channelId
|
|
5265
5298
|
),
|
|
5266
5299
|
{
|
|
@@ -5280,7 +5313,7 @@ class re extends EventTarget {
|
|
|
5280
5313
|
binaryType = "blob";
|
|
5281
5314
|
bufferedAmount = 0;
|
|
5282
5315
|
readyState = re.CONNECTING;
|
|
5283
|
-
socketId =
|
|
5316
|
+
socketId = Za();
|
|
5284
5317
|
listeners = /* @__PURE__ */ new Map();
|
|
5285
5318
|
send(t) {
|
|
5286
5319
|
if (this.readyState !== re.OPEN)
|
|
@@ -5290,7 +5323,7 @@ class re extends EventTarget {
|
|
|
5290
5323
|
);
|
|
5291
5324
|
window.dispatchEvent(
|
|
5292
5325
|
new CustomEvent(
|
|
5293
|
-
tt(
|
|
5326
|
+
tt(Yo, this.channelId),
|
|
5294
5327
|
{
|
|
5295
5328
|
detail: {
|
|
5296
5329
|
socketId: this.socketId,
|
|
@@ -5303,7 +5336,7 @@ class re extends EventTarget {
|
|
|
5303
5336
|
close(t, o) {
|
|
5304
5337
|
this.readyState !== re.CLOSED && (this.readyState = re.CLOSING, window.dispatchEvent(
|
|
5305
5338
|
new CustomEvent(
|
|
5306
|
-
tt(
|
|
5339
|
+
tt(Xo, this.channelId),
|
|
5307
5340
|
{
|
|
5308
5341
|
detail: { socketId: this.socketId, code: t, reason: o }
|
|
5309
5342
|
}
|
|
@@ -5325,19 +5358,19 @@ class re extends EventTarget {
|
|
|
5325
5358
|
this.listeners.clear();
|
|
5326
5359
|
}
|
|
5327
5360
|
}
|
|
5328
|
-
function
|
|
5361
|
+
function Za() {
|
|
5329
5362
|
const e = window.sessionStorage.getItem(
|
|
5330
|
-
|
|
5363
|
+
rn
|
|
5331
5364
|
);
|
|
5332
5365
|
if (e)
|
|
5333
5366
|
return e;
|
|
5334
5367
|
const t = crypto.randomUUID();
|
|
5335
|
-
return window.sessionStorage.setItem(
|
|
5368
|
+
return window.sessionStorage.setItem(rn, t), t;
|
|
5336
5369
|
}
|
|
5337
5370
|
function tt(e, t) {
|
|
5338
5371
|
return `${e}:${t}`;
|
|
5339
5372
|
}
|
|
5340
|
-
function
|
|
5373
|
+
function Ja(e) {
|
|
5341
5374
|
const t = document.currentScript;
|
|
5342
5375
|
if (t instanceof HTMLScriptElement)
|
|
5343
5376
|
return [t];
|
|
@@ -5345,20 +5378,20 @@ function Ka(e) {
|
|
|
5345
5378
|
return Array.from(
|
|
5346
5379
|
document.querySelectorAll("script[type='module'][src]")
|
|
5347
5380
|
).filter(
|
|
5348
|
-
(i) => i instanceof HTMLScriptElement &&
|
|
5381
|
+
(i) => i instanceof HTMLScriptElement && Ya(i) && Xa(i, n)
|
|
5349
5382
|
);
|
|
5350
5383
|
}
|
|
5351
|
-
function
|
|
5352
|
-
for (const t of
|
|
5353
|
-
if (
|
|
5384
|
+
function Qa(e) {
|
|
5385
|
+
for (const t of Ja(e)) {
|
|
5386
|
+
if (Pn.has(t) || t.dataset.plunoAutoMount === "false")
|
|
5354
5387
|
continue;
|
|
5355
|
-
|
|
5388
|
+
Pn.add(t);
|
|
5356
5389
|
const o = t.dataset.plunoPreviewChannel;
|
|
5357
|
-
|
|
5390
|
+
ki({
|
|
5358
5391
|
token: t.dataset.plunoToken,
|
|
5359
5392
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
5360
5393
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
5361
|
-
webSocketFactory: o ?
|
|
5394
|
+
webSocketFactory: o ? Ei(o) : void 0,
|
|
5362
5395
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
5363
5396
|
accentColor: t.dataset.plunoAccentColor,
|
|
5364
5397
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -5370,8 +5403,8 @@ function Ya(e) {
|
|
|
5370
5403
|
});
|
|
5371
5404
|
}
|
|
5372
5405
|
}
|
|
5373
|
-
|
|
5406
|
+
Qa(import.meta.url);
|
|
5374
5407
|
export {
|
|
5375
|
-
|
|
5376
|
-
|
|
5408
|
+
Ei as createProductAgentPreviewBridgeWebSocketFactory,
|
|
5409
|
+
ki as mountPlunoProductAgentWidget
|
|
5377
5410
|
};
|