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