@pluno/product-agent-web 0.1.67 → 0.1.68
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 +36 -2
- package/dist/product-agent-sdk.js +1053 -609
- package/dist/product-agent-widget.js +1282 -1228
- package/dist/transportIdentity.d.ts +26 -0
- package/dist/widget.d.ts +13 -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", xn = [253, 250, 241], yn = 3.5;
|
|
3
|
+
function Qn(e) {
|
|
4
|
+
const t = eo(e);
|
|
5
|
+
if (vn(Ye(t), xn) >= yn)
|
|
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), vn(o, xn) >= yn)
|
|
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 = eo(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 eo(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 vn(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 to = "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 !== to)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = Cn(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = Cn(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 Cn(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 = Sn(o.count), a = Sn(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 Sn(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 no = 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", En = "product-agent:sdk-preview-socket-id", Ti = "data-pluno-sdk-preview-channel", oo = "data-pluno-auto-mounted", se = "__plunoProductAgentAutoMountOwner", Ai = 1e4, Ni = "Failed to load Pluno widget token", kn = "Timed out loading Pluno widget token", Di = "pluno.productAgent.widgetClientId.", Dt = /* @__PURE__ */ new Set(), Ri = "product-agent:preview-diagnostic", io = "pluno.productAgent.sharePromptsDisabled", zi = 3, Ln = 'dialog[open], [aria-modal="true"], [role="dialog"]', Mi = 400, Oi = 5e3, Ui = 500, Pn = "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', In = "pluno-pa-scribble-font", ao = 190, ro = 41, Tn = 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, lo = "http://www.w3.org/2000/svg", jt = 26, Vt = 8, Yi = 36, Kt = 16, Xi = 4, An = [
|
|
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, po = 10, so = 40, Qi = "movable-launcher-position-v2", co = "pluno-pa-widget-styles", uo = "data-pluno-pa-widget-styles";
|
|
265
|
+
let Nn = 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 = Dn(
|
|
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
|
+
)), Yn(o, t.accentColor), Rn(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
|
+
), To = i.querySelector(
|
|
423
412
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
424
|
-
),
|
|
413
|
+
), Ao = i.querySelector(
|
|
425
414
|
".pluno-pa-widget__notify-suggestion-later"
|
|
426
|
-
),
|
|
415
|
+
), No = 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
|
+
Hn(b), Hn(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
|
+
}, Do = 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 Po(t.tokenEndpoint);
|
|
438
|
+
}), Ro = 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: Do,
|
|
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
|
+
}, zo = () => {
|
|
483
|
+
R.hidden = !1;
|
|
484
|
+
}, Mo = (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
|
+
}, Oo = () => {
|
|
533
|
+
!_t || pe || N.scrollHeight - N.scrollTop - N.clientHeight <= 24 && ln(_t);
|
|
534
|
+
}, pn = () => {
|
|
535
|
+
Pe || typeof document > "u" || (Yn(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 ? go(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
|
+
-no
|
|
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
|
+
), Un(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
|
+
Un(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 Uo = () => {
|
|
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
|
+
}, Bo = (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
|
+
}, Fo = P.length > 0 ? la({
|
|
716
704
|
root: i,
|
|
717
705
|
handles: P,
|
|
718
|
-
getBounds:
|
|
719
|
-
setBounds:
|
|
720
|
-
persist:
|
|
706
|
+
getBounds: Uo,
|
|
707
|
+
setBounds: Bo,
|
|
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
|
+
Gn(
|
|
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
|
+
}, Ho = () => {
|
|
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, Wo = (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(Ln);
|
|
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
|
+
}, Go = (r) => {
|
|
786
|
+
if (!r.isConnected || !r.matches(Ln))
|
|
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 || !Go(s)) && hn(null);
|
|
800
|
+
}, Ui) : ve !== null && (window.clearInterval(ve), ve = null, Qe = null));
|
|
801
|
+
}, $o = () => {
|
|
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 _ = Wo(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", Ho), A.addEventListener("scroll", () => {
|
|
828
|
+
A.scrollTop < _e - 1 && ee(!1, "userScroll"), _e = A.scrollTop;
|
|
829
|
+
}), R.addEventListener("click", () => {
|
|
830
|
+
Mo();
|
|
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 ? Pn : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ge ? "New update" : t.launcherLabel, x.placeholder = s ? Pn : 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 qo = () => {
|
|
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
|
+
}, jo = () => {
|
|
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(), jo(), 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(), qo(), 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", Oo), x.addEventListener("input", () => {
|
|
940
|
+
Ve(x), U(), j(), Yo();
|
|
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, Vo = 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
|
+
To?.addEventListener("click", () => {
|
|
976
|
+
Ne = !0, it(), je?.enable().catch(() => {
|
|
992
977
|
});
|
|
993
|
-
}),
|
|
994
|
-
Ne = !0,
|
|
995
|
-
}),
|
|
996
|
-
Ne = !0,
|
|
978
|
+
}), Ao?.addEventListener("click", () => {
|
|
979
|
+
Ne = !0, it();
|
|
980
|
+
}), No?.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 Ko = !!t.socialPostDraftHandler, Lt = /* @__PURE__ */ new Map(), Pt = () => x.value.trim().length > 0 || W.length > 0, Yo = () => {
|
|
987
|
+
const r = De !== null && Wt(y.getState(), Pt());
|
|
988
|
+
D.hidden = !r, r && De !== null && mo(D, De);
|
|
1004
989
|
};
|
|
1005
|
-
let
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
},
|
|
1009
|
-
if (!
|
|
1010
|
-
|
|
990
|
+
let Re = null;
|
|
991
|
+
const Xo = () => {
|
|
992
|
+
we = !0, ee(!0, "newSession"), te(), ue = !1, xe(), y.startNewSession(), 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", Xo), 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(), Vn(
|
|
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(), Vn(
|
|
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
|
+
Ko && !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) && zo();
|
|
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: Ro,
|
|
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, Vo();
|
|
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,102 @@ 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
|
+
host: n,
|
|
1107
|
+
updateAppearance: (r) => {
|
|
1108
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Tt(r, "widgetHandle.updateAppearance");
|
|
1123
1109
|
},
|
|
1124
|
-
updateBillingStatus: (
|
|
1125
|
-
const s =
|
|
1126
|
-
|
|
1110
|
+
updateBillingStatus: (r) => {
|
|
1111
|
+
const s = r ?? null;
|
|
1112
|
+
Gn(
|
|
1127
1113
|
t.billingStatus,
|
|
1128
1114
|
s,
|
|
1129
|
-
|
|
1130
|
-
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (
|
|
1115
|
+
Te
|
|
1116
|
+
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Te = null), Ht(
|
|
1131
1117
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
1132
1118
|
t.billingStatus,
|
|
1133
|
-
|
|
1119
|
+
Te
|
|
1134
1120
|
), j());
|
|
1135
1121
|
},
|
|
1136
|
-
updateAuthGate: (
|
|
1137
|
-
const s =
|
|
1138
|
-
t.loginRequired =
|
|
1122
|
+
updateAuthGate: (r) => {
|
|
1123
|
+
const s = et();
|
|
1124
|
+
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
1125
|
J(
|
|
1140
1126
|
"web-sdk.widget",
|
|
1141
1127
|
"Failed to connect after auth gate cleared",
|
|
1142
1128
|
{
|
|
1143
|
-
message:
|
|
1129
|
+
message: _ instanceof Error ? _.message : String(_)
|
|
1144
1130
|
}
|
|
1145
1131
|
);
|
|
1146
1132
|
});
|
|
1147
1133
|
},
|
|
1148
1134
|
openPanel: () => {
|
|
1149
|
-
|
|
1135
|
+
he(x.value, !1);
|
|
1150
1136
|
},
|
|
1151
|
-
updateDisplayState: (
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1137
|
+
updateDisplayState: (r) => {
|
|
1138
|
+
if (r === "shown") {
|
|
1139
|
+
Fe("shown", !1);
|
|
1154
1140
|
return;
|
|
1155
1141
|
}
|
|
1156
|
-
|
|
1142
|
+
Fe("minimized", !1);
|
|
1157
1143
|
},
|
|
1158
1144
|
destroy: () => {
|
|
1159
|
-
|
|
1145
|
+
Pe || (U(), Pe = !0, sn.disconnect(), mn?.disconnect(), $o(), window.removeEventListener("resize", dn), cn(), Fo(), le !== null && window.clearTimeout(le), wn(), _n(), Ie?.remove(), y.destroy(), ft.release(), n.remove());
|
|
1160
1146
|
}
|
|
1161
1147
|
};
|
|
1162
|
-
async function
|
|
1163
|
-
if (!
|
|
1164
|
-
|
|
1148
|
+
async function Zo(r) {
|
|
1149
|
+
if (!ot) {
|
|
1150
|
+
ot = r.id, qe = null, G(y.getState());
|
|
1165
1151
|
try {
|
|
1166
1152
|
if (!t.socialPostDraftHandler)
|
|
1167
1153
|
throw new Error("Social post drafting is not available here.");
|
|
1168
|
-
const s = await t.socialPostDraftHandler(
|
|
1154
|
+
const s = await t.socialPostDraftHandler(r);
|
|
1169
1155
|
if (!s.linkedinPost || !s.xPost)
|
|
1170
1156
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1171
|
-
|
|
1157
|
+
Le.add(r.id), Ze.add(r.id), U(), Ie?.remove(), Ie = lr(s, {
|
|
1172
1158
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1173
1159
|
onClose: () => {
|
|
1174
|
-
|
|
1160
|
+
Ie?.remove(), Ie = null;
|
|
1175
1161
|
}
|
|
1176
|
-
}), i.appendChild(
|
|
1162
|
+
}), i.appendChild(Ie);
|
|
1177
1163
|
} catch (s) {
|
|
1178
|
-
|
|
1164
|
+
qe = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1179
1165
|
} finally {
|
|
1180
|
-
|
|
1166
|
+
ot = null, G(y.getState());
|
|
1181
1167
|
}
|
|
1182
1168
|
}
|
|
1183
1169
|
}
|
|
1184
|
-
function
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
),
|
|
1190
|
-
accentColor:
|
|
1191
|
-
colorScheme:
|
|
1170
|
+
function Tt(r, s) {
|
|
1171
|
+
const _ = r.accentColor ?? t.accentColor, L = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, At = r.scribbleStyle ?? t.scribbleStyle;
|
|
1172
|
+
a = Dn(
|
|
1173
|
+
_,
|
|
1174
|
+
At
|
|
1175
|
+
), Rn(i, a, {
|
|
1176
|
+
accentColor: _,
|
|
1177
|
+
colorScheme: L,
|
|
1192
1178
|
fontFamily: M,
|
|
1193
|
-
scribbleStyle:
|
|
1179
|
+
scribbleStyle: At
|
|
1194
1180
|
}), J("web-sdk.widget", "Updated widget appearance", {
|
|
1195
1181
|
source: s,
|
|
1196
|
-
inputAppearance:
|
|
1197
|
-
appliedAccentColor:
|
|
1198
|
-
appliedColorScheme:
|
|
1182
|
+
inputAppearance: r,
|
|
1183
|
+
appliedAccentColor: _,
|
|
1184
|
+
appliedColorScheme: L,
|
|
1199
1185
|
appliedFontFamily: M,
|
|
1200
|
-
appliedScribbleStyle:
|
|
1186
|
+
appliedScribbleStyle: At,
|
|
1201
1187
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
1202
1188
|
});
|
|
1203
1189
|
}
|
|
1204
1190
|
}
|
|
1205
|
-
function
|
|
1191
|
+
function Dn(e, t) {
|
|
1206
1192
|
return { accentColor: e, scribbleStyle: t };
|
|
1207
1193
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const t =
|
|
1210
|
-
return t === null ? "#fafafa" :
|
|
1194
|
+
function na(e) {
|
|
1195
|
+
const t = oa(e);
|
|
1196
|
+
return t === null ? "#fafafa" : ia(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1211
1197
|
}
|
|
1212
|
-
function
|
|
1198
|
+
function oa(e) {
|
|
1213
1199
|
const t = e.trim();
|
|
1214
1200
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1215
1201
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1221,14 +1207,14 @@ function qi(e) {
|
|
|
1221
1207
|
Number.parseInt(t[3] + t[3], 16)
|
|
1222
1208
|
] : null;
|
|
1223
1209
|
}
|
|
1224
|
-
function
|
|
1210
|
+
function ia([e, t, n]) {
|
|
1225
1211
|
const o = (i) => {
|
|
1226
|
-
const
|
|
1227
|
-
return
|
|
1212
|
+
const a = i / 255;
|
|
1213
|
+
return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
1228
1214
|
};
|
|
1229
1215
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
1230
1216
|
}
|
|
1231
|
-
function
|
|
1217
|
+
function Rn(e, t, n) {
|
|
1232
1218
|
e.classList.toggle(
|
|
1233
1219
|
"pluno-pa-widget--dark",
|
|
1234
1220
|
n.colorScheme === "dark"
|
|
@@ -1236,27 +1222,27 @@ function In(e, t, n) {
|
|
|
1236
1222
|
"pluno-pa-widget--light",
|
|
1237
1223
|
n.colorScheme !== "dark"
|
|
1238
1224
|
), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
1239
|
-
const o = n.scribbleStyle ?
|
|
1225
|
+
const o = n.scribbleStyle ? Qn(n.accentColor) : n.accentColor;
|
|
1240
1226
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1241
1227
|
"--pluno-pa-accent-contrast",
|
|
1242
|
-
|
|
1243
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ?
|
|
1228
|
+
na(o)
|
|
1229
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Fi : n.fontFamily, n.scribbleStyle && aa(e.ownerDocument);
|
|
1244
1230
|
const i = Array.from(
|
|
1245
1231
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1246
1232
|
);
|
|
1247
|
-
for (const
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
Array.from(
|
|
1233
|
+
for (const a of i)
|
|
1234
|
+
a.replaceWith(
|
|
1235
|
+
fe(
|
|
1236
|
+
Array.from(a.classList).join(" "),
|
|
1251
1237
|
t
|
|
1252
1238
|
)
|
|
1253
1239
|
);
|
|
1254
1240
|
}
|
|
1255
|
-
function
|
|
1256
|
-
if (e.getElementById(
|
|
1241
|
+
function aa(e) {
|
|
1242
|
+
if (e.getElementById(In))
|
|
1257
1243
|
return;
|
|
1258
1244
|
const t = e.createElement("style");
|
|
1259
|
-
t.id =
|
|
1245
|
+
t.id = In, t.textContent = `@font-face {
|
|
1260
1246
|
font-family: "Architects Daughter";
|
|
1261
1247
|
font-style: normal;
|
|
1262
1248
|
font-weight: 400;
|
|
@@ -1264,28 +1250,28 @@ function Vi(e) {
|
|
|
1264
1250
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1265
1251
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1266
1252
|
}
|
|
1267
|
-
function
|
|
1253
|
+
function ra({
|
|
1268
1254
|
root: e,
|
|
1269
1255
|
launcher: t,
|
|
1270
1256
|
launcherDragHandle: n,
|
|
1271
1257
|
getPosition: o,
|
|
1272
1258
|
setPosition: i,
|
|
1273
|
-
persist:
|
|
1259
|
+
persist: a
|
|
1274
1260
|
}) {
|
|
1275
1261
|
let l = null, p = null, d = null, c = !1, u = null;
|
|
1276
1262
|
const m = () => {
|
|
1277
1263
|
l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1278
|
-
},
|
|
1264
|
+
}, E = (h) => {
|
|
1279
1265
|
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
1266
|
}, v = (h) => {
|
|
1281
1267
|
if (l !== h.pointerId || !p || !d)
|
|
1282
1268
|
return;
|
|
1283
1269
|
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
|
-
},
|
|
1270
|
+
const P = h.clientX - p.x, T = h.clientY - p.y;
|
|
1271
|
+
!c && Math.hypot(P, T) < Yt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + T }));
|
|
1272
|
+
}, z = (h) => {
|
|
1273
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, a()), m());
|
|
1274
|
+
}, b = (h) => {
|
|
1289
1275
|
l === h.pointerId && (h.preventDefault(), m());
|
|
1290
1276
|
}, g = (h) => {
|
|
1291
1277
|
if (!u)
|
|
@@ -1293,61 +1279,61 @@ function Ki({
|
|
|
1293
1279
|
const P = Math.hypot(
|
|
1294
1280
|
h.clientX - u.x,
|
|
1295
1281
|
h.clientY - u.y
|
|
1296
|
-
) <=
|
|
1282
|
+
) <= Yt;
|
|
1297
1283
|
u = null, P && (h.preventDefault(), h.stopPropagation());
|
|
1298
|
-
},
|
|
1284
|
+
}, w = (h) => {
|
|
1299
1285
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1300
1286
|
return;
|
|
1301
|
-
const P = h.shiftKey ?
|
|
1302
|
-
let
|
|
1303
|
-
h.key === "ArrowUp" ?
|
|
1287
|
+
const P = h.shiftKey ? so : po, T = o();
|
|
1288
|
+
let k = null;
|
|
1289
|
+
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
1290
|
};
|
|
1305
|
-
return t.addEventListener("pointerdown",
|
|
1306
|
-
t.removeEventListener("pointerdown",
|
|
1291
|
+
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), () => {
|
|
1292
|
+
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
1293
|
};
|
|
1308
1294
|
}
|
|
1309
|
-
function
|
|
1295
|
+
function la({
|
|
1310
1296
|
root: e,
|
|
1311
1297
|
handles: t,
|
|
1312
1298
|
getBounds: n,
|
|
1313
1299
|
setBounds: o,
|
|
1314
1300
|
persist: i
|
|
1315
1301
|
}) {
|
|
1316
|
-
let
|
|
1302
|
+
let a = null, l = null, p = null, d = null, c = !1;
|
|
1317
1303
|
const u = () => {
|
|
1318
|
-
|
|
1304
|
+
a = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
|
|
1319
1305
|
}, m = (g) => {
|
|
1320
|
-
const
|
|
1321
|
-
!e.classList.contains("pluno-pa-widget--open") || !
|
|
1322
|
-
},
|
|
1323
|
-
if (
|
|
1306
|
+
const w = g.currentTarget, h = w.dataset.resizeDirection;
|
|
1307
|
+
!e.classList.contains("pluno-pa-widget--open") || !zn(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));
|
|
1308
|
+
}, E = (g) => {
|
|
1309
|
+
if (a !== g.pointerId || !l || !p || !d)
|
|
1324
1310
|
return;
|
|
1325
1311
|
g.preventDefault(), g.stopPropagation();
|
|
1326
|
-
const
|
|
1327
|
-
!c && Math.hypot(
|
|
1328
|
-
|
|
1312
|
+
const w = g.clientX - p.x, h = g.clientY - p.y;
|
|
1313
|
+
!c && Math.hypot(w, h) < Yt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
|
|
1314
|
+
Mn(d, l, w, h)
|
|
1329
1315
|
));
|
|
1330
1316
|
}, v = (g) => {
|
|
1331
|
-
|
|
1332
|
-
},
|
|
1333
|
-
|
|
1334
|
-
},
|
|
1335
|
-
const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ?
|
|
1336
|
-
let
|
|
1337
|
-
|
|
1317
|
+
a === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
|
|
1318
|
+
}, z = (g) => {
|
|
1319
|
+
a === g.pointerId && (g.preventDefault(), u());
|
|
1320
|
+
}, b = (g) => {
|
|
1321
|
+
const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? so : po, T = n();
|
|
1322
|
+
let k = 0, F = 0;
|
|
1323
|
+
zn(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(Mn(T, h, k, F)), i()));
|
|
1338
1324
|
};
|
|
1339
1325
|
for (const g of t)
|
|
1340
|
-
g.addEventListener("pointerdown", m), g.addEventListener("pointermove",
|
|
1326
|
+
g.addEventListener("pointerdown", m), g.addEventListener("pointermove", E), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", z), g.addEventListener("keydown", b);
|
|
1341
1327
|
return () => {
|
|
1342
1328
|
for (const g of t)
|
|
1343
|
-
g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove",
|
|
1329
|
+
g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", E), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", z), g.removeEventListener("keydown", b);
|
|
1344
1330
|
};
|
|
1345
1331
|
}
|
|
1346
|
-
function
|
|
1332
|
+
function zn(e) {
|
|
1347
1333
|
return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
|
|
1348
1334
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const i = Y(),
|
|
1335
|
+
function Mn(e, t, n, o) {
|
|
1336
|
+
const i = Y(), a = On({
|
|
1351
1337
|
leading: e.position.x,
|
|
1352
1338
|
length: e.size.width,
|
|
1353
1339
|
delta: n,
|
|
@@ -1356,54 +1342,50 @@ function Nn(e, t, n, o) {
|
|
|
1356
1342
|
minLeading: I,
|
|
1357
1343
|
maxTrailing: i.width - I,
|
|
1358
1344
|
minLength: Math.min(
|
|
1359
|
-
|
|
1345
|
+
tn,
|
|
1360
1346
|
i.width - I * 2
|
|
1361
1347
|
)
|
|
1362
|
-
}), l =
|
|
1348
|
+
}), l = On({
|
|
1363
1349
|
leading: e.position.y,
|
|
1364
1350
|
length: e.size.height,
|
|
1365
1351
|
delta: o,
|
|
1366
1352
|
resizeLeading: t.startsWith("top") || t === "top",
|
|
1367
1353
|
resizeTrailing: t.startsWith("bottom") || t === "bottom",
|
|
1368
|
-
minLeading:
|
|
1354
|
+
minLeading: Se,
|
|
1369
1355
|
maxTrailing: i.height - I,
|
|
1370
1356
|
minLength: Math.min(
|
|
1371
|
-
|
|
1372
|
-
i.height -
|
|
1357
|
+
nn,
|
|
1358
|
+
i.height - Se - I
|
|
1373
1359
|
)
|
|
1374
1360
|
});
|
|
1375
1361
|
return {
|
|
1376
|
-
position: { x:
|
|
1377
|
-
size: { width:
|
|
1362
|
+
position: { x: a.leading, y: l.leading },
|
|
1363
|
+
size: { width: a.length, height: l.length }
|
|
1378
1364
|
};
|
|
1379
1365
|
}
|
|
1380
|
-
function
|
|
1366
|
+
function On({
|
|
1381
1367
|
leading: e,
|
|
1382
1368
|
length: t,
|
|
1383
1369
|
delta: n,
|
|
1384
1370
|
resizeLeading: o,
|
|
1385
1371
|
resizeTrailing: i,
|
|
1386
|
-
minLeading:
|
|
1372
|
+
minLeading: a,
|
|
1387
1373
|
maxTrailing: l,
|
|
1388
1374
|
minLength: p
|
|
1389
1375
|
}) {
|
|
1390
1376
|
const d = e + t;
|
|
1391
1377
|
if (o) {
|
|
1392
1378
|
const c = e + n;
|
|
1393
|
-
if (c >=
|
|
1394
|
-
const m = K(
|
|
1395
|
-
c,
|
|
1396
|
-
r,
|
|
1397
|
-
d - p
|
|
1398
|
-
);
|
|
1379
|
+
if (c >= a) {
|
|
1380
|
+
const m = K(c, a, d - p);
|
|
1399
1381
|
return { leading: m, length: d - m };
|
|
1400
1382
|
}
|
|
1401
1383
|
const u = K(
|
|
1402
|
-
d +
|
|
1384
|
+
d + a - c,
|
|
1403
1385
|
d,
|
|
1404
1386
|
l
|
|
1405
1387
|
);
|
|
1406
|
-
return { leading:
|
|
1388
|
+
return { leading: a, length: u - a };
|
|
1407
1389
|
}
|
|
1408
1390
|
if (i) {
|
|
1409
1391
|
const c = d + n;
|
|
@@ -1417,54 +1399,57 @@ function Tn({
|
|
|
1417
1399
|
}
|
|
1418
1400
|
const u = K(
|
|
1419
1401
|
e - (c - l),
|
|
1420
|
-
|
|
1402
|
+
a,
|
|
1421
1403
|
e
|
|
1422
1404
|
);
|
|
1423
1405
|
return { leading: u, length: l - u };
|
|
1424
1406
|
}
|
|
1425
1407
|
return { leading: e, length: t };
|
|
1426
1408
|
}
|
|
1427
|
-
function
|
|
1409
|
+
function ct(e, t = !0) {
|
|
1428
1410
|
const n = Y();
|
|
1429
1411
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1430
|
-
return
|
|
1412
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? {
|
|
1413
|
+
width: Hi,
|
|
1414
|
+
height: Wi
|
|
1415
|
+
} : { width: Tn, height: Tn };
|
|
1431
1416
|
const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1432
1417
|
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") ?
|
|
1418
|
+
width: t && i && o.width > 0 ? o.width : Math.min(ao, n.width - 36),
|
|
1419
|
+
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? $i : ro
|
|
1435
1420
|
};
|
|
1436
1421
|
}
|
|
1437
|
-
function
|
|
1422
|
+
function pa() {
|
|
1438
1423
|
const e = Y();
|
|
1439
1424
|
return {
|
|
1440
1425
|
width: Math.min(
|
|
1441
1426
|
K(
|
|
1442
|
-
e.width *
|
|
1443
|
-
|
|
1444
|
-
|
|
1427
|
+
e.width * ji,
|
|
1428
|
+
tn,
|
|
1429
|
+
qi
|
|
1445
1430
|
),
|
|
1446
1431
|
e.width - I * 2
|
|
1447
1432
|
),
|
|
1448
1433
|
height: Math.min(
|
|
1449
1434
|
K(
|
|
1450
|
-
e.height *
|
|
1451
|
-
|
|
1452
|
-
|
|
1435
|
+
e.height * Ki,
|
|
1436
|
+
nn,
|
|
1437
|
+
Vi
|
|
1453
1438
|
),
|
|
1454
|
-
e.height -
|
|
1439
|
+
e.height - Se - I
|
|
1455
1440
|
)
|
|
1456
1441
|
};
|
|
1457
1442
|
}
|
|
1458
1443
|
function ze(e = null) {
|
|
1459
|
-
return e ?
|
|
1444
|
+
return e ? gt(e) : pa();
|
|
1460
1445
|
}
|
|
1461
|
-
function
|
|
1446
|
+
function gt(e) {
|
|
1462
1447
|
const t = Y();
|
|
1463
1448
|
return {
|
|
1464
1449
|
width: K(
|
|
1465
1450
|
e.width,
|
|
1466
1451
|
Math.min(
|
|
1467
|
-
|
|
1452
|
+
tn,
|
|
1468
1453
|
t.width - I * 2
|
|
1469
1454
|
),
|
|
1470
1455
|
Math.max(
|
|
@@ -1475,54 +1460,54 @@ function ut(e) {
|
|
|
1475
1460
|
height: K(
|
|
1476
1461
|
e.height,
|
|
1477
1462
|
Math.min(
|
|
1478
|
-
|
|
1479
|
-
t.height -
|
|
1463
|
+
nn,
|
|
1464
|
+
t.height - Se - I
|
|
1480
1465
|
),
|
|
1481
1466
|
Math.max(
|
|
1482
1467
|
I,
|
|
1483
|
-
t.height -
|
|
1468
|
+
t.height - Se - I
|
|
1484
1469
|
)
|
|
1485
1470
|
)
|
|
1486
1471
|
};
|
|
1487
1472
|
}
|
|
1488
|
-
function
|
|
1473
|
+
function Rt(e, t) {
|
|
1489
1474
|
if (!t) {
|
|
1490
1475
|
e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
|
|
1491
1476
|
return;
|
|
1492
1477
|
}
|
|
1493
|
-
const n =
|
|
1478
|
+
const n = gt(t);
|
|
1494
1479
|
e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
|
|
1495
1480
|
}
|
|
1496
|
-
function
|
|
1481
|
+
function sa(e, t, n) {
|
|
1497
1482
|
const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1498
1483
|
if (Number.isFinite(o) && Number.isFinite(i))
|
|
1499
1484
|
return { x: o, y: i };
|
|
1500
|
-
const
|
|
1501
|
-
if (
|
|
1502
|
-
return { x:
|
|
1485
|
+
const a = e.getBoundingClientRect();
|
|
1486
|
+
if (a.width > 0 || a.height > 0)
|
|
1487
|
+
return { x: a.left, y: a.top };
|
|
1503
1488
|
const l = Y();
|
|
1504
1489
|
return {
|
|
1505
1490
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
1506
1491
|
y: l.height - 24 - n.height
|
|
1507
1492
|
};
|
|
1508
1493
|
}
|
|
1509
|
-
function
|
|
1510
|
-
const o =
|
|
1511
|
-
return t ?
|
|
1494
|
+
function zt(e, t, n) {
|
|
1495
|
+
const o = ct(e, !1);
|
|
1496
|
+
return t ? Xt(
|
|
1512
1497
|
e,
|
|
1513
|
-
|
|
1498
|
+
go(t, o),
|
|
1514
1499
|
o
|
|
1515
|
-
) :
|
|
1500
|
+
) : da(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Gi);
|
|
1516
1501
|
}
|
|
1517
|
-
function
|
|
1502
|
+
function da(e, t, n) {
|
|
1518
1503
|
const o = Y();
|
|
1519
1504
|
return {
|
|
1520
1505
|
x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
|
|
1521
1506
|
y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
|
|
1522
1507
|
};
|
|
1523
1508
|
}
|
|
1524
|
-
function
|
|
1525
|
-
const o = Y(), i = I +
|
|
1509
|
+
function Xt(e, t, n) {
|
|
1510
|
+
const o = Y(), i = I + ga(e);
|
|
1526
1511
|
return {
|
|
1527
1512
|
x: K(
|
|
1528
1513
|
t.x,
|
|
@@ -1542,36 +1527,36 @@ function Vt(e, t, n) {
|
|
|
1542
1527
|
)
|
|
1543
1528
|
};
|
|
1544
1529
|
}
|
|
1545
|
-
function
|
|
1530
|
+
function go(e, t) {
|
|
1546
1531
|
const n = Y();
|
|
1547
1532
|
return {
|
|
1548
1533
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
1549
1534
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
1550
1535
|
};
|
|
1551
1536
|
}
|
|
1552
|
-
function
|
|
1553
|
-
const n =
|
|
1537
|
+
function ca(e, t) {
|
|
1538
|
+
const n = ua(e, t), o = Y();
|
|
1554
1539
|
return {
|
|
1555
1540
|
anchor: n,
|
|
1556
1541
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
1557
1542
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
1558
1543
|
};
|
|
1559
1544
|
}
|
|
1560
|
-
function
|
|
1561
|
-
const n = Y(), o = e.x + t.width / 2,
|
|
1562
|
-
return `${
|
|
1545
|
+
function ua(e, t) {
|
|
1546
|
+
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";
|
|
1547
|
+
return `${a}-${l}`;
|
|
1563
1548
|
}
|
|
1564
|
-
function
|
|
1565
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1549
|
+
function ga(e) {
|
|
1550
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? Ji : Zi;
|
|
1566
1551
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const i =
|
|
1569
|
-
x: n === "bottom-left" ? t.x : t.x + i.width -
|
|
1570
|
-
y: t.y + i.height -
|
|
1552
|
+
function Mt(e, t, n, o = null) {
|
|
1553
|
+
const i = ct(e), a = ze(o), l = {
|
|
1554
|
+
x: n === "bottom-left" ? t.x : t.x + i.width - a.width,
|
|
1555
|
+
y: t.y + i.height - a.height
|
|
1571
1556
|
};
|
|
1572
|
-
return
|
|
1557
|
+
return pt(l, a);
|
|
1573
1558
|
}
|
|
1574
|
-
function
|
|
1559
|
+
function pt(e, t) {
|
|
1575
1560
|
const n = Y();
|
|
1576
1561
|
return {
|
|
1577
1562
|
x: K(
|
|
@@ -1584,34 +1569,34 @@ function lt(e, t) {
|
|
|
1584
1569
|
),
|
|
1585
1570
|
y: K(
|
|
1586
1571
|
e.y,
|
|
1587
|
-
|
|
1572
|
+
Se,
|
|
1588
1573
|
Math.max(
|
|
1589
|
-
|
|
1574
|
+
Se,
|
|
1590
1575
|
n.height - t.height - I
|
|
1591
1576
|
)
|
|
1592
1577
|
)
|
|
1593
1578
|
};
|
|
1594
1579
|
}
|
|
1595
|
-
function
|
|
1580
|
+
function Ce(e, t) {
|
|
1596
1581
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1597
1582
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1598
1583
|
return;
|
|
1599
1584
|
}
|
|
1600
1585
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1601
1586
|
}
|
|
1602
|
-
function
|
|
1587
|
+
function ha(e, t) {
|
|
1603
1588
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1604
1589
|
}
|
|
1605
|
-
function
|
|
1590
|
+
function Un(e) {
|
|
1606
1591
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1607
1592
|
}
|
|
1608
1593
|
function Y() {
|
|
1609
1594
|
return {
|
|
1610
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1611
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1595
|
+
width: window.innerWidth || document.documentElement.clientWidth || ao + I * 2,
|
|
1596
|
+
height: window.innerHeight || document.documentElement.clientHeight || ro + I * 2
|
|
1612
1597
|
};
|
|
1613
1598
|
}
|
|
1614
|
-
function
|
|
1599
|
+
function Ot(e) {
|
|
1615
1600
|
const t = e.getBoundingClientRect();
|
|
1616
1601
|
return {
|
|
1617
1602
|
x: Math.round(t.x),
|
|
@@ -1631,46 +1616,46 @@ function J(e, t, n) {
|
|
|
1631
1616
|
source: e,
|
|
1632
1617
|
message: t,
|
|
1633
1618
|
details: n
|
|
1634
|
-
},
|
|
1635
|
-
|
|
1636
|
-
new CustomEvent(
|
|
1619
|
+
}, a = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1620
|
+
a.push(i), a.length > 120 && a.splice(0, a.length - 120), o.__plunoProductAgentDiagnostics__ = a, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
|
|
1621
|
+
new CustomEvent(Ri, { detail: i })
|
|
1637
1622
|
);
|
|
1638
1623
|
}
|
|
1639
|
-
function
|
|
1624
|
+
function ma(e, t) {
|
|
1640
1625
|
J("web-sdk.widget.position", e, t);
|
|
1641
1626
|
}
|
|
1642
|
-
function
|
|
1627
|
+
function Ut(e, t, n) {
|
|
1643
1628
|
const o = t.value.trim();
|
|
1644
1629
|
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(
|
|
1630
|
+
attachments: n.length > 0 ? n.map(ba) : void 0
|
|
1646
1631
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1647
1632
|
}
|
|
1648
|
-
function
|
|
1633
|
+
function fa(e, t, n) {
|
|
1649
1634
|
const o = e.activeElement;
|
|
1650
1635
|
return o === n ? "composer" : o === t ? "launcher" : null;
|
|
1651
1636
|
}
|
|
1652
|
-
function
|
|
1653
|
-
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt >
|
|
1637
|
+
function wa(e, t, n, o) {
|
|
1638
|
+
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > vi)
|
|
1654
1639
|
return;
|
|
1655
1640
|
const i = e.focusedInput === "composer" ? o : n;
|
|
1656
1641
|
i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
|
|
1657
1642
|
!i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
|
|
1658
1643
|
});
|
|
1659
1644
|
}
|
|
1660
|
-
function
|
|
1645
|
+
function ba(e) {
|
|
1661
1646
|
return e;
|
|
1662
1647
|
}
|
|
1663
|
-
function
|
|
1648
|
+
function Ve(e) {
|
|
1664
1649
|
e.style.height = "0px";
|
|
1665
1650
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1666
1651
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1667
1652
|
}
|
|
1668
|
-
function
|
|
1653
|
+
function Ke(e, t = () => !0) {
|
|
1669
1654
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1670
1655
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1671
1656
|
});
|
|
1672
1657
|
}
|
|
1673
|
-
function
|
|
1658
|
+
function _a(e) {
|
|
1674
1659
|
const t = e.messages[e.messages.length - 1];
|
|
1675
1660
|
return [
|
|
1676
1661
|
e.messages.length,
|
|
@@ -1681,13 +1666,13 @@ function la(e) {
|
|
|
1681
1666
|
e.lastError ?? ""
|
|
1682
1667
|
].join(":");
|
|
1683
1668
|
}
|
|
1684
|
-
function
|
|
1669
|
+
function xa(e) {
|
|
1685
1670
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1686
1671
|
}
|
|
1687
|
-
function
|
|
1672
|
+
function ya(e) {
|
|
1688
1673
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1689
1674
|
}
|
|
1690
|
-
function
|
|
1675
|
+
function va(e) {
|
|
1691
1676
|
const t = e.currentPage;
|
|
1692
1677
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1693
1678
|
try {
|
|
@@ -1698,7 +1683,7 @@ function da(e) {
|
|
|
1698
1683
|
}
|
|
1699
1684
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1700
1685
|
}
|
|
1701
|
-
function
|
|
1686
|
+
function Ca(e, t) {
|
|
1702
1687
|
const n = new Date(e).getTime();
|
|
1703
1688
|
if (!Number.isFinite(n))
|
|
1704
1689
|
return "now";
|
|
@@ -1707,103 +1692,103 @@ function ca(e, t) {
|
|
|
1707
1692
|
["hour", 36e5],
|
|
1708
1693
|
["min", 6e4]
|
|
1709
1694
|
];
|
|
1710
|
-
for (const [
|
|
1695
|
+
for (const [a, l] of i)
|
|
1711
1696
|
if (o >= l) {
|
|
1712
1697
|
const p = Math.max(1, Math.floor(o / l));
|
|
1713
|
-
return
|
|
1698
|
+
return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
|
|
1714
1699
|
}
|
|
1715
1700
|
return "now";
|
|
1716
1701
|
}
|
|
1717
|
-
function
|
|
1718
|
-
e.appendChild(
|
|
1719
|
-
|
|
1702
|
+
function Sa(e, t, n, o, i) {
|
|
1703
|
+
e.appendChild(Da()), e.appendChild(
|
|
1704
|
+
Ea(
|
|
1720
1705
|
t,
|
|
1721
1706
|
n,
|
|
1722
1707
|
o,
|
|
1723
1708
|
i
|
|
1724
1709
|
)
|
|
1725
1710
|
), e.appendChild(
|
|
1726
|
-
|
|
1711
|
+
ht(
|
|
1727
1712
|
"pluno-pa-widget__close",
|
|
1728
1713
|
"Close",
|
|
1729
|
-
|
|
1714
|
+
Ra(16),
|
|
1730
1715
|
!0
|
|
1731
1716
|
)
|
|
1732
|
-
), e.appendChild(
|
|
1717
|
+
), e.appendChild(ka(n));
|
|
1733
1718
|
}
|
|
1734
|
-
function
|
|
1719
|
+
function Ea(e, t, n, o) {
|
|
1735
1720
|
const i = document.createElement("form");
|
|
1736
1721
|
if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
|
|
1737
1722
|
const d = document.createElement("button");
|
|
1738
1723
|
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
1724
|
}
|
|
1740
1725
|
i.appendChild(
|
|
1741
|
-
|
|
1726
|
+
wo(
|
|
1742
1727
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1743
1728
|
10
|
|
1744
1729
|
)
|
|
1745
1730
|
), i.appendChild(
|
|
1746
|
-
|
|
1731
|
+
fe(
|
|
1747
1732
|
"pluno-pa-widget__character--launcher",
|
|
1748
1733
|
t
|
|
1749
1734
|
)
|
|
1750
1735
|
);
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1736
|
+
const a = document.createElement("span");
|
|
1737
|
+
a.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(a);
|
|
1753
1738
|
const l = document.createElement("input");
|
|
1754
1739
|
l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
|
|
1755
|
-
const p =
|
|
1740
|
+
const p = ut("Working...");
|
|
1756
1741
|
if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
|
|
1757
1742
|
const d = document.createElement("button");
|
|
1758
1743
|
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
1744
|
}
|
|
1760
1745
|
return i;
|
|
1761
1746
|
}
|
|
1762
|
-
function
|
|
1747
|
+
function ka(e) {
|
|
1763
1748
|
const t = document.createElement("section");
|
|
1764
1749
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1765
|
-
|
|
1750
|
+
wo("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1766
1751
|
);
|
|
1767
1752
|
const n = document.createElement("div");
|
|
1768
1753
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1769
1754
|
const o = document.createElement("main");
|
|
1770
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1755
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(Ta(e));
|
|
1771
1756
|
const i = document.createElement("div");
|
|
1772
1757
|
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1758
|
+
const a = document.createElement("div");
|
|
1759
|
+
a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a);
|
|
1775
1760
|
const l = document.createElement("button");
|
|
1776
1761
|
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
|
|
1777
1762
|
const p = document.createElement("div");
|
|
1778
1763
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
1779
|
-
|
|
1764
|
+
ht(
|
|
1780
1765
|
"pluno-pa-widget__history",
|
|
1781
|
-
|
|
1782
|
-
|
|
1766
|
+
Zt(),
|
|
1767
|
+
Ma(),
|
|
1783
1768
|
!0
|
|
1784
1769
|
)
|
|
1785
|
-
), n.appendChild(p), n.appendChild(
|
|
1786
|
-
|
|
1787
|
-
), t.appendChild(
|
|
1788
|
-
|
|
1770
|
+
), 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(
|
|
1771
|
+
me("right", "Resize Pluno from right")
|
|
1772
|
+
), t.appendChild(me("top", "Resize Pluno from top")), t.appendChild(
|
|
1773
|
+
me("bottom", "Resize Pluno from bottom")
|
|
1789
1774
|
), t.appendChild(
|
|
1790
|
-
|
|
1775
|
+
me("top-left", "Resize Pluno from top left")
|
|
1791
1776
|
), t.appendChild(
|
|
1792
|
-
|
|
1777
|
+
me("top-right", "Resize Pluno from top right")
|
|
1793
1778
|
), t.appendChild(
|
|
1794
|
-
|
|
1779
|
+
me("bottom-left", "Resize Pluno from bottom left")
|
|
1795
1780
|
), t.appendChild(
|
|
1796
|
-
|
|
1781
|
+
me("bottom-right", "Resize Pluno from bottom right")
|
|
1797
1782
|
), t;
|
|
1798
1783
|
}
|
|
1799
|
-
function
|
|
1784
|
+
function me(e, t) {
|
|
1800
1785
|
const n = document.createElement("button");
|
|
1801
1786
|
return n.type = "button", n.className = [
|
|
1802
1787
|
"pluno-pa-widget__resize-handle",
|
|
1803
1788
|
`pluno-pa-widget__resize-handle--${e}`
|
|
1804
1789
|
].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
|
|
1805
1790
|
}
|
|
1806
|
-
function
|
|
1791
|
+
function La() {
|
|
1807
1792
|
const e = document.createElement("div");
|
|
1808
1793
|
e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
|
|
1809
1794
|
const t = document.createElement("span");
|
|
@@ -1814,10 +1799,10 @@ function ma() {
|
|
|
1814
1799
|
o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
|
|
1815
1800
|
const i = document.createElement("button");
|
|
1816
1801
|
i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
|
|
1817
|
-
const
|
|
1818
|
-
return
|
|
1802
|
+
const a = document.createElement("button");
|
|
1803
|
+
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
1804
|
}
|
|
1820
|
-
function
|
|
1805
|
+
function Pa() {
|
|
1821
1806
|
const e = document.createElement("form");
|
|
1822
1807
|
e.className = "pluno-pa-widget__composer";
|
|
1823
1808
|
const t = document.createElement("div");
|
|
@@ -1828,14 +1813,14 @@ function fa() {
|
|
|
1828
1813
|
o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
|
|
1829
1814
|
const i = document.createElement("div");
|
|
1830
1815
|
i.className = "pluno-pa-widget__composer-inner";
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1816
|
+
const a = document.createElement("input");
|
|
1817
|
+
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
1818
|
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(
|
|
1819
|
+
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
1820
|
const p = document.createElement("textarea");
|
|
1836
1821
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1837
1822
|
const d = document.createElement("button");
|
|
1838
|
-
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(
|
|
1823
|
+
d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(_o()), i.appendChild(d), e.appendChild(i);
|
|
1839
1824
|
const c = document.createElement("div");
|
|
1840
1825
|
c.className = "pluno-pa-widget__composer-meta";
|
|
1841
1826
|
const u = document.createElement("a");
|
|
@@ -1843,42 +1828,42 @@ function fa() {
|
|
|
1843
1828
|
const m = document.createElement("span");
|
|
1844
1829
|
return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
|
|
1845
1830
|
}
|
|
1846
|
-
function
|
|
1831
|
+
function Zt() {
|
|
1847
1832
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
1848
1833
|
}
|
|
1849
|
-
function
|
|
1834
|
+
function Ia() {
|
|
1850
1835
|
const e = document.createElement("section");
|
|
1851
|
-
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label",
|
|
1836
|
+
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Zt());
|
|
1852
1837
|
const t = document.createElement("div");
|
|
1853
1838
|
t.className = "pluno-pa-widget__history-header";
|
|
1854
1839
|
const n = document.createElement("strong");
|
|
1855
|
-
n.textContent =
|
|
1856
|
-
const o =
|
|
1840
|
+
n.textContent = Zt();
|
|
1841
|
+
const o = ht(
|
|
1857
1842
|
"pluno-pa-widget__history-close",
|
|
1858
1843
|
"Close recent chats",
|
|
1859
|
-
|
|
1844
|
+
Oa(),
|
|
1860
1845
|
!1
|
|
1861
1846
|
);
|
|
1862
1847
|
t.append(n, o);
|
|
1863
1848
|
const i = document.createElement("div");
|
|
1864
1849
|
i.className = "pluno-pa-widget__history-list";
|
|
1865
|
-
const
|
|
1866
|
-
return
|
|
1850
|
+
const a = document.createElement("p");
|
|
1851
|
+
return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
|
|
1867
1852
|
}
|
|
1868
|
-
function
|
|
1853
|
+
function Ta(e) {
|
|
1869
1854
|
const t = document.createElement("div");
|
|
1870
1855
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1871
|
-
|
|
1856
|
+
fe(
|
|
1872
1857
|
"pluno-pa-widget__character--empty",
|
|
1873
1858
|
e
|
|
1874
1859
|
)
|
|
1875
|
-
), t.appendChild(
|
|
1860
|
+
), t.appendChild(ho()), t;
|
|
1876
1861
|
}
|
|
1877
|
-
function
|
|
1862
|
+
function ho() {
|
|
1878
1863
|
const e = document.createElement("div");
|
|
1879
1864
|
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
1865
|
}
|
|
1881
|
-
function
|
|
1866
|
+
function mo(e, t) {
|
|
1882
1867
|
e.replaceChildren(), e.setAttribute(
|
|
1883
1868
|
"aria-label",
|
|
1884
1869
|
`${t.toLocaleString("en-US")} users currently active`
|
|
@@ -1890,17 +1875,17 @@ function po(e, t) {
|
|
|
1890
1875
|
)
|
|
1891
1876
|
);
|
|
1892
1877
|
}
|
|
1893
|
-
function
|
|
1894
|
-
const n = `pluno-pa-character-${
|
|
1895
|
-
|
|
1896
|
-
const o = t.scribbleStyle ?
|
|
1878
|
+
function fe(e, t) {
|
|
1879
|
+
const n = `pluno-pa-character-${Nn}`;
|
|
1880
|
+
Nn += 1;
|
|
1881
|
+
const o = t.scribbleStyle ? Na(t.accentColor, n) : Aa(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
|
|
1897
1882
|
return o.setAttribute(
|
|
1898
1883
|
"class",
|
|
1899
1884
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1900
1885
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1901
1886
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const n =
|
|
1887
|
+
function Aa(e, t) {
|
|
1888
|
+
const n = ni(e), o = {
|
|
1904
1889
|
boltFill: `${t}-boltFill`,
|
|
1905
1890
|
boltEdge: `${t}-boltEdge`,
|
|
1906
1891
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1911,7 +1896,7 @@ function _a(e, t) {
|
|
|
1911
1896
|
eyeShadow: `${t}-eyeShadow`,
|
|
1912
1897
|
pupilGloss: `${t}-pupilGloss`,
|
|
1913
1898
|
boltClip: `${t}-boltClip`
|
|
1914
|
-
}, i =
|
|
1899
|
+
}, i = fo(), a = f(i, "defs"), l = f(a, "linearGradient", {
|
|
1915
1900
|
id: o.boltFill,
|
|
1916
1901
|
x1: "420",
|
|
1917
1902
|
y1: "180",
|
|
@@ -1920,7 +1905,7 @@ function _a(e, t) {
|
|
|
1920
1905
|
gradientUnits: "userSpaceOnUse"
|
|
1921
1906
|
});
|
|
1922
1907
|
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(
|
|
1908
|
+
const p = f(a, "linearGradient", {
|
|
1924
1909
|
id: o.boltEdge,
|
|
1925
1910
|
x1: "470",
|
|
1926
1911
|
y1: "145",
|
|
@@ -1929,28 +1914,28 @@ function _a(e, t) {
|
|
|
1929
1914
|
gradientUnits: "userSpaceOnUse"
|
|
1930
1915
|
});
|
|
1931
1916
|
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(
|
|
1917
|
+
const d = f(a, "radialGradient", {
|
|
1933
1918
|
id: o.boltGlow,
|
|
1934
1919
|
cx: "50%",
|
|
1935
1920
|
cy: "22%",
|
|
1936
1921
|
r: "82%"
|
|
1937
1922
|
});
|
|
1938
1923
|
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(
|
|
1924
|
+
const c = f(a, "radialGradient", {
|
|
1940
1925
|
id: o.eyeWhite,
|
|
1941
1926
|
cx: "35%",
|
|
1942
1927
|
cy: "25%",
|
|
1943
1928
|
r: "70%"
|
|
1944
1929
|
});
|
|
1945
1930
|
O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
|
|
1946
|
-
const u = f(
|
|
1931
|
+
const u = f(a, "radialGradient", {
|
|
1947
1932
|
id: o.pupil,
|
|
1948
1933
|
cx: "42%",
|
|
1949
1934
|
cy: "38%",
|
|
1950
1935
|
r: "65%"
|
|
1951
1936
|
});
|
|
1952
1937
|
O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
|
|
1953
|
-
const m = f(
|
|
1938
|
+
const m = f(a, "filter", {
|
|
1954
1939
|
id: o.softDropShadow,
|
|
1955
1940
|
x: "-18%",
|
|
1956
1941
|
y: "-12%",
|
|
@@ -1965,7 +1950,7 @@ function _a(e, t) {
|
|
|
1965
1950
|
"flood-color": n.shadow,
|
|
1966
1951
|
"flood-opacity": "0.24"
|
|
1967
1952
|
});
|
|
1968
|
-
const
|
|
1953
|
+
const E = f(a, "filter", {
|
|
1969
1954
|
id: o.innerDepth,
|
|
1970
1955
|
x: "-8%",
|
|
1971
1956
|
y: "-8%",
|
|
@@ -1973,32 +1958,32 @@ function _a(e, t) {
|
|
|
1973
1958
|
height: "116%",
|
|
1974
1959
|
"color-interpolation-filters": "sRGB"
|
|
1975
1960
|
});
|
|
1976
|
-
f(
|
|
1961
|
+
f(E, "feGaussianBlur", {
|
|
1977
1962
|
in: "SourceAlpha",
|
|
1978
1963
|
stdDeviation: "8",
|
|
1979
1964
|
result: "blur"
|
|
1980
|
-
}), f(
|
|
1965
|
+
}), f(E, "feOffset", {
|
|
1981
1966
|
dx: "-7",
|
|
1982
1967
|
dy: "-9",
|
|
1983
1968
|
result: "topLeft"
|
|
1984
|
-
}), f(
|
|
1969
|
+
}), f(E, "feComposite", {
|
|
1985
1970
|
in: "topLeft",
|
|
1986
1971
|
in2: "SourceAlpha",
|
|
1987
1972
|
operator: "arithmetic",
|
|
1988
1973
|
k2: "-1",
|
|
1989
1974
|
k3: "1",
|
|
1990
1975
|
result: "innerShadow"
|
|
1991
|
-
}), f(
|
|
1976
|
+
}), f(E, "feColorMatrix", {
|
|
1992
1977
|
in: "innerShadow",
|
|
1993
1978
|
type: "matrix",
|
|
1994
1979
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1995
1980
|
result: "innerLight"
|
|
1996
|
-
}), f(
|
|
1981
|
+
}), f(E, "feBlend", {
|
|
1997
1982
|
in: "SourceGraphic",
|
|
1998
1983
|
in2: "innerLight",
|
|
1999
1984
|
mode: "screen"
|
|
2000
1985
|
});
|
|
2001
|
-
const v = f(
|
|
1986
|
+
const v = f(a, "filter", {
|
|
2002
1987
|
id: o.eyeShadow,
|
|
2003
1988
|
x: "-24%",
|
|
2004
1989
|
y: "-20%",
|
|
@@ -2013,7 +1998,7 @@ function _a(e, t) {
|
|
|
2013
1998
|
"flood-color": n.shadow,
|
|
2014
1999
|
"flood-opacity": "0.3"
|
|
2015
2000
|
});
|
|
2016
|
-
const
|
|
2001
|
+
const z = f(a, "filter", {
|
|
2017
2002
|
id: o.pupilGloss,
|
|
2018
2003
|
x: "-15%",
|
|
2019
2004
|
y: "-15%",
|
|
@@ -2021,29 +2006,29 @@ function _a(e, t) {
|
|
|
2021
2006
|
height: "130%",
|
|
2022
2007
|
"color-interpolation-filters": "sRGB"
|
|
2023
2008
|
});
|
|
2024
|
-
f(
|
|
2009
|
+
f(z, "feDropShadow", {
|
|
2025
2010
|
dx: "0",
|
|
2026
2011
|
dy: "3",
|
|
2027
2012
|
stdDeviation: "3",
|
|
2028
2013
|
"flood-color": "#000000",
|
|
2029
2014
|
"flood-opacity": "0.22"
|
|
2030
2015
|
});
|
|
2031
|
-
const
|
|
2032
|
-
f(
|
|
2016
|
+
const b = f(a, "clipPath", { id: o.boltClip });
|
|
2017
|
+
f(b, "path", { d: st });
|
|
2033
2018
|
const g = f(i, "g", {
|
|
2034
2019
|
filter: V(o.softDropShadow)
|
|
2035
2020
|
});
|
|
2036
2021
|
f(g, "path", {
|
|
2037
|
-
d:
|
|
2022
|
+
d: st,
|
|
2038
2023
|
fill: V(o.boltEdge)
|
|
2039
2024
|
});
|
|
2040
|
-
const
|
|
2025
|
+
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
2026
|
f(g, "path", {
|
|
2042
|
-
d:
|
|
2027
|
+
d: w,
|
|
2043
2028
|
fill: V(o.boltFill),
|
|
2044
2029
|
filter: V(o.innerDepth)
|
|
2045
2030
|
}), f(g, "path", {
|
|
2046
|
-
d:
|
|
2031
|
+
d: w,
|
|
2047
2032
|
fill: V(o.boltGlow),
|
|
2048
2033
|
opacity: "0.74"
|
|
2049
2034
|
});
|
|
@@ -2074,7 +2059,7 @@ function _a(e, t) {
|
|
|
2074
2059
|
opacity: "0.48"
|
|
2075
2060
|
});
|
|
2076
2061
|
const P = f(i, "g", { filter: V(o.eyeShadow) });
|
|
2077
|
-
return
|
|
2062
|
+
return Bn(
|
|
2078
2063
|
P,
|
|
2079
2064
|
"rotate(-2 528 463)",
|
|
2080
2065
|
"528",
|
|
@@ -2084,7 +2069,7 @@ function _a(e, t) {
|
|
|
2084
2069
|
"557",
|
|
2085
2070
|
"447",
|
|
2086
2071
|
o
|
|
2087
|
-
),
|
|
2072
|
+
), Bn(
|
|
2088
2073
|
P,
|
|
2089
2074
|
"rotate(2 717 462)",
|
|
2090
2075
|
"717",
|
|
@@ -2096,13 +2081,13 @@ function _a(e, t) {
|
|
|
2096
2081
|
o
|
|
2097
2082
|
), i;
|
|
2098
2083
|
}
|
|
2099
|
-
function
|
|
2100
|
-
const n =
|
|
2084
|
+
function Na(e, t) {
|
|
2085
|
+
const n = Qn(e), o = {
|
|
2101
2086
|
clip: `${t}-scribbleBoltClip`,
|
|
2102
2087
|
wobble: `${t}-scribbleBoltWobble`
|
|
2103
|
-
}, i =
|
|
2104
|
-
f(l, "path", { d:
|
|
2105
|
-
const p = f(
|
|
2088
|
+
}, i = fo(), a = f(i, "defs"), l = f(a, "clipPath", { id: o.clip });
|
|
2089
|
+
f(l, "path", { d: st });
|
|
2090
|
+
const p = f(a, "filter", {
|
|
2106
2091
|
id: o.wobble,
|
|
2107
2092
|
x: "-10%",
|
|
2108
2093
|
y: "-10%",
|
|
@@ -2127,7 +2112,7 @@ function xa(e, t) {
|
|
|
2127
2112
|
"clip-path": V(o.clip)
|
|
2128
2113
|
});
|
|
2129
2114
|
return f(c, "path", {
|
|
2130
|
-
d:
|
|
2115
|
+
d: ti(),
|
|
2131
2116
|
fill: "none",
|
|
2132
2117
|
stroke: n,
|
|
2133
2118
|
"stroke-width": "56",
|
|
@@ -2136,12 +2121,12 @@ function xa(e, t) {
|
|
|
2136
2121
|
opacity: "0.9",
|
|
2137
2122
|
transform: "rotate(-14 627 600)"
|
|
2138
2123
|
}), f(d, "path", {
|
|
2139
|
-
d:
|
|
2124
|
+
d: st,
|
|
2140
2125
|
fill: "none",
|
|
2141
|
-
stroke:
|
|
2126
|
+
stroke: dt,
|
|
2142
2127
|
"stroke-width": "18",
|
|
2143
2128
|
"stroke-linejoin": "round"
|
|
2144
|
-
}),
|
|
2129
|
+
}), Fn(
|
|
2145
2130
|
d,
|
|
2146
2131
|
"rotate(-2 528 463)",
|
|
2147
2132
|
"528",
|
|
@@ -2150,7 +2135,7 @@ function xa(e, t) {
|
|
|
2150
2135
|
"473",
|
|
2151
2136
|
"557",
|
|
2152
2137
|
"447"
|
|
2153
|
-
),
|
|
2138
|
+
), Fn(
|
|
2154
2139
|
d,
|
|
2155
2140
|
"rotate(2 717 462)",
|
|
2156
2141
|
"717",
|
|
@@ -2161,13 +2146,13 @@ function xa(e, t) {
|
|
|
2161
2146
|
"447"
|
|
2162
2147
|
), i;
|
|
2163
2148
|
}
|
|
2164
|
-
function
|
|
2165
|
-
return
|
|
2166
|
-
xmlns:
|
|
2149
|
+
function fo() {
|
|
2150
|
+
return S("svg", {
|
|
2151
|
+
xmlns: lo,
|
|
2167
2152
|
viewBox: "0 0 1254 1254"
|
|
2168
2153
|
});
|
|
2169
2154
|
}
|
|
2170
|
-
function
|
|
2155
|
+
function Bn(e, t, n, o, i, a, l, p, d) {
|
|
2171
2156
|
const c = f(e, "g", { transform: t });
|
|
2172
2157
|
f(c, "ellipse", {
|
|
2173
2158
|
cx: n,
|
|
@@ -2177,7 +2162,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
|
|
|
2177
2162
|
fill: V(d.eyeWhite)
|
|
2178
2163
|
}), f(c, "ellipse", {
|
|
2179
2164
|
cx: i,
|
|
2180
|
-
cy:
|
|
2165
|
+
cy: a,
|
|
2181
2166
|
rx: "49",
|
|
2182
2167
|
ry: "57",
|
|
2183
2168
|
fill: V(d.pupil),
|
|
@@ -2189,7 +2174,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
|
|
|
2189
2174
|
fill: "#ffffff"
|
|
2190
2175
|
});
|
|
2191
2176
|
}
|
|
2192
|
-
function
|
|
2177
|
+
function Fn(e, t, n, o, i, a, l, p) {
|
|
2193
2178
|
const d = f(e, "g", { transform: t });
|
|
2194
2179
|
f(d, "ellipse", {
|
|
2195
2180
|
cx: n,
|
|
@@ -2197,14 +2182,14 @@ function Rn(e, t, n, o, i, r, l, p) {
|
|
|
2197
2182
|
rx: "73",
|
|
2198
2183
|
ry: "80",
|
|
2199
2184
|
fill: "#ffffff",
|
|
2200
|
-
stroke:
|
|
2185
|
+
stroke: dt,
|
|
2201
2186
|
"stroke-width": "13"
|
|
2202
2187
|
}), f(d, "ellipse", {
|
|
2203
2188
|
cx: i,
|
|
2204
|
-
cy:
|
|
2189
|
+
cy: a,
|
|
2205
2190
|
rx: "45",
|
|
2206
2191
|
ry: "53",
|
|
2207
|
-
fill:
|
|
2192
|
+
fill: dt
|
|
2208
2193
|
}), f(d, "circle", {
|
|
2209
2194
|
cx: l,
|
|
2210
2195
|
cy: p,
|
|
@@ -2213,7 +2198,7 @@ function Rn(e, t, n, o, i, r, l, p) {
|
|
|
2213
2198
|
});
|
|
2214
2199
|
}
|
|
2215
2200
|
function f(e, t, n = {}) {
|
|
2216
|
-
const o =
|
|
2201
|
+
const o = S(t, n);
|
|
2217
2202
|
return e.appendChild(o), o;
|
|
2218
2203
|
}
|
|
2219
2204
|
function O(e, t, n, o) {
|
|
@@ -2223,61 +2208,61 @@ function O(e, t, n, o) {
|
|
|
2223
2208
|
function V(e) {
|
|
2224
2209
|
return `url(#${e})`;
|
|
2225
2210
|
}
|
|
2226
|
-
function
|
|
2211
|
+
function ht(e, t, n, o) {
|
|
2227
2212
|
const i = document.createElement("button");
|
|
2228
2213
|
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
|
|
2229
2214
|
}
|
|
2230
|
-
function
|
|
2231
|
-
const e =
|
|
2215
|
+
function Da() {
|
|
2216
|
+
const e = S("svg", {
|
|
2232
2217
|
class: "pluno-pa-widget__scribble-defs",
|
|
2233
2218
|
"aria-hidden": "true",
|
|
2234
2219
|
focusable: "false",
|
|
2235
2220
|
width: "0",
|
|
2236
2221
|
height: "0"
|
|
2237
|
-
}), t =
|
|
2238
|
-
return t.appendChild(
|
|
2239
|
-
|
|
2222
|
+
}), t = S("defs");
|
|
2223
|
+
return t.appendChild(Ft("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
2224
|
+
Ft("pluno-pa-scribble-wobble-2", "5", "15")
|
|
2240
2225
|
), t.appendChild(
|
|
2241
|
-
|
|
2226
|
+
Ft("pluno-pa-scribble-wobble-3", "9", "19")
|
|
2242
2227
|
), e.appendChild(t), e;
|
|
2243
2228
|
}
|
|
2244
|
-
function
|
|
2245
|
-
const n =
|
|
2229
|
+
function wo(e, t) {
|
|
2230
|
+
const n = S("svg", {
|
|
2246
2231
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
2247
2232
|
preserveAspectRatio: "xMidYMid meet",
|
|
2248
2233
|
"aria-hidden": "true",
|
|
2249
2234
|
focusable: "false"
|
|
2250
2235
|
});
|
|
2251
|
-
return
|
|
2236
|
+
return bo(n, t), n;
|
|
2252
2237
|
}
|
|
2253
|
-
function
|
|
2238
|
+
function Bt(e, t) {
|
|
2254
2239
|
if (!e)
|
|
2255
2240
|
return;
|
|
2256
2241
|
const n = Math.max(
|
|
2257
2242
|
0,
|
|
2258
|
-
t -
|
|
2243
|
+
t - Kt * 2
|
|
2259
2244
|
), o = Math.max(
|
|
2260
|
-
|
|
2245
|
+
Xi,
|
|
2261
2246
|
Math.floor(
|
|
2262
|
-
(n -
|
|
2247
|
+
(n - Vt * 2) / jt
|
|
2263
2248
|
)
|
|
2264
2249
|
);
|
|
2265
|
-
|
|
2250
|
+
bo(e, o);
|
|
2266
2251
|
}
|
|
2267
|
-
function
|
|
2252
|
+
function bo(e, t) {
|
|
2268
2253
|
if (e.dataset.spiralCount === `${t}`)
|
|
2269
2254
|
return;
|
|
2270
|
-
const n = t *
|
|
2255
|
+
const n = t * jt + Vt * 2;
|
|
2271
2256
|
e.dataset.spiralCount = `${t}`, e.setAttribute(
|
|
2272
2257
|
"viewBox",
|
|
2273
|
-
`0 0 ${n} ${
|
|
2258
|
+
`0 0 ${n} ${Yi}`
|
|
2274
2259
|
), e.replaceChildren();
|
|
2275
2260
|
for (let o = 0; o < t; o += 1) {
|
|
2276
|
-
const i =
|
|
2277
|
-
transform: `translate(${
|
|
2261
|
+
const i = An[o % An.length], a = S("g", {
|
|
2262
|
+
transform: `translate(${Vt + o * jt} 0)`
|
|
2278
2263
|
});
|
|
2279
|
-
|
|
2280
|
-
|
|
2264
|
+
a.appendChild(
|
|
2265
|
+
S("ellipse", {
|
|
2281
2266
|
cx: i.ellipseCx,
|
|
2282
2267
|
cy: i.ellipseCy,
|
|
2283
2268
|
rx: i.ellipseRx,
|
|
@@ -2287,19 +2272,19 @@ function uo(e, t) {
|
|
|
2287
2272
|
"stroke-width": i.strokeWidth,
|
|
2288
2273
|
opacity: "0.8"
|
|
2289
2274
|
})
|
|
2290
|
-
),
|
|
2291
|
-
|
|
2275
|
+
), a.appendChild(
|
|
2276
|
+
S("path", {
|
|
2292
2277
|
d: i.path,
|
|
2293
2278
|
fill: "none",
|
|
2294
2279
|
stroke: "#2c2a1e",
|
|
2295
2280
|
"stroke-width": i.pathStrokeWidth,
|
|
2296
2281
|
"stroke-linecap": "round"
|
|
2297
2282
|
})
|
|
2298
|
-
), e.appendChild(
|
|
2283
|
+
), e.appendChild(a);
|
|
2299
2284
|
}
|
|
2300
2285
|
}
|
|
2301
|
-
function
|
|
2302
|
-
const o =
|
|
2286
|
+
function Ft(e, t, n) {
|
|
2287
|
+
const o = S("filter", {
|
|
2303
2288
|
id: e,
|
|
2304
2289
|
x: "-8%",
|
|
2305
2290
|
y: "-8%",
|
|
@@ -2307,7 +2292,7 @@ function Ot(e, t, n) {
|
|
|
2307
2292
|
height: "116%"
|
|
2308
2293
|
});
|
|
2309
2294
|
return o.appendChild(
|
|
2310
|
-
|
|
2295
|
+
S("feTurbulence", {
|
|
2311
2296
|
type: "fractalNoise",
|
|
2312
2297
|
baseFrequency: "0.012 0.028",
|
|
2313
2298
|
numOctaves: "3",
|
|
@@ -2315,7 +2300,7 @@ function Ot(e, t, n) {
|
|
|
2315
2300
|
result: "stroke-noise"
|
|
2316
2301
|
})
|
|
2317
2302
|
), o.appendChild(
|
|
2318
|
-
|
|
2303
|
+
S("feDisplacementMap", {
|
|
2319
2304
|
in: "SourceGraphic",
|
|
2320
2305
|
in2: "stroke-noise",
|
|
2321
2306
|
scale: "3.5",
|
|
@@ -2324,7 +2309,7 @@ function Ot(e, t, n) {
|
|
|
2324
2309
|
result: "warped"
|
|
2325
2310
|
})
|
|
2326
2311
|
), o.appendChild(
|
|
2327
|
-
|
|
2312
|
+
S("feTurbulence", {
|
|
2328
2313
|
type: "fractalNoise",
|
|
2329
2314
|
baseFrequency: "0.7",
|
|
2330
2315
|
numOctaves: "1",
|
|
@@ -2332,7 +2317,7 @@ function Ot(e, t, n) {
|
|
|
2332
2317
|
result: "ink-noise"
|
|
2333
2318
|
})
|
|
2334
2319
|
), o.appendChild(
|
|
2335
|
-
|
|
2320
|
+
S("feDisplacementMap", {
|
|
2336
2321
|
in: "warped",
|
|
2337
2322
|
in2: "ink-noise",
|
|
2338
2323
|
scale: "0.9",
|
|
@@ -2341,7 +2326,7 @@ function Ot(e, t, n) {
|
|
|
2341
2326
|
})
|
|
2342
2327
|
), o;
|
|
2343
2328
|
}
|
|
2344
|
-
function
|
|
2329
|
+
function Ra(e) {
|
|
2345
2330
|
const t = re(
|
|
2346
2331
|
"0 0 24 24",
|
|
2347
2332
|
e,
|
|
@@ -2350,9 +2335,9 @@ function va(e) {
|
|
|
2350
2335
|
"currentColor",
|
|
2351
2336
|
"2.25"
|
|
2352
2337
|
);
|
|
2353
|
-
return t.appendChild(
|
|
2338
|
+
return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
|
|
2354
2339
|
}
|
|
2355
|
-
function
|
|
2340
|
+
function za() {
|
|
2356
2341
|
const e = re(
|
|
2357
2342
|
"0 0 24 24",
|
|
2358
2343
|
17,
|
|
@@ -2362,16 +2347,16 @@ function Ca() {
|
|
|
2362
2347
|
"2.25"
|
|
2363
2348
|
);
|
|
2364
2349
|
return e.appendChild(
|
|
2365
|
-
|
|
2350
|
+
S("path", {
|
|
2366
2351
|
d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
|
2367
2352
|
})
|
|
2368
2353
|
), e.appendChild(
|
|
2369
|
-
|
|
2354
|
+
S("path", {
|
|
2370
2355
|
d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
|
|
2371
2356
|
})
|
|
2372
2357
|
), e;
|
|
2373
2358
|
}
|
|
2374
|
-
function
|
|
2359
|
+
function Ma() {
|
|
2375
2360
|
const e = re(
|
|
2376
2361
|
"0 0 24 24",
|
|
2377
2362
|
17,
|
|
@@ -2380,9 +2365,9 @@ function Sa() {
|
|
|
2380
2365
|
"currentColor",
|
|
2381
2366
|
"2.25"
|
|
2382
2367
|
);
|
|
2383
|
-
return e.appendChild(
|
|
2368
|
+
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
2369
|
}
|
|
2385
|
-
function
|
|
2370
|
+
function Oa() {
|
|
2386
2371
|
const e = re(
|
|
2387
2372
|
"0 0 24 24",
|
|
2388
2373
|
15,
|
|
@@ -2391,9 +2376,9 @@ function Ea() {
|
|
|
2391
2376
|
"currentColor",
|
|
2392
2377
|
"2.4"
|
|
2393
2378
|
);
|
|
2394
|
-
return e.appendChild(
|
|
2379
|
+
return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
|
|
2395
2380
|
}
|
|
2396
|
-
function
|
|
2381
|
+
function _o() {
|
|
2397
2382
|
const e = re(
|
|
2398
2383
|
"0 0 24 24",
|
|
2399
2384
|
14,
|
|
@@ -2403,10 +2388,10 @@ function go() {
|
|
|
2403
2388
|
"2.75"
|
|
2404
2389
|
);
|
|
2405
2390
|
return e.appendChild(
|
|
2406
|
-
|
|
2407
|
-
), e.appendChild(
|
|
2391
|
+
S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2392
|
+
), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2408
2393
|
}
|
|
2409
|
-
function
|
|
2394
|
+
function Ua() {
|
|
2410
2395
|
const e = re(
|
|
2411
2396
|
"0 0 24 24",
|
|
2412
2397
|
16,
|
|
@@ -2419,18 +2404,18 @@ function ka() {
|
|
|
2419
2404
|
"class",
|
|
2420
2405
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
|
|
2421
2406
|
), e.appendChild(
|
|
2422
|
-
|
|
2407
|
+
S("path", {
|
|
2423
2408
|
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
2409
|
})
|
|
2425
2410
|
), e;
|
|
2426
2411
|
}
|
|
2427
|
-
function
|
|
2412
|
+
function Ba() {
|
|
2428
2413
|
const e = re("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2429
2414
|
return e.setAttribute(
|
|
2430
2415
|
"class",
|
|
2431
2416
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
|
|
2432
2417
|
), e.appendChild(
|
|
2433
|
-
|
|
2418
|
+
S("path", {
|
|
2434
2419
|
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
2420
|
stroke: "currentColor",
|
|
2436
2421
|
"stroke-width": "2",
|
|
@@ -2439,10 +2424,10 @@ function La() {
|
|
|
2439
2424
|
})
|
|
2440
2425
|
), e;
|
|
2441
2426
|
}
|
|
2442
|
-
function
|
|
2427
|
+
function Fa() {
|
|
2443
2428
|
const e = re("0 0 24 24", 18, 18, "currentColor");
|
|
2444
2429
|
return e.appendChild(
|
|
2445
|
-
|
|
2430
|
+
S("rect", {
|
|
2446
2431
|
x: "6",
|
|
2447
2432
|
y: "6",
|
|
2448
2433
|
width: "12",
|
|
@@ -2451,7 +2436,7 @@ function Pa() {
|
|
|
2451
2436
|
})
|
|
2452
2437
|
), e;
|
|
2453
2438
|
}
|
|
2454
|
-
function
|
|
2439
|
+
function Ha() {
|
|
2455
2440
|
const e = re(
|
|
2456
2441
|
"0 0 24 24",
|
|
2457
2442
|
12,
|
|
@@ -2460,9 +2445,9 @@ function Ia() {
|
|
|
2460
2445
|
"currentColor",
|
|
2461
2446
|
"2.4"
|
|
2462
2447
|
);
|
|
2463
|
-
return e.appendChild(
|
|
2448
|
+
return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
|
|
2464
2449
|
}
|
|
2465
|
-
function
|
|
2450
|
+
function Wa() {
|
|
2466
2451
|
const e = re(
|
|
2467
2452
|
"0 0 24 24",
|
|
2468
2453
|
13,
|
|
@@ -2472,7 +2457,7 @@ function Aa() {
|
|
|
2472
2457
|
"2.25"
|
|
2473
2458
|
);
|
|
2474
2459
|
return e.appendChild(
|
|
2475
|
-
|
|
2460
|
+
S("rect", {
|
|
2476
2461
|
width: "14",
|
|
2477
2462
|
height: "14",
|
|
2478
2463
|
x: "8",
|
|
@@ -2481,12 +2466,12 @@ function Aa() {
|
|
|
2481
2466
|
ry: "2"
|
|
2482
2467
|
})
|
|
2483
2468
|
), e.appendChild(
|
|
2484
|
-
|
|
2469
|
+
S("path", {
|
|
2485
2470
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
2486
2471
|
})
|
|
2487
2472
|
), e;
|
|
2488
2473
|
}
|
|
2489
|
-
function re(e, t, n, o, i,
|
|
2474
|
+
function re(e, t, n, o, i, a) {
|
|
2490
2475
|
const l = {
|
|
2491
2476
|
viewBox: e,
|
|
2492
2477
|
width: String(t),
|
|
@@ -2494,188 +2479,165 @@ function re(e, t, n, o, i, r) {
|
|
|
2494
2479
|
fill: o,
|
|
2495
2480
|
"aria-hidden": "true"
|
|
2496
2481
|
};
|
|
2497
|
-
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"),
|
|
2482
|
+
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), S("svg", l);
|
|
2498
2483
|
}
|
|
2499
|
-
function
|
|
2500
|
-
const n = document.createElementNS(
|
|
2484
|
+
function S(e, t = {}) {
|
|
2485
|
+
const n = document.createElementNS(lo, e);
|
|
2501
2486
|
for (const [o, i] of Object.entries(t))
|
|
2502
2487
|
n.setAttribute(o, i);
|
|
2503
2488
|
return n;
|
|
2504
2489
|
}
|
|
2505
|
-
function
|
|
2490
|
+
function Hn(e) {
|
|
2506
2491
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2507
2492
|
e.addEventListener(t, (n) => {
|
|
2508
2493
|
n.stopPropagation();
|
|
2509
2494
|
});
|
|
2510
2495
|
}
|
|
2511
|
-
function
|
|
2496
|
+
function Ga(e, t, n) {
|
|
2512
2497
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2513
2498
|
for (const [o, i] of t.entries()) {
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2499
|
+
const a = document.createElement("div");
|
|
2500
|
+
a.className = "pluno-pa-widget__attachment", a.appendChild($a(i));
|
|
2516
2501
|
const l = document.createElement("span");
|
|
2517
|
-
l.textContent = i.name,
|
|
2502
|
+
l.textContent = i.name, a.appendChild(l);
|
|
2518
2503
|
const p = document.createElement("button");
|
|
2519
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2504
|
+
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
2505
|
}
|
|
2521
2506
|
}
|
|
2522
|
-
function
|
|
2523
|
-
const t =
|
|
2507
|
+
function $a(e) {
|
|
2508
|
+
const t = on(e), n = xo(e);
|
|
2524
2509
|
if (t === "image" && n) {
|
|
2525
2510
|
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;
|
|
2511
|
+
return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o;
|
|
2530
2512
|
}
|
|
2531
2513
|
if (t === "video" && n) {
|
|
2532
2514
|
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;
|
|
2515
|
+
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
2516
|
}
|
|
2541
2517
|
return ie(e);
|
|
2542
2518
|
}
|
|
2543
|
-
function
|
|
2544
|
-
const t =
|
|
2519
|
+
function qa(e) {
|
|
2520
|
+
const t = on(e), n = xo(e);
|
|
2545
2521
|
if (t === "image" && n) {
|
|
2546
2522
|
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;
|
|
2523
|
+
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
2524
|
}
|
|
2552
2525
|
if (t === "pdf" && n) {
|
|
2553
2526
|
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;
|
|
2527
|
+
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
2528
|
}
|
|
2561
2529
|
if (t === "video" && n) {
|
|
2562
2530
|
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;
|
|
2531
|
+
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
2532
|
}
|
|
2571
2533
|
return ie(e, "message");
|
|
2572
2534
|
}
|
|
2573
2535
|
function ie(e, t = "composer") {
|
|
2574
2536
|
if (t === "composer") {
|
|
2575
|
-
const
|
|
2576
|
-
return
|
|
2537
|
+
const a = document.createElement("span");
|
|
2538
|
+
return a.className = "pluno-pa-widget__attachment-file", a.textContent = Wn(e), a;
|
|
2577
2539
|
}
|
|
2578
2540
|
const n = document.createElement("div");
|
|
2579
2541
|
n.className = "pluno-pa-widget__message-attachment-file";
|
|
2580
2542
|
const o = document.createElement("span");
|
|
2581
|
-
o.textContent =
|
|
2543
|
+
o.textContent = Wn(e);
|
|
2582
2544
|
const i = document.createElement("strong");
|
|
2583
2545
|
return i.textContent = e.name, n.append(o, i), n;
|
|
2584
2546
|
}
|
|
2585
|
-
function
|
|
2547
|
+
function on(e) {
|
|
2586
2548
|
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2587
2549
|
}
|
|
2588
|
-
function
|
|
2550
|
+
function xo(e) {
|
|
2589
2551
|
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2590
2552
|
}
|
|
2591
|
-
function
|
|
2592
|
-
const t =
|
|
2553
|
+
function Wn(e) {
|
|
2554
|
+
const t = on(e);
|
|
2593
2555
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2594
2556
|
}
|
|
2595
|
-
function
|
|
2557
|
+
function ja(e, t) {
|
|
2596
2558
|
return t ? Array.from(t).map((o) => ({
|
|
2597
2559
|
...e.createLocalAttachment(o),
|
|
2598
|
-
previewUrl:
|
|
2560
|
+
previewUrl: Va(o)
|
|
2599
2561
|
})) : [];
|
|
2600
2562
|
}
|
|
2601
|
-
function
|
|
2563
|
+
function Va(e) {
|
|
2602
2564
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2603
2565
|
}
|
|
2604
|
-
function
|
|
2566
|
+
function at(e) {
|
|
2605
2567
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2606
2568
|
}
|
|
2607
|
-
function
|
|
2608
|
-
if (!e || !
|
|
2569
|
+
function Ht(e, t, n = null) {
|
|
2570
|
+
if (!e || !Jt(t, n)) {
|
|
2609
2571
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2610
2572
|
return;
|
|
2611
2573
|
}
|
|
2612
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) ||
|
|
2613
|
-
|
|
2614
|
-
) :
|
|
2574
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || an(n) ? e.appendChild(
|
|
2575
|
+
Ka(t, n)
|
|
2576
|
+
) : yo(t) && e.appendChild(Ya(t));
|
|
2615
2577
|
}
|
|
2616
|
-
function
|
|
2578
|
+
function Ka(e, t) {
|
|
2617
2579
|
const n = document.createElement("div");
|
|
2618
2580
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
2619
2581
|
const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2620
2582
|
i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
|
|
2621
|
-
const
|
|
2622
|
-
return
|
|
2623
|
-
|
|
2583
|
+
const a = document.createElement("span");
|
|
2584
|
+
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(
|
|
2585
|
+
vo(
|
|
2624
2586
|
e,
|
|
2625
2587
|
"Upgrade plan",
|
|
2626
2588
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2627
2589
|
)
|
|
2628
2590
|
), n;
|
|
2629
2591
|
}
|
|
2630
|
-
function
|
|
2592
|
+
function Ya(e) {
|
|
2631
2593
|
const t = document.createElement("div");
|
|
2632
2594
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2633
2595
|
const n = document.createElement("strong");
|
|
2634
2596
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2635
2597
|
const o = document.createElement("span");
|
|
2636
|
-
return o.textContent =
|
|
2637
|
-
|
|
2598
|
+
return o.textContent = Za(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
|
|
2599
|
+
vo(
|
|
2638
2600
|
e,
|
|
2639
2601
|
"Upgrade",
|
|
2640
2602
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2641
2603
|
)
|
|
2642
2604
|
), t;
|
|
2643
2605
|
}
|
|
2644
|
-
function
|
|
2645
|
-
return e !== null && (ae(e) ||
|
|
2606
|
+
function Jt(e, t) {
|
|
2607
|
+
return e !== null && (ae(e) || yo(e) || an(t));
|
|
2646
2608
|
}
|
|
2647
|
-
function
|
|
2648
|
-
return
|
|
2609
|
+
function Gn(e, t, n) {
|
|
2610
|
+
return Jt(t, n) || Xa(t) ? !0 : !Jt(e, n);
|
|
2649
2611
|
}
|
|
2650
|
-
function
|
|
2612
|
+
function Xa(e) {
|
|
2651
2613
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
|
|
2652
2614
|
}
|
|
2653
2615
|
function ae(e) {
|
|
2654
2616
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2655
2617
|
}
|
|
2656
|
-
function
|
|
2618
|
+
function an(e) {
|
|
2657
2619
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2658
2620
|
}
|
|
2659
|
-
function
|
|
2621
|
+
function yo(e) {
|
|
2660
2622
|
return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2661
2623
|
}
|
|
2662
|
-
function
|
|
2663
|
-
return e.creditsRemaining === null ? null : `${
|
|
2624
|
+
function Za(e) {
|
|
2625
|
+
return e.creditsRemaining === null ? null : `${Ja(e.creditsRemaining)} credits left`;
|
|
2664
2626
|
}
|
|
2665
|
-
function
|
|
2627
|
+
function Ja(e) {
|
|
2666
2628
|
return new Intl.NumberFormat("en-US", {
|
|
2667
2629
|
maximumFractionDigits: 0
|
|
2668
2630
|
}).format(Math.ceil(e));
|
|
2669
2631
|
}
|
|
2670
|
-
function
|
|
2632
|
+
function vo(e, t, n) {
|
|
2671
2633
|
const o = document.createElement("div");
|
|
2672
2634
|
return o.className = n, o.appendChild(
|
|
2673
|
-
|
|
2635
|
+
$n(t, e.pricingUrl)
|
|
2674
2636
|
), o.appendChild(
|
|
2675
|
-
|
|
2637
|
+
$n("Earn credits", e.earnCreditsUrl)
|
|
2676
2638
|
), o;
|
|
2677
2639
|
}
|
|
2678
|
-
function
|
|
2640
|
+
function $n(e, t) {
|
|
2679
2641
|
const n = document.createElement("button");
|
|
2680
2642
|
if (n.type = "button", e === "Earn credits") {
|
|
2681
2643
|
const o = document.createElement("span");
|
|
@@ -2686,137 +2648,123 @@ function Un(e, t) {
|
|
|
2686
2648
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
2687
2649
|
}), n;
|
|
2688
2650
|
}
|
|
2689
|
-
function
|
|
2651
|
+
function Wt(e, t) {
|
|
2690
2652
|
return e.messages.filter(
|
|
2691
|
-
(o) => !
|
|
2653
|
+
(o) => !Co(o)
|
|
2692
2654
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2693
2655
|
}
|
|
2694
|
-
function
|
|
2695
|
-
const g =
|
|
2696
|
-
(C) => !
|
|
2697
|
-
), h = e.scrollTop, P = [],
|
|
2656
|
+
function Qa(e, t, n, o, i, a, l, p, d, c, u, m, E, v, z, b) {
|
|
2657
|
+
const g = or(a), w = g.filter(
|
|
2658
|
+
(C) => !Co(C)
|
|
2659
|
+
), h = e.scrollTop, P = [], T = /* @__PURE__ */ new Set(), k = (C) => {
|
|
2698
2660
|
P.push(C);
|
|
2699
2661
|
};
|
|
2700
|
-
|
|
2701
|
-
const F =
|
|
2702
|
-
if (o(F),
|
|
2662
|
+
Eo(n, a.isThinking), i.hidden = !p, p && l !== null && mo(i, l);
|
|
2663
|
+
const F = w.length > 0 || !!a.assistantDraft || a.isThinking;
|
|
2664
|
+
if (o(F), w.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
|
|
2703
2665
|
const C = document.createElement("div");
|
|
2704
2666
|
C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2705
|
-
const
|
|
2706
|
-
|
|
2707
|
-
const
|
|
2667
|
+
const N = document.createElement("div");
|
|
2668
|
+
N.className = "pluno-pa-widget__empty-hero";
|
|
2669
|
+
const Ee = fe(
|
|
2708
2670
|
"pluno-pa-widget__character--empty",
|
|
2709
2671
|
v()
|
|
2710
2672
|
);
|
|
2711
|
-
|
|
2673
|
+
N.appendChild(Ee), C.appendChild(N), C.appendChild(ho());
|
|
2712
2674
|
const q = document.createElement("div");
|
|
2713
|
-
if (q.className =
|
|
2714
|
-
for (const
|
|
2675
|
+
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)
|
|
2676
|
+
for (const R of a.starterPrompts) {
|
|
2715
2677
|
const D = document.createElement("button");
|
|
2716
|
-
D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${
|
|
2717
|
-
R
|
|
2678
|
+
D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${R}"`, D.addEventListener("click", () => {
|
|
2679
|
+
z(R);
|
|
2718
2680
|
}), q.appendChild(D);
|
|
2719
2681
|
}
|
|
2720
|
-
else if (
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2682
|
+
else if (a.starterPromptsLoading) {
|
|
2683
|
+
const R = document.createElement("button");
|
|
2684
|
+
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
2685
|
} else
|
|
2724
|
-
for (let
|
|
2686
|
+
for (let R = 0; R < zi; R += 1) {
|
|
2725
2687
|
const D = document.createElement("button");
|
|
2726
2688
|
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
2689
|
}
|
|
2728
|
-
C.appendChild(q), m.clear(),
|
|
2690
|
+
C.appendChild(q), m.clear(), k(C), k(t), qn(e, P);
|
|
2729
2691
|
return;
|
|
2730
2692
|
}
|
|
2731
2693
|
let H = null, $ = null, Q = [];
|
|
2732
|
-
const
|
|
2694
|
+
const Me = w.some(Qt), x = () => {
|
|
2733
2695
|
if (Q.length === 0)
|
|
2734
2696
|
return !1;
|
|
2735
|
-
const C =
|
|
2697
|
+
const C = gr(
|
|
2736
2698
|
Q,
|
|
2737
2699
|
u,
|
|
2738
|
-
|
|
2700
|
+
E,
|
|
2739
2701
|
v()
|
|
2740
2702
|
);
|
|
2741
|
-
return
|
|
2703
|
+
return k(C), H = null, $ = C, Q = [], !0;
|
|
2742
2704
|
};
|
|
2743
|
-
for (let C = 0; C <
|
|
2744
|
-
const
|
|
2745
|
-
if (
|
|
2746
|
-
Q.push(
|
|
2705
|
+
for (let C = 0; C < w.length; C += 1) {
|
|
2706
|
+
const N = w[C];
|
|
2707
|
+
if (N.role === "tool") {
|
|
2708
|
+
Q.push(N);
|
|
2747
2709
|
continue;
|
|
2748
2710
|
}
|
|
2749
|
-
if (
|
|
2711
|
+
if (Qt(N)) {
|
|
2750
2712
|
if (x()) {
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2713
|
+
const A = ut();
|
|
2714
|
+
k(A), H = null, $ = A;
|
|
2753
2715
|
} else {
|
|
2754
|
-
const
|
|
2755
|
-
|
|
2716
|
+
const A = Kn(v());
|
|
2717
|
+
k(A), H = null, $ = A;
|
|
2756
2718
|
}
|
|
2757
2719
|
continue;
|
|
2758
2720
|
}
|
|
2759
|
-
if (
|
|
2721
|
+
if (N.role === "system")
|
|
2760
2722
|
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;
|
|
2723
|
+
const Ee = x(), q = ur(N.content);
|
|
2724
|
+
if (N.role === "assistant" && !Ee) {
|
|
2725
|
+
const D = So(v());
|
|
2726
|
+
k(D), H = null, $ = D;
|
|
2727
|
+
}
|
|
2728
|
+
const R = er(N, q, m, T);
|
|
2729
|
+
k(R), H = R, $ = null;
|
|
2773
2730
|
}
|
|
2774
|
-
const
|
|
2775
|
-
if (
|
|
2776
|
-
if (
|
|
2777
|
-
const C =
|
|
2778
|
-
|
|
2731
|
+
const ce = x(), Xe = w[w.length - 1]?.id === "assistant-draft";
|
|
2732
|
+
if (a.isThinking && !Xe && !Me)
|
|
2733
|
+
if (ce) {
|
|
2734
|
+
const C = ut();
|
|
2735
|
+
k(C), H = null, $ = C;
|
|
2779
2736
|
} else {
|
|
2780
|
-
const C =
|
|
2781
|
-
|
|
2737
|
+
const C = Kn(v());
|
|
2738
|
+
k(C), H = null, $ = C;
|
|
2782
2739
|
}
|
|
2783
|
-
if (
|
|
2740
|
+
if (a.lastError) {
|
|
2784
2741
|
const C = document.createElement("div");
|
|
2785
|
-
C.className = "pluno-pa-widget__error", C.textContent =
|
|
2742
|
+
C.className = "pluno-pa-widget__error", C.textContent = a.lastError, k(C), H = C, $ = null;
|
|
2786
2743
|
}
|
|
2787
|
-
const X =
|
|
2788
|
-
if (
|
|
2789
|
-
const C =
|
|
2790
|
-
isDrafting:
|
|
2791
|
-
error:
|
|
2792
|
-
characterIconOptions:
|
|
2793
|
-
onDraft:
|
|
2794
|
-
onDismiss:
|
|
2795
|
-
onDisable:
|
|
2744
|
+
const X = b && !a.isThinking ? ri(g) : null;
|
|
2745
|
+
if (b && X && !b.dismissedCandidateIds.has(X.id)) {
|
|
2746
|
+
const C = rr(X, {
|
|
2747
|
+
isDrafting: b.draftingCandidateId === X.id,
|
|
2748
|
+
error: b.error,
|
|
2749
|
+
characterIconOptions: b.characterIconOptions,
|
|
2750
|
+
onDraft: b.onDraft,
|
|
2751
|
+
onDismiss: b.onDismiss,
|
|
2752
|
+
onDisable: b.onDisable
|
|
2796
2753
|
});
|
|
2797
|
-
|
|
2754
|
+
k(C), b.onSeen(X), H = null, $ = C;
|
|
2798
2755
|
}
|
|
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;
|
|
2756
|
+
H?.classList.add("pluno-pa-widget__message--bottom-reserve"), $?.classList.add("pluno-pa-widget__bottom-reserve-compact"), k(t), nr(m, T), qn(e, P), d ? Ke(e, c) : e.scrollTop = h;
|
|
2757
|
+
}
|
|
2758
|
+
function er(e, t, n, o) {
|
|
2759
|
+
const i = tr(e, t), a = i ? n.get(i) : void 0;
|
|
2760
|
+
if (i && a)
|
|
2761
|
+
return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), a;
|
|
2814
2762
|
const l = document.createElement("div");
|
|
2815
|
-
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ?
|
|
2763
|
+
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
2764
|
const p = document.createElement("div");
|
|
2817
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
2765
|
+
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
2766
|
}
|
|
2819
|
-
function
|
|
2767
|
+
function tr(e, t) {
|
|
2820
2768
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2821
2769
|
id: e.id,
|
|
2822
2770
|
content: t,
|
|
@@ -2834,11 +2782,11 @@ function Ga(e, t) {
|
|
|
2834
2782
|
})
|
|
2835
2783
|
});
|
|
2836
2784
|
}
|
|
2837
|
-
function
|
|
2785
|
+
function nr(e, t) {
|
|
2838
2786
|
for (const n of e.keys())
|
|
2839
2787
|
t.has(n) || e.delete(n);
|
|
2840
2788
|
}
|
|
2841
|
-
function
|
|
2789
|
+
function qn(e, t) {
|
|
2842
2790
|
let n = e.firstChild;
|
|
2843
2791
|
for (const o of t) {
|
|
2844
2792
|
if (o === n) {
|
|
@@ -2852,7 +2800,7 @@ function Fn(e, t) {
|
|
|
2852
2800
|
n = n.nextSibling, e.removeChild(o);
|
|
2853
2801
|
}
|
|
2854
2802
|
}
|
|
2855
|
-
function
|
|
2803
|
+
function or(e) {
|
|
2856
2804
|
if (!e.assistantDraft)
|
|
2857
2805
|
return [...e.messages];
|
|
2858
2806
|
const t = {
|
|
@@ -2867,12 +2815,12 @@ function qa(e) {
|
|
|
2867
2815
|
if (!t.respondsToUserMessageId)
|
|
2868
2816
|
return [...e.messages, t];
|
|
2869
2817
|
const n = e.messages.findIndex(
|
|
2870
|
-
(
|
|
2818
|
+
(a) => a.role === "user" && a.id === t.respondsToUserMessageId
|
|
2871
2819
|
);
|
|
2872
2820
|
if (n === -1)
|
|
2873
2821
|
return [...e.messages, t];
|
|
2874
2822
|
const o = e.messages.findIndex(
|
|
2875
|
-
(
|
|
2823
|
+
(a, l) => l > n && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && jn(a, t) && Qt(a)
|
|
2876
2824
|
);
|
|
2877
2825
|
if (o !== -1)
|
|
2878
2826
|
return [
|
|
@@ -2881,7 +2829,7 @@ function qa(e) {
|
|
|
2881
2829
|
...e.messages.slice(o + 1)
|
|
2882
2830
|
];
|
|
2883
2831
|
let i = n + 1;
|
|
2884
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2832
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && jn(e.messages[i], t); )
|
|
2885
2833
|
i += 1;
|
|
2886
2834
|
return [
|
|
2887
2835
|
...e.messages.slice(0, i),
|
|
@@ -2889,17 +2837,17 @@ function qa(e) {
|
|
|
2889
2837
|
...e.messages.slice(i)
|
|
2890
2838
|
];
|
|
2891
2839
|
}
|
|
2892
|
-
function
|
|
2840
|
+
function Qt(e) {
|
|
2893
2841
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2894
2842
|
}
|
|
2895
|
-
function
|
|
2843
|
+
function jn(e, t) {
|
|
2896
2844
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2897
2845
|
}
|
|
2898
|
-
function
|
|
2899
|
-
e.replaceChildren(),
|
|
2846
|
+
function Vn(e, t, n, o, i, a, l, p) {
|
|
2847
|
+
e.replaceChildren(), Eo(t, !1), t.disabled = !0, n(!1);
|
|
2900
2848
|
const d = document.createElement("div");
|
|
2901
2849
|
d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2902
|
-
const c =
|
|
2850
|
+
const c = fe(
|
|
2903
2851
|
"pluno-pa-widget__character--empty",
|
|
2904
2852
|
o()
|
|
2905
2853
|
);
|
|
@@ -2907,40 +2855,40 @@ function Wn(e, t, n, o, i, r, l, p) {
|
|
|
2907
2855
|
const u = document.createElement("div");
|
|
2908
2856
|
if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
|
|
2909
2857
|
const m = document.createElement("a");
|
|
2910
|
-
m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent =
|
|
2858
|
+
m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = a, d.appendChild(m);
|
|
2911
2859
|
} else {
|
|
2912
2860
|
const m = document.createElement("button");
|
|
2913
|
-
m.type = "button", m.className = "pluno-pa-widget__login", m.textContent =
|
|
2861
|
+
m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = a, m.addEventListener("click", () => p?.()), d.appendChild(m);
|
|
2914
2862
|
}
|
|
2915
2863
|
e.appendChild(d);
|
|
2916
2864
|
}
|
|
2917
|
-
function
|
|
2865
|
+
function ir(e) {
|
|
2918
2866
|
const t = document.createElement("div");
|
|
2919
2867
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2920
2868
|
for (const n of e)
|
|
2921
|
-
t.appendChild(
|
|
2869
|
+
t.appendChild(qa(n));
|
|
2922
2870
|
return t;
|
|
2923
2871
|
}
|
|
2924
|
-
function
|
|
2872
|
+
function ar(e) {
|
|
2925
2873
|
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(
|
|
2874
|
+
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
2875
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
2928
2876
|
}), t;
|
|
2929
2877
|
}
|
|
2930
|
-
function
|
|
2878
|
+
function rr(e, t) {
|
|
2931
2879
|
const n = document.createElement("article");
|
|
2932
2880
|
n.className = "pluno-pa-widget__share-prompt";
|
|
2933
2881
|
const o = document.createElement("div");
|
|
2934
2882
|
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
|
|
2935
|
-
|
|
2883
|
+
fe(
|
|
2936
2884
|
"pluno-pa-widget__share-prompt-icon",
|
|
2937
2885
|
t.characterIconOptions
|
|
2938
2886
|
)
|
|
2939
2887
|
);
|
|
2940
2888
|
const i = document.createElement("div");
|
|
2941
2889
|
i.className = "pluno-pa-widget__share-prompt-copy";
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2890
|
+
const a = document.createElement("strong");
|
|
2891
|
+
a.textContent = "Share this win?", i.appendChild(a);
|
|
2944
2892
|
const l = document.createElement("span");
|
|
2945
2893
|
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
2894
|
const u = document.createElement("span");
|
|
@@ -2954,7 +2902,7 @@ function Ka(e, t) {
|
|
|
2954
2902
|
const c = document.createElement("button");
|
|
2955
2903
|
if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
|
|
2956
2904
|
t.onDraft(e);
|
|
2957
|
-
}), t.isDrafting ? (c.appendChild(
|
|
2905
|
+
}), t.isDrafting ? (c.appendChild(en()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
|
|
2958
2906
|
p.appendChild(d);
|
|
2959
2907
|
else {
|
|
2960
2908
|
const u = document.createElement("button");
|
|
@@ -2968,15 +2916,15 @@ function Ka(e, t) {
|
|
|
2968
2916
|
}
|
|
2969
2917
|
return o.appendChild(p), n.appendChild(o), n;
|
|
2970
2918
|
}
|
|
2971
|
-
function
|
|
2919
|
+
function lr(e, t) {
|
|
2972
2920
|
const n = document.createElement("div");
|
|
2973
2921
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
|
|
2974
2922
|
g.target === n && t.onClose();
|
|
2975
2923
|
});
|
|
2976
2924
|
const o = document.createElement("section");
|
|
2977
2925
|
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
|
-
|
|
2926
|
+
const i = document.createElement("header"), a = document.createElement("strong");
|
|
2927
|
+
a.textContent = "Share this win", i.appendChild(a);
|
|
2980
2928
|
const l = document.createElement("button");
|
|
2981
2929
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
|
|
2982
2930
|
const p = document.createElement("p");
|
|
@@ -2987,11 +2935,11 @@ function Ya(e, t) {
|
|
|
2987
2935
|
c.className = "pluno-pa-widget__share-dialog-step-header";
|
|
2988
2936
|
const u = document.createElement("strong");
|
|
2989
2937
|
u.textContent = "1) Copy Screenshot", c.appendChild(u);
|
|
2990
|
-
const m =
|
|
2938
|
+
const m = pr(
|
|
2991
2939
|
"Copy Screenshot",
|
|
2992
2940
|
async () => {
|
|
2993
2941
|
try {
|
|
2994
|
-
return await
|
|
2942
|
+
return await li(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
2995
2943
|
} catch {
|
|
2996
2944
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
2997
2945
|
}
|
|
@@ -3000,39 +2948,39 @@ function Ya(e, t) {
|
|
|
3000
2948
|
if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
|
|
3001
2949
|
const g = document.createElement("div");
|
|
3002
2950
|
g.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
3003
|
-
const
|
|
3004
|
-
|
|
2951
|
+
const w = document.createElement("img");
|
|
2952
|
+
w.src = e.screenshotDataUrl, w.alt = "Product page with Pluno open", g.appendChild(w), d.appendChild(g);
|
|
3005
2953
|
}
|
|
3006
2954
|
o.appendChild(d), o.appendChild(p);
|
|
3007
|
-
const
|
|
3008
|
-
|
|
2955
|
+
const E = document.createElement("div");
|
|
2956
|
+
E.className = "pluno-pa-widget__share-dialog-step";
|
|
3009
2957
|
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
|
-
|
|
2958
|
+
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", E.appendChild(v);
|
|
2959
|
+
const z = document.createElement("p");
|
|
2960
|
+
z.className = "pluno-pa-widget__share-dialog-hint", z.textContent = "Post draft opens prefilled on supported platforms.", E.appendChild(z);
|
|
2961
|
+
const b = document.createElement("footer");
|
|
2962
|
+
b.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2963
|
+
for (const g of sr(e)) {
|
|
2964
|
+
const w = document.createElement("a");
|
|
2965
|
+
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
2966
|
}
|
|
3019
|
-
if (
|
|
2967
|
+
if (E.appendChild(b), o.appendChild(E), t.socialPostRewardsUrl) {
|
|
3020
2968
|
const g = document.createElement("div");
|
|
3021
2969
|
g.className = "pluno-pa-widget__share-dialog-step";
|
|
3022
|
-
const
|
|
3023
|
-
|
|
2970
|
+
const w = document.createElement("strong");
|
|
2971
|
+
w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(w);
|
|
3024
2972
|
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(
|
|
2973
|
+
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
2974
|
}
|
|
3027
2975
|
return n.appendChild(o), n;
|
|
3028
2976
|
}
|
|
3029
|
-
function
|
|
2977
|
+
function pr(e, t) {
|
|
3030
2978
|
const n = document.createElement("button");
|
|
3031
2979
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
3032
2980
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
3033
2981
|
}), n;
|
|
3034
2982
|
}
|
|
3035
|
-
function
|
|
2983
|
+
function sr(e) {
|
|
3036
2984
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
3037
2985
|
return [
|
|
3038
2986
|
{
|
|
@@ -3052,90 +3000,90 @@ function Za(e) {
|
|
|
3052
3000
|
}
|
|
3053
3001
|
];
|
|
3054
3002
|
}
|
|
3055
|
-
function
|
|
3003
|
+
function dr(e) {
|
|
3056
3004
|
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" ? (
|
|
3005
|
+
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
3006
|
t,
|
|
3059
3007
|
"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
|
-
),
|
|
3008
|
+
), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(
|
|
3061
3009
|
t,
|
|
3062
3010
|
"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
|
-
),
|
|
3011
|
+
), 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
3012
|
t,
|
|
3065
3013
|
"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
|
-
),
|
|
3014
|
+
), B(
|
|
3067
3015
|
t,
|
|
3068
3016
|
"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
3017
|
"0.48"
|
|
3070
|
-
),
|
|
3018
|
+
), B(
|
|
3071
3019
|
t,
|
|
3072
3020
|
"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
|
-
),
|
|
3021
|
+
), B(
|
|
3074
3022
|
t,
|
|
3075
3023
|
"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
3024
|
), t);
|
|
3077
3025
|
}
|
|
3078
|
-
function
|
|
3026
|
+
function B(e, t, n) {
|
|
3079
3027
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3080
3028
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
3081
3029
|
}
|
|
3082
|
-
function
|
|
3030
|
+
function cr() {
|
|
3083
3031
|
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"),
|
|
3032
|
+
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
3033
|
e,
|
|
3086
3034
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
3087
3035
|
), e;
|
|
3088
3036
|
}
|
|
3089
|
-
function
|
|
3090
|
-
return e.role === "tool" && e.toolName ===
|
|
3037
|
+
function Co(e) {
|
|
3038
|
+
return e.role === "tool" && e.toolName === to;
|
|
3091
3039
|
}
|
|
3092
|
-
function
|
|
3040
|
+
function ur(e) {
|
|
3093
3041
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
3094
3042
|
}
|
|
3095
|
-
function
|
|
3043
|
+
function gr(e, t, n, o) {
|
|
3096
3044
|
const i = document.createElement("article");
|
|
3097
3045
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
3098
3046
|
e[e.length - 1].createdAt
|
|
3099
3047
|
).toLocaleString(), i.appendChild(
|
|
3100
|
-
|
|
3048
|
+
fe(
|
|
3101
3049
|
"pluno-pa-widget__character--tool-group",
|
|
3102
3050
|
o
|
|
3103
3051
|
)
|
|
3104
3052
|
);
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3107
|
-
i.classList.toggle("pluno-pa-widget__tool-group--open",
|
|
3053
|
+
const a = document.createElement("details"), l = hr(e);
|
|
3054
|
+
a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
|
|
3055
|
+
i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), n();
|
|
3108
3056
|
});
|
|
3109
3057
|
const p = document.createElement("summary");
|
|
3110
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(
|
|
3058
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(en());
|
|
3111
3059
|
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),
|
|
3060
|
+
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
3061
|
const u = document.createElement("div");
|
|
3114
3062
|
u.className = "pluno-pa-widget__tool-lines";
|
|
3115
3063
|
for (const m of e) {
|
|
3116
|
-
const
|
|
3117
|
-
|
|
3064
|
+
const E = document.createElement("div");
|
|
3065
|
+
E.className = "pluno-pa-widget__tool-line", m.loading && E.appendChild(en());
|
|
3118
3066
|
const v = document.createElement("span");
|
|
3119
|
-
v.textContent = m.content || "Run tool",
|
|
3067
|
+
v.textContent = m.content || "Run tool", E.appendChild(v), u.appendChild(E);
|
|
3120
3068
|
}
|
|
3121
|
-
|
|
3069
|
+
a.appendChild(u);
|
|
3122
3070
|
}
|
|
3123
|
-
return i.appendChild(
|
|
3071
|
+
return i.appendChild(a), i;
|
|
3124
3072
|
}
|
|
3125
|
-
function
|
|
3073
|
+
function So(e) {
|
|
3126
3074
|
const t = document.createElement("article");
|
|
3127
3075
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
3128
|
-
|
|
3076
|
+
fe(
|
|
3129
3077
|
"pluno-pa-widget__character--tool-group",
|
|
3130
3078
|
e
|
|
3131
3079
|
)
|
|
3132
3080
|
), t;
|
|
3133
3081
|
}
|
|
3134
|
-
function
|
|
3135
|
-
const t =
|
|
3136
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
3082
|
+
function Kn(e) {
|
|
3083
|
+
const t = So(e);
|
|
3084
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ut()), t;
|
|
3137
3085
|
}
|
|
3138
|
-
function
|
|
3086
|
+
function ut(e = "Thinking...") {
|
|
3139
3087
|
const t = document.createElement("div");
|
|
3140
3088
|
t.className = "pluno-pa-widget__status";
|
|
3141
3089
|
const n = document.createElement("span");
|
|
@@ -3143,17 +3091,17 @@ function ct(e = "Thinking...") {
|
|
|
3143
3091
|
const o = document.createElement("span");
|
|
3144
3092
|
return o.textContent = e, t.appendChild(o), t;
|
|
3145
3093
|
}
|
|
3146
|
-
function
|
|
3094
|
+
function hr(e) {
|
|
3147
3095
|
return `tools:${e[0]?.id ?? ""}`;
|
|
3148
3096
|
}
|
|
3149
|
-
function
|
|
3097
|
+
function en() {
|
|
3150
3098
|
const e = document.createElement("span");
|
|
3151
3099
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
3152
3100
|
}
|
|
3153
|
-
function
|
|
3154
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
3101
|
+
function Eo(e, t) {
|
|
3102
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Fa() : _o());
|
|
3155
3103
|
}
|
|
3156
|
-
function
|
|
3104
|
+
function mr(e, t) {
|
|
3157
3105
|
const n = t.replace(/\r\n/g, `
|
|
3158
3106
|
`).split(`
|
|
3159
3107
|
`);
|
|
@@ -3177,14 +3125,14 @@ function or(e, t) {
|
|
|
3177
3125
|
const l = i.match(/^(#{1,3})\s+(.+)$/);
|
|
3178
3126
|
if (l) {
|
|
3179
3127
|
const c = document.createElement(`h${l[1].length + 2}`);
|
|
3180
|
-
|
|
3128
|
+
rt(c, l[2]), e.appendChild(c), o += 1;
|
|
3181
3129
|
continue;
|
|
3182
3130
|
}
|
|
3183
3131
|
if (/^\s*[-*+]\s+/.test(i)) {
|
|
3184
3132
|
const c = document.createElement("ul");
|
|
3185
3133
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
3186
3134
|
const u = document.createElement("li");
|
|
3187
|
-
|
|
3135
|
+
rt(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
|
|
3188
3136
|
}
|
|
3189
3137
|
e.appendChild(c);
|
|
3190
3138
|
continue;
|
|
@@ -3193,7 +3141,7 @@ function or(e, t) {
|
|
|
3193
3141
|
const c = document.createElement("ol");
|
|
3194
3142
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
3195
3143
|
const u = document.createElement("li");
|
|
3196
|
-
|
|
3144
|
+
rt(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
|
|
3197
3145
|
}
|
|
3198
3146
|
e.appendChild(c);
|
|
3199
3147
|
continue;
|
|
@@ -3203,17 +3151,17 @@ function or(e, t) {
|
|
|
3203
3151
|
p.push(n[o]), o += 1;
|
|
3204
3152
|
const d = document.createElement("p");
|
|
3205
3153
|
p.forEach((c, u) => {
|
|
3206
|
-
u > 0 && d.appendChild(document.createElement("br")),
|
|
3154
|
+
u > 0 && d.appendChild(document.createElement("br")), rt(d, c);
|
|
3207
3155
|
}), e.appendChild(d);
|
|
3208
3156
|
}
|
|
3209
3157
|
}
|
|
3210
|
-
function
|
|
3158
|
+
function rt(e, t) {
|
|
3211
3159
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
3212
3160
|
let o = 0;
|
|
3213
3161
|
for (const i of t.matchAll(n)) {
|
|
3214
|
-
const
|
|
3215
|
-
|
|
3216
|
-
document.createTextNode(t.slice(o,
|
|
3162
|
+
const a = i.index ?? 0;
|
|
3163
|
+
a > o && e.appendChild(
|
|
3164
|
+
document.createTextNode(t.slice(o, a))
|
|
3217
3165
|
);
|
|
3218
3166
|
const l = i[0];
|
|
3219
3167
|
if (l.startsWith("`")) {
|
|
@@ -3227,17 +3175,17 @@ function at(e, t) {
|
|
|
3227
3175
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
3228
3176
|
} else {
|
|
3229
3177
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
3230
|
-
if (p &&
|
|
3178
|
+
if (p && fr(p[2])) {
|
|
3231
3179
|
const d = document.createElement("a");
|
|
3232
3180
|
d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
|
|
3233
3181
|
} else
|
|
3234
3182
|
e.appendChild(document.createTextNode(l));
|
|
3235
3183
|
}
|
|
3236
|
-
o =
|
|
3184
|
+
o = a + l.length;
|
|
3237
3185
|
}
|
|
3238
3186
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
3239
3187
|
}
|
|
3240
|
-
function
|
|
3188
|
+
function fr(e) {
|
|
3241
3189
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
3242
3190
|
return !0;
|
|
3243
3191
|
try {
|
|
@@ -3247,8 +3195,8 @@ function ir(e) {
|
|
|
3247
3195
|
return !1;
|
|
3248
3196
|
}
|
|
3249
3197
|
}
|
|
3250
|
-
function
|
|
3251
|
-
if (
|
|
3198
|
+
function Yn(e, t) {
|
|
3199
|
+
if (wr(e))
|
|
3252
3200
|
return;
|
|
3253
3201
|
const n = `
|
|
3254
3202
|
:host {
|
|
@@ -3291,9 +3239,6 @@ function $n(e, t) {
|
|
|
3291
3239
|
--pluno-pa-faint: #8e8e95;
|
|
3292
3240
|
--pluno-pa-divider: rgba(24, 24, 27, 0.08);
|
|
3293
3241
|
--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
3242
|
--pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
|
|
3298
3243
|
--pluno-pa-launcher-height: 41px;
|
|
3299
3244
|
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
|
|
@@ -3517,15 +3462,12 @@ function $n(e, t) {
|
|
|
3517
3462
|
.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
3463
|
display: none;
|
|
3519
3464
|
}
|
|
3520
|
-
.pluno-pa-widget
|
|
3465
|
+
.pluno-pa-widget--minimized {
|
|
3521
3466
|
--pluno-pa-launcher-width: 22px;
|
|
3522
3467
|
--pluno-pa-launcher-height: 22px;
|
|
3523
3468
|
pointer-events: none;
|
|
3524
3469
|
}
|
|
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;
|
|
3470
|
+
.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
|
|
3529
3471
|
border: 0;
|
|
3530
3472
|
border-radius: 999px;
|
|
3531
3473
|
background: transparent;
|
|
@@ -3539,31 +3481,16 @@ function $n(e, t) {
|
|
|
3539
3481
|
overflow: visible;
|
|
3540
3482
|
pointer-events: auto;
|
|
3541
3483
|
}
|
|
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
3484
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-input,
|
|
3557
3485
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-drag-handle,
|
|
3558
3486
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-minimize,
|
|
3559
3487
|
.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals--launcher {
|
|
3560
3488
|
display: none;
|
|
3561
3489
|
}
|
|
3562
|
-
.pluno-pa-widget
|
|
3563
|
-
left:
|
|
3564
|
-
width:
|
|
3565
|
-
height:
|
|
3566
|
-
margin-top: 0;
|
|
3490
|
+
.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
|
|
3491
|
+
left: 1px;
|
|
3492
|
+
width: 20px;
|
|
3493
|
+
height: 20px;
|
|
3567
3494
|
}
|
|
3568
3495
|
.pluno-pa-widget--bottom-left .pluno-pa-widget__launcher {
|
|
3569
3496
|
left: 0;
|
|
@@ -5189,8 +5116,8 @@ function $n(e, t) {
|
|
|
5189
5116
|
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
|
|
5190
5117
|
position: absolute;
|
|
5191
5118
|
top: -16px;
|
|
5192
|
-
left: ${
|
|
5193
|
-
width: calc(100% - ${
|
|
5119
|
+
left: ${Kt}px;
|
|
5120
|
+
width: calc(100% - ${Kt * 2}px);
|
|
5194
5121
|
height: 36px;
|
|
5195
5122
|
z-index: 3;
|
|
5196
5123
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -5280,6 +5207,20 @@ function $n(e, t) {
|
|
|
5280
5207
|
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
|
|
5281
5208
|
border-radius: var(--pluno-pa-scribble-wobble);
|
|
5282
5209
|
}
|
|
5210
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized {
|
|
5211
|
+
--pluno-pa-launcher-width: 16px;
|
|
5212
|
+
--pluno-pa-launcher-height: 24px;
|
|
5213
|
+
}
|
|
5214
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
|
|
5215
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
|
|
5216
|
+
content: none;
|
|
5217
|
+
}
|
|
5218
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
|
|
5219
|
+
left: -3px;
|
|
5220
|
+
width: 22px;
|
|
5221
|
+
height: 22px;
|
|
5222
|
+
margin-top: 0;
|
|
5223
|
+
}
|
|
5283
5224
|
.pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize {
|
|
5284
5225
|
color: var(--pluno-pa-text);
|
|
5285
5226
|
font-size: 18px;
|
|
@@ -5415,6 +5356,21 @@ function $n(e, t) {
|
|
|
5415
5356
|
opacity: 0.6;
|
|
5416
5357
|
transform: rotate(5deg);
|
|
5417
5358
|
}
|
|
5359
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
|
|
5360
|
+
border: 0;
|
|
5361
|
+
width: var(--pluno-pa-launcher-width);
|
|
5362
|
+
min-width: 0;
|
|
5363
|
+
height: var(--pluno-pa-launcher-height);
|
|
5364
|
+
min-height: 0;
|
|
5365
|
+
padding: 0;
|
|
5366
|
+
}
|
|
5367
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
|
|
5368
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
|
|
5369
|
+
content: none;
|
|
5370
|
+
}
|
|
5371
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals {
|
|
5372
|
+
display: none;
|
|
5373
|
+
}
|
|
5418
5374
|
.pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
|
|
5419
5375
|
.pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
|
|
5420
5376
|
background: transparent;
|
|
@@ -5509,28 +5465,28 @@ function $n(e, t) {
|
|
|
5509
5465
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
5510
5466
|
}
|
|
5511
5467
|
`;
|
|
5512
|
-
if (
|
|
5468
|
+
if (br(e, n))
|
|
5513
5469
|
return;
|
|
5514
5470
|
const o = e.ownerDocument.createElement("style");
|
|
5515
|
-
o.id =
|
|
5471
|
+
o.id = co, o.textContent = n, e.appendChild(o), ko(e);
|
|
5516
5472
|
}
|
|
5517
|
-
function
|
|
5518
|
-
return e.getElementById(
|
|
5473
|
+
function wr(e) {
|
|
5474
|
+
return e.getElementById(co) !== null || e.host instanceof HTMLElement && e.host.getAttribute(uo) === "true";
|
|
5519
5475
|
}
|
|
5520
|
-
function
|
|
5521
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
5476
|
+
function ko(e) {
|
|
5477
|
+
e.host instanceof HTMLElement && e.host.setAttribute(uo, "true");
|
|
5522
5478
|
}
|
|
5523
|
-
function
|
|
5479
|
+
function br(e, t) {
|
|
5524
5480
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5525
5481
|
return !1;
|
|
5526
5482
|
try {
|
|
5527
5483
|
const n = new CSSStyleSheet();
|
|
5528
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
5484
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], ko(e), !0;
|
|
5529
5485
|
} catch {
|
|
5530
5486
|
return !1;
|
|
5531
5487
|
}
|
|
5532
5488
|
}
|
|
5533
|
-
async function
|
|
5489
|
+
async function _r() {
|
|
5534
5490
|
return document.body ? document.body : await new Promise((e) => {
|
|
5535
5491
|
const t = new MutationObserver(() => {
|
|
5536
5492
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -5538,14 +5494,36 @@ async function lr() {
|
|
|
5538
5494
|
t.observe(document.documentElement, { childList: !0 });
|
|
5539
5495
|
});
|
|
5540
5496
|
}
|
|
5541
|
-
function
|
|
5497
|
+
function Lo(e) {
|
|
5542
5498
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5543
5499
|
}
|
|
5544
|
-
function
|
|
5500
|
+
function xr(e) {
|
|
5501
|
+
if (e)
|
|
5502
|
+
return { clientId: e, release: () => {
|
|
5503
|
+
} };
|
|
5504
|
+
let t = 0;
|
|
5505
|
+
for (; Dt.has(t); )
|
|
5506
|
+
t += 1;
|
|
5507
|
+
Dt.add(t);
|
|
5508
|
+
const n = `${Di}${t}`;
|
|
5509
|
+
let o = crypto.randomUUID();
|
|
5545
5510
|
try {
|
|
5546
|
-
|
|
5511
|
+
o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
|
|
5512
|
+
} catch {
|
|
5513
|
+
}
|
|
5514
|
+
let i = !1;
|
|
5515
|
+
return {
|
|
5516
|
+
clientId: o,
|
|
5517
|
+
release: () => {
|
|
5518
|
+
i || (i = !0, Dt.delete(t));
|
|
5519
|
+
}
|
|
5520
|
+
};
|
|
5521
|
+
}
|
|
5522
|
+
function yr(e) {
|
|
5523
|
+
try {
|
|
5524
|
+
const t = window.localStorage.getItem(Lo(e));
|
|
5547
5525
|
if (!t)
|
|
5548
|
-
return
|
|
5526
|
+
return Xn();
|
|
5549
5527
|
const n = JSON.parse(t);
|
|
5550
5528
|
return {
|
|
5551
5529
|
isOpen: n.isOpen === !0,
|
|
@@ -5555,25 +5533,25 @@ function pr(e) {
|
|
|
5555
5533
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
|
|
5556
5534
|
(o) => typeof o == "string"
|
|
5557
5535
|
) : [],
|
|
5558
|
-
launcherPosition:
|
|
5559
|
-
panelSize:
|
|
5560
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
5536
|
+
launcherPosition: Er(n.launcherPosition) ? n.launcherPosition : null,
|
|
5537
|
+
panelSize: kr(n.panelSize) ? gt(n.panelSize) : null,
|
|
5538
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-no) : [],
|
|
5561
5539
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
5562
5540
|
};
|
|
5563
5541
|
} catch {
|
|
5564
|
-
return
|
|
5542
|
+
return Xn();
|
|
5565
5543
|
}
|
|
5566
5544
|
}
|
|
5567
|
-
async function
|
|
5545
|
+
async function vr(e) {
|
|
5568
5546
|
if (e.loadSharePromptsDisabled)
|
|
5569
5547
|
return e.loadSharePromptsDisabled();
|
|
5570
5548
|
try {
|
|
5571
|
-
return window.localStorage.getItem(
|
|
5549
|
+
return window.localStorage.getItem(io) === "true";
|
|
5572
5550
|
} catch {
|
|
5573
5551
|
return !1;
|
|
5574
5552
|
}
|
|
5575
5553
|
}
|
|
5576
|
-
function
|
|
5554
|
+
function Cr(e, t) {
|
|
5577
5555
|
if (e.persistSharePromptsDisabled) {
|
|
5578
5556
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
5579
5557
|
() => {
|
|
@@ -5582,12 +5560,12 @@ function dr(e, t) {
|
|
|
5582
5560
|
return;
|
|
5583
5561
|
}
|
|
5584
5562
|
try {
|
|
5585
|
-
t && window.localStorage.setItem(
|
|
5563
|
+
t && window.localStorage.setItem(io, "true");
|
|
5586
5564
|
} catch {
|
|
5587
5565
|
return;
|
|
5588
5566
|
}
|
|
5589
5567
|
}
|
|
5590
|
-
function
|
|
5568
|
+
function Xn() {
|
|
5591
5569
|
return {
|
|
5592
5570
|
isOpen: !1,
|
|
5593
5571
|
composerValue: "",
|
|
@@ -5600,54 +5578,99 @@ function qn() {
|
|
|
5600
5578
|
sharePromptsDisabled: !1
|
|
5601
5579
|
};
|
|
5602
5580
|
}
|
|
5603
|
-
function
|
|
5581
|
+
function Sr(e, t) {
|
|
5604
5582
|
try {
|
|
5605
5583
|
window.localStorage.setItem(
|
|
5606
|
-
|
|
5584
|
+
Lo(e),
|
|
5607
5585
|
JSON.stringify(t)
|
|
5608
5586
|
);
|
|
5609
5587
|
} catch {
|
|
5610
5588
|
return;
|
|
5611
5589
|
}
|
|
5612
5590
|
}
|
|
5613
|
-
function
|
|
5591
|
+
function Er(e) {
|
|
5614
5592
|
if (!e || typeof e != "object")
|
|
5615
5593
|
return !1;
|
|
5616
5594
|
const t = e;
|
|
5617
5595
|
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
5596
|
}
|
|
5619
|
-
function
|
|
5597
|
+
function kr(e) {
|
|
5620
5598
|
if (!e || typeof e != "object")
|
|
5621
5599
|
return !1;
|
|
5622
5600
|
const t = e;
|
|
5623
5601
|
return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
|
|
5624
5602
|
}
|
|
5625
|
-
|
|
5626
|
-
|
|
5603
|
+
async function Po(e, t) {
|
|
5604
|
+
const n = await fetch(e, {
|
|
5605
|
+
method: "POST",
|
|
5606
|
+
credentials: "include",
|
|
5607
|
+
headers: { "content-type": "application/json" },
|
|
5608
|
+
body: JSON.stringify({
|
|
5609
|
+
origin: location.origin,
|
|
5610
|
+
url: location.href
|
|
5611
|
+
}),
|
|
5612
|
+
...t ? { signal: t } : {}
|
|
5613
|
+
});
|
|
5614
|
+
if (!n.ok) {
|
|
5615
|
+
const i = await n.text(), a = Qo(i);
|
|
5616
|
+
throw a ? (console.error(a), new Error(a)) : new Error(`Failed to load Pluno token (${n.status})`);
|
|
5617
|
+
}
|
|
5618
|
+
const o = await n.json();
|
|
5619
|
+
if (!o.token)
|
|
5620
|
+
throw new Error("Pluno token endpoint did not return a token");
|
|
5621
|
+
return o.token;
|
|
5622
|
+
}
|
|
5623
|
+
function Lr(e) {
|
|
5624
|
+
return async () => {
|
|
5625
|
+
const t = new AbortController();
|
|
5626
|
+
let n = !1;
|
|
5627
|
+
const o = new Promise((i, a) => {
|
|
5628
|
+
const l = window.setTimeout(() => {
|
|
5629
|
+
n = !0, t.abort(), a(new Error(kn));
|
|
5630
|
+
}, Ai);
|
|
5631
|
+
t.signal.addEventListener(
|
|
5632
|
+
"abort",
|
|
5633
|
+
() => window.clearTimeout(l),
|
|
5634
|
+
{ once: !0 }
|
|
5635
|
+
);
|
|
5636
|
+
});
|
|
5637
|
+
try {
|
|
5638
|
+
const i = await Promise.race([
|
|
5639
|
+
Po(e, t.signal),
|
|
5640
|
+
o
|
|
5641
|
+
]);
|
|
5642
|
+
return t.abort(), i;
|
|
5643
|
+
} catch (i) {
|
|
5644
|
+
throw t.abort(), n ? new Error(kn) : i instanceof Error && i.message.startsWith("Pluno widget blocked on ") ? i : new Error(Ni);
|
|
5645
|
+
}
|
|
5646
|
+
};
|
|
5647
|
+
}
|
|
5648
|
+
const Zn = /* @__PURE__ */ new WeakSet();
|
|
5649
|
+
function Pr(e) {
|
|
5627
5650
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5628
5651
|
}
|
|
5629
|
-
function
|
|
5652
|
+
function Jn(e) {
|
|
5630
5653
|
const t = e.pathname.split("/");
|
|
5631
5654
|
return t[t.length - 1] ?? "";
|
|
5632
5655
|
}
|
|
5633
|
-
function
|
|
5656
|
+
function Ir(e, t) {
|
|
5634
5657
|
const n = new URL(e.src, document.baseURI);
|
|
5635
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
5658
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Jn(n) === Jn(t);
|
|
5636
5659
|
}
|
|
5637
|
-
class
|
|
5660
|
+
class de extends EventTarget {
|
|
5638
5661
|
constructor(t, n) {
|
|
5639
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
5640
|
-
this.readyState =
|
|
5641
|
-
}), this.addPreviewListener(
|
|
5662
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(ki, () => {
|
|
5663
|
+
this.readyState = de.OPEN, this.dispatchEvent(new Event("open"));
|
|
5664
|
+
}), this.addPreviewListener(Li, (o) => {
|
|
5642
5665
|
const i = o;
|
|
5643
5666
|
this.dispatchEvent(
|
|
5644
5667
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5645
5668
|
);
|
|
5646
|
-
}), this.addPreviewListener(
|
|
5647
|
-
this.readyState =
|
|
5648
|
-
}), this.addPreviewListener(
|
|
5669
|
+
}), this.addPreviewListener(Pi, () => {
|
|
5670
|
+
this.readyState = de.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5671
|
+
}), this.addPreviewListener(Ii, (o) => {
|
|
5649
5672
|
const i = o;
|
|
5650
|
-
this.readyState =
|
|
5673
|
+
this.readyState = de.CLOSED, this.dispatchEvent(
|
|
5651
5674
|
new CloseEvent("close", {
|
|
5652
5675
|
code: i.detail?.code ?? 1e3,
|
|
5653
5676
|
reason: i.detail?.reason ?? "",
|
|
@@ -5656,8 +5679,8 @@ class se extends EventTarget {
|
|
|
5656
5679
|
), this.cleanup();
|
|
5657
5680
|
}), window.dispatchEvent(
|
|
5658
5681
|
new CustomEvent(
|
|
5659
|
-
|
|
5660
|
-
|
|
5682
|
+
lt(
|
|
5683
|
+
Ci,
|
|
5661
5684
|
this.channelId
|
|
5662
5685
|
),
|
|
5663
5686
|
{
|
|
@@ -5676,18 +5699,18 @@ class se extends EventTarget {
|
|
|
5676
5699
|
extensions = "";
|
|
5677
5700
|
binaryType = "blob";
|
|
5678
5701
|
bufferedAmount = 0;
|
|
5679
|
-
readyState =
|
|
5680
|
-
socketId =
|
|
5702
|
+
readyState = de.CONNECTING;
|
|
5703
|
+
socketId = Tr();
|
|
5681
5704
|
listeners = /* @__PURE__ */ new Map();
|
|
5682
5705
|
send(t) {
|
|
5683
|
-
if (this.readyState !==
|
|
5706
|
+
if (this.readyState !== de.OPEN)
|
|
5684
5707
|
throw new DOMException(
|
|
5685
5708
|
"Pluno preview websocket is not open",
|
|
5686
5709
|
"InvalidStateError"
|
|
5687
5710
|
);
|
|
5688
5711
|
window.dispatchEvent(
|
|
5689
5712
|
new CustomEvent(
|
|
5690
|
-
|
|
5713
|
+
lt(Si, this.channelId),
|
|
5691
5714
|
{
|
|
5692
5715
|
detail: {
|
|
5693
5716
|
socketId: this.socketId,
|
|
@@ -5698,9 +5721,9 @@ class se extends EventTarget {
|
|
|
5698
5721
|
);
|
|
5699
5722
|
}
|
|
5700
5723
|
close(t, n) {
|
|
5701
|
-
this.readyState !==
|
|
5724
|
+
this.readyState !== de.CLOSED && (this.readyState = de.CLOSING, window.dispatchEvent(
|
|
5702
5725
|
new CustomEvent(
|
|
5703
|
-
|
|
5726
|
+
lt(Ei, this.channelId),
|
|
5704
5727
|
{
|
|
5705
5728
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
5706
5729
|
}
|
|
@@ -5708,11 +5731,11 @@ class se extends EventTarget {
|
|
|
5708
5731
|
), this.cleanup());
|
|
5709
5732
|
}
|
|
5710
5733
|
addPreviewListener(t, n) {
|
|
5711
|
-
const o =
|
|
5734
|
+
const o = lt(
|
|
5712
5735
|
t,
|
|
5713
5736
|
this.channelId
|
|
5714
|
-
), i = (
|
|
5715
|
-
|
|
5737
|
+
), i = (a) => {
|
|
5738
|
+
a.detail?.socketId === this.socketId && n(a);
|
|
5716
5739
|
};
|
|
5717
5740
|
this.listeners.set(o, i), window.addEventListener(o, i);
|
|
5718
5741
|
}
|
|
@@ -5722,19 +5745,19 @@ class se extends EventTarget {
|
|
|
5722
5745
|
this.listeners.clear();
|
|
5723
5746
|
}
|
|
5724
5747
|
}
|
|
5725
|
-
function
|
|
5748
|
+
function Tr() {
|
|
5726
5749
|
const e = window.sessionStorage.getItem(
|
|
5727
|
-
|
|
5750
|
+
En
|
|
5728
5751
|
);
|
|
5729
5752
|
if (e)
|
|
5730
5753
|
return e;
|
|
5731
5754
|
const t = crypto.randomUUID();
|
|
5732
|
-
return window.sessionStorage.setItem(
|
|
5755
|
+
return window.sessionStorage.setItem(En, t), t;
|
|
5733
5756
|
}
|
|
5734
|
-
function
|
|
5757
|
+
function lt(e, t) {
|
|
5735
5758
|
return `${e}:${t}`;
|
|
5736
5759
|
}
|
|
5737
|
-
function
|
|
5760
|
+
function Ar(e) {
|
|
5738
5761
|
const t = document.currentScript;
|
|
5739
5762
|
if (t instanceof HTMLScriptElement)
|
|
5740
5763
|
return [t];
|
|
@@ -5742,33 +5765,64 @@ function wr(e) {
|
|
|
5742
5765
|
return Array.from(
|
|
5743
5766
|
document.querySelectorAll("script[type='module'][src]")
|
|
5744
5767
|
).filter(
|
|
5745
|
-
(i) => i instanceof HTMLScriptElement &&
|
|
5768
|
+
(i) => i instanceof HTMLScriptElement && Pr(i) && Ir(i, o)
|
|
5746
5769
|
);
|
|
5747
5770
|
}
|
|
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
|
-
});
|
|
5771
|
+
function Nr(e) {
|
|
5772
|
+
for (const t of Ar(e))
|
|
5773
|
+
Zn.has(t) || t.dataset.plunoAutoMount === "false" || (Zn.add(t), Io(t).catch((n) => {
|
|
5774
|
+
console.error("Failed to mount Pluno widget", n);
|
|
5775
|
+
}));
|
|
5776
|
+
}
|
|
5777
|
+
function Io(e) {
|
|
5778
|
+
const t = window, n = t[se];
|
|
5779
|
+
if (n) {
|
|
5780
|
+
if (n.host === null)
|
|
5781
|
+
return n.mountPromise.catch(() => {
|
|
5782
|
+
const p = t[se];
|
|
5783
|
+
return p ? p.mountPromise : Io(e);
|
|
5784
|
+
});
|
|
5785
|
+
if (Dr(n.host))
|
|
5786
|
+
return n.mountPromise;
|
|
5787
|
+
n.destroy?.(), delete t[se];
|
|
5768
5788
|
}
|
|
5789
|
+
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint;
|
|
5790
|
+
let a;
|
|
5791
|
+
const l = ta({
|
|
5792
|
+
token: e.dataset.plunoToken,
|
|
5793
|
+
tokenProvider: !e.dataset.plunoToken && !o && i ? Lr(i) : void 0,
|
|
5794
|
+
tokenEndpoint: i,
|
|
5795
|
+
backendUrl: e.dataset.plunoBackendUrl,
|
|
5796
|
+
webSocketFactory: o ? ea(o) : void 0,
|
|
5797
|
+
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
5798
|
+
accentColor: e.dataset.plunoAccentColor,
|
|
5799
|
+
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
5800
|
+
fontFamily: e.dataset.plunoFontFamily,
|
|
5801
|
+
scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
|
|
5802
|
+
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
5803
|
+
}).then((p) => {
|
|
5804
|
+
if (t[se] !== a) {
|
|
5805
|
+
p.destroy();
|
|
5806
|
+
return;
|
|
5807
|
+
}
|
|
5808
|
+
const d = p.host;
|
|
5809
|
+
d.setAttribute(oo, "true"), a.host = d, a.destroy = () => {
|
|
5810
|
+
t[se] === a && delete t[se], a.host = null, a.destroy = null, p.destroy();
|
|
5811
|
+
};
|
|
5812
|
+
}).catch((p) => {
|
|
5813
|
+
throw t[se] === a && delete t[se], p;
|
|
5814
|
+
});
|
|
5815
|
+
return a = {
|
|
5816
|
+
mountPromise: l,
|
|
5817
|
+
host: null,
|
|
5818
|
+
destroy: null
|
|
5819
|
+
}, t[se] = a, l;
|
|
5820
|
+
}
|
|
5821
|
+
function Dr(e) {
|
|
5822
|
+
return e.isConnected && e.getAttribute(oo) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|
|
5769
5823
|
}
|
|
5770
|
-
|
|
5824
|
+
Nr(import.meta.url);
|
|
5771
5825
|
export {
|
|
5772
|
-
|
|
5773
|
-
|
|
5826
|
+
ea as createProductAgentPreviewBridgeWebSocketFactory,
|
|
5827
|
+
ta as mountPlunoProductAgentWidget
|
|
5774
5828
|
};
|