@pluno/product-agent-web 0.1.67 → 0.1.69
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/INTEGRATION.md +41 -3
- package/README.md +37 -1
- package/dist/index.d.ts +39 -3
- package/dist/product-agent-sdk.js +1056 -611
- package/dist/product-agent-widget.js +1283 -1228
- package/dist/transportIdentity.d.ts +26 -0
- package/dist/widget.d.ts +16 -11
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as Jo, getProductAgentOriginAccessErrorMessage as Qo } from "./product-agent-sdk.js";
|
|
2
|
+
const ei = "#7c3aed", st = "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", dt = "#2c2a1e", yn = [253, 250, 241], vn = 3.5;
|
|
3
|
+
function eo(e) {
|
|
4
|
+
const t = to(e);
|
|
5
|
+
if (Cn(Ye(t), yn) >= vn)
|
|
6
6
|
return t;
|
|
7
|
-
let o =
|
|
8
|
-
const i =
|
|
9
|
-
for (let
|
|
10
|
-
if (o =
|
|
11
|
-
return
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
function
|
|
7
|
+
let o = Ye(t);
|
|
8
|
+
const i = Ye(dt);
|
|
9
|
+
for (let a = 0; a < 6; a += 1)
|
|
10
|
+
if (o = oi(o, i, 0.22), Cn(o, yn) >= vn)
|
|
11
|
+
return Gt(o);
|
|
12
|
+
return Gt(o);
|
|
13
|
+
}
|
|
14
|
+
function ti() {
|
|
15
15
|
let n = "M 280 120", o = !1, i = 0;
|
|
16
|
-
for (let
|
|
16
|
+
for (let a = 150; a <= 1170; a += 62) {
|
|
17
17
|
const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
18
|
-
n += ` L ${p} ${
|
|
18
|
+
n += ` L ${p} ${a}`, o = !o, i += 1;
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function ni(e) {
|
|
23
|
+
const t = to(e), n = $t(Ye(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -56,34 +56,34 @@ function Yo(e) {
|
|
|
56
56
|
shadow: ne(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function to(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((n) => n + n).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((n) => n + n).join("").toLowerCase()}` : ei;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Ye(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 Gt([e, t, n]) {
|
|
71
71
|
const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
|
|
72
72
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function $t([e, t, n]) {
|
|
75
75
|
const o = (i) => {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
76
|
+
const a = i / 255;
|
|
77
|
+
return a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
79
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const n =
|
|
83
|
-
return (i + 0.05) / (
|
|
81
|
+
function Cn(e, t) {
|
|
82
|
+
const n = $t(e), o = $t(t), [i, a] = n > o ? [n, o] : [o, n];
|
|
83
|
+
return (i + 0.05) / (a + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const o =
|
|
85
|
+
function oi(e, t, n) {
|
|
86
|
+
const o = qt(n);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * o,
|
|
89
89
|
e[1] + (t[1] - e[1]) * o,
|
|
@@ -91,43 +91,43 @@ function Xo(e, t, n) {
|
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
93
|
function ne(e, t, n) {
|
|
94
|
-
const [o, i,
|
|
95
|
-
return
|
|
94
|
+
const [o, i, a] = ii(Ye(e));
|
|
95
|
+
return Gt(ai(o, qt(i + n), qt(a + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const o = e / 255, i = t / 255,
|
|
97
|
+
function ii([e, t, n]) {
|
|
98
|
+
const o = e / 255, i = t / 255, a = n / 255, l = Math.max(o, i, a), p = Math.min(o, i, a), d = (l + p) / 2;
|
|
99
99
|
if (l === p)
|
|
100
100
|
return [0, 0, d];
|
|
101
101
|
const c = l - p, u = d > 0.5 ? c / (2 - l - p) : c / (l + p);
|
|
102
|
-
return [(l === o ? (i -
|
|
102
|
+
return [(l === o ? (i - a) / c + (i < a ? 6 : 0) : l === i ? (a - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function ai(e, t, n) {
|
|
105
105
|
if (t === 0)
|
|
106
106
|
return [n * 255, n * 255, n * 255];
|
|
107
107
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
|
|
108
108
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
Nt(i, o, e + 1 / 3) * 255,
|
|
110
|
+
Nt(i, o, e) * 255,
|
|
111
|
+
Nt(i, o, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Nt(e, t, n) {
|
|
115
115
|
let o = n;
|
|
116
116
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function qt(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const no = "suggest_share_on_socials";
|
|
122
|
+
function ri(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
124
|
const n = e[t];
|
|
125
|
-
if (n.role !== "tool" || n.toolName !==
|
|
125
|
+
if (n.role !== "tool" || n.toolName !== no)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = Sn(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = Sn(e, o.index, "user");
|
|
131
131
|
return i ? {
|
|
132
132
|
id: `share:${n.callId ?? n.id}`,
|
|
133
133
|
userPrompt: i.content,
|
|
@@ -136,13 +136,13 @@ function Qo(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function li(e) {
|
|
140
|
+
const t = await pi(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 Sn(e, t, n) {
|
|
146
146
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
147
147
|
const i = e[o];
|
|
148
148
|
if (i.role === n && i.content.trim())
|
|
@@ -150,81 +150,81 @@ function _n(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function pi(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
let n = !1, o = null, i = null,
|
|
156
|
+
const si = "https://app.pluno.ai", di = "/api/product-agent/embed/active-users", ci = 1800, ui = 15e3, gi = 250, hi = 1e3, mi = 3e4;
|
|
157
|
+
function fi(e, t = {}) {
|
|
158
|
+
let n = !1, o = null, i = null, a = null;
|
|
159
159
|
const l = () => {
|
|
160
|
-
|
|
160
|
+
a !== null && (window.clearInterval(a), a = null);
|
|
161
161
|
}, p = (u) => {
|
|
162
162
|
n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
|
|
163
163
|
c();
|
|
164
|
-
},
|
|
164
|
+
}, _i(u)));
|
|
165
165
|
}, d = (u) => {
|
|
166
166
|
if (l(), o === null) {
|
|
167
167
|
o = u, e(u);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
const m = o,
|
|
171
|
-
|
|
170
|
+
const m = o, E = performance.now();
|
|
171
|
+
a = window.setInterval(() => {
|
|
172
172
|
if (n) {
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const v = Math.min(1, (performance.now() -
|
|
177
|
-
o = Math.round(m + (u - m) *
|
|
178
|
-
},
|
|
176
|
+
const v = Math.min(1, (performance.now() - E) / ci);
|
|
177
|
+
o = Math.round(m + (u - m) * xi(v)), e(o), v >= 1 && (o = u, e(u), l());
|
|
178
|
+
}, gi);
|
|
179
179
|
}, c = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const u = await
|
|
181
|
+
const u = await wi(t);
|
|
182
182
|
if (n)
|
|
183
183
|
return;
|
|
184
184
|
d(u.count), p(u.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(ui);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return c(), () => {
|
|
190
190
|
n = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function wi(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
196
|
+
const n = await (e.fetcher ?? fetch)(new URL(di, bi(e.backendUrl ?? si)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
200
200
|
if (!n.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const o = await n.json(), i =
|
|
203
|
-
if (i === null ||
|
|
202
|
+
const o = await n.json(), i = En(o.count), a = En(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
203
|
+
if (i === null || a === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
|
-
return { count: i, refreshAfterMs:
|
|
205
|
+
return { count: i, refreshAfterMs: a };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function En(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function bi(e) {
|
|
211
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return Math.min(
|
|
213
|
+
function _i(e) {
|
|
214
|
+
return Math.min(mi, Math.max(hi, e));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function xi(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 oo = 100, yi = 1e4, vi = 5e3, Ci = "product-agent:sdk-preview-socket-connect", Si = "product-agent:sdk-preview-socket-send", Ei = "product-agent:sdk-preview-socket-close", ki = "product-agent:sdk-preview-socket-open", Li = "product-agent:sdk-preview-socket-message", Pi = "product-agent:sdk-preview-socket-error", Ii = "product-agent:sdk-preview-socket-closed", kn = "product-agent:sdk-preview-socket-id", Ti = "data-pluno-sdk-preview-channel", io = "data-pluno-auto-mounted", se = "__plunoProductAgentAutoMountOwner", Ai = 1e4, Ni = "Failed to load Pluno widget token", Ln = "Timed out loading Pluno widget token", Di = "pluno.productAgent.widgetClientId.", Dt = /* @__PURE__ */ new Set(), Ri = "product-agent:preview-diagnostic", ao = "pluno.productAgent.sharePromptsDisabled", zi = 3, Pn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Mi = 400, Oi = 5e3, Ui = 500, In = "Close the page's popup to chat", Bi = "No recent chats for this page yet.", oe = {
|
|
220
220
|
launcherLabel: "Ask for anything...",
|
|
221
221
|
accentColor: "#7c3aed",
|
|
222
222
|
colorScheme: "light",
|
|
223
223
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif',
|
|
224
|
-
scribbleStyle: !
|
|
224
|
+
scribbleStyle: !0,
|
|
225
225
|
position: "bottom-right",
|
|
226
226
|
movableLauncher: !1
|
|
227
|
-
},
|
|
227
|
+
}, Fi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tn = "pluno-pa-scribble-font", ro = 190, lo = 41, An = 22, Hi = 16, Wi = 24, Gi = 1, $i = 48, tn = 420, qi = 520, ji = 0.24, nn = 680, Vi = 800, Ki = 0.76, I = 8, Se = 50, po = "http://www.w3.org/2000/svg", jt = 26, Vt = 8, Yi = 36, Kt = 16, Xi = 4, Nn = [
|
|
228
228
|
{
|
|
229
229
|
ellipseCx: "17.5",
|
|
230
230
|
ellipseCy: "24.5",
|
|
@@ -261,12 +261,12 @@ const Zn = 100, hi = 1e4, mi = 5e3, fi = "product-agent:sdk-preview-socket-conne
|
|
|
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
|
+
], Zi = 11, Ji = 13, Yt = 4, so = 10, co = 40, Qi = "movable-launcher-position-v2", uo = "pluno-pa-widget-styles", go = "data-pluno-pa-widget-styles";
|
|
265
|
+
let Dn = 0;
|
|
266
|
+
function ea(e) {
|
|
267
|
+
return (t) => new de(t, e);
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function ta(e = {}) {
|
|
270
270
|
const t = {
|
|
271
271
|
launcherLabel: e.launcherLabel ?? oe.launcherLabel,
|
|
272
272
|
accentColor: e.accentColor ?? oe.accentColor,
|
|
@@ -325,63 +325,52 @@ async function Gi(e = {}) {
|
|
|
325
325
|
);
|
|
326
326
|
const n = document.createElement("div");
|
|
327
327
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
|
|
328
|
-
|
|
328
|
+
Ti,
|
|
329
329
|
t.sdkPreviewChannelId
|
|
330
330
|
);
|
|
331
331
|
const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
332
332
|
i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
333
|
-
let
|
|
333
|
+
let a = Rn(
|
|
334
334
|
t.accentColor,
|
|
335
335
|
t.scribbleStyle
|
|
336
336
|
);
|
|
337
|
-
|
|
337
|
+
Sa(
|
|
338
338
|
i,
|
|
339
339
|
t.launcherLabel,
|
|
340
|
-
|
|
340
|
+
a,
|
|
341
341
|
t.movableLauncher,
|
|
342
342
|
t.showLauncherMinimizeButton
|
|
343
343
|
), o.appendChild(i);
|
|
344
|
-
const l =
|
|
344
|
+
const l = yr(t);
|
|
345
345
|
let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null, c = l.panelSize, u = 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"),
|
|
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"), Ce(
|
|
347
347
|
i,
|
|
348
|
-
|
|
348
|
+
zt(
|
|
349
349
|
i,
|
|
350
350
|
p,
|
|
351
351
|
t.position
|
|
352
352
|
)
|
|
353
|
-
)),
|
|
353
|
+
)), Xn(o, t.accentColor), zn(i, a, {
|
|
354
354
|
accentColor: t.accentColor,
|
|
355
355
|
colorScheme: t.colorScheme,
|
|
356
356
|
fontFamily: t.fontFamily,
|
|
357
357
|
scribbleStyle: t.scribbleStyle
|
|
358
358
|
});
|
|
359
|
-
const m = await
|
|
360
|
-
m.appendChild(n), J(
|
|
361
|
-
"web-sdk.widget",
|
|
362
|
-
"Applied initial widget appearance",
|
|
363
|
-
{
|
|
364
|
-
accentColor: t.accentColor,
|
|
365
|
-
colorScheme: t.colorScheme,
|
|
366
|
-
fontFamily: t.fontFamily,
|
|
367
|
-
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
const v = i.querySelector(
|
|
359
|
+
const m = await _r(), E = m.ownerDocument, v = i.querySelector(
|
|
371
360
|
".pluno-pa-widget__launcher"
|
|
372
|
-
),
|
|
361
|
+
), z = i.querySelector(
|
|
373
362
|
".pluno-pa-widget__launcher-drag-handle"
|
|
374
|
-
),
|
|
363
|
+
), b = i.querySelector(
|
|
375
364
|
".pluno-pa-widget__launcher-input"
|
|
376
365
|
), g = i.querySelector(
|
|
377
366
|
".pluno-pa-widget__launcher-minimize"
|
|
378
|
-
),
|
|
367
|
+
), w = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
|
|
379
368
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
380
369
|
), P = Array.from(
|
|
381
370
|
i.querySelectorAll(".pluno-pa-widget__resize-handle")
|
|
382
|
-
),
|
|
371
|
+
), T = i.querySelector(
|
|
383
372
|
".pluno-pa-widget__close"
|
|
384
|
-
),
|
|
373
|
+
), k = i.querySelector(
|
|
385
374
|
".pluno-pa-widget__composer"
|
|
386
375
|
), F = i.querySelector(
|
|
387
376
|
".pluno-pa-widget__attachment-error"
|
|
@@ -391,143 +380,143 @@ async function Gi(e = {}) {
|
|
|
391
380
|
".pluno-pa-widget__attachments"
|
|
392
381
|
), Q = i.querySelector(
|
|
393
382
|
".pluno-pa-widget__attachment-input"
|
|
394
|
-
),
|
|
383
|
+
), Me = i.querySelector(
|
|
395
384
|
".pluno-pa-widget__attach"
|
|
396
385
|
), x = i.querySelector(
|
|
397
386
|
".pluno-pa-widget__input"
|
|
398
|
-
),
|
|
387
|
+
), ce = i.querySelector(
|
|
399
388
|
".pluno-pa-widget__send"
|
|
400
|
-
),
|
|
389
|
+
), Xe = i.querySelector(
|
|
401
390
|
".pluno-pa-widget__top-actions"
|
|
402
391
|
), X = i.querySelector(
|
|
403
392
|
".pluno-pa-widget__history"
|
|
404
393
|
), C = i.querySelector(
|
|
405
394
|
".pluno-pa-widget__history-panel"
|
|
406
|
-
),
|
|
395
|
+
), N = i.querySelector(
|
|
407
396
|
".pluno-pa-widget__history-list"
|
|
408
|
-
),
|
|
397
|
+
), Ee = i.querySelector(
|
|
409
398
|
".pluno-pa-widget__history-close"
|
|
410
399
|
), q = i.querySelector(
|
|
411
400
|
".pluno-pa-widget__history-status"
|
|
412
|
-
),
|
|
401
|
+
), R = i.querySelector(
|
|
413
402
|
".pluno-pa-widget__timeline-jump"
|
|
414
403
|
), D = i.querySelector(
|
|
415
404
|
".pluno-pa-widget__active-users-counter"
|
|
416
|
-
),
|
|
405
|
+
), A = i.querySelector(
|
|
417
406
|
".pluno-pa-widget__timeline"
|
|
418
|
-
),
|
|
407
|
+
), mt = i.querySelector(
|
|
419
408
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
420
|
-
),
|
|
409
|
+
), Oe = i.querySelector(
|
|
421
410
|
".pluno-pa-widget__notify-suggestion"
|
|
422
|
-
),
|
|
411
|
+
), Ao = i.querySelector(
|
|
423
412
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
424
|
-
),
|
|
413
|
+
), No = i.querySelector(
|
|
425
414
|
".pluno-pa-widget__notify-suggestion-later"
|
|
426
|
-
),
|
|
415
|
+
), Do = i.querySelector(
|
|
427
416
|
".pluno-pa-widget__notify-suggestion-never"
|
|
428
417
|
);
|
|
429
|
-
if (!v || !
|
|
418
|
+
if (!v || !b || !w || !T || !k || !F || !H || !$ || !Q || !Me || !x || !ce || !Xe || !X || !C || !N || !Ee || !q || !R || !D || !A || !mt)
|
|
430
419
|
throw new Error("Failed to mount Pluno widget");
|
|
431
|
-
if (t.movableLauncher && !
|
|
420
|
+
if (t.movableLauncher && !z)
|
|
432
421
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
433
|
-
|
|
422
|
+
Wn(b), Wn(x);
|
|
434
423
|
let W = [], le = null;
|
|
435
|
-
const
|
|
436
|
-
|
|
424
|
+
const ke = () => {
|
|
425
|
+
Ga(
|
|
437
426
|
$,
|
|
438
427
|
W,
|
|
439
|
-
(
|
|
428
|
+
(r) => {
|
|
440
429
|
W = W.filter(
|
|
441
|
-
(s,
|
|
442
|
-
),
|
|
430
|
+
(s, _) => _ !== r
|
|
431
|
+
), ke(), G(y.getState()), j();
|
|
443
432
|
}
|
|
444
433
|
);
|
|
445
|
-
},
|
|
434
|
+
}, Ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
446
435
|
if (!t.tokenEndpoint)
|
|
447
436
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
credentials: "include",
|
|
451
|
-
headers: { "content-type": "application/json" },
|
|
452
|
-
body: JSON.stringify({
|
|
453
|
-
origin: location.origin,
|
|
454
|
-
url: location.href
|
|
455
|
-
})
|
|
456
|
-
});
|
|
457
|
-
if (!a.ok) {
|
|
458
|
-
const w = await a.text(), S = jo(w);
|
|
459
|
-
throw S ? (console.error(S), new Error(S)) : new Error(`Failed to load Pluno token (${a.status})`);
|
|
460
|
-
}
|
|
461
|
-
const s = await a.json();
|
|
462
|
-
if (!s.token)
|
|
463
|
-
throw new Error("Pluno token endpoint did not return a token");
|
|
464
|
-
return s.token;
|
|
465
|
-
}), ko = window.fetch.bind(window);
|
|
437
|
+
return Io(t.tokenEndpoint);
|
|
438
|
+
}), zo = window.fetch.bind(window), ft = xr(t.clientId);
|
|
466
439
|
let y;
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
440
|
+
try {
|
|
441
|
+
const r = {
|
|
442
|
+
token: t.token,
|
|
443
|
+
tokenProvider: Ro,
|
|
444
|
+
backendUrl: t.backendUrl,
|
|
445
|
+
metadata: () => ({
|
|
446
|
+
...t.metadata ?? {},
|
|
447
|
+
...!y.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
448
|
+
}),
|
|
449
|
+
initialStarterPrompts: t.initialStarterPrompts,
|
|
450
|
+
clientId: ft.clientId,
|
|
451
|
+
restorePersistedState: t.restorePersistedState,
|
|
452
|
+
expectedPersistedSessionId: t.expectedPersistedSessionId,
|
|
453
|
+
webSocketFactory: t.webSocketFactory,
|
|
454
|
+
prepareAttachmentUpload: t.prepareAttachmentUpload,
|
|
455
|
+
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0,
|
|
456
|
+
disableNetworkCapture: !!t.sdkPreviewChannelId
|
|
457
|
+
};
|
|
458
|
+
y = await Jo.init(r);
|
|
459
|
+
} catch (r) {
|
|
460
|
+
throw ft.release(), n.remove(), r;
|
|
461
|
+
}
|
|
462
|
+
m.appendChild(n), J(
|
|
463
|
+
"web-sdk.widget",
|
|
464
|
+
"Applied initial widget appearance",
|
|
465
|
+
{
|
|
466
|
+
accentColor: t.accentColor,
|
|
467
|
+
colorScheme: t.colorScheme,
|
|
468
|
+
fontFamily: t.fontFamily,
|
|
469
|
+
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
const wt = new Set(l.openToolGroupKeys), Le = new Set(
|
|
484
473
|
l.seenShareCandidateIds
|
|
485
|
-
),
|
|
486
|
-
let
|
|
474
|
+
), Ze = new Set(Le);
|
|
475
|
+
let bt = l.sharePromptsDisabled || await vr(t), Z = null, Pe = !1, we = !1, be = {
|
|
487
476
|
enabled: !0
|
|
488
|
-
},
|
|
489
|
-
const ee = (
|
|
490
|
-
|
|
477
|
+
}, _e = 0, rn = "", ue = !1, pe = !1, ge = [], _t = null, Ue = null;
|
|
478
|
+
const ee = (r, s) => {
|
|
479
|
+
be = { enabled: r, reason: s };
|
|
491
480
|
}, te = () => {
|
|
492
|
-
|
|
493
|
-
},
|
|
494
|
-
|
|
495
|
-
},
|
|
496
|
-
ee(!0,
|
|
497
|
-
},
|
|
498
|
-
if (X.hidden = t.loginRequired, C.hidden = !
|
|
481
|
+
R.hidden = !0;
|
|
482
|
+
}, Mo = () => {
|
|
483
|
+
R.hidden = !1;
|
|
484
|
+
}, Oo = (r = "jump") => {
|
|
485
|
+
ee(!0, r), te(), Ke(A, () => be.enabled), _e = A.scrollTop;
|
|
486
|
+
}, xe = () => {
|
|
487
|
+
if (X.hidden = t.loginRequired, C.hidden = !ue, X.setAttribute("aria-expanded", String(ue)), N.classList.toggle(
|
|
499
488
|
"pluno-pa-widget__history-list--center",
|
|
500
|
-
pe &&
|
|
501
|
-
),
|
|
502
|
-
const
|
|
503
|
-
|
|
489
|
+
pe && ge.length === 0
|
|
490
|
+
), N.replaceChildren(), pe && ge.length === 0) {
|
|
491
|
+
const r = document.createElement("p");
|
|
492
|
+
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", N.appendChild(r);
|
|
504
493
|
}
|
|
505
|
-
for (const
|
|
494
|
+
for (const r of ge) {
|
|
506
495
|
const s = document.createElement("button");
|
|
507
496
|
s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = pe;
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
497
|
+
const _ = document.createElement("span");
|
|
498
|
+
_.className = "pluno-pa-widget__history-item-title", _.textContent = ya(r);
|
|
499
|
+
const L = document.createElement("time");
|
|
500
|
+
L.className = "pluno-pa-widget__history-time", L.dateTime = r.lastActiveAt, L.textContent = Ca(
|
|
501
|
+
r.lastActiveAt,
|
|
513
502
|
Date.now()
|
|
514
503
|
);
|
|
515
504
|
const M = document.createElement("small");
|
|
516
|
-
M.className = "pluno-pa-widget__history-path", M.textContent =
|
|
517
|
-
|
|
518
|
-
}),
|
|
505
|
+
M.className = "pluno-pa-widget__history-path", M.textContent = va(r), s.append(_, L, M), s.addEventListener("click", () => {
|
|
506
|
+
ue = !1, Ue = null, xe(), ee(!0, "newSession"), te(), y.loadSession(r.id), G(y.getState());
|
|
507
|
+
}), N.appendChild(s);
|
|
519
508
|
}
|
|
520
|
-
if (pe &&
|
|
521
|
-
const
|
|
522
|
-
|
|
509
|
+
if (pe && ge.length > 0) {
|
|
510
|
+
const r = document.createElement("p");
|
|
511
|
+
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", N.appendChild(r);
|
|
523
512
|
}
|
|
524
|
-
q.textContent =
|
|
525
|
-
},
|
|
513
|
+
q.textContent = Ue ?? (!pe && ge.length === 0 ? "No recent chats for this page yet." : ""), q.hidden = q.textContent.length === 0;
|
|
514
|
+
}, ln = async (r) => {
|
|
526
515
|
if (!pe) {
|
|
527
|
-
pe = !0,
|
|
516
|
+
pe = !0, Ue = null, xe();
|
|
528
517
|
try {
|
|
529
|
-
const s = await y.listSessions({ cursor:
|
|
530
|
-
|
|
518
|
+
const s = await y.listSessions({ cursor: r, limit: 20 });
|
|
519
|
+
ge = r ? [...ge, ...s.sessions] : s.sessions, _t = s.nextCursor;
|
|
531
520
|
} catch (s) {
|
|
532
521
|
J(
|
|
533
522
|
"web-sdk.widget",
|
|
@@ -535,68 +524,64 @@ async function Gi(e = {}) {
|
|
|
535
524
|
{
|
|
536
525
|
message: s instanceof Error ? s.message : String(s)
|
|
537
526
|
}
|
|
538
|
-
),
|
|
527
|
+
), Ue = Bi;
|
|
539
528
|
} finally {
|
|
540
|
-
pe = !1,
|
|
529
|
+
pe = !1, xe();
|
|
541
530
|
}
|
|
542
531
|
}
|
|
543
|
-
},
|
|
544
|
-
!
|
|
545
|
-
},
|
|
546
|
-
|
|
547
|
-
},
|
|
548
|
-
|
|
532
|
+
}, Uo = () => {
|
|
533
|
+
!_t || pe || N.scrollHeight - N.scrollTop - N.clientHeight <= 24 && ln(_t);
|
|
534
|
+
}, pn = () => {
|
|
535
|
+
Pe || typeof document > "u" || (Xn(o, t.accentColor), n.isConnected || E.body?.appendChild(n));
|
|
536
|
+
}, sn = new MutationObserver(pn);
|
|
537
|
+
sn.observe(E.documentElement, {
|
|
549
538
|
childList: !0,
|
|
550
539
|
subtree: !0
|
|
551
|
-
});
|
|
552
|
-
const Be = (
|
|
553
|
-
const s =
|
|
554
|
-
return
|
|
540
|
+
}), pn();
|
|
541
|
+
const Be = (r = !0) => {
|
|
542
|
+
const s = ct(i, r);
|
|
543
|
+
return Xt(
|
|
555
544
|
i,
|
|
556
|
-
p ?
|
|
545
|
+
p ? ho(p, s) : sa(
|
|
557
546
|
i,
|
|
558
547
|
t.position,
|
|
559
548
|
s
|
|
560
549
|
),
|
|
561
550
|
s
|
|
562
551
|
);
|
|
563
|
-
},
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
_,
|
|
567
|
-
x
|
|
568
|
-
);
|
|
569
|
-
cr(t, {
|
|
552
|
+
}, U = () => {
|
|
553
|
+
const r = fa(o, b, x);
|
|
554
|
+
Sr(t, {
|
|
570
555
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
571
556
|
composerValue: x.value,
|
|
572
|
-
focusedInput:
|
|
573
|
-
focusedInputAt:
|
|
574
|
-
openToolGroupKeys: [...
|
|
557
|
+
focusedInput: r,
|
|
558
|
+
focusedInputAt: r ? Date.now() : null,
|
|
559
|
+
openToolGroupKeys: [...wt],
|
|
575
560
|
launcherPosition: d ? p : null,
|
|
576
561
|
panelSize: c,
|
|
577
|
-
seenShareCandidateIds: [...
|
|
578
|
-
-
|
|
562
|
+
seenShareCandidateIds: [...Le].slice(
|
|
563
|
+
-oo
|
|
579
564
|
),
|
|
580
|
-
sharePromptsDisabled:
|
|
565
|
+
sharePromptsDisabled: bt
|
|
581
566
|
});
|
|
582
|
-
},
|
|
583
|
-
t.onDisplayStateChange?.(
|
|
584
|
-
},
|
|
585
|
-
if (
|
|
586
|
-
i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") &&
|
|
567
|
+
}, Je = (r) => {
|
|
568
|
+
t.onDisplayStateChange?.(r);
|
|
569
|
+
}, Fe = (r, s = !0) => {
|
|
570
|
+
if (r === "shown") {
|
|
571
|
+
i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && He(!1), s && Je("shown");
|
|
587
572
|
return;
|
|
588
573
|
}
|
|
589
|
-
Z !== null && (window.clearTimeout(Z), Z = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1,
|
|
574
|
+
Z !== null && (window.clearTimeout(Z), Z = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, w.hidden = !0, T.hidden = !0, v.tabIndex = 0, x.value = "", Ce(
|
|
590
575
|
i,
|
|
591
|
-
|
|
576
|
+
zt(
|
|
592
577
|
i,
|
|
593
578
|
p,
|
|
594
579
|
t.position
|
|
595
580
|
)
|
|
596
|
-
),
|
|
597
|
-
},
|
|
598
|
-
|
|
599
|
-
debugVersion:
|
|
581
|
+
), Bn(i), U(), s && Je("minimized");
|
|
582
|
+
}, ye = (r, s = {}) => {
|
|
583
|
+
ma(r, {
|
|
584
|
+
debugVersion: Qi,
|
|
600
585
|
launcherPosition: p,
|
|
601
586
|
rootClasses: i.className,
|
|
602
587
|
rootStyle: {
|
|
@@ -605,35 +590,35 @@ async function Gi(e = {}) {
|
|
|
605
590
|
right: i.style.right,
|
|
606
591
|
bottom: i.style.bottom
|
|
607
592
|
},
|
|
608
|
-
rootRect:
|
|
609
|
-
launcherRect:
|
|
610
|
-
panelRect:
|
|
593
|
+
rootRect: Ot(i),
|
|
594
|
+
launcherRect: Ot(v),
|
|
595
|
+
panelRect: Ot(w),
|
|
611
596
|
viewport: Y(),
|
|
612
|
-
panelHidden:
|
|
613
|
-
closeHidden:
|
|
597
|
+
panelHidden: w.hidden,
|
|
598
|
+
closeHidden: T.hidden,
|
|
614
599
|
...s
|
|
615
600
|
});
|
|
616
|
-
},
|
|
601
|
+
}, He = (r = !0) => {
|
|
617
602
|
if (!p)
|
|
618
|
-
return
|
|
619
|
-
const s = Be(
|
|
620
|
-
return
|
|
603
|
+
return Ce(i, null), Be(r);
|
|
604
|
+
const s = Be(r);
|
|
605
|
+
return Ce(i, s), ye("Applied stored closed launcher position", {
|
|
621
606
|
visibleLauncherPosition: s
|
|
622
607
|
}), s;
|
|
623
|
-
},
|
|
624
|
-
if (!
|
|
625
|
-
|
|
608
|
+
}, xt = (r, s) => {
|
|
609
|
+
if (!r || !s) {
|
|
610
|
+
Bn(i);
|
|
626
611
|
return;
|
|
627
612
|
}
|
|
628
|
-
|
|
629
|
-
x:
|
|
630
|
-
y:
|
|
613
|
+
ha(i, {
|
|
614
|
+
x: r.x - s.x,
|
|
615
|
+
y: r.y - s.y
|
|
631
616
|
});
|
|
632
|
-
},
|
|
617
|
+
}, dn = () => {
|
|
633
618
|
if (i.classList.contains("pluno-pa-widget--minimized")) {
|
|
634
|
-
|
|
619
|
+
Ce(
|
|
635
620
|
i,
|
|
636
|
-
|
|
621
|
+
zt(
|
|
637
622
|
i,
|
|
638
623
|
p,
|
|
639
624
|
t.position
|
|
@@ -641,234 +626,234 @@ async function Gi(e = {}) {
|
|
|
641
626
|
);
|
|
642
627
|
return;
|
|
643
628
|
}
|
|
644
|
-
const
|
|
629
|
+
const r = He();
|
|
645
630
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
646
|
-
|
|
631
|
+
Rt(i, c);
|
|
647
632
|
const s = ze(c);
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
633
|
+
Bt(
|
|
634
|
+
h,
|
|
635
|
+
s.width
|
|
636
|
+
);
|
|
637
|
+
const _ = pt(
|
|
638
|
+
u ?? Mt(
|
|
651
639
|
i,
|
|
652
|
-
|
|
640
|
+
r,
|
|
653
641
|
t.position,
|
|
654
642
|
c
|
|
655
643
|
),
|
|
656
644
|
s
|
|
657
645
|
);
|
|
658
|
-
u && (u =
|
|
646
|
+
u && (u = _), xt(_, r), ye(
|
|
659
647
|
"Applied open panel position after viewport resize",
|
|
660
|
-
{ openPanelPosition:
|
|
648
|
+
{ openPanelPosition: _ }
|
|
661
649
|
);
|
|
662
|
-
} else p &&
|
|
650
|
+
} else p && ye(
|
|
663
651
|
"Applied visible launcher position after viewport resize",
|
|
664
|
-
{ visibleLauncherPosition:
|
|
652
|
+
{ visibleLauncherPosition: r }
|
|
665
653
|
);
|
|
666
654
|
};
|
|
667
|
-
let
|
|
655
|
+
let cn = () => {
|
|
668
656
|
};
|
|
669
|
-
window.addEventListener("resize",
|
|
657
|
+
window.addEventListener("resize", dn), t.movableLauncher && z ? (He(), cn = ra({
|
|
670
658
|
root: i,
|
|
671
659
|
launcher: v,
|
|
672
|
-
launcherDragHandle:
|
|
660
|
+
launcherDragHandle: z,
|
|
673
661
|
getPosition: () => Be(),
|
|
674
|
-
setPosition: (
|
|
675
|
-
const s =
|
|
662
|
+
setPosition: (r) => {
|
|
663
|
+
const s = r, _ = ct(i), L = Xt(
|
|
676
664
|
i,
|
|
677
|
-
|
|
678
|
-
|
|
665
|
+
r,
|
|
666
|
+
_
|
|
679
667
|
);
|
|
680
|
-
p =
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
),
|
|
668
|
+
p = ca(
|
|
669
|
+
L,
|
|
670
|
+
_
|
|
671
|
+
), Ce(i, L), ye("Dragging closed launcher", {
|
|
684
672
|
requestedPosition: s
|
|
685
673
|
});
|
|
686
674
|
},
|
|
687
675
|
persist: () => {
|
|
688
|
-
d = !0,
|
|
676
|
+
d = !0, U(), ye("Persisted closed launcher drag position");
|
|
689
677
|
}
|
|
690
|
-
})) :
|
|
691
|
-
const
|
|
692
|
-
const
|
|
678
|
+
})) : Ce(i, null), Rt(i, c);
|
|
679
|
+
const Bo = () => {
|
|
680
|
+
const r = ze(c), s = Be();
|
|
693
681
|
return {
|
|
694
|
-
position:
|
|
695
|
-
u ??
|
|
682
|
+
position: pt(
|
|
683
|
+
u ?? Mt(
|
|
696
684
|
i,
|
|
697
685
|
s,
|
|
698
686
|
t.position,
|
|
699
687
|
c
|
|
700
688
|
),
|
|
701
|
-
|
|
689
|
+
r
|
|
702
690
|
),
|
|
703
|
-
size:
|
|
691
|
+
size: r
|
|
704
692
|
};
|
|
705
|
-
},
|
|
706
|
-
c =
|
|
693
|
+
}, Fo = (r) => {
|
|
694
|
+
c = gt(r.size), Rt(i, c), Bt(
|
|
707
695
|
h,
|
|
708
696
|
ze(c).width
|
|
709
|
-
), u =
|
|
710
|
-
|
|
697
|
+
), u = pt(
|
|
698
|
+
r.position,
|
|
711
699
|
ze(c)
|
|
712
700
|
);
|
|
713
701
|
const s = Be();
|
|
714
|
-
|
|
715
|
-
},
|
|
702
|
+
xt(u, s);
|
|
703
|
+
}, Ho = P.length > 0 ? la({
|
|
716
704
|
root: i,
|
|
717
705
|
handles: P,
|
|
718
|
-
getBounds:
|
|
719
|
-
setBounds:
|
|
720
|
-
persist:
|
|
706
|
+
getBounds: Bo,
|
|
707
|
+
setBounds: Fo,
|
|
708
|
+
persist: U
|
|
721
709
|
}) : () => {
|
|
722
710
|
};
|
|
723
|
-
let
|
|
724
|
-
const
|
|
725
|
-
if (!(!t.billingStatusLoader ||
|
|
726
|
-
|
|
711
|
+
let yt = !1;
|
|
712
|
+
const un = async () => {
|
|
713
|
+
if (!(!t.billingStatusLoader || yt)) {
|
|
714
|
+
yt = !0;
|
|
727
715
|
try {
|
|
728
|
-
const
|
|
729
|
-
|
|
716
|
+
const r = await t.billingStatusLoader();
|
|
717
|
+
$n(
|
|
730
718
|
t.billingStatus,
|
|
731
|
-
|
|
719
|
+
r,
|
|
732
720
|
y.getState().lastErrorCode
|
|
733
|
-
) && (t.billingStatus =
|
|
721
|
+
) && (t.billingStatus = r, Ht(
|
|
734
722
|
H,
|
|
735
723
|
t.billingStatus,
|
|
736
724
|
y.getState().lastErrorCode
|
|
737
725
|
), j());
|
|
738
726
|
} finally {
|
|
739
|
-
|
|
727
|
+
yt = !1;
|
|
740
728
|
}
|
|
741
729
|
}
|
|
742
|
-
},
|
|
743
|
-
|
|
730
|
+
}, he = (r = "", s = !0) => {
|
|
731
|
+
un(), Ge && (Ge = !1, Ct()), i.classList.contains("pluno-pa-widget--open") || (u = null), Z !== null && (window.clearTimeout(Z), Z = null), Fe("shown", !1), w.hidden = !1, T.hidden = !1, Bt(
|
|
744
732
|
h,
|
|
745
733
|
ze(c).width
|
|
746
734
|
), i.classList.remove("pluno-pa-widget--closing");
|
|
747
|
-
const
|
|
735
|
+
const _ = He(), L = Mt(
|
|
748
736
|
i,
|
|
749
|
-
|
|
737
|
+
_,
|
|
750
738
|
t.position,
|
|
751
739
|
c
|
|
752
740
|
);
|
|
753
|
-
if (
|
|
754
|
-
openPanelPosition:
|
|
755
|
-
visibleLauncherPosition:
|
|
741
|
+
if (xt(L, _), ye("Opening launcher at clamped open panel position", {
|
|
742
|
+
openPanelPosition: L,
|
|
743
|
+
visibleLauncherPosition: _
|
|
756
744
|
}), ee(!0, "open"), te(), !s) {
|
|
757
|
-
i.classList.add("pluno-pa-widget--open"), v.hidden = !0,
|
|
745
|
+
i.classList.add("pluno-pa-widget--open"), v.hidden = !0, r && (x.value = r, Ve(x)), Ke(A, () => be.enabled), _e = A.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), U(), Je("shown"), t.onPanelOpenChange?.(!0);
|
|
758
746
|
return;
|
|
759
747
|
}
|
|
760
748
|
window.requestAnimationFrame(() => {
|
|
761
|
-
i.classList.add("pluno-pa-widget--open"),
|
|
762
|
-
v.hidden = !0,
|
|
749
|
+
i.classList.add("pluno-pa-widget--open"), r && (x.value = r, Ve(x)), Ke(A, () => be.enabled), _e = A.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), U(), Je("shown"), t.onPanelOpenChange?.(!0), Z = window.setTimeout(() => {
|
|
750
|
+
v.hidden = !0, Ke(A, () => be.enabled), _e = A.scrollTop;
|
|
763
751
|
}, 220);
|
|
764
752
|
});
|
|
765
|
-
},
|
|
766
|
-
Z !== null && (window.clearTimeout(Z), Z = null), v.hidden = !1, p && (
|
|
767
|
-
|
|
753
|
+
}, Wo = () => {
|
|
754
|
+
Z !== null && (window.clearTimeout(Z), Z = null), v.hidden = !1, p && (He(!1), ye("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), U(), t.onPanelOpenChange?.(!1), Z = window.setTimeout(() => {
|
|
755
|
+
w.hidden = !0, T.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
|
|
768
756
|
}, 220);
|
|
769
757
|
};
|
|
770
|
-
v.addEventListener("submit", (
|
|
771
|
-
|
|
772
|
-
}),
|
|
773
|
-
|
|
774
|
-
}), v.addEventListener("click", (
|
|
775
|
-
|
|
776
|
-
}),
|
|
777
|
-
|
|
778
|
-
}),
|
|
779
|
-
if (!
|
|
758
|
+
v.addEventListener("submit", (r) => {
|
|
759
|
+
r.preventDefault(), he(b.value), b.value = "";
|
|
760
|
+
}), z?.addEventListener("click", (r) => {
|
|
761
|
+
r.preventDefault(), r.stopPropagation();
|
|
762
|
+
}), v.addEventListener("click", (r) => {
|
|
763
|
+
r.target === b && !z || (he(b.value), b.value = "");
|
|
764
|
+
}), b.addEventListener("focus", () => {
|
|
765
|
+
he(b.value), b.value = "";
|
|
766
|
+
}), b.addEventListener("input", () => {
|
|
767
|
+
if (!b.value)
|
|
780
768
|
return;
|
|
781
|
-
const
|
|
782
|
-
|
|
769
|
+
const r = b.value;
|
|
770
|
+
he(r), b.value = "";
|
|
783
771
|
});
|
|
784
|
-
let
|
|
785
|
-
const
|
|
786
|
-
if (!(
|
|
772
|
+
let vt = null, Qe = null, ve = null;
|
|
773
|
+
const gn = (r) => r === b || r === x, Go = (r) => {
|
|
774
|
+
if (!(r instanceof Element) || r.getRootNode() === i.getRootNode())
|
|
787
775
|
return null;
|
|
788
|
-
let s =
|
|
776
|
+
let s = r;
|
|
789
777
|
for (; s; ) {
|
|
790
|
-
const
|
|
791
|
-
if (
|
|
792
|
-
return
|
|
793
|
-
const
|
|
794
|
-
s =
|
|
778
|
+
const _ = s.closest(Pn);
|
|
779
|
+
if (_)
|
|
780
|
+
return _;
|
|
781
|
+
const L = s.getRootNode();
|
|
782
|
+
s = L instanceof ShadowRoot ? L.host : null;
|
|
795
783
|
}
|
|
796
784
|
return null;
|
|
797
|
-
},
|
|
798
|
-
if (!
|
|
785
|
+
}, $o = (r) => {
|
|
786
|
+
if (!r.isConnected || !r.matches(Pn))
|
|
799
787
|
return !1;
|
|
800
|
-
if (!(
|
|
788
|
+
if (!(r instanceof HTMLElement))
|
|
801
789
|
return !0;
|
|
802
|
-
if (
|
|
790
|
+
if (r.hidden)
|
|
803
791
|
return !1;
|
|
804
|
-
if (typeof
|
|
805
|
-
return
|
|
806
|
-
const s = window.getComputedStyle(
|
|
792
|
+
if (typeof r.checkVisibility == "function")
|
|
793
|
+
return r.checkVisibility();
|
|
794
|
+
const s = window.getComputedStyle(r);
|
|
807
795
|
return s.display !== "none" && s.visibility !== "hidden";
|
|
808
|
-
},
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}, Pi) : ye !== null && (window.clearInterval(ye), ye = null, Je = null));
|
|
816
|
-
}, Oo = () => {
|
|
817
|
-
ye !== null && (window.clearInterval(ye), ye = null);
|
|
796
|
+
}, hn = (r) => {
|
|
797
|
+
We !== r && (We = r, i.classList.toggle("pluno-pa-widget--host-modal-conflict", r !== null), tt(), r !== null ? ve = window.setInterval(() => {
|
|
798
|
+
const s = We;
|
|
799
|
+
(!s || !$o(s)) && hn(null);
|
|
800
|
+
}, Ui) : ve !== null && (window.clearInterval(ve), ve = null, Qe = null));
|
|
801
|
+
}, qo = () => {
|
|
802
|
+
ve !== null && (window.clearInterval(ve), ve = null);
|
|
818
803
|
};
|
|
819
|
-
i.addEventListener("focusin", (
|
|
820
|
-
|
|
821
|
-
}), i.addEventListener("focusout", (
|
|
822
|
-
if (!
|
|
804
|
+
i.addEventListener("focusin", (r) => {
|
|
805
|
+
gn(r.target) && (vt = Date.now(), U());
|
|
806
|
+
}), i.addEventListener("focusout", (r) => {
|
|
807
|
+
if (!gn(r.target) || We !== null)
|
|
823
808
|
return;
|
|
824
|
-
const s =
|
|
825
|
-
if (
|
|
809
|
+
const s = vt;
|
|
810
|
+
if (vt = null, s === null || Date.now() - s > Mi)
|
|
826
811
|
return;
|
|
827
|
-
const
|
|
828
|
-
if (!
|
|
812
|
+
const _ = Go(r.relatedTarget);
|
|
813
|
+
if (!_)
|
|
829
814
|
return;
|
|
830
|
-
const
|
|
831
|
-
if (
|
|
832
|
-
|
|
815
|
+
const L = Date.now();
|
|
816
|
+
if (Qe !== null && L - Qe <= Oi) {
|
|
817
|
+
hn(_);
|
|
833
818
|
return;
|
|
834
819
|
}
|
|
835
|
-
|
|
836
|
-
}), v.addEventListener("keydown", (
|
|
837
|
-
!i.classList.contains("pluno-pa-widget--minimized") ||
|
|
838
|
-
}), g?.addEventListener("pointerdown", (
|
|
839
|
-
|
|
840
|
-
}), g?.addEventListener("click", (
|
|
841
|
-
|
|
842
|
-
}),
|
|
843
|
-
|
|
844
|
-
}),
|
|
845
|
-
|
|
820
|
+
Qe = L;
|
|
821
|
+
}), v.addEventListener("keydown", (r) => {
|
|
822
|
+
!i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), he());
|
|
823
|
+
}), g?.addEventListener("pointerdown", (r) => {
|
|
824
|
+
r.stopPropagation();
|
|
825
|
+
}), g?.addEventListener("click", (r) => {
|
|
826
|
+
r.preventDefault(), r.stopPropagation(), Fe("minimized");
|
|
827
|
+
}), T.addEventListener("click", Wo), A.addEventListener("scroll", () => {
|
|
828
|
+
A.scrollTop < _e - 1 && ee(!1, "userScroll"), _e = A.scrollTop;
|
|
829
|
+
}), R.addEventListener("click", () => {
|
|
830
|
+
Oo();
|
|
846
831
|
});
|
|
847
|
-
const
|
|
848
|
-
([
|
|
849
|
-
|
|
832
|
+
const mn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
833
|
+
([r]) => {
|
|
834
|
+
r?.isIntersecting && (ee(!0, "bottom"), te());
|
|
850
835
|
},
|
|
851
|
-
{ root:
|
|
836
|
+
{ root: A, threshold: 0 }
|
|
852
837
|
);
|
|
853
|
-
|
|
854
|
-
const
|
|
855
|
-
let
|
|
856
|
-
const
|
|
857
|
-
const
|
|
858
|
-
|
|
838
|
+
mn?.observe(mt);
|
|
839
|
+
const et = () => t.loginRequired || t.signupRequired;
|
|
840
|
+
let We = null, Ge = !1;
|
|
841
|
+
const tt = () => {
|
|
842
|
+
const r = et(), s = We !== null;
|
|
843
|
+
b.readOnly = r || s, x.readOnly = s, b.placeholder = s ? In : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ge ? "New update" : t.launcherLabel, x.placeholder = s ? In : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : oe.launcherLabel, k.hidden = r;
|
|
859
844
|
}, j = () => {
|
|
860
|
-
|
|
845
|
+
ce.disabled = ae(t.billingStatus) || !y.getState().isThinking && x.value.trim().length === 0 && W.length === 0, Me.disabled = et() || ae(t.billingStatus);
|
|
861
846
|
};
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
const
|
|
865
|
-
i.classList.toggle("pluno-pa-widget--thinking",
|
|
847
|
+
tt();
|
|
848
|
+
const Ct = () => {
|
|
849
|
+
const r = y.getState().isThinking;
|
|
850
|
+
i.classList.toggle("pluno-pa-widget--thinking", r), i.classList.toggle(
|
|
866
851
|
"pluno-pa-widget--unread",
|
|
867
|
-
!
|
|
868
|
-
),
|
|
852
|
+
!r && Ge
|
|
853
|
+
), tt();
|
|
869
854
|
};
|
|
870
|
-
|
|
871
|
-
if (
|
|
855
|
+
Ct(), k.addEventListener("submit", (r) => {
|
|
856
|
+
if (r.preventDefault(), t.loginRequired) {
|
|
872
857
|
t.onLoginClick?.();
|
|
873
858
|
return;
|
|
874
859
|
}
|
|
@@ -876,64 +861,64 @@ async function Gi(e = {}) {
|
|
|
876
861
|
t.onSignupClick?.();
|
|
877
862
|
return;
|
|
878
863
|
}
|
|
879
|
-
ae(t.billingStatus) || (
|
|
864
|
+
ae(t.billingStatus) || (we = !0, ee(!0, "send"), te(), W = Ut(
|
|
880
865
|
y,
|
|
881
866
|
x,
|
|
882
867
|
W
|
|
883
|
-
),
|
|
868
|
+
), ke(), j());
|
|
884
869
|
});
|
|
885
|
-
let
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
},
|
|
889
|
-
le !== null && window.clearTimeout(le), F.textContent =
|
|
870
|
+
let $e = 0;
|
|
871
|
+
const jo = () => {
|
|
872
|
+
$e = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
873
|
+
}, St = (r) => {
|
|
874
|
+
le !== null && window.clearTimeout(le), F.textContent = r, F.hidden = !1, le = window.setTimeout(() => {
|
|
890
875
|
F.textContent = "", F.hidden = !0, le = null;
|
|
891
876
|
}, 3e3);
|
|
892
|
-
},
|
|
877
|
+
}, Vo = () => {
|
|
893
878
|
le !== null && (window.clearTimeout(le), le = null), F.textContent = "", F.hidden = !0;
|
|
894
|
-
},
|
|
895
|
-
if (
|
|
879
|
+
}, Et = async (r) => {
|
|
880
|
+
if (r.length === 0)
|
|
896
881
|
return;
|
|
897
|
-
const s =
|
|
898
|
-
W = [...W, ...s],
|
|
882
|
+
const s = ja(y, r);
|
|
883
|
+
W = [...W, ...s], ke(), Vo(), j(), G(y.getState()), i.classList.contains("pluno-pa-widget--open") || he();
|
|
899
884
|
};
|
|
900
|
-
|
|
885
|
+
Me.addEventListener("click", () => {
|
|
901
886
|
t.loginRequired || ae(t.billingStatus) || Q.click();
|
|
902
887
|
}), Q.addEventListener("change", () => {
|
|
903
|
-
const
|
|
904
|
-
Q.value = "",
|
|
905
|
-
|
|
888
|
+
const r = Array.from(Q.files ?? []);
|
|
889
|
+
Q.value = "", Et(r).catch((s) => {
|
|
890
|
+
St(
|
|
906
891
|
s instanceof Error ? s.message : "Failed to attach file"
|
|
907
892
|
), J("web-sdk.widget", "Attachment failed", {
|
|
908
893
|
message: s instanceof Error ? s.message : String(s)
|
|
909
894
|
});
|
|
910
895
|
});
|
|
911
|
-
}), i.addEventListener("dragenter", (
|
|
912
|
-
!
|
|
913
|
-
}), i.addEventListener("dragover", (
|
|
914
|
-
const s =
|
|
915
|
-
!
|
|
916
|
-
}), i.addEventListener("dragleave", (
|
|
917
|
-
|
|
918
|
-
}), i.addEventListener("drop", (
|
|
919
|
-
const s =
|
|
920
|
-
!
|
|
921
|
-
|
|
922
|
-
|
|
896
|
+
}), i.addEventListener("dragenter", (r) => {
|
|
897
|
+
!at(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), $e += 1, i.classList.add("pluno-pa-widget--drag-over"));
|
|
898
|
+
}), i.addEventListener("dragover", (r) => {
|
|
899
|
+
const s = r.dataTransfer;
|
|
900
|
+
!at(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
|
|
901
|
+
}), i.addEventListener("dragleave", (r) => {
|
|
902
|
+
at(r.dataTransfer) && (r.stopPropagation(), $e = Math.max(0, $e - 1), $e === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
903
|
+
}), i.addEventListener("drop", (r) => {
|
|
904
|
+
const s = r.dataTransfer;
|
|
905
|
+
!at(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), jo(), Et(s.files).catch((_) => {
|
|
906
|
+
St(
|
|
907
|
+
_ instanceof Error ? _.message : "Failed to attach file"
|
|
923
908
|
), J("web-sdk.widget", "Attachment failed", {
|
|
924
|
-
message:
|
|
909
|
+
message: _ instanceof Error ? _.message : String(_)
|
|
925
910
|
});
|
|
926
911
|
}));
|
|
927
|
-
}), i.addEventListener("paste", (
|
|
928
|
-
const s =
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
912
|
+
}), i.addEventListener("paste", (r) => {
|
|
913
|
+
const s = r.clipboardData, _ = Array.from(s?.files ?? []);
|
|
914
|
+
_.length === 0 || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Et(_).catch((L) => {
|
|
915
|
+
St(
|
|
916
|
+
L instanceof Error ? L.message : "Failed to attach file"
|
|
932
917
|
), J("web-sdk.widget", "Attachment failed", {
|
|
933
|
-
message:
|
|
918
|
+
message: L instanceof Error ? L.message : String(L)
|
|
934
919
|
});
|
|
935
920
|
}));
|
|
936
|
-
}),
|
|
921
|
+
}), ce.addEventListener("click", () => {
|
|
937
922
|
if (t.loginRequired) {
|
|
938
923
|
t.onLoginClick?.();
|
|
939
924
|
return;
|
|
@@ -942,91 +927,91 @@ async function Gi(e = {}) {
|
|
|
942
927
|
y.stop();
|
|
943
928
|
return;
|
|
944
929
|
}
|
|
945
|
-
|
|
930
|
+
we = !0, ee(!0, "send"), te(), W = Ut(
|
|
946
931
|
y,
|
|
947
932
|
x,
|
|
948
933
|
W
|
|
949
|
-
),
|
|
934
|
+
), ke(), j(), G(y.getState());
|
|
950
935
|
}), X.addEventListener("click", () => {
|
|
951
|
-
|
|
952
|
-
}),
|
|
953
|
-
|
|
954
|
-
}),
|
|
955
|
-
|
|
956
|
-
}), x.addEventListener("keydown", (
|
|
957
|
-
if (!(
|
|
958
|
-
if (
|
|
936
|
+
ue = !ue, Ue = null, xe(), ue && ge.length === 0 && ln(null);
|
|
937
|
+
}), Ee.addEventListener("click", () => {
|
|
938
|
+
ue = !1, xe();
|
|
939
|
+
}), N.addEventListener("scroll", Uo), x.addEventListener("input", () => {
|
|
940
|
+
Ve(x), U(), j(), Xo();
|
|
941
|
+
}), x.addEventListener("keydown", (r) => {
|
|
942
|
+
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
943
|
+
if (r.preventDefault(), t.loginRequired) {
|
|
959
944
|
t.onLoginClick?.();
|
|
960
945
|
return;
|
|
961
946
|
}
|
|
962
|
-
|
|
947
|
+
we = !0, ee(!0, "send"), te(), W = Ut(
|
|
963
948
|
y,
|
|
964
949
|
x,
|
|
965
950
|
W
|
|
966
|
-
),
|
|
967
|
-
}
|
|
968
|
-
}), i.addEventListener("click", (
|
|
969
|
-
(
|
|
970
|
-
}), l.composerValue && (x.value = l.composerValue,
|
|
971
|
-
const
|
|
972
|
-
let
|
|
973
|
-
const
|
|
951
|
+
), ke(), j(), G(y.getState());
|
|
952
|
+
}
|
|
953
|
+
}), i.addEventListener("click", (r) => {
|
|
954
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && U();
|
|
955
|
+
}), l.composerValue && (x.value = l.composerValue, Ve(x)), t.initialDisplayState === "minimized" ? Fe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(x.value, !1), wa(l, i, b, x);
|
|
956
|
+
const nt = () => a;
|
|
957
|
+
let kt = y.getState().appearance !== null, ot = null, qe = null, Ie = null, fn = y.getState().isThinking, Te = null;
|
|
958
|
+
const je = t.taskNotifications;
|
|
974
959
|
let Ae = null, Ne = !1;
|
|
975
|
-
const
|
|
960
|
+
const wn = () => {
|
|
976
961
|
Ae !== null && (window.clearTimeout(Ae), Ae = null);
|
|
977
|
-
},
|
|
978
|
-
|
|
979
|
-
},
|
|
980
|
-
if (!
|
|
962
|
+
}, it = () => {
|
|
963
|
+
Oe && (Oe.hidden = !0);
|
|
964
|
+
}, bn = () => y.getState().assistantDraft.trim().length > 0, Ko = async () => {
|
|
965
|
+
if (!je || !Oe || Ne || Pe || !y.getState().isThinking || bn())
|
|
981
966
|
return;
|
|
982
|
-
let
|
|
967
|
+
let r;
|
|
983
968
|
try {
|
|
984
|
-
|
|
969
|
+
r = await je.getState();
|
|
985
970
|
} catch {
|
|
986
971
|
return;
|
|
987
972
|
}
|
|
988
|
-
|
|
973
|
+
r.enabled || r.neverSuggest || !y.getState().isThinking || bn() || Ne || Pe || (Oe.hidden = !1);
|
|
989
974
|
};
|
|
990
|
-
|
|
991
|
-
Ne = !0,
|
|
975
|
+
Ao?.addEventListener("click", () => {
|
|
976
|
+
Ne = !0, it(), je?.enable().catch(() => {
|
|
992
977
|
});
|
|
993
|
-
}),
|
|
994
|
-
Ne = !0,
|
|
995
|
-
}),
|
|
996
|
-
Ne = !0,
|
|
978
|
+
}), No?.addEventListener("click", () => {
|
|
979
|
+
Ne = !0, it();
|
|
980
|
+
}), Do?.addEventListener("click", () => {
|
|
981
|
+
Ne = !0, it(), je?.dismissForever().catch(() => {
|
|
997
982
|
});
|
|
998
983
|
});
|
|
999
|
-
let
|
|
984
|
+
let De = null, _n = () => {
|
|
1000
985
|
};
|
|
1001
|
-
const
|
|
1002
|
-
const
|
|
1003
|
-
D.hidden = !
|
|
986
|
+
const Yo = !!t.socialPostDraftHandler, Lt = /* @__PURE__ */ new Map(), Pt = () => x.value.trim().length > 0 || W.length > 0, Xo = () => {
|
|
987
|
+
const r = De !== null && Wt(y.getState(), Pt());
|
|
988
|
+
D.hidden = !r, r && De !== null && fo(D, De);
|
|
1004
989
|
};
|
|
1005
|
-
let
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
},
|
|
1009
|
-
if (!
|
|
1010
|
-
|
|
990
|
+
let Re = null;
|
|
991
|
+
const xn = (r = {}) => {
|
|
992
|
+
we = !0, ee(!0, "newSession"), te(), ue = !1, xe(), y.startNewSession(r), wt.clear(), x.value = "", W = [], ke(), Ve(x), U(), j(), x.focus(), G(y.getState());
|
|
993
|
+
}, It = (r) => {
|
|
994
|
+
if (!r) {
|
|
995
|
+
Re?.remove(), Re = null;
|
|
1011
996
|
return;
|
|
1012
997
|
}
|
|
1013
|
-
|
|
998
|
+
Re || (Re = ht(
|
|
1014
999
|
"pluno-pa-widget__new-chat",
|
|
1015
1000
|
"New chat",
|
|
1016
|
-
|
|
1001
|
+
za(),
|
|
1017
1002
|
!1
|
|
1018
|
-
),
|
|
1019
|
-
}, G = (
|
|
1020
|
-
if (
|
|
1003
|
+
), Re.addEventListener("click", () => xn()), Xe.insertBefore(Re, X));
|
|
1004
|
+
}, G = (r) => {
|
|
1005
|
+
if (xe(), an(r.lastErrorCode) ? Te = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Te = null), Ht(
|
|
1021
1006
|
H,
|
|
1022
1007
|
t.billingStatus,
|
|
1023
|
-
|
|
1008
|
+
Te
|
|
1024
1009
|
), t.loginRequired) {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1010
|
+
Lt.clear(), Kn(
|
|
1011
|
+
A,
|
|
1012
|
+
ce,
|
|
1013
|
+
It,
|
|
1014
|
+
nt,
|
|
1030
1015
|
"Log in to use Pluno on this page.",
|
|
1031
1016
|
t.loginButtonLabel,
|
|
1032
1017
|
t.loginUrl,
|
|
@@ -1035,11 +1020,11 @@ async function Gi(e = {}) {
|
|
|
1035
1020
|
return;
|
|
1036
1021
|
}
|
|
1037
1022
|
if (t.signupRequired) {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1023
|
+
Lt.clear(), Kn(
|
|
1024
|
+
A,
|
|
1025
|
+
ce,
|
|
1026
|
+
It,
|
|
1027
|
+
nt,
|
|
1043
1028
|
"Complete signup to unlock your free trial credits.",
|
|
1044
1029
|
t.signupButtonLabel,
|
|
1045
1030
|
t.signupUrl,
|
|
@@ -1047,67 +1032,67 @@ async function Gi(e = {}) {
|
|
|
1047
1032
|
);
|
|
1048
1033
|
return;
|
|
1049
1034
|
}
|
|
1050
|
-
const s =
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
ht,
|
|
1056
|
-
de,
|
|
1057
|
-
Lt,
|
|
1058
|
-
D,
|
|
1059
|
-
a,
|
|
1060
|
-
Te,
|
|
1061
|
-
Te !== null && Ut(a, kt()),
|
|
1062
|
-
S,
|
|
1063
|
-
() => we.enabled,
|
|
1035
|
+
const s = _a(r), _ = s !== rn;
|
|
1036
|
+
rn = s;
|
|
1037
|
+
const L = we || be.enabled;
|
|
1038
|
+
we = !1, Qa(
|
|
1039
|
+
A,
|
|
1064
1040
|
mt,
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1041
|
+
ce,
|
|
1042
|
+
It,
|
|
1043
|
+
D,
|
|
1044
|
+
r,
|
|
1045
|
+
De,
|
|
1046
|
+
De !== null && Wt(r, Pt()),
|
|
1047
|
+
L,
|
|
1048
|
+
() => be.enabled,
|
|
1049
|
+
wt,
|
|
1050
|
+
Lt,
|
|
1051
|
+
U,
|
|
1052
|
+
nt,
|
|
1068
1053
|
(M) => {
|
|
1069
|
-
|
|
1054
|
+
we = !0, ee(!0, "send"), te(), y.sendMessage(M);
|
|
1070
1055
|
},
|
|
1071
|
-
|
|
1072
|
-
dismissedCandidateIds:
|
|
1073
|
-
draftingCandidateId:
|
|
1074
|
-
error:
|
|
1075
|
-
characterIconOptions:
|
|
1056
|
+
Yo && !bt ? {
|
|
1057
|
+
dismissedCandidateIds: Ze,
|
|
1058
|
+
draftingCandidateId: ot,
|
|
1059
|
+
error: qe,
|
|
1060
|
+
characterIconOptions: nt(),
|
|
1076
1061
|
onSeen: (M) => {
|
|
1077
|
-
|
|
1062
|
+
Le.add(M.id), U();
|
|
1078
1063
|
},
|
|
1079
1064
|
onDraft: (M) => {
|
|
1080
|
-
|
|
1065
|
+
Zo(M);
|
|
1081
1066
|
},
|
|
1082
1067
|
onDismiss: (M) => {
|
|
1083
|
-
|
|
1068
|
+
Le.add(M.id), Ze.add(M.id), U(), qe = null, G(y.getState());
|
|
1084
1069
|
},
|
|
1085
1070
|
onDisable: (M) => {
|
|
1086
|
-
|
|
1071
|
+
bt = !0, Le.add(M.id), Ze.add(M.id), U(), Cr(t, !0), qe = null, G(y.getState());
|
|
1087
1072
|
}
|
|
1088
1073
|
} : void 0
|
|
1089
|
-
),
|
|
1074
|
+
), L ? (_e = A.scrollTop, te()) : _ && xa(r) && Mo();
|
|
1090
1075
|
};
|
|
1091
|
-
return
|
|
1092
|
-
(
|
|
1093
|
-
|
|
1076
|
+
return _n = fi(
|
|
1077
|
+
(r) => {
|
|
1078
|
+
De = r, !Pe && Wt(y.getState(), Pt()) && G(y.getState());
|
|
1094
1079
|
},
|
|
1095
1080
|
{
|
|
1096
1081
|
backendUrl: t.backendUrl,
|
|
1097
|
-
fetcher:
|
|
1082
|
+
fetcher: zo,
|
|
1098
1083
|
loader: t.activeUsersLoader
|
|
1099
1084
|
}
|
|
1100
|
-
), y.on("state", (
|
|
1101
|
-
const s =
|
|
1102
|
-
|
|
1103
|
-
Ae = null,
|
|
1104
|
-
},
|
|
1085
|
+
), y.on("state", (r) => {
|
|
1086
|
+
const s = fn && !r.isThinking;
|
|
1087
|
+
fn = r.isThinking, r.isThinking && !r.assistantDraft.trim() && je && !Ne && Ae === null && Oe?.hidden !== !1 && (Ae = window.setTimeout(() => {
|
|
1088
|
+
Ae = null, Ko();
|
|
1089
|
+
}, yi)), (!r.isThinking || r.assistantDraft.trim()) && (wn(), it()), s && !i.classList.contains("pluno-pa-widget--open") && (Ge = !0), Ct(), r.appearance ? (kt = !0, J(
|
|
1105
1090
|
"web-sdk.widget",
|
|
1106
1091
|
"Agent state supplied appearance",
|
|
1107
1092
|
{
|
|
1108
|
-
appearance:
|
|
1093
|
+
appearance: r.appearance
|
|
1109
1094
|
}
|
|
1110
|
-
),
|
|
1095
|
+
), Tt(r.appearance, "agent.state.appearance")) : kt && (kt = !1, J(
|
|
1111
1096
|
"web-sdk.widget",
|
|
1112
1097
|
"Agent state cleared appearance; reverting to configured widget options",
|
|
1113
1098
|
{
|
|
@@ -1115,101 +1100,103 @@ async function Gi(e = {}) {
|
|
|
1115
1100
|
fallbackColorScheme: t.colorScheme,
|
|
1116
1101
|
fallbackFontFamily: t.fontFamily
|
|
1117
1102
|
}
|
|
1118
|
-
),
|
|
1103
|
+
), Tt({}, "agent.state.appearance-cleared")), G(r), j(), s && un();
|
|
1119
1104
|
}), G(y.getState()), j(), {
|
|
1120
1105
|
agent: y,
|
|
1121
|
-
|
|
1122
|
-
|
|
1106
|
+
startNewChat: xn,
|
|
1107
|
+
host: n,
|
|
1108
|
+
updateAppearance: (r) => {
|
|
1109
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Tt(r, "widgetHandle.updateAppearance");
|
|
1123
1110
|
},
|
|
1124
|
-
updateBillingStatus: (
|
|
1125
|
-
const s =
|
|
1126
|
-
|
|
1111
|
+
updateBillingStatus: (r) => {
|
|
1112
|
+
const s = r ?? null;
|
|
1113
|
+
$n(
|
|
1127
1114
|
t.billingStatus,
|
|
1128
1115
|
s,
|
|
1129
|
-
|
|
1130
|
-
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (
|
|
1116
|
+
Te
|
|
1117
|
+
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Te = null), Ht(
|
|
1131
1118
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
1132
1119
|
t.billingStatus,
|
|
1133
|
-
|
|
1120
|
+
Te
|
|
1134
1121
|
), j());
|
|
1135
1122
|
},
|
|
1136
|
-
updateAuthGate: (
|
|
1137
|
-
const s =
|
|
1138
|
-
t.loginRequired =
|
|
1123
|
+
updateAuthGate: (r) => {
|
|
1124
|
+
const s = et();
|
|
1125
|
+
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), tt(), G(y.getState()), j(), s && !et() && y.connect().catch((_) => {
|
|
1139
1126
|
J(
|
|
1140
1127
|
"web-sdk.widget",
|
|
1141
1128
|
"Failed to connect after auth gate cleared",
|
|
1142
1129
|
{
|
|
1143
|
-
message:
|
|
1130
|
+
message: _ instanceof Error ? _.message : String(_)
|
|
1144
1131
|
}
|
|
1145
1132
|
);
|
|
1146
1133
|
});
|
|
1147
1134
|
},
|
|
1148
1135
|
openPanel: () => {
|
|
1149
|
-
|
|
1136
|
+
he(x.value, !1);
|
|
1150
1137
|
},
|
|
1151
|
-
updateDisplayState: (
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1138
|
+
updateDisplayState: (r) => {
|
|
1139
|
+
if (r === "shown") {
|
|
1140
|
+
Fe("shown", !1);
|
|
1154
1141
|
return;
|
|
1155
1142
|
}
|
|
1156
|
-
|
|
1143
|
+
Fe("minimized", !1);
|
|
1157
1144
|
},
|
|
1158
1145
|
destroy: () => {
|
|
1159
|
-
|
|
1146
|
+
Pe || (U(), Pe = !0, sn.disconnect(), mn?.disconnect(), qo(), window.removeEventListener("resize", dn), cn(), Ho(), le !== null && window.clearTimeout(le), wn(), _n(), Ie?.remove(), y.destroy(), ft.release(), n.remove());
|
|
1160
1147
|
}
|
|
1161
1148
|
};
|
|
1162
|
-
async function
|
|
1163
|
-
if (!
|
|
1164
|
-
|
|
1149
|
+
async function Zo(r) {
|
|
1150
|
+
if (!ot) {
|
|
1151
|
+
ot = r.id, qe = null, G(y.getState());
|
|
1165
1152
|
try {
|
|
1166
1153
|
if (!t.socialPostDraftHandler)
|
|
1167
1154
|
throw new Error("Social post drafting is not available here.");
|
|
1168
|
-
const s = await t.socialPostDraftHandler(
|
|
1155
|
+
const s = await t.socialPostDraftHandler(r);
|
|
1169
1156
|
if (!s.linkedinPost || !s.xPost)
|
|
1170
1157
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1171
|
-
|
|
1158
|
+
Le.add(r.id), Ze.add(r.id), U(), Ie?.remove(), Ie = lr(s, {
|
|
1172
1159
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1173
1160
|
onClose: () => {
|
|
1174
|
-
|
|
1161
|
+
Ie?.remove(), Ie = null;
|
|
1175
1162
|
}
|
|
1176
|
-
}), i.appendChild(
|
|
1163
|
+
}), i.appendChild(Ie);
|
|
1177
1164
|
} catch (s) {
|
|
1178
|
-
|
|
1165
|
+
qe = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1179
1166
|
} finally {
|
|
1180
|
-
|
|
1167
|
+
ot = null, G(y.getState());
|
|
1181
1168
|
}
|
|
1182
1169
|
}
|
|
1183
1170
|
}
|
|
1184
|
-
function
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
),
|
|
1190
|
-
accentColor:
|
|
1191
|
-
colorScheme:
|
|
1171
|
+
function Tt(r, s) {
|
|
1172
|
+
const _ = r.accentColor ?? t.accentColor, L = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, At = r.scribbleStyle ?? t.scribbleStyle;
|
|
1173
|
+
a = Rn(
|
|
1174
|
+
_,
|
|
1175
|
+
At
|
|
1176
|
+
), zn(i, a, {
|
|
1177
|
+
accentColor: _,
|
|
1178
|
+
colorScheme: L,
|
|
1192
1179
|
fontFamily: M,
|
|
1193
|
-
scribbleStyle:
|
|
1180
|
+
scribbleStyle: At
|
|
1194
1181
|
}), J("web-sdk.widget", "Updated widget appearance", {
|
|
1195
1182
|
source: s,
|
|
1196
|
-
inputAppearance:
|
|
1197
|
-
appliedAccentColor:
|
|
1198
|
-
appliedColorScheme:
|
|
1183
|
+
inputAppearance: r,
|
|
1184
|
+
appliedAccentColor: _,
|
|
1185
|
+
appliedColorScheme: L,
|
|
1199
1186
|
appliedFontFamily: M,
|
|
1200
|
-
appliedScribbleStyle:
|
|
1187
|
+
appliedScribbleStyle: At,
|
|
1201
1188
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
1202
1189
|
});
|
|
1203
1190
|
}
|
|
1204
1191
|
}
|
|
1205
|
-
function
|
|
1192
|
+
function Rn(e, t) {
|
|
1206
1193
|
return { accentColor: e, scribbleStyle: t };
|
|
1207
1194
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const t =
|
|
1210
|
-
return t === null ? "#fafafa" :
|
|
1195
|
+
function na(e) {
|
|
1196
|
+
const t = oa(e);
|
|
1197
|
+
return t === null ? "#fafafa" : ia(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1211
1198
|
}
|
|
1212
|
-
function
|
|
1199
|
+
function oa(e) {
|
|
1213
1200
|
const t = e.trim();
|
|
1214
1201
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1215
1202
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1221,14 +1208,14 @@ function qi(e) {
|
|
|
1221
1208
|
Number.parseInt(t[3] + t[3], 16)
|
|
1222
1209
|
] : null;
|
|
1223
1210
|
}
|
|
1224
|
-
function
|
|
1211
|
+
function ia([e, t, n]) {
|
|
1225
1212
|
const o = (i) => {
|
|
1226
|
-
const
|
|
1227
|
-
return
|
|
1213
|
+
const a = i / 255;
|
|
1214
|
+
return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
1228
1215
|
};
|
|
1229
1216
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
1230
1217
|
}
|
|
1231
|
-
function
|
|
1218
|
+
function zn(e, t, n) {
|
|
1232
1219
|
e.classList.toggle(
|
|
1233
1220
|
"pluno-pa-widget--dark",
|
|
1234
1221
|
n.colorScheme === "dark"
|
|
@@ -1236,27 +1223,27 @@ function In(e, t, n) {
|
|
|
1236
1223
|
"pluno-pa-widget--light",
|
|
1237
1224
|
n.colorScheme !== "dark"
|
|
1238
1225
|
), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
1239
|
-
const o = n.scribbleStyle ?
|
|
1226
|
+
const o = n.scribbleStyle ? eo(n.accentColor) : n.accentColor;
|
|
1240
1227
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1241
1228
|
"--pluno-pa-accent-contrast",
|
|
1242
|
-
|
|
1243
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ?
|
|
1229
|
+
na(o)
|
|
1230
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Fi : n.fontFamily, n.scribbleStyle && aa(e.ownerDocument);
|
|
1244
1231
|
const i = Array.from(
|
|
1245
1232
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1246
1233
|
);
|
|
1247
|
-
for (const
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
Array.from(
|
|
1234
|
+
for (const a of i)
|
|
1235
|
+
a.replaceWith(
|
|
1236
|
+
fe(
|
|
1237
|
+
Array.from(a.classList).join(" "),
|
|
1251
1238
|
t
|
|
1252
1239
|
)
|
|
1253
1240
|
);
|
|
1254
1241
|
}
|
|
1255
|
-
function
|
|
1256
|
-
if (e.getElementById(
|
|
1242
|
+
function aa(e) {
|
|
1243
|
+
if (e.getElementById(Tn))
|
|
1257
1244
|
return;
|
|
1258
1245
|
const t = e.createElement("style");
|
|
1259
|
-
t.id =
|
|
1246
|
+
t.id = Tn, t.textContent = `@font-face {
|
|
1260
1247
|
font-family: "Architects Daughter";
|
|
1261
1248
|
font-style: normal;
|
|
1262
1249
|
font-weight: 400;
|
|
@@ -1264,28 +1251,28 @@ function Vi(e) {
|
|
|
1264
1251
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1265
1252
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1266
1253
|
}
|
|
1267
|
-
function
|
|
1254
|
+
function ra({
|
|
1268
1255
|
root: e,
|
|
1269
1256
|
launcher: t,
|
|
1270
1257
|
launcherDragHandle: n,
|
|
1271
1258
|
getPosition: o,
|
|
1272
1259
|
setPosition: i,
|
|
1273
|
-
persist:
|
|
1260
|
+
persist: a
|
|
1274
1261
|
}) {
|
|
1275
1262
|
let l = null, p = null, d = null, c = !1, u = null;
|
|
1276
1263
|
const m = () => {
|
|
1277
1264
|
l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1278
|
-
},
|
|
1265
|
+
}, E = (h) => {
|
|
1279
1266
|
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 = o(), c = !1, t.setPointerCapture?.(h.pointerId));
|
|
1280
1267
|
}, v = (h) => {
|
|
1281
1268
|
if (l !== h.pointerId || !p || !d)
|
|
1282
1269
|
return;
|
|
1283
1270
|
h.preventDefault();
|
|
1284
|
-
const P = h.clientX - p.x,
|
|
1285
|
-
!c && Math.hypot(P,
|
|
1286
|
-
},
|
|
1287
|
-
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY },
|
|
1288
|
-
},
|
|
1271
|
+
const P = h.clientX - p.x, T = h.clientY - p.y;
|
|
1272
|
+
!c && Math.hypot(P, T) < Yt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + T }));
|
|
1273
|
+
}, z = (h) => {
|
|
1274
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, a()), m());
|
|
1275
|
+
}, b = (h) => {
|
|
1289
1276
|
l === h.pointerId && (h.preventDefault(), m());
|
|
1290
1277
|
}, g = (h) => {
|
|
1291
1278
|
if (!u)
|
|
@@ -1293,61 +1280,61 @@ function Ki({
|
|
|
1293
1280
|
const P = Math.hypot(
|
|
1294
1281
|
h.clientX - u.x,
|
|
1295
1282
|
h.clientY - u.y
|
|
1296
|
-
) <=
|
|
1283
|
+
) <= Yt;
|
|
1297
1284
|
u = null, P && (h.preventDefault(), h.stopPropagation());
|
|
1298
|
-
},
|
|
1285
|
+
}, w = (h) => {
|
|
1299
1286
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1300
1287
|
return;
|
|
1301
|
-
const P = h.shiftKey ?
|
|
1302
|
-
let
|
|
1303
|
-
h.key === "ArrowUp" ?
|
|
1288
|
+
const P = h.shiftKey ? co : so, T = o();
|
|
1289
|
+
let k = null;
|
|
1290
|
+
h.key === "ArrowUp" ? k = { x: T.x, y: T.y - P } : h.key === "ArrowDown" ? k = { x: T.x, y: T.y + P } : h.key === "ArrowLeft" ? k = { x: T.x - P, y: T.y } : h.key === "ArrowRight" && (k = { x: T.x + P, y: T.y }), k && (h.preventDefault(), h.stopPropagation(), i(k), a());
|
|
1304
1291
|
};
|
|
1305
|
-
return t.addEventListener("pointerdown",
|
|
1306
|
-
t.removeEventListener("pointerdown",
|
|
1292
|
+
return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", v), t.addEventListener("pointerup", z), t.addEventListener("pointercancel", b), t.addEventListener("click", g, !0), n.addEventListener("keydown", w), () => {
|
|
1293
|
+
t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", z), t.removeEventListener("pointercancel", b), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", w);
|
|
1307
1294
|
};
|
|
1308
1295
|
}
|
|
1309
|
-
function
|
|
1296
|
+
function la({
|
|
1310
1297
|
root: e,
|
|
1311
1298
|
handles: t,
|
|
1312
1299
|
getBounds: n,
|
|
1313
1300
|
setBounds: o,
|
|
1314
1301
|
persist: i
|
|
1315
1302
|
}) {
|
|
1316
|
-
let
|
|
1303
|
+
let a = null, l = null, p = null, d = null, c = !1;
|
|
1317
1304
|
const u = () => {
|
|
1318
|
-
|
|
1305
|
+
a = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
|
|
1319
1306
|
}, m = (g) => {
|
|
1320
|
-
const
|
|
1321
|
-
!e.classList.contains("pluno-pa-widget--open") || !
|
|
1322
|
-
},
|
|
1323
|
-
if (
|
|
1307
|
+
const w = g.currentTarget, h = w.dataset.resizeDirection;
|
|
1308
|
+
!e.classList.contains("pluno-pa-widget--open") || !Mn(h) || (g.preventDefault(), g.stopPropagation(), a = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, w.setPointerCapture?.(g.pointerId));
|
|
1309
|
+
}, E = (g) => {
|
|
1310
|
+
if (a !== g.pointerId || !l || !p || !d)
|
|
1324
1311
|
return;
|
|
1325
1312
|
g.preventDefault(), g.stopPropagation();
|
|
1326
|
-
const
|
|
1327
|
-
!c && Math.hypot(
|
|
1328
|
-
|
|
1313
|
+
const w = g.clientX - p.x, h = g.clientY - p.y;
|
|
1314
|
+
!c && Math.hypot(w, h) < Yt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
|
|
1315
|
+
On(d, l, w, h)
|
|
1329
1316
|
));
|
|
1330
1317
|
}, v = (g) => {
|
|
1331
|
-
|
|
1332
|
-
},
|
|
1333
|
-
|
|
1334
|
-
},
|
|
1335
|
-
const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ?
|
|
1336
|
-
let
|
|
1337
|
-
|
|
1318
|
+
a === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
|
|
1319
|
+
}, z = (g) => {
|
|
1320
|
+
a === g.pointerId && (g.preventDefault(), u());
|
|
1321
|
+
}, b = (g) => {
|
|
1322
|
+
const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? co : so, T = n();
|
|
1323
|
+
let k = 0, F = 0;
|
|
1324
|
+
Mn(h) && (g.key === "ArrowLeft" ? k = -P : g.key === "ArrowRight" ? k = P : g.key === "ArrowUp" ? F = -P : g.key === "ArrowDown" && (F = P), !(k === 0 && F === 0) && (g.preventDefault(), g.stopPropagation(), o(On(T, h, k, F)), i()));
|
|
1338
1325
|
};
|
|
1339
1326
|
for (const g of t)
|
|
1340
|
-
g.addEventListener("pointerdown", m), g.addEventListener("pointermove",
|
|
1327
|
+
g.addEventListener("pointerdown", m), g.addEventListener("pointermove", E), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", z), g.addEventListener("keydown", b);
|
|
1341
1328
|
return () => {
|
|
1342
1329
|
for (const g of t)
|
|
1343
|
-
g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove",
|
|
1330
|
+
g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", E), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", z), g.removeEventListener("keydown", b);
|
|
1344
1331
|
};
|
|
1345
1332
|
}
|
|
1346
|
-
function
|
|
1333
|
+
function Mn(e) {
|
|
1347
1334
|
return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
|
|
1348
1335
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const i = Y(),
|
|
1336
|
+
function On(e, t, n, o) {
|
|
1337
|
+
const i = Y(), a = Un({
|
|
1351
1338
|
leading: e.position.x,
|
|
1352
1339
|
length: e.size.width,
|
|
1353
1340
|
delta: n,
|
|
@@ -1356,54 +1343,50 @@ function Nn(e, t, n, o) {
|
|
|
1356
1343
|
minLeading: I,
|
|
1357
1344
|
maxTrailing: i.width - I,
|
|
1358
1345
|
minLength: Math.min(
|
|
1359
|
-
|
|
1346
|
+
tn,
|
|
1360
1347
|
i.width - I * 2
|
|
1361
1348
|
)
|
|
1362
|
-
}), l =
|
|
1349
|
+
}), l = Un({
|
|
1363
1350
|
leading: e.position.y,
|
|
1364
1351
|
length: e.size.height,
|
|
1365
1352
|
delta: o,
|
|
1366
1353
|
resizeLeading: t.startsWith("top") || t === "top",
|
|
1367
1354
|
resizeTrailing: t.startsWith("bottom") || t === "bottom",
|
|
1368
|
-
minLeading:
|
|
1355
|
+
minLeading: Se,
|
|
1369
1356
|
maxTrailing: i.height - I,
|
|
1370
1357
|
minLength: Math.min(
|
|
1371
|
-
|
|
1372
|
-
i.height -
|
|
1358
|
+
nn,
|
|
1359
|
+
i.height - Se - I
|
|
1373
1360
|
)
|
|
1374
1361
|
});
|
|
1375
1362
|
return {
|
|
1376
|
-
position: { x:
|
|
1377
|
-
size: { width:
|
|
1363
|
+
position: { x: a.leading, y: l.leading },
|
|
1364
|
+
size: { width: a.length, height: l.length }
|
|
1378
1365
|
};
|
|
1379
1366
|
}
|
|
1380
|
-
function
|
|
1367
|
+
function Un({
|
|
1381
1368
|
leading: e,
|
|
1382
1369
|
length: t,
|
|
1383
1370
|
delta: n,
|
|
1384
1371
|
resizeLeading: o,
|
|
1385
1372
|
resizeTrailing: i,
|
|
1386
|
-
minLeading:
|
|
1373
|
+
minLeading: a,
|
|
1387
1374
|
maxTrailing: l,
|
|
1388
1375
|
minLength: p
|
|
1389
1376
|
}) {
|
|
1390
1377
|
const d = e + t;
|
|
1391
1378
|
if (o) {
|
|
1392
1379
|
const c = e + n;
|
|
1393
|
-
if (c >=
|
|
1394
|
-
const m = K(
|
|
1395
|
-
c,
|
|
1396
|
-
r,
|
|
1397
|
-
d - p
|
|
1398
|
-
);
|
|
1380
|
+
if (c >= a) {
|
|
1381
|
+
const m = K(c, a, d - p);
|
|
1399
1382
|
return { leading: m, length: d - m };
|
|
1400
1383
|
}
|
|
1401
1384
|
const u = K(
|
|
1402
|
-
d +
|
|
1385
|
+
d + a - c,
|
|
1403
1386
|
d,
|
|
1404
1387
|
l
|
|
1405
1388
|
);
|
|
1406
|
-
return { leading:
|
|
1389
|
+
return { leading: a, length: u - a };
|
|
1407
1390
|
}
|
|
1408
1391
|
if (i) {
|
|
1409
1392
|
const c = d + n;
|
|
@@ -1417,54 +1400,57 @@ function Tn({
|
|
|
1417
1400
|
}
|
|
1418
1401
|
const u = K(
|
|
1419
1402
|
e - (c - l),
|
|
1420
|
-
|
|
1403
|
+
a,
|
|
1421
1404
|
e
|
|
1422
1405
|
);
|
|
1423
1406
|
return { leading: u, length: l - u };
|
|
1424
1407
|
}
|
|
1425
1408
|
return { leading: e, length: t };
|
|
1426
1409
|
}
|
|
1427
|
-
function
|
|
1410
|
+
function ct(e, t = !0) {
|
|
1428
1411
|
const n = Y();
|
|
1429
1412
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1430
|
-
return
|
|
1413
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? {
|
|
1414
|
+
width: Hi,
|
|
1415
|
+
height: Wi
|
|
1416
|
+
} : { width: An, height: An };
|
|
1431
1417
|
const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1432
1418
|
return {
|
|
1433
|
-
width: t && i && o.width > 0 ? o.width : Math.min(
|
|
1434
|
-
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1419
|
+
width: t && i && o.width > 0 ? o.width : Math.min(ro, n.width - 36),
|
|
1420
|
+
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? $i : lo
|
|
1435
1421
|
};
|
|
1436
1422
|
}
|
|
1437
|
-
function
|
|
1423
|
+
function pa() {
|
|
1438
1424
|
const e = Y();
|
|
1439
1425
|
return {
|
|
1440
1426
|
width: Math.min(
|
|
1441
1427
|
K(
|
|
1442
|
-
e.width *
|
|
1443
|
-
|
|
1444
|
-
|
|
1428
|
+
e.width * ji,
|
|
1429
|
+
tn,
|
|
1430
|
+
qi
|
|
1445
1431
|
),
|
|
1446
1432
|
e.width - I * 2
|
|
1447
1433
|
),
|
|
1448
1434
|
height: Math.min(
|
|
1449
1435
|
K(
|
|
1450
|
-
e.height *
|
|
1451
|
-
|
|
1452
|
-
|
|
1436
|
+
e.height * Ki,
|
|
1437
|
+
nn,
|
|
1438
|
+
Vi
|
|
1453
1439
|
),
|
|
1454
|
-
e.height -
|
|
1440
|
+
e.height - Se - I
|
|
1455
1441
|
)
|
|
1456
1442
|
};
|
|
1457
1443
|
}
|
|
1458
1444
|
function ze(e = null) {
|
|
1459
|
-
return e ?
|
|
1445
|
+
return e ? gt(e) : pa();
|
|
1460
1446
|
}
|
|
1461
|
-
function
|
|
1447
|
+
function gt(e) {
|
|
1462
1448
|
const t = Y();
|
|
1463
1449
|
return {
|
|
1464
1450
|
width: K(
|
|
1465
1451
|
e.width,
|
|
1466
1452
|
Math.min(
|
|
1467
|
-
|
|
1453
|
+
tn,
|
|
1468
1454
|
t.width - I * 2
|
|
1469
1455
|
),
|
|
1470
1456
|
Math.max(
|
|
@@ -1475,54 +1461,54 @@ function ut(e) {
|
|
|
1475
1461
|
height: K(
|
|
1476
1462
|
e.height,
|
|
1477
1463
|
Math.min(
|
|
1478
|
-
|
|
1479
|
-
t.height -
|
|
1464
|
+
nn,
|
|
1465
|
+
t.height - Se - I
|
|
1480
1466
|
),
|
|
1481
1467
|
Math.max(
|
|
1482
1468
|
I,
|
|
1483
|
-
t.height -
|
|
1469
|
+
t.height - Se - I
|
|
1484
1470
|
)
|
|
1485
1471
|
)
|
|
1486
1472
|
};
|
|
1487
1473
|
}
|
|
1488
|
-
function
|
|
1474
|
+
function Rt(e, t) {
|
|
1489
1475
|
if (!t) {
|
|
1490
1476
|
e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
|
|
1491
1477
|
return;
|
|
1492
1478
|
}
|
|
1493
|
-
const n =
|
|
1479
|
+
const n = gt(t);
|
|
1494
1480
|
e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
|
|
1495
1481
|
}
|
|
1496
|
-
function
|
|
1482
|
+
function sa(e, t, n) {
|
|
1497
1483
|
const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1498
1484
|
if (Number.isFinite(o) && Number.isFinite(i))
|
|
1499
1485
|
return { x: o, y: i };
|
|
1500
|
-
const
|
|
1501
|
-
if (
|
|
1502
|
-
return { x:
|
|
1486
|
+
const a = e.getBoundingClientRect();
|
|
1487
|
+
if (a.width > 0 || a.height > 0)
|
|
1488
|
+
return { x: a.left, y: a.top };
|
|
1503
1489
|
const l = Y();
|
|
1504
1490
|
return {
|
|
1505
1491
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
1506
1492
|
y: l.height - 24 - n.height
|
|
1507
1493
|
};
|
|
1508
1494
|
}
|
|
1509
|
-
function
|
|
1510
|
-
const o =
|
|
1511
|
-
return t ?
|
|
1495
|
+
function zt(e, t, n) {
|
|
1496
|
+
const o = ct(e, !1);
|
|
1497
|
+
return t ? Xt(
|
|
1512
1498
|
e,
|
|
1513
|
-
|
|
1499
|
+
ho(t, o),
|
|
1514
1500
|
o
|
|
1515
|
-
) :
|
|
1501
|
+
) : da(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Gi);
|
|
1516
1502
|
}
|
|
1517
|
-
function
|
|
1503
|
+
function da(e, t, n) {
|
|
1518
1504
|
const o = Y();
|
|
1519
1505
|
return {
|
|
1520
1506
|
x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
|
|
1521
1507
|
y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
|
|
1522
1508
|
};
|
|
1523
1509
|
}
|
|
1524
|
-
function
|
|
1525
|
-
const o = Y(), i = I +
|
|
1510
|
+
function Xt(e, t, n) {
|
|
1511
|
+
const o = Y(), i = I + ga(e);
|
|
1526
1512
|
return {
|
|
1527
1513
|
x: K(
|
|
1528
1514
|
t.x,
|
|
@@ -1542,36 +1528,36 @@ function Vt(e, t, n) {
|
|
|
1542
1528
|
)
|
|
1543
1529
|
};
|
|
1544
1530
|
}
|
|
1545
|
-
function
|
|
1531
|
+
function ho(e, t) {
|
|
1546
1532
|
const n = Y();
|
|
1547
1533
|
return {
|
|
1548
1534
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
1549
1535
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
1550
1536
|
};
|
|
1551
1537
|
}
|
|
1552
|
-
function
|
|
1553
|
-
const n =
|
|
1538
|
+
function ca(e, t) {
|
|
1539
|
+
const n = ua(e, t), o = Y();
|
|
1554
1540
|
return {
|
|
1555
1541
|
anchor: n,
|
|
1556
1542
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
1557
1543
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
1558
1544
|
};
|
|
1559
1545
|
}
|
|
1560
|
-
function
|
|
1561
|
-
const n = Y(), o = e.x + t.width / 2,
|
|
1562
|
-
return `${
|
|
1546
|
+
function ua(e, t) {
|
|
1547
|
+
const n = Y(), o = e.x + t.width / 2, a = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
1548
|
+
return `${a}-${l}`;
|
|
1563
1549
|
}
|
|
1564
|
-
function
|
|
1565
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1550
|
+
function ga(e) {
|
|
1551
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? Ji : Zi;
|
|
1566
1552
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const i =
|
|
1569
|
-
x: n === "bottom-left" ? t.x : t.x + i.width -
|
|
1570
|
-
y: t.y + i.height -
|
|
1553
|
+
function Mt(e, t, n, o = null) {
|
|
1554
|
+
const i = ct(e), a = ze(o), l = {
|
|
1555
|
+
x: n === "bottom-left" ? t.x : t.x + i.width - a.width,
|
|
1556
|
+
y: t.y + i.height - a.height
|
|
1571
1557
|
};
|
|
1572
|
-
return
|
|
1558
|
+
return pt(l, a);
|
|
1573
1559
|
}
|
|
1574
|
-
function
|
|
1560
|
+
function pt(e, t) {
|
|
1575
1561
|
const n = Y();
|
|
1576
1562
|
return {
|
|
1577
1563
|
x: K(
|
|
@@ -1584,34 +1570,34 @@ function lt(e, t) {
|
|
|
1584
1570
|
),
|
|
1585
1571
|
y: K(
|
|
1586
1572
|
e.y,
|
|
1587
|
-
|
|
1573
|
+
Se,
|
|
1588
1574
|
Math.max(
|
|
1589
|
-
|
|
1575
|
+
Se,
|
|
1590
1576
|
n.height - t.height - I
|
|
1591
1577
|
)
|
|
1592
1578
|
)
|
|
1593
1579
|
};
|
|
1594
1580
|
}
|
|
1595
|
-
function
|
|
1581
|
+
function Ce(e, t) {
|
|
1596
1582
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1597
1583
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1598
1584
|
return;
|
|
1599
1585
|
}
|
|
1600
1586
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1601
1587
|
}
|
|
1602
|
-
function
|
|
1588
|
+
function ha(e, t) {
|
|
1603
1589
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1604
1590
|
}
|
|
1605
|
-
function
|
|
1591
|
+
function Bn(e) {
|
|
1606
1592
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1607
1593
|
}
|
|
1608
1594
|
function Y() {
|
|
1609
1595
|
return {
|
|
1610
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1611
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1596
|
+
width: window.innerWidth || document.documentElement.clientWidth || ro + I * 2,
|
|
1597
|
+
height: window.innerHeight || document.documentElement.clientHeight || lo + I * 2
|
|
1612
1598
|
};
|
|
1613
1599
|
}
|
|
1614
|
-
function
|
|
1600
|
+
function Ot(e) {
|
|
1615
1601
|
const t = e.getBoundingClientRect();
|
|
1616
1602
|
return {
|
|
1617
1603
|
x: Math.round(t.x),
|
|
@@ -1631,46 +1617,46 @@ function J(e, t, n) {
|
|
|
1631
1617
|
source: e,
|
|
1632
1618
|
message: t,
|
|
1633
1619
|
details: n
|
|
1634
|
-
},
|
|
1635
|
-
|
|
1636
|
-
new CustomEvent(
|
|
1620
|
+
}, a = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1621
|
+
a.push(i), a.length > 120 && a.splice(0, a.length - 120), o.__plunoProductAgentDiagnostics__ = a, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
|
|
1622
|
+
new CustomEvent(Ri, { detail: i })
|
|
1637
1623
|
);
|
|
1638
1624
|
}
|
|
1639
|
-
function
|
|
1625
|
+
function ma(e, t) {
|
|
1640
1626
|
J("web-sdk.widget.position", e, t);
|
|
1641
1627
|
}
|
|
1642
|
-
function
|
|
1628
|
+
function Ut(e, t, n) {
|
|
1643
1629
|
const o = t.value.trim();
|
|
1644
1630
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
|
|
1645
|
-
attachments: n.length > 0 ? n.map(
|
|
1631
|
+
attachments: n.length > 0 ? n.map(ba) : void 0
|
|
1646
1632
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1647
1633
|
}
|
|
1648
|
-
function
|
|
1634
|
+
function fa(e, t, n) {
|
|
1649
1635
|
const o = e.activeElement;
|
|
1650
1636
|
return o === n ? "composer" : o === t ? "launcher" : null;
|
|
1651
1637
|
}
|
|
1652
|
-
function
|
|
1653
|
-
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt >
|
|
1638
|
+
function wa(e, t, n, o) {
|
|
1639
|
+
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > vi)
|
|
1654
1640
|
return;
|
|
1655
1641
|
const i = e.focusedInput === "composer" ? o : n;
|
|
1656
1642
|
i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
|
|
1657
1643
|
!i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
|
|
1658
1644
|
});
|
|
1659
1645
|
}
|
|
1660
|
-
function
|
|
1646
|
+
function ba(e) {
|
|
1661
1647
|
return e;
|
|
1662
1648
|
}
|
|
1663
|
-
function
|
|
1649
|
+
function Ve(e) {
|
|
1664
1650
|
e.style.height = "0px";
|
|
1665
1651
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1666
1652
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1667
1653
|
}
|
|
1668
|
-
function
|
|
1654
|
+
function Ke(e, t = () => !0) {
|
|
1669
1655
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1670
1656
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1671
1657
|
});
|
|
1672
1658
|
}
|
|
1673
|
-
function
|
|
1659
|
+
function _a(e) {
|
|
1674
1660
|
const t = e.messages[e.messages.length - 1];
|
|
1675
1661
|
return [
|
|
1676
1662
|
e.messages.length,
|
|
@@ -1681,13 +1667,13 @@ function la(e) {
|
|
|
1681
1667
|
e.lastError ?? ""
|
|
1682
1668
|
].join(":");
|
|
1683
1669
|
}
|
|
1684
|
-
function
|
|
1670
|
+
function xa(e) {
|
|
1685
1671
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1686
1672
|
}
|
|
1687
|
-
function
|
|
1673
|
+
function ya(e) {
|
|
1688
1674
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1689
1675
|
}
|
|
1690
|
-
function
|
|
1676
|
+
function va(e) {
|
|
1691
1677
|
const t = e.currentPage;
|
|
1692
1678
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1693
1679
|
try {
|
|
@@ -1698,7 +1684,7 @@ function da(e) {
|
|
|
1698
1684
|
}
|
|
1699
1685
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1700
1686
|
}
|
|
1701
|
-
function
|
|
1687
|
+
function Ca(e, t) {
|
|
1702
1688
|
const n = new Date(e).getTime();
|
|
1703
1689
|
if (!Number.isFinite(n))
|
|
1704
1690
|
return "now";
|
|
@@ -1707,103 +1693,103 @@ function ca(e, t) {
|
|
|
1707
1693
|
["hour", 36e5],
|
|
1708
1694
|
["min", 6e4]
|
|
1709
1695
|
];
|
|
1710
|
-
for (const [
|
|
1696
|
+
for (const [a, l] of i)
|
|
1711
1697
|
if (o >= l) {
|
|
1712
1698
|
const p = Math.max(1, Math.floor(o / l));
|
|
1713
|
-
return
|
|
1699
|
+
return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
|
|
1714
1700
|
}
|
|
1715
1701
|
return "now";
|
|
1716
1702
|
}
|
|
1717
|
-
function
|
|
1718
|
-
e.appendChild(
|
|
1719
|
-
|
|
1703
|
+
function Sa(e, t, n, o, i) {
|
|
1704
|
+
e.appendChild(Da()), e.appendChild(
|
|
1705
|
+
Ea(
|
|
1720
1706
|
t,
|
|
1721
1707
|
n,
|
|
1722
1708
|
o,
|
|
1723
1709
|
i
|
|
1724
1710
|
)
|
|
1725
1711
|
), e.appendChild(
|
|
1726
|
-
|
|
1712
|
+
ht(
|
|
1727
1713
|
"pluno-pa-widget__close",
|
|
1728
1714
|
"Close",
|
|
1729
|
-
|
|
1715
|
+
Ra(16),
|
|
1730
1716
|
!0
|
|
1731
1717
|
)
|
|
1732
|
-
), e.appendChild(
|
|
1718
|
+
), e.appendChild(ka(n));
|
|
1733
1719
|
}
|
|
1734
|
-
function
|
|
1720
|
+
function Ea(e, t, n, o) {
|
|
1735
1721
|
const i = document.createElement("form");
|
|
1736
1722
|
if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
|
|
1737
1723
|
const d = document.createElement("button");
|
|
1738
1724
|
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);
|
|
1739
1725
|
}
|
|
1740
1726
|
i.appendChild(
|
|
1741
|
-
|
|
1727
|
+
bo(
|
|
1742
1728
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1743
1729
|
10
|
|
1744
1730
|
)
|
|
1745
1731
|
), i.appendChild(
|
|
1746
|
-
|
|
1732
|
+
fe(
|
|
1747
1733
|
"pluno-pa-widget__character--launcher",
|
|
1748
1734
|
t
|
|
1749
1735
|
)
|
|
1750
1736
|
);
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1737
|
+
const a = document.createElement("span");
|
|
1738
|
+
a.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(a);
|
|
1753
1739
|
const l = document.createElement("input");
|
|
1754
1740
|
l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
|
|
1755
|
-
const p =
|
|
1741
|
+
const p = ut("Working...");
|
|
1756
1742
|
if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
|
|
1757
1743
|
const d = document.createElement("button");
|
|
1758
1744
|
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);
|
|
1759
1745
|
}
|
|
1760
1746
|
return i;
|
|
1761
1747
|
}
|
|
1762
|
-
function
|
|
1748
|
+
function ka(e) {
|
|
1763
1749
|
const t = document.createElement("section");
|
|
1764
1750
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1765
|
-
|
|
1751
|
+
bo("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1766
1752
|
);
|
|
1767
1753
|
const n = document.createElement("div");
|
|
1768
1754
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1769
1755
|
const o = document.createElement("main");
|
|
1770
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1756
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(Ta(e));
|
|
1771
1757
|
const i = document.createElement("div");
|
|
1772
1758
|
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1759
|
+
const a = document.createElement("div");
|
|
1760
|
+
a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a);
|
|
1775
1761
|
const l = document.createElement("button");
|
|
1776
1762
|
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
|
|
1777
1763
|
const p = document.createElement("div");
|
|
1778
1764
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
1779
|
-
|
|
1765
|
+
ht(
|
|
1780
1766
|
"pluno-pa-widget__history",
|
|
1781
|
-
|
|
1782
|
-
|
|
1767
|
+
Zt(),
|
|
1768
|
+
Ma(),
|
|
1783
1769
|
!0
|
|
1784
1770
|
)
|
|
1785
|
-
), n.appendChild(p), n.appendChild(
|
|
1786
|
-
|
|
1787
|
-
), t.appendChild(
|
|
1788
|
-
|
|
1771
|
+
), n.appendChild(p), n.appendChild(Ia()), t.appendChild(n), t.appendChild(La()), t.appendChild(Pa()), t.appendChild(me("left", "Resize Pluno from left")), t.appendChild(
|
|
1772
|
+
me("right", "Resize Pluno from right")
|
|
1773
|
+
), t.appendChild(me("top", "Resize Pluno from top")), t.appendChild(
|
|
1774
|
+
me("bottom", "Resize Pluno from bottom")
|
|
1789
1775
|
), t.appendChild(
|
|
1790
|
-
|
|
1776
|
+
me("top-left", "Resize Pluno from top left")
|
|
1791
1777
|
), t.appendChild(
|
|
1792
|
-
|
|
1778
|
+
me("top-right", "Resize Pluno from top right")
|
|
1793
1779
|
), t.appendChild(
|
|
1794
|
-
|
|
1780
|
+
me("bottom-left", "Resize Pluno from bottom left")
|
|
1795
1781
|
), t.appendChild(
|
|
1796
|
-
|
|
1782
|
+
me("bottom-right", "Resize Pluno from bottom right")
|
|
1797
1783
|
), t;
|
|
1798
1784
|
}
|
|
1799
|
-
function
|
|
1785
|
+
function me(e, t) {
|
|
1800
1786
|
const n = document.createElement("button");
|
|
1801
1787
|
return n.type = "button", n.className = [
|
|
1802
1788
|
"pluno-pa-widget__resize-handle",
|
|
1803
1789
|
`pluno-pa-widget__resize-handle--${e}`
|
|
1804
1790
|
].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
|
|
1805
1791
|
}
|
|
1806
|
-
function
|
|
1792
|
+
function La() {
|
|
1807
1793
|
const e = document.createElement("div");
|
|
1808
1794
|
e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
|
|
1809
1795
|
const t = document.createElement("span");
|
|
@@ -1814,10 +1800,10 @@ function ma() {
|
|
|
1814
1800
|
o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
|
|
1815
1801
|
const i = document.createElement("button");
|
|
1816
1802
|
i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
|
|
1817
|
-
const
|
|
1818
|
-
return
|
|
1803
|
+
const a = document.createElement("button");
|
|
1804
|
+
return a.type = "button", a.className = "pluno-pa-widget__notify-suggestion-never", a.textContent = "Never", n.append(o, i, a), e.append(t, n), e;
|
|
1819
1805
|
}
|
|
1820
|
-
function
|
|
1806
|
+
function Pa() {
|
|
1821
1807
|
const e = document.createElement("form");
|
|
1822
1808
|
e.className = "pluno-pa-widget__composer";
|
|
1823
1809
|
const t = document.createElement("div");
|
|
@@ -1828,14 +1814,14 @@ function fa() {
|
|
|
1828
1814
|
o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
|
|
1829
1815
|
const i = document.createElement("div");
|
|
1830
1816
|
i.className = "pluno-pa-widget__composer-inner";
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1817
|
+
const a = document.createElement("input");
|
|
1818
|
+
a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
|
|
1833
1819
|
const l = document.createElement("button");
|
|
1834
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1820
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ua()), l.appendChild(Ba()), i.appendChild(l);
|
|
1835
1821
|
const p = document.createElement("textarea");
|
|
1836
1822
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1837
1823
|
const d = document.createElement("button");
|
|
1838
|
-
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(
|
|
1824
|
+
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(xo()), i.appendChild(d), e.appendChild(i);
|
|
1839
1825
|
const c = document.createElement("div");
|
|
1840
1826
|
c.className = "pluno-pa-widget__composer-meta";
|
|
1841
1827
|
const u = document.createElement("a");
|
|
@@ -1843,42 +1829,42 @@ function fa() {
|
|
|
1843
1829
|
const m = document.createElement("span");
|
|
1844
1830
|
return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
|
|
1845
1831
|
}
|
|
1846
|
-
function
|
|
1832
|
+
function Zt() {
|
|
1847
1833
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
1848
1834
|
}
|
|
1849
|
-
function
|
|
1835
|
+
function Ia() {
|
|
1850
1836
|
const e = document.createElement("section");
|
|
1851
|
-
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label",
|
|
1837
|
+
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Zt());
|
|
1852
1838
|
const t = document.createElement("div");
|
|
1853
1839
|
t.className = "pluno-pa-widget__history-header";
|
|
1854
1840
|
const n = document.createElement("strong");
|
|
1855
|
-
n.textContent =
|
|
1856
|
-
const o =
|
|
1841
|
+
n.textContent = Zt();
|
|
1842
|
+
const o = ht(
|
|
1857
1843
|
"pluno-pa-widget__history-close",
|
|
1858
1844
|
"Close recent chats",
|
|
1859
|
-
|
|
1845
|
+
Oa(),
|
|
1860
1846
|
!1
|
|
1861
1847
|
);
|
|
1862
1848
|
t.append(n, o);
|
|
1863
1849
|
const i = document.createElement("div");
|
|
1864
1850
|
i.className = "pluno-pa-widget__history-list";
|
|
1865
|
-
const
|
|
1866
|
-
return
|
|
1851
|
+
const a = document.createElement("p");
|
|
1852
|
+
return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
|
|
1867
1853
|
}
|
|
1868
|
-
function
|
|
1854
|
+
function Ta(e) {
|
|
1869
1855
|
const t = document.createElement("div");
|
|
1870
1856
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1871
|
-
|
|
1857
|
+
fe(
|
|
1872
1858
|
"pluno-pa-widget__character--empty",
|
|
1873
1859
|
e
|
|
1874
1860
|
)
|
|
1875
|
-
), t.appendChild(
|
|
1861
|
+
), t.appendChild(mo()), t;
|
|
1876
1862
|
}
|
|
1877
|
-
function
|
|
1863
|
+
function mo() {
|
|
1878
1864
|
const e = document.createElement("div");
|
|
1879
1865
|
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;
|
|
1880
1866
|
}
|
|
1881
|
-
function
|
|
1867
|
+
function fo(e, t) {
|
|
1882
1868
|
e.replaceChildren(), e.setAttribute(
|
|
1883
1869
|
"aria-label",
|
|
1884
1870
|
`${t.toLocaleString("en-US")} users currently active`
|
|
@@ -1890,17 +1876,17 @@ function po(e, t) {
|
|
|
1890
1876
|
)
|
|
1891
1877
|
);
|
|
1892
1878
|
}
|
|
1893
|
-
function
|
|
1894
|
-
const n = `pluno-pa-character-${
|
|
1895
|
-
|
|
1896
|
-
const o = t.scribbleStyle ?
|
|
1879
|
+
function fe(e, t) {
|
|
1880
|
+
const n = `pluno-pa-character-${Dn}`;
|
|
1881
|
+
Dn += 1;
|
|
1882
|
+
const o = t.scribbleStyle ? Na(t.accentColor, n) : Aa(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
|
|
1897
1883
|
return o.setAttribute(
|
|
1898
1884
|
"class",
|
|
1899
1885
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1900
1886
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1901
1887
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const n =
|
|
1888
|
+
function Aa(e, t) {
|
|
1889
|
+
const n = ni(e), o = {
|
|
1904
1890
|
boltFill: `${t}-boltFill`,
|
|
1905
1891
|
boltEdge: `${t}-boltEdge`,
|
|
1906
1892
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1911,7 +1897,7 @@ function _a(e, t) {
|
|
|
1911
1897
|
eyeShadow: `${t}-eyeShadow`,
|
|
1912
1898
|
pupilGloss: `${t}-pupilGloss`,
|
|
1913
1899
|
boltClip: `${t}-boltClip`
|
|
1914
|
-
}, i =
|
|
1900
|
+
}, i = wo(), a = f(i, "defs"), l = f(a, "linearGradient", {
|
|
1915
1901
|
id: o.boltFill,
|
|
1916
1902
|
x1: "420",
|
|
1917
1903
|
y1: "180",
|
|
@@ -1920,7 +1906,7 @@ function _a(e, t) {
|
|
|
1920
1906
|
gradientUnits: "userSpaceOnUse"
|
|
1921
1907
|
});
|
|
1922
1908
|
O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
|
|
1923
|
-
const p = f(
|
|
1909
|
+
const p = f(a, "linearGradient", {
|
|
1924
1910
|
id: o.boltEdge,
|
|
1925
1911
|
x1: "470",
|
|
1926
1912
|
y1: "145",
|
|
@@ -1929,28 +1915,28 @@ function _a(e, t) {
|
|
|
1929
1915
|
gradientUnits: "userSpaceOnUse"
|
|
1930
1916
|
});
|
|
1931
1917
|
O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
|
|
1932
|
-
const d = f(
|
|
1918
|
+
const d = f(a, "radialGradient", {
|
|
1933
1919
|
id: o.boltGlow,
|
|
1934
1920
|
cx: "50%",
|
|
1935
1921
|
cy: "22%",
|
|
1936
1922
|
r: "82%"
|
|
1937
1923
|
});
|
|
1938
1924
|
O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
|
|
1939
|
-
const c = f(
|
|
1925
|
+
const c = f(a, "radialGradient", {
|
|
1940
1926
|
id: o.eyeWhite,
|
|
1941
1927
|
cx: "35%",
|
|
1942
1928
|
cy: "25%",
|
|
1943
1929
|
r: "70%"
|
|
1944
1930
|
});
|
|
1945
1931
|
O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
|
|
1946
|
-
const u = f(
|
|
1932
|
+
const u = f(a, "radialGradient", {
|
|
1947
1933
|
id: o.pupil,
|
|
1948
1934
|
cx: "42%",
|
|
1949
1935
|
cy: "38%",
|
|
1950
1936
|
r: "65%"
|
|
1951
1937
|
});
|
|
1952
1938
|
O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
|
|
1953
|
-
const m = f(
|
|
1939
|
+
const m = f(a, "filter", {
|
|
1954
1940
|
id: o.softDropShadow,
|
|
1955
1941
|
x: "-18%",
|
|
1956
1942
|
y: "-12%",
|
|
@@ -1965,7 +1951,7 @@ function _a(e, t) {
|
|
|
1965
1951
|
"flood-color": n.shadow,
|
|
1966
1952
|
"flood-opacity": "0.24"
|
|
1967
1953
|
});
|
|
1968
|
-
const
|
|
1954
|
+
const E = f(a, "filter", {
|
|
1969
1955
|
id: o.innerDepth,
|
|
1970
1956
|
x: "-8%",
|
|
1971
1957
|
y: "-8%",
|
|
@@ -1973,32 +1959,32 @@ function _a(e, t) {
|
|
|
1973
1959
|
height: "116%",
|
|
1974
1960
|
"color-interpolation-filters": "sRGB"
|
|
1975
1961
|
});
|
|
1976
|
-
f(
|
|
1962
|
+
f(E, "feGaussianBlur", {
|
|
1977
1963
|
in: "SourceAlpha",
|
|
1978
1964
|
stdDeviation: "8",
|
|
1979
1965
|
result: "blur"
|
|
1980
|
-
}), f(
|
|
1966
|
+
}), f(E, "feOffset", {
|
|
1981
1967
|
dx: "-7",
|
|
1982
1968
|
dy: "-9",
|
|
1983
1969
|
result: "topLeft"
|
|
1984
|
-
}), f(
|
|
1970
|
+
}), f(E, "feComposite", {
|
|
1985
1971
|
in: "topLeft",
|
|
1986
1972
|
in2: "SourceAlpha",
|
|
1987
1973
|
operator: "arithmetic",
|
|
1988
1974
|
k2: "-1",
|
|
1989
1975
|
k3: "1",
|
|
1990
1976
|
result: "innerShadow"
|
|
1991
|
-
}), f(
|
|
1977
|
+
}), f(E, "feColorMatrix", {
|
|
1992
1978
|
in: "innerShadow",
|
|
1993
1979
|
type: "matrix",
|
|
1994
1980
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1995
1981
|
result: "innerLight"
|
|
1996
|
-
}), f(
|
|
1982
|
+
}), f(E, "feBlend", {
|
|
1997
1983
|
in: "SourceGraphic",
|
|
1998
1984
|
in2: "innerLight",
|
|
1999
1985
|
mode: "screen"
|
|
2000
1986
|
});
|
|
2001
|
-
const v = f(
|
|
1987
|
+
const v = f(a, "filter", {
|
|
2002
1988
|
id: o.eyeShadow,
|
|
2003
1989
|
x: "-24%",
|
|
2004
1990
|
y: "-20%",
|
|
@@ -2013,7 +1999,7 @@ function _a(e, t) {
|
|
|
2013
1999
|
"flood-color": n.shadow,
|
|
2014
2000
|
"flood-opacity": "0.3"
|
|
2015
2001
|
});
|
|
2016
|
-
const
|
|
2002
|
+
const z = f(a, "filter", {
|
|
2017
2003
|
id: o.pupilGloss,
|
|
2018
2004
|
x: "-15%",
|
|
2019
2005
|
y: "-15%",
|
|
@@ -2021,29 +2007,29 @@ function _a(e, t) {
|
|
|
2021
2007
|
height: "130%",
|
|
2022
2008
|
"color-interpolation-filters": "sRGB"
|
|
2023
2009
|
});
|
|
2024
|
-
f(
|
|
2010
|
+
f(z, "feDropShadow", {
|
|
2025
2011
|
dx: "0",
|
|
2026
2012
|
dy: "3",
|
|
2027
2013
|
stdDeviation: "3",
|
|
2028
2014
|
"flood-color": "#000000",
|
|
2029
2015
|
"flood-opacity": "0.22"
|
|
2030
2016
|
});
|
|
2031
|
-
const
|
|
2032
|
-
f(
|
|
2017
|
+
const b = f(a, "clipPath", { id: o.boltClip });
|
|
2018
|
+
f(b, "path", { d: st });
|
|
2033
2019
|
const g = f(i, "g", {
|
|
2034
2020
|
filter: V(o.softDropShadow)
|
|
2035
2021
|
});
|
|
2036
2022
|
f(g, "path", {
|
|
2037
|
-
d:
|
|
2023
|
+
d: st,
|
|
2038
2024
|
fill: V(o.boltEdge)
|
|
2039
2025
|
});
|
|
2040
|
-
const
|
|
2026
|
+
const w = "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";
|
|
2041
2027
|
f(g, "path", {
|
|
2042
|
-
d:
|
|
2028
|
+
d: w,
|
|
2043
2029
|
fill: V(o.boltFill),
|
|
2044
2030
|
filter: V(o.innerDepth)
|
|
2045
2031
|
}), f(g, "path", {
|
|
2046
|
-
d:
|
|
2032
|
+
d: w,
|
|
2047
2033
|
fill: V(o.boltGlow),
|
|
2048
2034
|
opacity: "0.74"
|
|
2049
2035
|
});
|
|
@@ -2074,7 +2060,7 @@ function _a(e, t) {
|
|
|
2074
2060
|
opacity: "0.48"
|
|
2075
2061
|
});
|
|
2076
2062
|
const P = f(i, "g", { filter: V(o.eyeShadow) });
|
|
2077
|
-
return
|
|
2063
|
+
return Fn(
|
|
2078
2064
|
P,
|
|
2079
2065
|
"rotate(-2 528 463)",
|
|
2080
2066
|
"528",
|
|
@@ -2084,7 +2070,7 @@ function _a(e, t) {
|
|
|
2084
2070
|
"557",
|
|
2085
2071
|
"447",
|
|
2086
2072
|
o
|
|
2087
|
-
),
|
|
2073
|
+
), Fn(
|
|
2088
2074
|
P,
|
|
2089
2075
|
"rotate(2 717 462)",
|
|
2090
2076
|
"717",
|
|
@@ -2096,13 +2082,13 @@ function _a(e, t) {
|
|
|
2096
2082
|
o
|
|
2097
2083
|
), i;
|
|
2098
2084
|
}
|
|
2099
|
-
function
|
|
2100
|
-
const n =
|
|
2085
|
+
function Na(e, t) {
|
|
2086
|
+
const n = eo(e), o = {
|
|
2101
2087
|
clip: `${t}-scribbleBoltClip`,
|
|
2102
2088
|
wobble: `${t}-scribbleBoltWobble`
|
|
2103
|
-
}, i =
|
|
2104
|
-
f(l, "path", { d:
|
|
2105
|
-
const p = f(
|
|
2089
|
+
}, i = wo(), a = f(i, "defs"), l = f(a, "clipPath", { id: o.clip });
|
|
2090
|
+
f(l, "path", { d: st });
|
|
2091
|
+
const p = f(a, "filter", {
|
|
2106
2092
|
id: o.wobble,
|
|
2107
2093
|
x: "-10%",
|
|
2108
2094
|
y: "-10%",
|
|
@@ -2127,7 +2113,7 @@ function xa(e, t) {
|
|
|
2127
2113
|
"clip-path": V(o.clip)
|
|
2128
2114
|
});
|
|
2129
2115
|
return f(c, "path", {
|
|
2130
|
-
d:
|
|
2116
|
+
d: ti(),
|
|
2131
2117
|
fill: "none",
|
|
2132
2118
|
stroke: n,
|
|
2133
2119
|
"stroke-width": "56",
|
|
@@ -2136,12 +2122,12 @@ function xa(e, t) {
|
|
|
2136
2122
|
opacity: "0.9",
|
|
2137
2123
|
transform: "rotate(-14 627 600)"
|
|
2138
2124
|
}), f(d, "path", {
|
|
2139
|
-
d:
|
|
2125
|
+
d: st,
|
|
2140
2126
|
fill: "none",
|
|
2141
|
-
stroke:
|
|
2127
|
+
stroke: dt,
|
|
2142
2128
|
"stroke-width": "18",
|
|
2143
2129
|
"stroke-linejoin": "round"
|
|
2144
|
-
}),
|
|
2130
|
+
}), Hn(
|
|
2145
2131
|
d,
|
|
2146
2132
|
"rotate(-2 528 463)",
|
|
2147
2133
|
"528",
|
|
@@ -2150,7 +2136,7 @@ function xa(e, t) {
|
|
|
2150
2136
|
"473",
|
|
2151
2137
|
"557",
|
|
2152
2138
|
"447"
|
|
2153
|
-
),
|
|
2139
|
+
), Hn(
|
|
2154
2140
|
d,
|
|
2155
2141
|
"rotate(2 717 462)",
|
|
2156
2142
|
"717",
|
|
@@ -2161,13 +2147,13 @@ function xa(e, t) {
|
|
|
2161
2147
|
"447"
|
|
2162
2148
|
), i;
|
|
2163
2149
|
}
|
|
2164
|
-
function
|
|
2165
|
-
return
|
|
2166
|
-
xmlns:
|
|
2150
|
+
function wo() {
|
|
2151
|
+
return S("svg", {
|
|
2152
|
+
xmlns: po,
|
|
2167
2153
|
viewBox: "0 0 1254 1254"
|
|
2168
2154
|
});
|
|
2169
2155
|
}
|
|
2170
|
-
function
|
|
2156
|
+
function Fn(e, t, n, o, i, a, l, p, d) {
|
|
2171
2157
|
const c = f(e, "g", { transform: t });
|
|
2172
2158
|
f(c, "ellipse", {
|
|
2173
2159
|
cx: n,
|
|
@@ -2177,7 +2163,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
|
|
|
2177
2163
|
fill: V(d.eyeWhite)
|
|
2178
2164
|
}), f(c, "ellipse", {
|
|
2179
2165
|
cx: i,
|
|
2180
|
-
cy:
|
|
2166
|
+
cy: a,
|
|
2181
2167
|
rx: "49",
|
|
2182
2168
|
ry: "57",
|
|
2183
2169
|
fill: V(d.pupil),
|
|
@@ -2189,7 +2175,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
|
|
|
2189
2175
|
fill: "#ffffff"
|
|
2190
2176
|
});
|
|
2191
2177
|
}
|
|
2192
|
-
function
|
|
2178
|
+
function Hn(e, t, n, o, i, a, l, p) {
|
|
2193
2179
|
const d = f(e, "g", { transform: t });
|
|
2194
2180
|
f(d, "ellipse", {
|
|
2195
2181
|
cx: n,
|
|
@@ -2197,14 +2183,14 @@ function Rn(e, t, n, o, i, r, l, p) {
|
|
|
2197
2183
|
rx: "73",
|
|
2198
2184
|
ry: "80",
|
|
2199
2185
|
fill: "#ffffff",
|
|
2200
|
-
stroke:
|
|
2186
|
+
stroke: dt,
|
|
2201
2187
|
"stroke-width": "13"
|
|
2202
2188
|
}), f(d, "ellipse", {
|
|
2203
2189
|
cx: i,
|
|
2204
|
-
cy:
|
|
2190
|
+
cy: a,
|
|
2205
2191
|
rx: "45",
|
|
2206
2192
|
ry: "53",
|
|
2207
|
-
fill:
|
|
2193
|
+
fill: dt
|
|
2208
2194
|
}), f(d, "circle", {
|
|
2209
2195
|
cx: l,
|
|
2210
2196
|
cy: p,
|
|
@@ -2213,7 +2199,7 @@ function Rn(e, t, n, o, i, r, l, p) {
|
|
|
2213
2199
|
});
|
|
2214
2200
|
}
|
|
2215
2201
|
function f(e, t, n = {}) {
|
|
2216
|
-
const o =
|
|
2202
|
+
const o = S(t, n);
|
|
2217
2203
|
return e.appendChild(o), o;
|
|
2218
2204
|
}
|
|
2219
2205
|
function O(e, t, n, o) {
|
|
@@ -2223,61 +2209,61 @@ function O(e, t, n, o) {
|
|
|
2223
2209
|
function V(e) {
|
|
2224
2210
|
return `url(#${e})`;
|
|
2225
2211
|
}
|
|
2226
|
-
function
|
|
2212
|
+
function ht(e, t, n, o) {
|
|
2227
2213
|
const i = document.createElement("button");
|
|
2228
2214
|
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
|
|
2229
2215
|
}
|
|
2230
|
-
function
|
|
2231
|
-
const e =
|
|
2216
|
+
function Da() {
|
|
2217
|
+
const e = S("svg", {
|
|
2232
2218
|
class: "pluno-pa-widget__scribble-defs",
|
|
2233
2219
|
"aria-hidden": "true",
|
|
2234
2220
|
focusable: "false",
|
|
2235
2221
|
width: "0",
|
|
2236
2222
|
height: "0"
|
|
2237
|
-
}), t =
|
|
2238
|
-
return t.appendChild(
|
|
2239
|
-
|
|
2223
|
+
}), t = S("defs");
|
|
2224
|
+
return t.appendChild(Ft("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
2225
|
+
Ft("pluno-pa-scribble-wobble-2", "5", "15")
|
|
2240
2226
|
), t.appendChild(
|
|
2241
|
-
|
|
2227
|
+
Ft("pluno-pa-scribble-wobble-3", "9", "19")
|
|
2242
2228
|
), e.appendChild(t), e;
|
|
2243
2229
|
}
|
|
2244
|
-
function
|
|
2245
|
-
const n =
|
|
2230
|
+
function bo(e, t) {
|
|
2231
|
+
const n = S("svg", {
|
|
2246
2232
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
2247
2233
|
preserveAspectRatio: "xMidYMid meet",
|
|
2248
2234
|
"aria-hidden": "true",
|
|
2249
2235
|
focusable: "false"
|
|
2250
2236
|
});
|
|
2251
|
-
return
|
|
2237
|
+
return _o(n, t), n;
|
|
2252
2238
|
}
|
|
2253
|
-
function
|
|
2239
|
+
function Bt(e, t) {
|
|
2254
2240
|
if (!e)
|
|
2255
2241
|
return;
|
|
2256
2242
|
const n = Math.max(
|
|
2257
2243
|
0,
|
|
2258
|
-
t -
|
|
2244
|
+
t - Kt * 2
|
|
2259
2245
|
), o = Math.max(
|
|
2260
|
-
|
|
2246
|
+
Xi,
|
|
2261
2247
|
Math.floor(
|
|
2262
|
-
(n -
|
|
2248
|
+
(n - Vt * 2) / jt
|
|
2263
2249
|
)
|
|
2264
2250
|
);
|
|
2265
|
-
|
|
2251
|
+
_o(e, o);
|
|
2266
2252
|
}
|
|
2267
|
-
function
|
|
2253
|
+
function _o(e, t) {
|
|
2268
2254
|
if (e.dataset.spiralCount === `${t}`)
|
|
2269
2255
|
return;
|
|
2270
|
-
const n = t *
|
|
2256
|
+
const n = t * jt + Vt * 2;
|
|
2271
2257
|
e.dataset.spiralCount = `${t}`, e.setAttribute(
|
|
2272
2258
|
"viewBox",
|
|
2273
|
-
`0 0 ${n} ${
|
|
2259
|
+
`0 0 ${n} ${Yi}`
|
|
2274
2260
|
), e.replaceChildren();
|
|
2275
2261
|
for (let o = 0; o < t; o += 1) {
|
|
2276
|
-
const i =
|
|
2277
|
-
transform: `translate(${
|
|
2262
|
+
const i = Nn[o % Nn.length], a = S("g", {
|
|
2263
|
+
transform: `translate(${Vt + o * jt} 0)`
|
|
2278
2264
|
});
|
|
2279
|
-
|
|
2280
|
-
|
|
2265
|
+
a.appendChild(
|
|
2266
|
+
S("ellipse", {
|
|
2281
2267
|
cx: i.ellipseCx,
|
|
2282
2268
|
cy: i.ellipseCy,
|
|
2283
2269
|
rx: i.ellipseRx,
|
|
@@ -2287,19 +2273,19 @@ function uo(e, t) {
|
|
|
2287
2273
|
"stroke-width": i.strokeWidth,
|
|
2288
2274
|
opacity: "0.8"
|
|
2289
2275
|
})
|
|
2290
|
-
),
|
|
2291
|
-
|
|
2276
|
+
), a.appendChild(
|
|
2277
|
+
S("path", {
|
|
2292
2278
|
d: i.path,
|
|
2293
2279
|
fill: "none",
|
|
2294
2280
|
stroke: "#2c2a1e",
|
|
2295
2281
|
"stroke-width": i.pathStrokeWidth,
|
|
2296
2282
|
"stroke-linecap": "round"
|
|
2297
2283
|
})
|
|
2298
|
-
), e.appendChild(
|
|
2284
|
+
), e.appendChild(a);
|
|
2299
2285
|
}
|
|
2300
2286
|
}
|
|
2301
|
-
function
|
|
2302
|
-
const o =
|
|
2287
|
+
function Ft(e, t, n) {
|
|
2288
|
+
const o = S("filter", {
|
|
2303
2289
|
id: e,
|
|
2304
2290
|
x: "-8%",
|
|
2305
2291
|
y: "-8%",
|
|
@@ -2307,7 +2293,7 @@ function Ot(e, t, n) {
|
|
|
2307
2293
|
height: "116%"
|
|
2308
2294
|
});
|
|
2309
2295
|
return o.appendChild(
|
|
2310
|
-
|
|
2296
|
+
S("feTurbulence", {
|
|
2311
2297
|
type: "fractalNoise",
|
|
2312
2298
|
baseFrequency: "0.012 0.028",
|
|
2313
2299
|
numOctaves: "3",
|
|
@@ -2315,7 +2301,7 @@ function Ot(e, t, n) {
|
|
|
2315
2301
|
result: "stroke-noise"
|
|
2316
2302
|
})
|
|
2317
2303
|
), o.appendChild(
|
|
2318
|
-
|
|
2304
|
+
S("feDisplacementMap", {
|
|
2319
2305
|
in: "SourceGraphic",
|
|
2320
2306
|
in2: "stroke-noise",
|
|
2321
2307
|
scale: "3.5",
|
|
@@ -2324,7 +2310,7 @@ function Ot(e, t, n) {
|
|
|
2324
2310
|
result: "warped"
|
|
2325
2311
|
})
|
|
2326
2312
|
), o.appendChild(
|
|
2327
|
-
|
|
2313
|
+
S("feTurbulence", {
|
|
2328
2314
|
type: "fractalNoise",
|
|
2329
2315
|
baseFrequency: "0.7",
|
|
2330
2316
|
numOctaves: "1",
|
|
@@ -2332,7 +2318,7 @@ function Ot(e, t, n) {
|
|
|
2332
2318
|
result: "ink-noise"
|
|
2333
2319
|
})
|
|
2334
2320
|
), o.appendChild(
|
|
2335
|
-
|
|
2321
|
+
S("feDisplacementMap", {
|
|
2336
2322
|
in: "warped",
|
|
2337
2323
|
in2: "ink-noise",
|
|
2338
2324
|
scale: "0.9",
|
|
@@ -2341,7 +2327,7 @@ function Ot(e, t, n) {
|
|
|
2341
2327
|
})
|
|
2342
2328
|
), o;
|
|
2343
2329
|
}
|
|
2344
|
-
function
|
|
2330
|
+
function Ra(e) {
|
|
2345
2331
|
const t = re(
|
|
2346
2332
|
"0 0 24 24",
|
|
2347
2333
|
e,
|
|
@@ -2350,9 +2336,9 @@ function va(e) {
|
|
|
2350
2336
|
"currentColor",
|
|
2351
2337
|
"2.25"
|
|
2352
2338
|
);
|
|
2353
|
-
return t.appendChild(
|
|
2339
|
+
return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
|
|
2354
2340
|
}
|
|
2355
|
-
function
|
|
2341
|
+
function za() {
|
|
2356
2342
|
const e = re(
|
|
2357
2343
|
"0 0 24 24",
|
|
2358
2344
|
17,
|
|
@@ -2362,16 +2348,16 @@ function Ca() {
|
|
|
2362
2348
|
"2.25"
|
|
2363
2349
|
);
|
|
2364
2350
|
return e.appendChild(
|
|
2365
|
-
|
|
2351
|
+
S("path", {
|
|
2366
2352
|
d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
|
2367
2353
|
})
|
|
2368
2354
|
), e.appendChild(
|
|
2369
|
-
|
|
2355
|
+
S("path", {
|
|
2370
2356
|
d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
|
|
2371
2357
|
})
|
|
2372
2358
|
), e;
|
|
2373
2359
|
}
|
|
2374
|
-
function
|
|
2360
|
+
function Ma() {
|
|
2375
2361
|
const e = re(
|
|
2376
2362
|
"0 0 24 24",
|
|
2377
2363
|
17,
|
|
@@ -2380,9 +2366,9 @@ function Sa() {
|
|
|
2380
2366
|
"currentColor",
|
|
2381
2367
|
"2.25"
|
|
2382
2368
|
);
|
|
2383
|
-
return e.appendChild(
|
|
2369
|
+
return e.appendChild(S("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(S("path", { d: "M3 4v5h5" })), e.appendChild(S("path", { d: "M12 7v5l3 2" })), e;
|
|
2384
2370
|
}
|
|
2385
|
-
function
|
|
2371
|
+
function Oa() {
|
|
2386
2372
|
const e = re(
|
|
2387
2373
|
"0 0 24 24",
|
|
2388
2374
|
15,
|
|
@@ -2391,9 +2377,9 @@ function Ea() {
|
|
|
2391
2377
|
"currentColor",
|
|
2392
2378
|
"2.4"
|
|
2393
2379
|
);
|
|
2394
|
-
return e.appendChild(
|
|
2380
|
+
return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
|
|
2395
2381
|
}
|
|
2396
|
-
function
|
|
2382
|
+
function xo() {
|
|
2397
2383
|
const e = re(
|
|
2398
2384
|
"0 0 24 24",
|
|
2399
2385
|
14,
|
|
@@ -2403,10 +2389,10 @@ function go() {
|
|
|
2403
2389
|
"2.75"
|
|
2404
2390
|
);
|
|
2405
2391
|
return e.appendChild(
|
|
2406
|
-
|
|
2407
|
-
), e.appendChild(
|
|
2392
|
+
S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2393
|
+
), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2408
2394
|
}
|
|
2409
|
-
function
|
|
2395
|
+
function Ua() {
|
|
2410
2396
|
const e = re(
|
|
2411
2397
|
"0 0 24 24",
|
|
2412
2398
|
16,
|
|
@@ -2419,18 +2405,18 @@ function ka() {
|
|
|
2419
2405
|
"class",
|
|
2420
2406
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
|
|
2421
2407
|
), e.appendChild(
|
|
2422
|
-
|
|
2408
|
+
S("path", {
|
|
2423
2409
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
2424
2410
|
})
|
|
2425
2411
|
), e;
|
|
2426
2412
|
}
|
|
2427
|
-
function
|
|
2413
|
+
function Ba() {
|
|
2428
2414
|
const e = re("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2429
2415
|
return e.setAttribute(
|
|
2430
2416
|
"class",
|
|
2431
2417
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
|
|
2432
2418
|
), e.appendChild(
|
|
2433
|
-
|
|
2419
|
+
S("path", {
|
|
2434
2420
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
2435
2421
|
stroke: "currentColor",
|
|
2436
2422
|
"stroke-width": "2",
|
|
@@ -2439,10 +2425,10 @@ function La() {
|
|
|
2439
2425
|
})
|
|
2440
2426
|
), e;
|
|
2441
2427
|
}
|
|
2442
|
-
function
|
|
2428
|
+
function Fa() {
|
|
2443
2429
|
const e = re("0 0 24 24", 18, 18, "currentColor");
|
|
2444
2430
|
return e.appendChild(
|
|
2445
|
-
|
|
2431
|
+
S("rect", {
|
|
2446
2432
|
x: "6",
|
|
2447
2433
|
y: "6",
|
|
2448
2434
|
width: "12",
|
|
@@ -2451,7 +2437,7 @@ function Pa() {
|
|
|
2451
2437
|
})
|
|
2452
2438
|
), e;
|
|
2453
2439
|
}
|
|
2454
|
-
function
|
|
2440
|
+
function Ha() {
|
|
2455
2441
|
const e = re(
|
|
2456
2442
|
"0 0 24 24",
|
|
2457
2443
|
12,
|
|
@@ -2460,9 +2446,9 @@ function Ia() {
|
|
|
2460
2446
|
"currentColor",
|
|
2461
2447
|
"2.4"
|
|
2462
2448
|
);
|
|
2463
|
-
return e.appendChild(
|
|
2449
|
+
return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
|
|
2464
2450
|
}
|
|
2465
|
-
function
|
|
2451
|
+
function Wa() {
|
|
2466
2452
|
const e = re(
|
|
2467
2453
|
"0 0 24 24",
|
|
2468
2454
|
13,
|
|
@@ -2472,7 +2458,7 @@ function Aa() {
|
|
|
2472
2458
|
"2.25"
|
|
2473
2459
|
);
|
|
2474
2460
|
return e.appendChild(
|
|
2475
|
-
|
|
2461
|
+
S("rect", {
|
|
2476
2462
|
width: "14",
|
|
2477
2463
|
height: "14",
|
|
2478
2464
|
x: "8",
|
|
@@ -2481,12 +2467,12 @@ function Aa() {
|
|
|
2481
2467
|
ry: "2"
|
|
2482
2468
|
})
|
|
2483
2469
|
), e.appendChild(
|
|
2484
|
-
|
|
2470
|
+
S("path", {
|
|
2485
2471
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
2486
2472
|
})
|
|
2487
2473
|
), e;
|
|
2488
2474
|
}
|
|
2489
|
-
function re(e, t, n, o, i,
|
|
2475
|
+
function re(e, t, n, o, i, a) {
|
|
2490
2476
|
const l = {
|
|
2491
2477
|
viewBox: e,
|
|
2492
2478
|
width: String(t),
|
|
@@ -2494,188 +2480,165 @@ function re(e, t, n, o, i, r) {
|
|
|
2494
2480
|
fill: o,
|
|
2495
2481
|
"aria-hidden": "true"
|
|
2496
2482
|
};
|
|
2497
|
-
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"),
|
|
2483
|
+
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), S("svg", l);
|
|
2498
2484
|
}
|
|
2499
|
-
function
|
|
2500
|
-
const n = document.createElementNS(
|
|
2485
|
+
function S(e, t = {}) {
|
|
2486
|
+
const n = document.createElementNS(po, e);
|
|
2501
2487
|
for (const [o, i] of Object.entries(t))
|
|
2502
2488
|
n.setAttribute(o, i);
|
|
2503
2489
|
return n;
|
|
2504
2490
|
}
|
|
2505
|
-
function
|
|
2491
|
+
function Wn(e) {
|
|
2506
2492
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2507
2493
|
e.addEventListener(t, (n) => {
|
|
2508
2494
|
n.stopPropagation();
|
|
2509
2495
|
});
|
|
2510
2496
|
}
|
|
2511
|
-
function
|
|
2497
|
+
function Ga(e, t, n) {
|
|
2512
2498
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2513
2499
|
for (const [o, i] of t.entries()) {
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2500
|
+
const a = document.createElement("div");
|
|
2501
|
+
a.className = "pluno-pa-widget__attachment", a.appendChild($a(i));
|
|
2516
2502
|
const l = document.createElement("span");
|
|
2517
|
-
l.textContent = i.name,
|
|
2503
|
+
l.textContent = i.name, a.appendChild(l);
|
|
2518
2504
|
const p = document.createElement("button");
|
|
2519
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2505
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ha()), p.addEventListener("click", () => n(o)), a.appendChild(p), e.appendChild(a);
|
|
2520
2506
|
}
|
|
2521
2507
|
}
|
|
2522
|
-
function
|
|
2523
|
-
const t =
|
|
2508
|
+
function $a(e) {
|
|
2509
|
+
const t = on(e), n = yo(e);
|
|
2524
2510
|
if (t === "image" && n) {
|
|
2525
2511
|
const o = document.createElement("img");
|
|
2526
|
-
return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener(
|
|
2527
|
-
"error",
|
|
2528
|
-
() => o.replaceWith(ie(e))
|
|
2529
|
-
), o;
|
|
2512
|
+
return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o;
|
|
2530
2513
|
}
|
|
2531
2514
|
if (t === "video" && n) {
|
|
2532
2515
|
const o = document.createElement("video");
|
|
2533
|
-
return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener(
|
|
2534
|
-
"error",
|
|
2535
|
-
() => o.replaceWith(ie(e))
|
|
2536
|
-
), o.addEventListener(
|
|
2537
|
-
"stalled",
|
|
2538
|
-
() => o.replaceWith(ie(e))
|
|
2539
|
-
), o;
|
|
2516
|
+
return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o.addEventListener("stalled", () => o.replaceWith(ie(e))), o;
|
|
2540
2517
|
}
|
|
2541
2518
|
return ie(e);
|
|
2542
2519
|
}
|
|
2543
|
-
function
|
|
2544
|
-
const t =
|
|
2520
|
+
function qa(e) {
|
|
2521
|
+
const t = on(e), n = yo(e);
|
|
2545
2522
|
if (t === "image" && n) {
|
|
2546
2523
|
const o = document.createElement("img");
|
|
2547
|
-
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener(
|
|
2548
|
-
"error",
|
|
2549
|
-
() => o.replaceWith(ie(e, "message"))
|
|
2550
|
-
), o;
|
|
2524
|
+
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o;
|
|
2551
2525
|
}
|
|
2552
2526
|
if (t === "pdf" && n) {
|
|
2553
2527
|
const o = document.createElement("object");
|
|
2554
|
-
return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener(
|
|
2555
|
-
"error",
|
|
2556
|
-
() => o.replaceWith(
|
|
2557
|
-
ie(e, "message")
|
|
2558
|
-
)
|
|
2559
|
-
), o.appendChild(ie(e, "message")), o;
|
|
2528
|
+
return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.appendChild(ie(e, "message")), o;
|
|
2560
2529
|
}
|
|
2561
2530
|
if (t === "video" && n) {
|
|
2562
2531
|
const o = document.createElement("video");
|
|
2563
|
-
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener(
|
|
2564
|
-
"error",
|
|
2565
|
-
() => o.replaceWith(ie(e, "message"))
|
|
2566
|
-
), o.addEventListener(
|
|
2567
|
-
"stalled",
|
|
2568
|
-
() => o.replaceWith(ie(e, "message"))
|
|
2569
|
-
), o;
|
|
2532
|
+
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(ie(e, "message"))), o;
|
|
2570
2533
|
}
|
|
2571
2534
|
return ie(e, "message");
|
|
2572
2535
|
}
|
|
2573
2536
|
function ie(e, t = "composer") {
|
|
2574
2537
|
if (t === "composer") {
|
|
2575
|
-
const
|
|
2576
|
-
return
|
|
2538
|
+
const a = document.createElement("span");
|
|
2539
|
+
return a.className = "pluno-pa-widget__attachment-file", a.textContent = Gn(e), a;
|
|
2577
2540
|
}
|
|
2578
2541
|
const n = document.createElement("div");
|
|
2579
2542
|
n.className = "pluno-pa-widget__message-attachment-file";
|
|
2580
2543
|
const o = document.createElement("span");
|
|
2581
|
-
o.textContent =
|
|
2544
|
+
o.textContent = Gn(e);
|
|
2582
2545
|
const i = document.createElement("strong");
|
|
2583
2546
|
return i.textContent = e.name, n.append(o, i), n;
|
|
2584
2547
|
}
|
|
2585
|
-
function
|
|
2548
|
+
function on(e) {
|
|
2586
2549
|
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2587
2550
|
}
|
|
2588
|
-
function
|
|
2551
|
+
function yo(e) {
|
|
2589
2552
|
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2590
2553
|
}
|
|
2591
|
-
function
|
|
2592
|
-
const t =
|
|
2554
|
+
function Gn(e) {
|
|
2555
|
+
const t = on(e);
|
|
2593
2556
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2594
2557
|
}
|
|
2595
|
-
function
|
|
2558
|
+
function ja(e, t) {
|
|
2596
2559
|
return t ? Array.from(t).map((o) => ({
|
|
2597
2560
|
...e.createLocalAttachment(o),
|
|
2598
|
-
previewUrl:
|
|
2561
|
+
previewUrl: Va(o)
|
|
2599
2562
|
})) : [];
|
|
2600
2563
|
}
|
|
2601
|
-
function
|
|
2564
|
+
function Va(e) {
|
|
2602
2565
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2603
2566
|
}
|
|
2604
|
-
function
|
|
2567
|
+
function at(e) {
|
|
2605
2568
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2606
2569
|
}
|
|
2607
|
-
function
|
|
2608
|
-
if (!e || !
|
|
2570
|
+
function Ht(e, t, n = null) {
|
|
2571
|
+
if (!e || !Jt(t, n)) {
|
|
2609
2572
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2610
2573
|
return;
|
|
2611
2574
|
}
|
|
2612
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) ||
|
|
2613
|
-
|
|
2614
|
-
) :
|
|
2575
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || an(n) ? e.appendChild(
|
|
2576
|
+
Ka(t, n)
|
|
2577
|
+
) : vo(t) && e.appendChild(Ya(t));
|
|
2615
2578
|
}
|
|
2616
|
-
function
|
|
2579
|
+
function Ka(e, t) {
|
|
2617
2580
|
const n = document.createElement("div");
|
|
2618
2581
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
2619
2582
|
const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2620
2583
|
i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
|
|
2621
|
-
const
|
|
2622
|
-
return
|
|
2623
|
-
|
|
2584
|
+
const a = document.createElement("span");
|
|
2585
|
+
return a.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(a), n.appendChild(
|
|
2586
|
+
Co(
|
|
2624
2587
|
e,
|
|
2625
2588
|
"Upgrade plan",
|
|
2626
2589
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2627
2590
|
)
|
|
2628
2591
|
), n;
|
|
2629
2592
|
}
|
|
2630
|
-
function
|
|
2593
|
+
function Ya(e) {
|
|
2631
2594
|
const t = document.createElement("div");
|
|
2632
2595
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2633
2596
|
const n = document.createElement("strong");
|
|
2634
2597
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2635
2598
|
const o = document.createElement("span");
|
|
2636
|
-
return o.textContent =
|
|
2637
|
-
|
|
2599
|
+
return o.textContent = Za(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
|
|
2600
|
+
Co(
|
|
2638
2601
|
e,
|
|
2639
2602
|
"Upgrade",
|
|
2640
2603
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2641
2604
|
)
|
|
2642
2605
|
), t;
|
|
2643
2606
|
}
|
|
2644
|
-
function
|
|
2645
|
-
return e !== null && (ae(e) ||
|
|
2607
|
+
function Jt(e, t) {
|
|
2608
|
+
return e !== null && (ae(e) || vo(e) || an(t));
|
|
2646
2609
|
}
|
|
2647
|
-
function
|
|
2648
|
-
return
|
|
2610
|
+
function $n(e, t, n) {
|
|
2611
|
+
return Jt(t, n) || Xa(t) ? !0 : !Jt(e, n);
|
|
2649
2612
|
}
|
|
2650
|
-
function
|
|
2613
|
+
function Xa(e) {
|
|
2651
2614
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
|
|
2652
2615
|
}
|
|
2653
2616
|
function ae(e) {
|
|
2654
2617
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2655
2618
|
}
|
|
2656
|
-
function
|
|
2619
|
+
function an(e) {
|
|
2657
2620
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2658
2621
|
}
|
|
2659
|
-
function
|
|
2622
|
+
function vo(e) {
|
|
2660
2623
|
return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2661
2624
|
}
|
|
2662
|
-
function
|
|
2663
|
-
return e.creditsRemaining === null ? null : `${
|
|
2625
|
+
function Za(e) {
|
|
2626
|
+
return e.creditsRemaining === null ? null : `${Ja(e.creditsRemaining)} credits left`;
|
|
2664
2627
|
}
|
|
2665
|
-
function
|
|
2628
|
+
function Ja(e) {
|
|
2666
2629
|
return new Intl.NumberFormat("en-US", {
|
|
2667
2630
|
maximumFractionDigits: 0
|
|
2668
2631
|
}).format(Math.ceil(e));
|
|
2669
2632
|
}
|
|
2670
|
-
function
|
|
2633
|
+
function Co(e, t, n) {
|
|
2671
2634
|
const o = document.createElement("div");
|
|
2672
2635
|
return o.className = n, o.appendChild(
|
|
2673
|
-
|
|
2636
|
+
qn(t, e.pricingUrl)
|
|
2674
2637
|
), o.appendChild(
|
|
2675
|
-
|
|
2638
|
+
qn("Earn credits", e.earnCreditsUrl)
|
|
2676
2639
|
), o;
|
|
2677
2640
|
}
|
|
2678
|
-
function
|
|
2641
|
+
function qn(e, t) {
|
|
2679
2642
|
const n = document.createElement("button");
|
|
2680
2643
|
if (n.type = "button", e === "Earn credits") {
|
|
2681
2644
|
const o = document.createElement("span");
|
|
@@ -2686,137 +2649,123 @@ function Un(e, t) {
|
|
|
2686
2649
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
2687
2650
|
}), n;
|
|
2688
2651
|
}
|
|
2689
|
-
function
|
|
2652
|
+
function Wt(e, t) {
|
|
2690
2653
|
return e.messages.filter(
|
|
2691
|
-
(o) => !
|
|
2654
|
+
(o) => !So(o)
|
|
2692
2655
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2693
2656
|
}
|
|
2694
|
-
function
|
|
2695
|
-
const g =
|
|
2696
|
-
(C) => !
|
|
2697
|
-
), h = e.scrollTop, P = [],
|
|
2657
|
+
function Qa(e, t, n, o, i, a, l, p, d, c, u, m, E, v, z, b) {
|
|
2658
|
+
const g = or(a), w = g.filter(
|
|
2659
|
+
(C) => !So(C)
|
|
2660
|
+
), h = e.scrollTop, P = [], T = /* @__PURE__ */ new Set(), k = (C) => {
|
|
2698
2661
|
P.push(C);
|
|
2699
2662
|
};
|
|
2700
|
-
|
|
2701
|
-
const F =
|
|
2702
|
-
if (o(F),
|
|
2663
|
+
ko(n, a.isThinking), i.hidden = !p, p && l !== null && fo(i, l);
|
|
2664
|
+
const F = w.length > 0 || !!a.assistantDraft || a.isThinking;
|
|
2665
|
+
if (o(F), w.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
|
|
2703
2666
|
const C = document.createElement("div");
|
|
2704
2667
|
C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2705
|
-
const
|
|
2706
|
-
|
|
2707
|
-
const
|
|
2668
|
+
const N = document.createElement("div");
|
|
2669
|
+
N.className = "pluno-pa-widget__empty-hero";
|
|
2670
|
+
const Ee = fe(
|
|
2708
2671
|
"pluno-pa-widget__character--empty",
|
|
2709
2672
|
v()
|
|
2710
2673
|
);
|
|
2711
|
-
|
|
2674
|
+
N.appendChild(Ee), C.appendChild(N), C.appendChild(mo());
|
|
2712
2675
|
const q = document.createElement("div");
|
|
2713
|
-
if (q.className =
|
|
2714
|
-
for (const
|
|
2676
|
+
if (q.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && q.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
|
|
2677
|
+
for (const R of a.starterPrompts) {
|
|
2715
2678
|
const D = document.createElement("button");
|
|
2716
|
-
D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${
|
|
2717
|
-
R
|
|
2679
|
+
D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${R}"`, D.addEventListener("click", () => {
|
|
2680
|
+
z(R);
|
|
2718
2681
|
}), q.appendChild(D);
|
|
2719
2682
|
}
|
|
2720
|
-
else if (
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2683
|
+
else if (a.starterPromptsLoading) {
|
|
2684
|
+
const R = document.createElement("button");
|
|
2685
|
+
R.type = "button", R.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", R.disabled = !0, R.tabIndex = -1, R.textContent = "Generating example tasks...", q.appendChild(R);
|
|
2723
2686
|
} else
|
|
2724
|
-
for (let
|
|
2687
|
+
for (let R = 0; R < zi; R += 1) {
|
|
2725
2688
|
const D = document.createElement("button");
|
|
2726
2689
|
D.type = "button", D.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", D.disabled = !0, D.tabIndex = -1, D.textContent = "", q.appendChild(D);
|
|
2727
2690
|
}
|
|
2728
|
-
C.appendChild(q), m.clear(),
|
|
2691
|
+
C.appendChild(q), m.clear(), k(C), k(t), jn(e, P);
|
|
2729
2692
|
return;
|
|
2730
2693
|
}
|
|
2731
2694
|
let H = null, $ = null, Q = [];
|
|
2732
|
-
const
|
|
2695
|
+
const Me = w.some(Qt), x = () => {
|
|
2733
2696
|
if (Q.length === 0)
|
|
2734
2697
|
return !1;
|
|
2735
|
-
const C =
|
|
2698
|
+
const C = gr(
|
|
2736
2699
|
Q,
|
|
2737
2700
|
u,
|
|
2738
|
-
|
|
2701
|
+
E,
|
|
2739
2702
|
v()
|
|
2740
2703
|
);
|
|
2741
|
-
return
|
|
2704
|
+
return k(C), H = null, $ = C, Q = [], !0;
|
|
2742
2705
|
};
|
|
2743
|
-
for (let C = 0; C <
|
|
2744
|
-
const
|
|
2745
|
-
if (
|
|
2746
|
-
Q.push(
|
|
2706
|
+
for (let C = 0; C < w.length; C += 1) {
|
|
2707
|
+
const N = w[C];
|
|
2708
|
+
if (N.role === "tool") {
|
|
2709
|
+
Q.push(N);
|
|
2747
2710
|
continue;
|
|
2748
2711
|
}
|
|
2749
|
-
if (
|
|
2712
|
+
if (Qt(N)) {
|
|
2750
2713
|
if (x()) {
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2714
|
+
const A = ut();
|
|
2715
|
+
k(A), H = null, $ = A;
|
|
2753
2716
|
} else {
|
|
2754
|
-
const
|
|
2755
|
-
|
|
2717
|
+
const A = Yn(v());
|
|
2718
|
+
k(A), H = null, $ = A;
|
|
2756
2719
|
}
|
|
2757
2720
|
continue;
|
|
2758
2721
|
}
|
|
2759
|
-
if (
|
|
2722
|
+
if (N.role === "system")
|
|
2760
2723
|
continue;
|
|
2761
|
-
const
|
|
2762
|
-
if (
|
|
2763
|
-
const D =
|
|
2764
|
-
|
|
2765
|
-
}
|
|
2766
|
-
const
|
|
2767
|
-
|
|
2768
|
-
q,
|
|
2769
|
-
m,
|
|
2770
|
-
A
|
|
2771
|
-
);
|
|
2772
|
-
L(z), H = z, $ = null;
|
|
2724
|
+
const Ee = x(), q = ur(N.content);
|
|
2725
|
+
if (N.role === "assistant" && !Ee) {
|
|
2726
|
+
const D = Eo(v());
|
|
2727
|
+
k(D), H = null, $ = D;
|
|
2728
|
+
}
|
|
2729
|
+
const R = er(N, q, m, T);
|
|
2730
|
+
k(R), H = R, $ = null;
|
|
2773
2731
|
}
|
|
2774
|
-
const
|
|
2775
|
-
if (
|
|
2776
|
-
if (
|
|
2777
|
-
const C =
|
|
2778
|
-
|
|
2732
|
+
const ce = x(), Xe = w[w.length - 1]?.id === "assistant-draft";
|
|
2733
|
+
if (a.isThinking && !Xe && !Me)
|
|
2734
|
+
if (ce) {
|
|
2735
|
+
const C = ut();
|
|
2736
|
+
k(C), H = null, $ = C;
|
|
2779
2737
|
} else {
|
|
2780
|
-
const C =
|
|
2781
|
-
|
|
2738
|
+
const C = Yn(v());
|
|
2739
|
+
k(C), H = null, $ = C;
|
|
2782
2740
|
}
|
|
2783
|
-
if (
|
|
2741
|
+
if (a.lastError) {
|
|
2784
2742
|
const C = document.createElement("div");
|
|
2785
|
-
C.className = "pluno-pa-widget__error", C.textContent =
|
|
2743
|
+
C.className = "pluno-pa-widget__error", C.textContent = a.lastError, k(C), H = C, $ = null;
|
|
2786
2744
|
}
|
|
2787
|
-
const X =
|
|
2788
|
-
if (
|
|
2789
|
-
const C =
|
|
2790
|
-
isDrafting:
|
|
2791
|
-
error:
|
|
2792
|
-
characterIconOptions:
|
|
2793
|
-
onDraft:
|
|
2794
|
-
onDismiss:
|
|
2795
|
-
onDisable:
|
|
2745
|
+
const X = b && !a.isThinking ? ri(g) : null;
|
|
2746
|
+
if (b && X && !b.dismissedCandidateIds.has(X.id)) {
|
|
2747
|
+
const C = rr(X, {
|
|
2748
|
+
isDrafting: b.draftingCandidateId === X.id,
|
|
2749
|
+
error: b.error,
|
|
2750
|
+
characterIconOptions: b.characterIconOptions,
|
|
2751
|
+
onDraft: b.onDraft,
|
|
2752
|
+
onDismiss: b.onDismiss,
|
|
2753
|
+
onDisable: b.onDisable
|
|
2796
2754
|
});
|
|
2797
|
-
|
|
2755
|
+
k(C), b.onSeen(X), H = null, $ = C;
|
|
2798
2756
|
}
|
|
2799
|
-
H?.classList.add(
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
A
|
|
2806
|
-
), Fn(e, P), d ? Ve(e, c) : e.scrollTop = h;
|
|
2807
|
-
}
|
|
2808
|
-
function Wa(e, t, n, o) {
|
|
2809
|
-
const i = Ga(e, t), r = i ? n.get(i) : void 0;
|
|
2810
|
-
if (i && r)
|
|
2811
|
-
return r.classList.remove(
|
|
2812
|
-
"pluno-pa-widget__message--bottom-reserve"
|
|
2813
|
-
), o.add(i), r;
|
|
2757
|
+
H?.classList.add("pluno-pa-widget__message--bottom-reserve"), $?.classList.add("pluno-pa-widget__bottom-reserve-compact"), k(t), nr(m, T), jn(e, P), d ? Ke(e, c) : e.scrollTop = h;
|
|
2758
|
+
}
|
|
2759
|
+
function er(e, t, n, o) {
|
|
2760
|
+
const i = tr(e, t), a = i ? n.get(i) : void 0;
|
|
2761
|
+
if (i && a)
|
|
2762
|
+
return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), a;
|
|
2814
2763
|
const l = document.createElement("div");
|
|
2815
|
-
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ?
|
|
2764
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? mr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(ir(e.attachments));
|
|
2816
2765
|
const p = document.createElement("div");
|
|
2817
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
2766
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(ar(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
|
|
2818
2767
|
}
|
|
2819
|
-
function
|
|
2768
|
+
function tr(e, t) {
|
|
2820
2769
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2821
2770
|
id: e.id,
|
|
2822
2771
|
content: t,
|
|
@@ -2834,11 +2783,11 @@ function Ga(e, t) {
|
|
|
2834
2783
|
})
|
|
2835
2784
|
});
|
|
2836
2785
|
}
|
|
2837
|
-
function
|
|
2786
|
+
function nr(e, t) {
|
|
2838
2787
|
for (const n of e.keys())
|
|
2839
2788
|
t.has(n) || e.delete(n);
|
|
2840
2789
|
}
|
|
2841
|
-
function
|
|
2790
|
+
function jn(e, t) {
|
|
2842
2791
|
let n = e.firstChild;
|
|
2843
2792
|
for (const o of t) {
|
|
2844
2793
|
if (o === n) {
|
|
@@ -2852,7 +2801,7 @@ function Fn(e, t) {
|
|
|
2852
2801
|
n = n.nextSibling, e.removeChild(o);
|
|
2853
2802
|
}
|
|
2854
2803
|
}
|
|
2855
|
-
function
|
|
2804
|
+
function or(e) {
|
|
2856
2805
|
if (!e.assistantDraft)
|
|
2857
2806
|
return [...e.messages];
|
|
2858
2807
|
const t = {
|
|
@@ -2867,12 +2816,12 @@ function qa(e) {
|
|
|
2867
2816
|
if (!t.respondsToUserMessageId)
|
|
2868
2817
|
return [...e.messages, t];
|
|
2869
2818
|
const n = e.messages.findIndex(
|
|
2870
|
-
(
|
|
2819
|
+
(a) => a.role === "user" && a.id === t.respondsToUserMessageId
|
|
2871
2820
|
);
|
|
2872
2821
|
if (n === -1)
|
|
2873
2822
|
return [...e.messages, t];
|
|
2874
2823
|
const o = e.messages.findIndex(
|
|
2875
|
-
(
|
|
2824
|
+
(a, l) => l > n && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && Vn(a, t) && Qt(a)
|
|
2876
2825
|
);
|
|
2877
2826
|
if (o !== -1)
|
|
2878
2827
|
return [
|
|
@@ -2881,7 +2830,7 @@ function qa(e) {
|
|
|
2881
2830
|
...e.messages.slice(o + 1)
|
|
2882
2831
|
];
|
|
2883
2832
|
let i = n + 1;
|
|
2884
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2833
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Vn(e.messages[i], t); )
|
|
2885
2834
|
i += 1;
|
|
2886
2835
|
return [
|
|
2887
2836
|
...e.messages.slice(0, i),
|
|
@@ -2889,17 +2838,17 @@ function qa(e) {
|
|
|
2889
2838
|
...e.messages.slice(i)
|
|
2890
2839
|
];
|
|
2891
2840
|
}
|
|
2892
|
-
function
|
|
2841
|
+
function Qt(e) {
|
|
2893
2842
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2894
2843
|
}
|
|
2895
|
-
function
|
|
2844
|
+
function Vn(e, t) {
|
|
2896
2845
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2897
2846
|
}
|
|
2898
|
-
function
|
|
2899
|
-
e.replaceChildren(),
|
|
2847
|
+
function Kn(e, t, n, o, i, a, l, p) {
|
|
2848
|
+
e.replaceChildren(), ko(t, !1), t.disabled = !0, n(!1);
|
|
2900
2849
|
const d = document.createElement("div");
|
|
2901
2850
|
d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2902
|
-
const c =
|
|
2851
|
+
const c = fe(
|
|
2903
2852
|
"pluno-pa-widget__character--empty",
|
|
2904
2853
|
o()
|
|
2905
2854
|
);
|
|
@@ -2907,40 +2856,40 @@ function Wn(e, t, n, o, i, r, l, p) {
|
|
|
2907
2856
|
const u = document.createElement("div");
|
|
2908
2857
|
if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
|
|
2909
2858
|
const m = document.createElement("a");
|
|
2910
|
-
m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent =
|
|
2859
|
+
m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = a, d.appendChild(m);
|
|
2911
2860
|
} else {
|
|
2912
2861
|
const m = document.createElement("button");
|
|
2913
|
-
m.type = "button", m.className = "pluno-pa-widget__login", m.textContent =
|
|
2862
|
+
m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = a, m.addEventListener("click", () => p?.()), d.appendChild(m);
|
|
2914
2863
|
}
|
|
2915
2864
|
e.appendChild(d);
|
|
2916
2865
|
}
|
|
2917
|
-
function
|
|
2866
|
+
function ir(e) {
|
|
2918
2867
|
const t = document.createElement("div");
|
|
2919
2868
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2920
2869
|
for (const n of e)
|
|
2921
|
-
t.appendChild(
|
|
2870
|
+
t.appendChild(qa(n));
|
|
2922
2871
|
return t;
|
|
2923
2872
|
}
|
|
2924
|
-
function
|
|
2873
|
+
function ar(e) {
|
|
2925
2874
|
const t = document.createElement("button");
|
|
2926
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
2875
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Wa()), t.addEventListener("click", (n) => {
|
|
2927
2876
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
2928
2877
|
}), t;
|
|
2929
2878
|
}
|
|
2930
|
-
function
|
|
2879
|
+
function rr(e, t) {
|
|
2931
2880
|
const n = document.createElement("article");
|
|
2932
2881
|
n.className = "pluno-pa-widget__share-prompt";
|
|
2933
2882
|
const o = document.createElement("div");
|
|
2934
2883
|
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
|
|
2935
|
-
|
|
2884
|
+
fe(
|
|
2936
2885
|
"pluno-pa-widget__share-prompt-icon",
|
|
2937
2886
|
t.characterIconOptions
|
|
2938
2887
|
)
|
|
2939
2888
|
);
|
|
2940
2889
|
const i = document.createElement("div");
|
|
2941
2890
|
i.className = "pluno-pa-widget__share-prompt-copy";
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2891
|
+
const a = document.createElement("strong");
|
|
2892
|
+
a.textContent = "Share this win?", i.appendChild(a);
|
|
2944
2893
|
const l = document.createElement("span");
|
|
2945
2894
|
if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
|
|
2946
2895
|
const u = document.createElement("span");
|
|
@@ -2954,7 +2903,7 @@ function Ka(e, t) {
|
|
|
2954
2903
|
const c = document.createElement("button");
|
|
2955
2904
|
if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
|
|
2956
2905
|
t.onDraft(e);
|
|
2957
|
-
}), t.isDrafting ? (c.appendChild(
|
|
2906
|
+
}), t.isDrafting ? (c.appendChild(en()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
|
|
2958
2907
|
p.appendChild(d);
|
|
2959
2908
|
else {
|
|
2960
2909
|
const u = document.createElement("button");
|
|
@@ -2968,15 +2917,15 @@ function Ka(e, t) {
|
|
|
2968
2917
|
}
|
|
2969
2918
|
return o.appendChild(p), n.appendChild(o), n;
|
|
2970
2919
|
}
|
|
2971
|
-
function
|
|
2920
|
+
function lr(e, t) {
|
|
2972
2921
|
const n = document.createElement("div");
|
|
2973
2922
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
|
|
2974
2923
|
g.target === n && t.onClose();
|
|
2975
2924
|
});
|
|
2976
2925
|
const o = document.createElement("section");
|
|
2977
2926
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
2978
|
-
const i = document.createElement("header"),
|
|
2979
|
-
|
|
2927
|
+
const i = document.createElement("header"), a = document.createElement("strong");
|
|
2928
|
+
a.textContent = "Share this win", i.appendChild(a);
|
|
2980
2929
|
const l = document.createElement("button");
|
|
2981
2930
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
|
|
2982
2931
|
const p = document.createElement("p");
|
|
@@ -2987,11 +2936,11 @@ function Ya(e, t) {
|
|
|
2987
2936
|
c.className = "pluno-pa-widget__share-dialog-step-header";
|
|
2988
2937
|
const u = document.createElement("strong");
|
|
2989
2938
|
u.textContent = "1) Copy Screenshot", c.appendChild(u);
|
|
2990
|
-
const m =
|
|
2939
|
+
const m = pr(
|
|
2991
2940
|
"Copy Screenshot",
|
|
2992
2941
|
async () => {
|
|
2993
2942
|
try {
|
|
2994
|
-
return await
|
|
2943
|
+
return await li(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
2995
2944
|
} catch {
|
|
2996
2945
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
2997
2946
|
}
|
|
@@ -3000,39 +2949,39 @@ function Ya(e, t) {
|
|
|
3000
2949
|
if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
|
|
3001
2950
|
const g = document.createElement("div");
|
|
3002
2951
|
g.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
3003
|
-
const
|
|
3004
|
-
|
|
2952
|
+
const w = document.createElement("img");
|
|
2953
|
+
w.src = e.screenshotDataUrl, w.alt = "Product page with Pluno open", g.appendChild(w), d.appendChild(g);
|
|
3005
2954
|
}
|
|
3006
2955
|
o.appendChild(d), o.appendChild(p);
|
|
3007
|
-
const
|
|
3008
|
-
|
|
2956
|
+
const E = document.createElement("div");
|
|
2957
|
+
E.className = "pluno-pa-widget__share-dialog-step";
|
|
3009
2958
|
const v = document.createElement("strong");
|
|
3010
|
-
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on",
|
|
3011
|
-
const
|
|
3012
|
-
|
|
3013
|
-
const
|
|
3014
|
-
|
|
3015
|
-
for (const g of
|
|
3016
|
-
const
|
|
3017
|
-
|
|
2959
|
+
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", E.appendChild(v);
|
|
2960
|
+
const z = document.createElement("p");
|
|
2961
|
+
z.className = "pluno-pa-widget__share-dialog-hint", z.textContent = "Post draft opens prefilled on supported platforms.", E.appendChild(z);
|
|
2962
|
+
const b = document.createElement("footer");
|
|
2963
|
+
b.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2964
|
+
for (const g of sr(e)) {
|
|
2965
|
+
const w = document.createElement("a");
|
|
2966
|
+
w.href = g.href, w.target = "_blank", w.rel = "noopener noreferrer", w.title = g.label, w.setAttribute("aria-label", `Open ${g.label}`), w.appendChild(dr(g.id)), b.appendChild(w);
|
|
3018
2967
|
}
|
|
3019
|
-
if (
|
|
2968
|
+
if (E.appendChild(b), o.appendChild(E), t.socialPostRewardsUrl) {
|
|
3020
2969
|
const g = document.createElement("div");
|
|
3021
2970
|
g.className = "pluno-pa-widget__share-dialog-step";
|
|
3022
|
-
const
|
|
3023
|
-
|
|
2971
|
+
const w = document.createElement("strong");
|
|
2972
|
+
w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(w);
|
|
3024
2973
|
const h = document.createElement("a");
|
|
3025
|
-
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(
|
|
2974
|
+
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(cr()), g.appendChild(h), o.appendChild(g);
|
|
3026
2975
|
}
|
|
3027
2976
|
return n.appendChild(o), n;
|
|
3028
2977
|
}
|
|
3029
|
-
function
|
|
2978
|
+
function pr(e, t) {
|
|
3030
2979
|
const n = document.createElement("button");
|
|
3031
2980
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
3032
2981
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
3033
2982
|
}), n;
|
|
3034
2983
|
}
|
|
3035
|
-
function
|
|
2984
|
+
function sr(e) {
|
|
3036
2985
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
3037
2986
|
return [
|
|
3038
2987
|
{
|
|
@@ -3052,90 +3001,90 @@ function Za(e) {
|
|
|
3052
3001
|
}
|
|
3053
3002
|
];
|
|
3054
3003
|
}
|
|
3055
|
-
function
|
|
3004
|
+
function dr(e) {
|
|
3056
3005
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3057
|
-
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" ? (
|
|
3006
|
+
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" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(
|
|
3058
3007
|
t,
|
|
3059
3008
|
"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"
|
|
3060
|
-
),
|
|
3009
|
+
), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(
|
|
3061
3010
|
t,
|
|
3062
3011
|
"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"
|
|
3063
|
-
),
|
|
3012
|
+
), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(
|
|
3064
3013
|
t,
|
|
3065
3014
|
"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"
|
|
3066
|
-
),
|
|
3015
|
+
), B(
|
|
3067
3016
|
t,
|
|
3068
3017
|
"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",
|
|
3069
3018
|
"0.48"
|
|
3070
|
-
),
|
|
3019
|
+
), B(
|
|
3071
3020
|
t,
|
|
3072
3021
|
"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"
|
|
3073
|
-
),
|
|
3022
|
+
), B(
|
|
3074
3023
|
t,
|
|
3075
3024
|
"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"
|
|
3076
3025
|
), t);
|
|
3077
3026
|
}
|
|
3078
|
-
function
|
|
3027
|
+
function B(e, t, n) {
|
|
3079
3028
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3080
3029
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
3081
3030
|
}
|
|
3082
|
-
function
|
|
3031
|
+
function cr() {
|
|
3083
3032
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3084
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
3033
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(
|
|
3085
3034
|
e,
|
|
3086
3035
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
3087
3036
|
), e;
|
|
3088
3037
|
}
|
|
3089
|
-
function
|
|
3090
|
-
return e.role === "tool" && e.toolName ===
|
|
3038
|
+
function So(e) {
|
|
3039
|
+
return e.role === "tool" && e.toolName === no;
|
|
3091
3040
|
}
|
|
3092
|
-
function
|
|
3041
|
+
function ur(e) {
|
|
3093
3042
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
3094
3043
|
}
|
|
3095
|
-
function
|
|
3044
|
+
function gr(e, t, n, o) {
|
|
3096
3045
|
const i = document.createElement("article");
|
|
3097
3046
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
3098
3047
|
e[e.length - 1].createdAt
|
|
3099
3048
|
).toLocaleString(), i.appendChild(
|
|
3100
|
-
|
|
3049
|
+
fe(
|
|
3101
3050
|
"pluno-pa-widget__character--tool-group",
|
|
3102
3051
|
o
|
|
3103
3052
|
)
|
|
3104
3053
|
);
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3107
|
-
i.classList.toggle("pluno-pa-widget__tool-group--open",
|
|
3054
|
+
const a = document.createElement("details"), l = hr(e);
|
|
3055
|
+
a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
|
|
3056
|
+
i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), n();
|
|
3108
3057
|
});
|
|
3109
3058
|
const p = document.createElement("summary");
|
|
3110
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(
|
|
3059
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(en());
|
|
3111
3060
|
const c = document.createElement("span");
|
|
3112
|
-
if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c),
|
|
3061
|
+
if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), a.appendChild(p), e.length > 0) {
|
|
3113
3062
|
const u = document.createElement("div");
|
|
3114
3063
|
u.className = "pluno-pa-widget__tool-lines";
|
|
3115
3064
|
for (const m of e) {
|
|
3116
|
-
const
|
|
3117
|
-
|
|
3065
|
+
const E = document.createElement("div");
|
|
3066
|
+
E.className = "pluno-pa-widget__tool-line", m.loading && E.appendChild(en());
|
|
3118
3067
|
const v = document.createElement("span");
|
|
3119
|
-
v.textContent = m.content || "Run tool",
|
|
3068
|
+
v.textContent = m.content || "Run tool", E.appendChild(v), u.appendChild(E);
|
|
3120
3069
|
}
|
|
3121
|
-
|
|
3070
|
+
a.appendChild(u);
|
|
3122
3071
|
}
|
|
3123
|
-
return i.appendChild(
|
|
3072
|
+
return i.appendChild(a), i;
|
|
3124
3073
|
}
|
|
3125
|
-
function
|
|
3074
|
+
function Eo(e) {
|
|
3126
3075
|
const t = document.createElement("article");
|
|
3127
3076
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
3128
|
-
|
|
3077
|
+
fe(
|
|
3129
3078
|
"pluno-pa-widget__character--tool-group",
|
|
3130
3079
|
e
|
|
3131
3080
|
)
|
|
3132
3081
|
), t;
|
|
3133
3082
|
}
|
|
3134
|
-
function
|
|
3135
|
-
const t =
|
|
3136
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
3083
|
+
function Yn(e) {
|
|
3084
|
+
const t = Eo(e);
|
|
3085
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ut()), t;
|
|
3137
3086
|
}
|
|
3138
|
-
function
|
|
3087
|
+
function ut(e = "Thinking...") {
|
|
3139
3088
|
const t = document.createElement("div");
|
|
3140
3089
|
t.className = "pluno-pa-widget__status";
|
|
3141
3090
|
const n = document.createElement("span");
|
|
@@ -3143,17 +3092,17 @@ function ct(e = "Thinking...") {
|
|
|
3143
3092
|
const o = document.createElement("span");
|
|
3144
3093
|
return o.textContent = e, t.appendChild(o), t;
|
|
3145
3094
|
}
|
|
3146
|
-
function
|
|
3095
|
+
function hr(e) {
|
|
3147
3096
|
return `tools:${e[0]?.id ?? ""}`;
|
|
3148
3097
|
}
|
|
3149
|
-
function
|
|
3098
|
+
function en() {
|
|
3150
3099
|
const e = document.createElement("span");
|
|
3151
3100
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
3152
3101
|
}
|
|
3153
|
-
function
|
|
3154
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
3102
|
+
function ko(e, t) {
|
|
3103
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Fa() : xo());
|
|
3155
3104
|
}
|
|
3156
|
-
function
|
|
3105
|
+
function mr(e, t) {
|
|
3157
3106
|
const n = t.replace(/\r\n/g, `
|
|
3158
3107
|
`).split(`
|
|
3159
3108
|
`);
|
|
@@ -3177,14 +3126,14 @@ function or(e, t) {
|
|
|
3177
3126
|
const l = i.match(/^(#{1,3})\s+(.+)$/);
|
|
3178
3127
|
if (l) {
|
|
3179
3128
|
const c = document.createElement(`h${l[1].length + 2}`);
|
|
3180
|
-
|
|
3129
|
+
rt(c, l[2]), e.appendChild(c), o += 1;
|
|
3181
3130
|
continue;
|
|
3182
3131
|
}
|
|
3183
3132
|
if (/^\s*[-*+]\s+/.test(i)) {
|
|
3184
3133
|
const c = document.createElement("ul");
|
|
3185
3134
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
3186
3135
|
const u = document.createElement("li");
|
|
3187
|
-
|
|
3136
|
+
rt(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
|
|
3188
3137
|
}
|
|
3189
3138
|
e.appendChild(c);
|
|
3190
3139
|
continue;
|
|
@@ -3193,7 +3142,7 @@ function or(e, t) {
|
|
|
3193
3142
|
const c = document.createElement("ol");
|
|
3194
3143
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
3195
3144
|
const u = document.createElement("li");
|
|
3196
|
-
|
|
3145
|
+
rt(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
|
|
3197
3146
|
}
|
|
3198
3147
|
e.appendChild(c);
|
|
3199
3148
|
continue;
|
|
@@ -3203,17 +3152,17 @@ function or(e, t) {
|
|
|
3203
3152
|
p.push(n[o]), o += 1;
|
|
3204
3153
|
const d = document.createElement("p");
|
|
3205
3154
|
p.forEach((c, u) => {
|
|
3206
|
-
u > 0 && d.appendChild(document.createElement("br")),
|
|
3155
|
+
u > 0 && d.appendChild(document.createElement("br")), rt(d, c);
|
|
3207
3156
|
}), e.appendChild(d);
|
|
3208
3157
|
}
|
|
3209
3158
|
}
|
|
3210
|
-
function
|
|
3159
|
+
function rt(e, t) {
|
|
3211
3160
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
3212
3161
|
let o = 0;
|
|
3213
3162
|
for (const i of t.matchAll(n)) {
|
|
3214
|
-
const
|
|
3215
|
-
|
|
3216
|
-
document.createTextNode(t.slice(o,
|
|
3163
|
+
const a = i.index ?? 0;
|
|
3164
|
+
a > o && e.appendChild(
|
|
3165
|
+
document.createTextNode(t.slice(o, a))
|
|
3217
3166
|
);
|
|
3218
3167
|
const l = i[0];
|
|
3219
3168
|
if (l.startsWith("`")) {
|
|
@@ -3227,17 +3176,17 @@ function at(e, t) {
|
|
|
3227
3176
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
3228
3177
|
} else {
|
|
3229
3178
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
3230
|
-
if (p &&
|
|
3179
|
+
if (p && fr(p[2])) {
|
|
3231
3180
|
const d = document.createElement("a");
|
|
3232
3181
|
d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
|
|
3233
3182
|
} else
|
|
3234
3183
|
e.appendChild(document.createTextNode(l));
|
|
3235
3184
|
}
|
|
3236
|
-
o =
|
|
3185
|
+
o = a + l.length;
|
|
3237
3186
|
}
|
|
3238
3187
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
3239
3188
|
}
|
|
3240
|
-
function
|
|
3189
|
+
function fr(e) {
|
|
3241
3190
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
3242
3191
|
return !0;
|
|
3243
3192
|
try {
|
|
@@ -3247,8 +3196,8 @@ function ir(e) {
|
|
|
3247
3196
|
return !1;
|
|
3248
3197
|
}
|
|
3249
3198
|
}
|
|
3250
|
-
function
|
|
3251
|
-
if (
|
|
3199
|
+
function Xn(e, t) {
|
|
3200
|
+
if (wr(e))
|
|
3252
3201
|
return;
|
|
3253
3202
|
const n = `
|
|
3254
3203
|
:host {
|
|
@@ -3291,9 +3240,6 @@ function $n(e, t) {
|
|
|
3291
3240
|
--pluno-pa-faint: #8e8e95;
|
|
3292
3241
|
--pluno-pa-divider: rgba(24, 24, 27, 0.08);
|
|
3293
3242
|
--pluno-pa-launcher-hairline: rgba(24, 24, 27, 0.06);
|
|
3294
|
-
--pluno-pa-minimized-launcher-paper: #fffdf6;
|
|
3295
|
-
--pluno-pa-minimized-launcher-ink: #2c2a1e;
|
|
3296
|
-
--pluno-pa-scribble-grid-line: rgba(96, 138, 188, 0.22);
|
|
3297
3243
|
--pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
|
|
3298
3244
|
--pluno-pa-launcher-height: 41px;
|
|
3299
3245
|
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
|
|
@@ -3517,15 +3463,12 @@ function $n(e, t) {
|
|
|
3517
3463
|
.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 {
|
|
3518
3464
|
display: none;
|
|
3519
3465
|
}
|
|
3520
|
-
.pluno-pa-widget
|
|
3466
|
+
.pluno-pa-widget--minimized {
|
|
3521
3467
|
--pluno-pa-launcher-width: 22px;
|
|
3522
3468
|
--pluno-pa-launcher-height: 22px;
|
|
3523
3469
|
pointer-events: none;
|
|
3524
3470
|
}
|
|
3525
|
-
.pluno-pa-widget
|
|
3526
|
-
/* The scribble circle gives the bolt a recognizable silhouette on host
|
|
3527
|
-
pages whose background colors are outside the widget's control. */
|
|
3528
|
-
isolation: isolate;
|
|
3471
|
+
.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
|
|
3529
3472
|
border: 0;
|
|
3530
3473
|
border-radius: 999px;
|
|
3531
3474
|
background: transparent;
|
|
@@ -3539,31 +3482,16 @@ function $n(e, t) {
|
|
|
3539
3482
|
overflow: visible;
|
|
3540
3483
|
pointer-events: auto;
|
|
3541
3484
|
}
|
|
3542
|
-
.pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before {
|
|
3543
|
-
content: "";
|
|
3544
|
-
position: absolute;
|
|
3545
|
-
inset: 0;
|
|
3546
|
-
z-index: -1;
|
|
3547
|
-
border: 1.5px solid var(--pluno-pa-minimized-launcher-ink);
|
|
3548
|
-
border-radius: inherit;
|
|
3549
|
-
background-color: var(--pluno-pa-minimized-launcher-paper);
|
|
3550
|
-
background-image:
|
|
3551
|
-
linear-gradient(var(--pluno-pa-scribble-grid-line) 1px, transparent 1px),
|
|
3552
|
-
linear-gradient(90deg, var(--pluno-pa-scribble-grid-line) 1px, transparent 1px);
|
|
3553
|
-
background-size: 12px 12px;
|
|
3554
|
-
pointer-events: none;
|
|
3555
|
-
}
|
|
3556
3485
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-input,
|
|
3557
3486
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-drag-handle,
|
|
3558
3487
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-minimize,
|
|
3559
3488
|
.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals--launcher {
|
|
3560
3489
|
display: none;
|
|
3561
3490
|
}
|
|
3562
|
-
.pluno-pa-widget
|
|
3563
|
-
left:
|
|
3564
|
-
width:
|
|
3565
|
-
height:
|
|
3566
|
-
margin-top: 0;
|
|
3491
|
+
.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
|
|
3492
|
+
left: 1px;
|
|
3493
|
+
width: 20px;
|
|
3494
|
+
height: 20px;
|
|
3567
3495
|
}
|
|
3568
3496
|
.pluno-pa-widget--bottom-left .pluno-pa-widget__launcher {
|
|
3569
3497
|
left: 0;
|
|
@@ -5189,8 +5117,8 @@ function $n(e, t) {
|
|
|
5189
5117
|
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
|
|
5190
5118
|
position: absolute;
|
|
5191
5119
|
top: -16px;
|
|
5192
|
-
left: ${
|
|
5193
|
-
width: calc(100% - ${
|
|
5120
|
+
left: ${Kt}px;
|
|
5121
|
+
width: calc(100% - ${Kt * 2}px);
|
|
5194
5122
|
height: 36px;
|
|
5195
5123
|
z-index: 3;
|
|
5196
5124
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -5280,6 +5208,20 @@ function $n(e, t) {
|
|
|
5280
5208
|
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
|
|
5281
5209
|
border-radius: var(--pluno-pa-scribble-wobble);
|
|
5282
5210
|
}
|
|
5211
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized {
|
|
5212
|
+
--pluno-pa-launcher-width: 16px;
|
|
5213
|
+
--pluno-pa-launcher-height: 24px;
|
|
5214
|
+
}
|
|
5215
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
|
|
5216
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
|
|
5217
|
+
content: none;
|
|
5218
|
+
}
|
|
5219
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
|
|
5220
|
+
left: -3px;
|
|
5221
|
+
width: 22px;
|
|
5222
|
+
height: 22px;
|
|
5223
|
+
margin-top: 0;
|
|
5224
|
+
}
|
|
5283
5225
|
.pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize {
|
|
5284
5226
|
color: var(--pluno-pa-text);
|
|
5285
5227
|
font-size: 18px;
|
|
@@ -5415,6 +5357,21 @@ function $n(e, t) {
|
|
|
5415
5357
|
opacity: 0.6;
|
|
5416
5358
|
transform: rotate(5deg);
|
|
5417
5359
|
}
|
|
5360
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
|
|
5361
|
+
border: 0;
|
|
5362
|
+
width: var(--pluno-pa-launcher-width);
|
|
5363
|
+
min-width: 0;
|
|
5364
|
+
height: var(--pluno-pa-launcher-height);
|
|
5365
|
+
min-height: 0;
|
|
5366
|
+
padding: 0;
|
|
5367
|
+
}
|
|
5368
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
|
|
5369
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
|
|
5370
|
+
content: none;
|
|
5371
|
+
}
|
|
5372
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals {
|
|
5373
|
+
display: none;
|
|
5374
|
+
}
|
|
5418
5375
|
.pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
|
|
5419
5376
|
.pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
|
|
5420
5377
|
background: transparent;
|
|
@@ -5509,28 +5466,28 @@ function $n(e, t) {
|
|
|
5509
5466
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
5510
5467
|
}
|
|
5511
5468
|
`;
|
|
5512
|
-
if (
|
|
5469
|
+
if (br(e, n))
|
|
5513
5470
|
return;
|
|
5514
5471
|
const o = e.ownerDocument.createElement("style");
|
|
5515
|
-
o.id =
|
|
5472
|
+
o.id = uo, o.textContent = n, e.appendChild(o), Lo(e);
|
|
5516
5473
|
}
|
|
5517
|
-
function
|
|
5518
|
-
return e.getElementById(
|
|
5474
|
+
function wr(e) {
|
|
5475
|
+
return e.getElementById(uo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(go) === "true";
|
|
5519
5476
|
}
|
|
5520
|
-
function
|
|
5521
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
5477
|
+
function Lo(e) {
|
|
5478
|
+
e.host instanceof HTMLElement && e.host.setAttribute(go, "true");
|
|
5522
5479
|
}
|
|
5523
|
-
function
|
|
5480
|
+
function br(e, t) {
|
|
5524
5481
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5525
5482
|
return !1;
|
|
5526
5483
|
try {
|
|
5527
5484
|
const n = new CSSStyleSheet();
|
|
5528
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
5485
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Lo(e), !0;
|
|
5529
5486
|
} catch {
|
|
5530
5487
|
return !1;
|
|
5531
5488
|
}
|
|
5532
5489
|
}
|
|
5533
|
-
async function
|
|
5490
|
+
async function _r() {
|
|
5534
5491
|
return document.body ? document.body : await new Promise((e) => {
|
|
5535
5492
|
const t = new MutationObserver(() => {
|
|
5536
5493
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -5538,14 +5495,36 @@ async function lr() {
|
|
|
5538
5495
|
t.observe(document.documentElement, { childList: !0 });
|
|
5539
5496
|
});
|
|
5540
5497
|
}
|
|
5541
|
-
function
|
|
5498
|
+
function Po(e) {
|
|
5542
5499
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5543
5500
|
}
|
|
5544
|
-
function
|
|
5501
|
+
function xr(e) {
|
|
5502
|
+
if (e)
|
|
5503
|
+
return { clientId: e, release: () => {
|
|
5504
|
+
} };
|
|
5505
|
+
let t = 0;
|
|
5506
|
+
for (; Dt.has(t); )
|
|
5507
|
+
t += 1;
|
|
5508
|
+
Dt.add(t);
|
|
5509
|
+
const n = `${Di}${t}`;
|
|
5510
|
+
let o = crypto.randomUUID();
|
|
5545
5511
|
try {
|
|
5546
|
-
|
|
5512
|
+
o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
|
|
5513
|
+
} catch {
|
|
5514
|
+
}
|
|
5515
|
+
let i = !1;
|
|
5516
|
+
return {
|
|
5517
|
+
clientId: o,
|
|
5518
|
+
release: () => {
|
|
5519
|
+
i || (i = !0, Dt.delete(t));
|
|
5520
|
+
}
|
|
5521
|
+
};
|
|
5522
|
+
}
|
|
5523
|
+
function yr(e) {
|
|
5524
|
+
try {
|
|
5525
|
+
const t = window.localStorage.getItem(Po(e));
|
|
5547
5526
|
if (!t)
|
|
5548
|
-
return
|
|
5527
|
+
return Zn();
|
|
5549
5528
|
const n = JSON.parse(t);
|
|
5550
5529
|
return {
|
|
5551
5530
|
isOpen: n.isOpen === !0,
|
|
@@ -5555,25 +5534,25 @@ function pr(e) {
|
|
|
5555
5534
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
|
|
5556
5535
|
(o) => typeof o == "string"
|
|
5557
5536
|
) : [],
|
|
5558
|
-
launcherPosition:
|
|
5559
|
-
panelSize:
|
|
5560
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
5537
|
+
launcherPosition: Er(n.launcherPosition) ? n.launcherPosition : null,
|
|
5538
|
+
panelSize: kr(n.panelSize) ? gt(n.panelSize) : null,
|
|
5539
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-oo) : [],
|
|
5561
5540
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
5562
5541
|
};
|
|
5563
5542
|
} catch {
|
|
5564
|
-
return
|
|
5543
|
+
return Zn();
|
|
5565
5544
|
}
|
|
5566
5545
|
}
|
|
5567
|
-
async function
|
|
5546
|
+
async function vr(e) {
|
|
5568
5547
|
if (e.loadSharePromptsDisabled)
|
|
5569
5548
|
return e.loadSharePromptsDisabled();
|
|
5570
5549
|
try {
|
|
5571
|
-
return window.localStorage.getItem(
|
|
5550
|
+
return window.localStorage.getItem(ao) === "true";
|
|
5572
5551
|
} catch {
|
|
5573
5552
|
return !1;
|
|
5574
5553
|
}
|
|
5575
5554
|
}
|
|
5576
|
-
function
|
|
5555
|
+
function Cr(e, t) {
|
|
5577
5556
|
if (e.persistSharePromptsDisabled) {
|
|
5578
5557
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
5579
5558
|
() => {
|
|
@@ -5582,12 +5561,12 @@ function dr(e, t) {
|
|
|
5582
5561
|
return;
|
|
5583
5562
|
}
|
|
5584
5563
|
try {
|
|
5585
|
-
t && window.localStorage.setItem(
|
|
5564
|
+
t && window.localStorage.setItem(ao, "true");
|
|
5586
5565
|
} catch {
|
|
5587
5566
|
return;
|
|
5588
5567
|
}
|
|
5589
5568
|
}
|
|
5590
|
-
function
|
|
5569
|
+
function Zn() {
|
|
5591
5570
|
return {
|
|
5592
5571
|
isOpen: !1,
|
|
5593
5572
|
composerValue: "",
|
|
@@ -5600,54 +5579,99 @@ function qn() {
|
|
|
5600
5579
|
sharePromptsDisabled: !1
|
|
5601
5580
|
};
|
|
5602
5581
|
}
|
|
5603
|
-
function
|
|
5582
|
+
function Sr(e, t) {
|
|
5604
5583
|
try {
|
|
5605
5584
|
window.localStorage.setItem(
|
|
5606
|
-
|
|
5585
|
+
Po(e),
|
|
5607
5586
|
JSON.stringify(t)
|
|
5608
5587
|
);
|
|
5609
5588
|
} catch {
|
|
5610
5589
|
return;
|
|
5611
5590
|
}
|
|
5612
5591
|
}
|
|
5613
|
-
function
|
|
5592
|
+
function Er(e) {
|
|
5614
5593
|
if (!e || typeof e != "object")
|
|
5615
5594
|
return !1;
|
|
5616
5595
|
const t = e;
|
|
5617
5596
|
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");
|
|
5618
5597
|
}
|
|
5619
|
-
function
|
|
5598
|
+
function kr(e) {
|
|
5620
5599
|
if (!e || typeof e != "object")
|
|
5621
5600
|
return !1;
|
|
5622
5601
|
const t = e;
|
|
5623
5602
|
return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
|
|
5624
5603
|
}
|
|
5625
|
-
|
|
5626
|
-
|
|
5604
|
+
async function Io(e, t) {
|
|
5605
|
+
const n = await fetch(e, {
|
|
5606
|
+
method: "POST",
|
|
5607
|
+
credentials: "include",
|
|
5608
|
+
headers: { "content-type": "application/json" },
|
|
5609
|
+
body: JSON.stringify({
|
|
5610
|
+
origin: location.origin,
|
|
5611
|
+
url: location.href
|
|
5612
|
+
}),
|
|
5613
|
+
...t ? { signal: t } : {}
|
|
5614
|
+
});
|
|
5615
|
+
if (!n.ok) {
|
|
5616
|
+
const i = await n.text(), a = Qo(i);
|
|
5617
|
+
throw a ? (console.error(a), new Error(a)) : new Error(`Failed to load Pluno token (${n.status})`);
|
|
5618
|
+
}
|
|
5619
|
+
const o = await n.json();
|
|
5620
|
+
if (!o.token)
|
|
5621
|
+
throw new Error("Pluno token endpoint did not return a token");
|
|
5622
|
+
return o.token;
|
|
5623
|
+
}
|
|
5624
|
+
function Lr(e) {
|
|
5625
|
+
return async () => {
|
|
5626
|
+
const t = new AbortController();
|
|
5627
|
+
let n = !1;
|
|
5628
|
+
const o = new Promise((i, a) => {
|
|
5629
|
+
const l = window.setTimeout(() => {
|
|
5630
|
+
n = !0, t.abort(), a(new Error(Ln));
|
|
5631
|
+
}, Ai);
|
|
5632
|
+
t.signal.addEventListener(
|
|
5633
|
+
"abort",
|
|
5634
|
+
() => window.clearTimeout(l),
|
|
5635
|
+
{ once: !0 }
|
|
5636
|
+
);
|
|
5637
|
+
});
|
|
5638
|
+
try {
|
|
5639
|
+
const i = await Promise.race([
|
|
5640
|
+
Io(e, t.signal),
|
|
5641
|
+
o
|
|
5642
|
+
]);
|
|
5643
|
+
return t.abort(), i;
|
|
5644
|
+
} catch (i) {
|
|
5645
|
+
throw t.abort(), n ? new Error(Ln) : i instanceof Error && i.message.startsWith("Pluno widget blocked on ") ? i : new Error(Ni);
|
|
5646
|
+
}
|
|
5647
|
+
};
|
|
5648
|
+
}
|
|
5649
|
+
const Jn = /* @__PURE__ */ new WeakSet();
|
|
5650
|
+
function Pr(e) {
|
|
5627
5651
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5628
5652
|
}
|
|
5629
|
-
function
|
|
5653
|
+
function Qn(e) {
|
|
5630
5654
|
const t = e.pathname.split("/");
|
|
5631
5655
|
return t[t.length - 1] ?? "";
|
|
5632
5656
|
}
|
|
5633
|
-
function
|
|
5657
|
+
function Ir(e, t) {
|
|
5634
5658
|
const n = new URL(e.src, document.baseURI);
|
|
5635
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
5659
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Qn(n) === Qn(t);
|
|
5636
5660
|
}
|
|
5637
|
-
class
|
|
5661
|
+
class de extends EventTarget {
|
|
5638
5662
|
constructor(t, n) {
|
|
5639
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
5640
|
-
this.readyState =
|
|
5641
|
-
}), this.addPreviewListener(
|
|
5663
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(ki, () => {
|
|
5664
|
+
this.readyState = de.OPEN, this.dispatchEvent(new Event("open"));
|
|
5665
|
+
}), this.addPreviewListener(Li, (o) => {
|
|
5642
5666
|
const i = o;
|
|
5643
5667
|
this.dispatchEvent(
|
|
5644
5668
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5645
5669
|
);
|
|
5646
|
-
}), this.addPreviewListener(
|
|
5647
|
-
this.readyState =
|
|
5648
|
-
}), this.addPreviewListener(
|
|
5670
|
+
}), this.addPreviewListener(Pi, () => {
|
|
5671
|
+
this.readyState = de.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5672
|
+
}), this.addPreviewListener(Ii, (o) => {
|
|
5649
5673
|
const i = o;
|
|
5650
|
-
this.readyState =
|
|
5674
|
+
this.readyState = de.CLOSED, this.dispatchEvent(
|
|
5651
5675
|
new CloseEvent("close", {
|
|
5652
5676
|
code: i.detail?.code ?? 1e3,
|
|
5653
5677
|
reason: i.detail?.reason ?? "",
|
|
@@ -5656,8 +5680,8 @@ class se extends EventTarget {
|
|
|
5656
5680
|
), this.cleanup();
|
|
5657
5681
|
}), window.dispatchEvent(
|
|
5658
5682
|
new CustomEvent(
|
|
5659
|
-
|
|
5660
|
-
|
|
5683
|
+
lt(
|
|
5684
|
+
Ci,
|
|
5661
5685
|
this.channelId
|
|
5662
5686
|
),
|
|
5663
5687
|
{
|
|
@@ -5676,18 +5700,18 @@ class se extends EventTarget {
|
|
|
5676
5700
|
extensions = "";
|
|
5677
5701
|
binaryType = "blob";
|
|
5678
5702
|
bufferedAmount = 0;
|
|
5679
|
-
readyState =
|
|
5680
|
-
socketId =
|
|
5703
|
+
readyState = de.CONNECTING;
|
|
5704
|
+
socketId = Tr();
|
|
5681
5705
|
listeners = /* @__PURE__ */ new Map();
|
|
5682
5706
|
send(t) {
|
|
5683
|
-
if (this.readyState !==
|
|
5707
|
+
if (this.readyState !== de.OPEN)
|
|
5684
5708
|
throw new DOMException(
|
|
5685
5709
|
"Pluno preview websocket is not open",
|
|
5686
5710
|
"InvalidStateError"
|
|
5687
5711
|
);
|
|
5688
5712
|
window.dispatchEvent(
|
|
5689
5713
|
new CustomEvent(
|
|
5690
|
-
|
|
5714
|
+
lt(Si, this.channelId),
|
|
5691
5715
|
{
|
|
5692
5716
|
detail: {
|
|
5693
5717
|
socketId: this.socketId,
|
|
@@ -5698,9 +5722,9 @@ class se extends EventTarget {
|
|
|
5698
5722
|
);
|
|
5699
5723
|
}
|
|
5700
5724
|
close(t, n) {
|
|
5701
|
-
this.readyState !==
|
|
5725
|
+
this.readyState !== de.CLOSED && (this.readyState = de.CLOSING, window.dispatchEvent(
|
|
5702
5726
|
new CustomEvent(
|
|
5703
|
-
|
|
5727
|
+
lt(Ei, this.channelId),
|
|
5704
5728
|
{
|
|
5705
5729
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
5706
5730
|
}
|
|
@@ -5708,11 +5732,11 @@ class se extends EventTarget {
|
|
|
5708
5732
|
), this.cleanup());
|
|
5709
5733
|
}
|
|
5710
5734
|
addPreviewListener(t, n) {
|
|
5711
|
-
const o =
|
|
5735
|
+
const o = lt(
|
|
5712
5736
|
t,
|
|
5713
5737
|
this.channelId
|
|
5714
|
-
), i = (
|
|
5715
|
-
|
|
5738
|
+
), i = (a) => {
|
|
5739
|
+
a.detail?.socketId === this.socketId && n(a);
|
|
5716
5740
|
};
|
|
5717
5741
|
this.listeners.set(o, i), window.addEventListener(o, i);
|
|
5718
5742
|
}
|
|
@@ -5722,19 +5746,19 @@ class se extends EventTarget {
|
|
|
5722
5746
|
this.listeners.clear();
|
|
5723
5747
|
}
|
|
5724
5748
|
}
|
|
5725
|
-
function
|
|
5749
|
+
function Tr() {
|
|
5726
5750
|
const e = window.sessionStorage.getItem(
|
|
5727
|
-
|
|
5751
|
+
kn
|
|
5728
5752
|
);
|
|
5729
5753
|
if (e)
|
|
5730
5754
|
return e;
|
|
5731
5755
|
const t = crypto.randomUUID();
|
|
5732
|
-
return window.sessionStorage.setItem(
|
|
5756
|
+
return window.sessionStorage.setItem(kn, t), t;
|
|
5733
5757
|
}
|
|
5734
|
-
function
|
|
5758
|
+
function lt(e, t) {
|
|
5735
5759
|
return `${e}:${t}`;
|
|
5736
5760
|
}
|
|
5737
|
-
function
|
|
5761
|
+
function Ar(e) {
|
|
5738
5762
|
const t = document.currentScript;
|
|
5739
5763
|
if (t instanceof HTMLScriptElement)
|
|
5740
5764
|
return [t];
|
|
@@ -5742,33 +5766,64 @@ function wr(e) {
|
|
|
5742
5766
|
return Array.from(
|
|
5743
5767
|
document.querySelectorAll("script[type='module'][src]")
|
|
5744
5768
|
).filter(
|
|
5745
|
-
(i) => i instanceof HTMLScriptElement &&
|
|
5769
|
+
(i) => i instanceof HTMLScriptElement && Pr(i) && Ir(i, o)
|
|
5746
5770
|
);
|
|
5747
5771
|
}
|
|
5748
|
-
function
|
|
5749
|
-
for (const t of
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
}).catch((o) => {
|
|
5766
|
-
console.error("Failed to mount Pluno widget", o);
|
|
5767
|
-
});
|
|
5772
|
+
function Nr(e) {
|
|
5773
|
+
for (const t of Ar(e))
|
|
5774
|
+
Jn.has(t) || t.dataset.plunoAutoMount === "false" || (Jn.add(t), To(t).catch((n) => {
|
|
5775
|
+
console.error("Failed to mount Pluno widget", n);
|
|
5776
|
+
}));
|
|
5777
|
+
}
|
|
5778
|
+
function To(e) {
|
|
5779
|
+
const t = window, n = t[se];
|
|
5780
|
+
if (n) {
|
|
5781
|
+
if (n.host === null)
|
|
5782
|
+
return n.mountPromise.catch(() => {
|
|
5783
|
+
const p = t[se];
|
|
5784
|
+
return p ? p.mountPromise : To(e);
|
|
5785
|
+
});
|
|
5786
|
+
if (Dr(n.host))
|
|
5787
|
+
return n.mountPromise;
|
|
5788
|
+
n.destroy?.(), delete t[se];
|
|
5768
5789
|
}
|
|
5790
|
+
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint;
|
|
5791
|
+
let a;
|
|
5792
|
+
const l = ta({
|
|
5793
|
+
token: e.dataset.plunoToken,
|
|
5794
|
+
tokenProvider: !e.dataset.plunoToken && !o && i ? Lr(i) : void 0,
|
|
5795
|
+
tokenEndpoint: i,
|
|
5796
|
+
backendUrl: e.dataset.plunoBackendUrl,
|
|
5797
|
+
webSocketFactory: o ? ea(o) : void 0,
|
|
5798
|
+
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
5799
|
+
accentColor: e.dataset.plunoAccentColor,
|
|
5800
|
+
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
5801
|
+
fontFamily: e.dataset.plunoFontFamily,
|
|
5802
|
+
scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
|
|
5803
|
+
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
5804
|
+
}).then((p) => {
|
|
5805
|
+
if (t[se] !== a) {
|
|
5806
|
+
p.destroy();
|
|
5807
|
+
return;
|
|
5808
|
+
}
|
|
5809
|
+
const d = p.host;
|
|
5810
|
+
d.setAttribute(io, "true"), a.host = d, a.destroy = () => {
|
|
5811
|
+
t[se] === a && delete t[se], a.host = null, a.destroy = null, p.destroy();
|
|
5812
|
+
};
|
|
5813
|
+
}).catch((p) => {
|
|
5814
|
+
throw t[se] === a && delete t[se], p;
|
|
5815
|
+
});
|
|
5816
|
+
return a = {
|
|
5817
|
+
mountPromise: l,
|
|
5818
|
+
host: null,
|
|
5819
|
+
destroy: null
|
|
5820
|
+
}, t[se] = a, l;
|
|
5821
|
+
}
|
|
5822
|
+
function Dr(e) {
|
|
5823
|
+
return e.isConnected && e.getAttribute(io) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|
|
5769
5824
|
}
|
|
5770
|
-
|
|
5825
|
+
Nr(import.meta.url);
|
|
5771
5826
|
export {
|
|
5772
|
-
|
|
5773
|
-
|
|
5827
|
+
ea as createProductAgentPreviewBridgeWebSocketFactory,
|
|
5828
|
+
ta as mountPlunoProductAgentWidget
|
|
5774
5829
|
};
|