@pluno/product-agent-web 0.1.86 → 0.1.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-widget.js +607 -605
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as si, getProductAgentOriginAccessErrorMessage as di } from "./product-agent-sdk.js";
|
|
2
|
+
const ci = "#7c3aed", ft = "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", wt = "#2c2a1e", Nn = [253, 250, 241], Rn = 3.5;
|
|
3
|
+
function fo(e) {
|
|
4
|
+
const t = wo(e);
|
|
5
|
+
if (Dn(nt(t), Nn) >= Rn)
|
|
6
6
|
return t;
|
|
7
|
-
let o =
|
|
8
|
-
const i =
|
|
7
|
+
let o = nt(t);
|
|
8
|
+
const i = nt(wt);
|
|
9
9
|
for (let r = 0; r < 6; r += 1)
|
|
10
|
-
if (o =
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (o = hi(o, i, 0.22), Dn(o, Nn) >= Rn)
|
|
11
|
+
return Qt(o);
|
|
12
|
+
return Qt(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ui() {
|
|
15
15
|
let n = "M 280 120", o = !1, i = 0;
|
|
16
16
|
for (let r = 150; r <= 1170; r += 62) {
|
|
17
17
|
const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -19,8 +19,8 @@ function ci() {
|
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function gi(e) {
|
|
23
|
+
const t = wo(e), n = en(nt(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -56,34 +56,34 @@ function ui(e) {
|
|
|
56
56
|
shadow: le(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function wo(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()}` : ci;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function nt(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 Qt([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 en([e, t, n]) {
|
|
75
75
|
const o = (i) => {
|
|
76
76
|
const r = i / 255;
|
|
77
77
|
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
79
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const n =
|
|
81
|
+
function Dn(e, t) {
|
|
82
|
+
const n = en(e), o = en(t), [i, r] = n > o ? [n, o] : [o, n];
|
|
83
83
|
return (i + 0.05) / (r + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const o =
|
|
85
|
+
function hi(e, t, n) {
|
|
86
|
+
const o = tn(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 gi(e, t, n) {
|
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
93
|
function le(e, t, n) {
|
|
94
|
-
const [o, i, r] =
|
|
95
|
-
return
|
|
94
|
+
const [o, i, r] = mi(nt(e));
|
|
95
|
+
return Qt(fi(o, tn(i + n), tn(r + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function mi([e, t, n]) {
|
|
98
98
|
const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), s = (l + p) / 2;
|
|
99
99
|
if (l === p)
|
|
100
100
|
return [0, 0, s];
|
|
101
101
|
const g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
102
102
|
return [(l === o ? (i - r) / g + (i < r ? 6 : 0) : l === i ? (r - o) / g + 2 : (o - i) / g + 4) / 6, c, s];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function fi(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
|
+
Ht(i, o, e + 1 / 3) * 255,
|
|
110
|
+
Ht(i, o, e) * 255,
|
|
111
|
+
Ht(i, o, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Ht(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 tn(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const bo = "suggest_share_on_socials";
|
|
122
|
+
function wi(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 !== bo)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = zn(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = zn(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 fi(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function bi(e) {
|
|
140
|
+
const t = await _i(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 zn(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,18 +150,18 @@ function Dn(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function _i(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
156
|
+
const xi = "https://app.pluno.ai", yi = "/api/product-agent/embed/active-users", vi = 1800, Ci = 15e3, Si = 250, Ei = 1e3, ki = 3e4;
|
|
157
|
+
function Li(e, t = {}) {
|
|
158
158
|
let n = !1, o = null, i = null, r = null;
|
|
159
159
|
const l = () => {
|
|
160
160
|
r !== null && (window.clearInterval(r), r = null);
|
|
161
161
|
}, p = (c) => {
|
|
162
162
|
n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
|
|
163
163
|
g();
|
|
164
|
-
},
|
|
164
|
+
}, Ii(c)));
|
|
165
165
|
}, s = (c) => {
|
|
166
166
|
if (l(), o === null) {
|
|
167
167
|
o = c, e(c);
|
|
@@ -173,51 +173,51 @@ function ki(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const P = Math.min(1, (performance.now() - C) /
|
|
177
|
-
o = Math.round(h + (c - h) *
|
|
178
|
-
},
|
|
176
|
+
const P = Math.min(1, (performance.now() - C) / vi);
|
|
177
|
+
o = Math.round(h + (c - h) * Ai(P)), e(o), P >= 1 && (o = c, e(c), l());
|
|
178
|
+
}, Si);
|
|
179
179
|
}, g = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const c = await
|
|
181
|
+
const c = await Ti(t);
|
|
182
182
|
if (n)
|
|
183
183
|
return;
|
|
184
184
|
s(c.count), p(c.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(Ci);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return g(), () => {
|
|
190
190
|
n = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function Ti(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(yi, Pi(e.backendUrl ?? xi)).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 =
|
|
202
|
+
const o = await n.json(), i = Mn(o.count), r = Mn(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
203
203
|
if (i === null || r === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: i, refreshAfterMs: r };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Mn(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function Ti(e) {
|
|
211
|
-
return e.endsWith("/") ? e : `${e}/`;
|
|
212
|
-
}
|
|
213
210
|
function Pi(e) {
|
|
214
|
-
return
|
|
211
|
+
return e.endsWith("/") ? e : `${e}/`;
|
|
215
212
|
}
|
|
216
213
|
function Ii(e) {
|
|
214
|
+
return Math.min(ki, Math.max(Ei, e));
|
|
215
|
+
}
|
|
216
|
+
function Ai(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
function
|
|
219
|
+
const Ni = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
|
|
220
|
+
function Ri(e) {
|
|
221
221
|
let t = "", n = "", o = null;
|
|
222
222
|
for (const i of e.split(new RegExp("(?<=\\n)"))) {
|
|
223
223
|
if (o) {
|
|
@@ -228,7 +228,7 @@ function Ni(e) {
|
|
|
228
228
|
}
|
|
229
229
|
const r = i.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
|
|
230
230
|
if (r) {
|
|
231
|
-
t +=
|
|
231
|
+
t += On(n) + i, n = "", o = {
|
|
232
232
|
marker: r[1][0],
|
|
233
233
|
length: r[1].length
|
|
234
234
|
};
|
|
@@ -236,31 +236,31 @@ function Ni(e) {
|
|
|
236
236
|
}
|
|
237
237
|
n += i;
|
|
238
238
|
}
|
|
239
|
-
return t +
|
|
239
|
+
return t + On(n);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function On(e) {
|
|
242
242
|
let t = "", n = 0;
|
|
243
|
-
for (const o of e.matchAll(
|
|
243
|
+
for (const o of e.matchAll(Ni)) {
|
|
244
244
|
const i = o.index ?? 0;
|
|
245
|
-
t +=
|
|
245
|
+
t += Un(
|
|
246
246
|
e.slice(n, i)
|
|
247
247
|
), t += o[0], n = i + o[0].length;
|
|
248
248
|
}
|
|
249
|
-
return t +
|
|
249
|
+
return t + Un(e.slice(n));
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Un(e) {
|
|
252
252
|
return e.replace(
|
|
253
253
|
/\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
|
|
254
|
-
(t, n, o, i, r) => r[i - 1] === "!" ||
|
|
254
|
+
(t, n, o, i, r) => r[i - 1] === "!" || Di(r, i) || zi(r, i, n) ? t : `[${n}](${o})`
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Di(e, t) {
|
|
258
258
|
let n = 0;
|
|
259
259
|
for (let o = t - 1; e[o] === "\\"; o -= 1)
|
|
260
260
|
n += 1;
|
|
261
261
|
return n % 2 === 1;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function zi(e, t, n) {
|
|
264
264
|
if (n !== "x" && n !== "X")
|
|
265
265
|
return !1;
|
|
266
266
|
const o = e.lastIndexOf(`
|
|
@@ -269,7 +269,7 @@ function Di(e, t, n) {
|
|
|
269
269
|
e.slice(o, t)
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const _o = 100, Mi = 1e4, Oi = 5e3, Ui = "product-agent:sdk-preview-socket-connect", Bi = "product-agent:sdk-preview-socket-send", Fi = "product-agent:sdk-preview-socket-close", Wi = "product-agent:sdk-preview-socket-open", Hi = "product-agent:sdk-preview-socket-message", $i = "product-agent:sdk-preview-socket-error", Gi = "product-agent:sdk-preview-socket-closed", Bn = "product-agent:sdk-preview-socket-id", qi = "data-pluno-sdk-preview-channel", xo = "data-pluno-auto-mounted", me = "__plunoProductAgentAutoMountOwner", ji = 1e4, Vi = "Failed to load Pluno widget token", Fn = "Timed out loading Pluno widget token", Ki = "pluno.productAgent.widgetClientId.", $t = /* @__PURE__ */ new Set(), Yi = "product-agent:preview-diagnostic", yo = "pluno.productAgent.sharePromptsDisabled", Xi = 3, Wn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Zi = 400, Ji = 5e3, Qi = 500, Hn = "Close the page's popup to chat", ea = "No recent chats for this page yet.", pe = {
|
|
273
273
|
launcherLabel: "Ask for anything...",
|
|
274
274
|
accentColor: "#7c3aed",
|
|
275
275
|
colorScheme: "light",
|
|
@@ -277,7 +277,7 @@ const bo = 100, zi = 1e4, Mi = 5e3, Oi = "product-agent:sdk-preview-socket-conne
|
|
|
277
277
|
scribbleStyle: !0,
|
|
278
278
|
position: "bottom-right",
|
|
279
279
|
movableLauncher: !0
|
|
280
|
-
},
|
|
280
|
+
}, ta = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', $n = "pluno-pa-scribble-font", vo = 190, Co = 41, Gn = 22, na = 1, oa = 48, un = 420, ia = 520, aa = 0.24, gn = 680, ra = 800, la = 0.76, N = 8, Ne = 50, So = "http://www.w3.org/2000/svg", nn = 26, on = 8, pa = 36, an = 16, sa = 4, qn = [
|
|
281
281
|
{
|
|
282
282
|
ellipseCx: "17.5",
|
|
283
283
|
ellipseCy: "24.5",
|
|
@@ -314,12 +314,12 @@ const bo = 100, zi = 1e4, Mi = 5e3, Oi = "product-agent:sdk-preview-socket-conne
|
|
|
314
314
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
315
315
|
pathStrokeWidth: "2.45"
|
|
316
316
|
}
|
|
317
|
-
],
|
|
318
|
-
let
|
|
319
|
-
function
|
|
317
|
+
], da = 11, ca = 13, rn = 4, Eo = 10, ko = 40, ua = "movable-launcher-position-v2", Lo = "pluno-pa-widget-styles", To = "data-pluno-pa-widget-styles";
|
|
318
|
+
let jn = 0;
|
|
319
|
+
function ga(e) {
|
|
320
320
|
return (t) => new fe(t, e);
|
|
321
321
|
}
|
|
322
|
-
async function
|
|
322
|
+
async function ha(e = {}) {
|
|
323
323
|
const t = {
|
|
324
324
|
layout: e.layout ?? "floating",
|
|
325
325
|
mountTarget: e.mountTarget,
|
|
@@ -387,39 +387,39 @@ async function ga(e = {}) {
|
|
|
387
387
|
);
|
|
388
388
|
const n = document.createElement("div");
|
|
389
389
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), n.setAttribute("data-pluno-product-agent-layout", t.layout), t.sdkPreviewChannelId && n.setAttribute(
|
|
390
|
-
|
|
390
|
+
qi,
|
|
391
391
|
t.sdkPreviewChannelId
|
|
392
392
|
);
|
|
393
393
|
const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
394
394
|
i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.classList.add(`pluno-pa-widget--layout-${t.layout}`), i.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
395
|
-
let r =
|
|
395
|
+
let r = Vn(
|
|
396
396
|
t.accentColor,
|
|
397
397
|
t.scribbleStyle
|
|
398
398
|
);
|
|
399
|
-
|
|
399
|
+
Oa(
|
|
400
400
|
i,
|
|
401
401
|
t.launcherLabel,
|
|
402
402
|
r,
|
|
403
403
|
t.movableLauncher,
|
|
404
404
|
t.showLauncherMinimizeButton
|
|
405
405
|
), o.appendChild(i);
|
|
406
|
-
const l =
|
|
407
|
-
|
|
406
|
+
const l = Dr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Nr(t) : "shown";
|
|
407
|
+
uo(t, p);
|
|
408
408
|
let s = t.movableLauncher ? l.launcherPosition : null, g = s !== null, c = l.panelSize, h = null;
|
|
409
409
|
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), Ae(
|
|
410
410
|
i,
|
|
411
|
-
|
|
411
|
+
qt(
|
|
412
412
|
i,
|
|
413
413
|
s,
|
|
414
414
|
t.position
|
|
415
415
|
)
|
|
416
|
-
)),
|
|
416
|
+
)), co(o, t.accentColor), Kn(i, r, {
|
|
417
417
|
accentColor: t.accentColor,
|
|
418
418
|
colorScheme: t.colorScheme,
|
|
419
419
|
fontFamily: t.fontFamily,
|
|
420
420
|
scribbleStyle: t.scribbleStyle
|
|
421
421
|
});
|
|
422
|
-
const C = t.mountTarget ?? await
|
|
422
|
+
const C = t.mountTarget ?? await Ar(), P = C.ownerDocument, I = i.querySelector(
|
|
423
423
|
".pluno-pa-widget__launcher"
|
|
424
424
|
), D = i.querySelector(
|
|
425
425
|
".pluno-pa-widget__launcher-drag-handle"
|
|
@@ -457,7 +457,7 @@ async function ga(e = {}) {
|
|
|
457
457
|
".pluno-pa-widget__history-panel"
|
|
458
458
|
), j = i.querySelector(
|
|
459
459
|
".pluno-pa-widget__history-list"
|
|
460
|
-
),
|
|
460
|
+
), ot = i.querySelector(
|
|
461
461
|
".pluno-pa-widget__history-close"
|
|
462
462
|
), ie = i.querySelector(
|
|
463
463
|
".pluno-pa-widget__history-status"
|
|
@@ -475,17 +475,17 @@ async function ga(e = {}) {
|
|
|
475
475
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
476
476
|
), A = i.querySelector(
|
|
477
477
|
".pluno-pa-widget__notify-suggestion-later"
|
|
478
|
-
),
|
|
478
|
+
), jo = i.querySelector(
|
|
479
479
|
".pluno-pa-widget__notify-suggestion-never"
|
|
480
480
|
);
|
|
481
|
-
if (!I || !u || !m || !L || !oe || !J || !Re || !U || !we || !B || !f || !Q || !De || !Ce || !Se || !j || !
|
|
481
|
+
if (!I || !u || !m || !L || !oe || !J || !Re || !U || !we || !B || !f || !Q || !De || !Ce || !Se || !j || !ot || !ie || !x || !R || !T || !ae)
|
|
482
482
|
throw new Error("Failed to mount Pluno widget");
|
|
483
483
|
if (t.movableLauncher && !D)
|
|
484
484
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
485
|
-
B.hidden = !t.attachmentsEnabled, we.disabled = !t.attachmentsEnabled,
|
|
485
|
+
B.hidden = !t.attachmentsEnabled, we.disabled = !t.attachmentsEnabled, to(u), to(f);
|
|
486
486
|
let q = [], ue = null;
|
|
487
487
|
const ze = () => {
|
|
488
|
-
|
|
488
|
+
nr(
|
|
489
489
|
U,
|
|
490
490
|
q,
|
|
491
491
|
(a) => {
|
|
@@ -494,15 +494,15 @@ async function ga(e = {}) {
|
|
|
494
494
|
), ze(), W(b.getState()), $();
|
|
495
495
|
}
|
|
496
496
|
);
|
|
497
|
-
},
|
|
498
|
-
if (!t.loginRequired && !t.signupRequired && !t.token && !
|
|
497
|
+
}, wn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => Go(t.tokenEndpoint) : void 0);
|
|
498
|
+
if (!t.loginRequired && !t.signupRequired && !t.token && !wn && !t.webSocketFactory)
|
|
499
499
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
500
|
-
const
|
|
500
|
+
const Vo = window.fetch.bind(window), vt = Rr(t.clientId);
|
|
501
501
|
let b;
|
|
502
502
|
try {
|
|
503
503
|
const a = {
|
|
504
504
|
token: t.token,
|
|
505
|
-
tokenProvider:
|
|
505
|
+
tokenProvider: wn,
|
|
506
506
|
backendUrl: t.backendUrl,
|
|
507
507
|
metadata: () => ({
|
|
508
508
|
...t.metadata ?? {},
|
|
@@ -520,7 +520,7 @@ async function ga(e = {}) {
|
|
|
520
520
|
autoConnect: !1,
|
|
521
521
|
disableNetworkCapture: !!t.sdkPreviewChannelId
|
|
522
522
|
};
|
|
523
|
-
b = await
|
|
523
|
+
b = await si.init(a);
|
|
524
524
|
} catch (a) {
|
|
525
525
|
throw vt.release(), n.remove(), a;
|
|
526
526
|
}
|
|
@@ -536,18 +536,18 @@ async function ga(e = {}) {
|
|
|
536
536
|
);
|
|
537
537
|
const Ct = new Set(l.openToolGroupKeys), Me = new Set(
|
|
538
538
|
l.seenShareCandidateIds
|
|
539
|
-
),
|
|
540
|
-
let St = l.sharePromptsDisabled || await
|
|
539
|
+
), it = new Set(Me);
|
|
540
|
+
let St = l.sharePromptsDisabled || await zr(t), ee = null, re = !1, at = !(t.loginRequired || t.signupRequired), be = !1, Ee = {
|
|
541
541
|
enabled: !0
|
|
542
|
-
}, ke = 0,
|
|
542
|
+
}, ke = 0, bn = "", _e = !1, ge = !1, xe = [], Et = null, $e = null;
|
|
543
543
|
const te = (a, d) => {
|
|
544
544
|
Ee = { enabled: a, reason: d };
|
|
545
545
|
}, ne = () => {
|
|
546
546
|
x.hidden = !0;
|
|
547
|
-
},
|
|
547
|
+
}, Ko = () => {
|
|
548
548
|
x.hidden = !1;
|
|
549
|
-
},
|
|
550
|
-
te(!0, a), ne(),
|
|
549
|
+
}, Yo = (a = "jump") => {
|
|
550
|
+
te(!0, a), ne(), tt(T, () => Ee.enabled), ke = T.scrollTop;
|
|
551
551
|
}, Le = () => {
|
|
552
552
|
if (Ce.hidden = t.layout === "page" || t.loginRequired, Se.hidden = !_e, Ce.setAttribute("aria-expanded", String(_e)), j.classList.toggle(
|
|
553
553
|
"pluno-pa-widget__history-list--center",
|
|
@@ -560,14 +560,14 @@ async function ga(e = {}) {
|
|
|
560
560
|
const d = document.createElement("button");
|
|
561
561
|
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ge;
|
|
562
562
|
const _ = document.createElement("span");
|
|
563
|
-
_.className = "pluno-pa-widget__history-item-title", _.textContent =
|
|
563
|
+
_.className = "pluno-pa-widget__history-item-title", _.textContent = Da(a);
|
|
564
564
|
const k = document.createElement("time");
|
|
565
|
-
k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent =
|
|
565
|
+
k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent = Ma(
|
|
566
566
|
a.lastActiveAt,
|
|
567
567
|
Date.now()
|
|
568
568
|
);
|
|
569
569
|
const M = document.createElement("small");
|
|
570
|
-
M.className = "pluno-pa-widget__history-path", M.textContent =
|
|
570
|
+
M.className = "pluno-pa-widget__history-path", M.textContent = za(a), d.append(_, k, M), d.addEventListener("click", () => {
|
|
571
571
|
_e = !1, $e = null, Le(), te(!0, "newSession"), ne(), b.loadSession(a.id), W(b.getState());
|
|
572
572
|
}), j.appendChild(d);
|
|
573
573
|
}
|
|
@@ -576,7 +576,7 @@ async function ga(e = {}) {
|
|
|
576
576
|
a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", j.appendChild(a);
|
|
577
577
|
}
|
|
578
578
|
ie.textContent = $e ?? (!ge && xe.length === 0 ? "No recent chats for this page yet." : ""), ie.hidden = ie.textContent.length === 0;
|
|
579
|
-
},
|
|
579
|
+
}, _n = async (a) => {
|
|
580
580
|
if (!ge) {
|
|
581
581
|
ge = !0, $e = null, Le();
|
|
582
582
|
try {
|
|
@@ -589,25 +589,25 @@ async function ga(e = {}) {
|
|
|
589
589
|
{
|
|
590
590
|
message: d instanceof Error ? d.message : String(d)
|
|
591
591
|
}
|
|
592
|
-
), $e =
|
|
592
|
+
), $e = ea;
|
|
593
593
|
} finally {
|
|
594
594
|
ge = !1, Le();
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
},
|
|
598
|
-
!Et || ge || j.scrollHeight - j.scrollTop - j.clientHeight <= 24 &&
|
|
599
|
-
},
|
|
600
|
-
re || typeof document > "u" || (
|
|
601
|
-
},
|
|
602
|
-
|
|
597
|
+
}, Xo = () => {
|
|
598
|
+
!Et || ge || j.scrollHeight - j.scrollTop - j.clientHeight <= 24 && _n(Et);
|
|
599
|
+
}, xn = () => {
|
|
600
|
+
re || typeof document > "u" || (co(o, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
|
|
601
|
+
}, yn = new MutationObserver(xn);
|
|
602
|
+
yn.observe(P.documentElement, {
|
|
603
603
|
childList: !0,
|
|
604
604
|
subtree: !0
|
|
605
|
-
}),
|
|
605
|
+
}), xn();
|
|
606
606
|
const Ge = (a = !0) => {
|
|
607
607
|
const d = bt(i, a);
|
|
608
|
-
return
|
|
608
|
+
return ln(
|
|
609
609
|
i,
|
|
610
|
-
s ?
|
|
610
|
+
s ? Po(s, d) : va(
|
|
611
611
|
i,
|
|
612
612
|
t.position,
|
|
613
613
|
d
|
|
@@ -615,8 +615,8 @@ async function ga(e = {}) {
|
|
|
615
615
|
d
|
|
616
616
|
);
|
|
617
617
|
}, F = () => {
|
|
618
|
-
const a =
|
|
619
|
-
|
|
618
|
+
const a = Pa(o, u, f);
|
|
619
|
+
Or(t, {
|
|
620
620
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
621
621
|
composerValue: f.value,
|
|
622
622
|
focusedInput: a,
|
|
@@ -625,28 +625,28 @@ async function ga(e = {}) {
|
|
|
625
625
|
launcherPosition: g ? s : null,
|
|
626
626
|
panelSize: c,
|
|
627
627
|
seenShareCandidateIds: [...Me].slice(
|
|
628
|
-
-
|
|
628
|
+
-_o
|
|
629
629
|
),
|
|
630
630
|
sharePromptsDisabled: St
|
|
631
631
|
});
|
|
632
|
-
},
|
|
632
|
+
}, rt = (a) => {
|
|
633
633
|
t.onDisplayStateChange?.(a);
|
|
634
634
|
}, qe = (a, d = !0) => {
|
|
635
|
-
if (
|
|
636
|
-
i.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && je(!1), d &&
|
|
635
|
+
if (uo(t, a), a === "shown") {
|
|
636
|
+
i.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && je(!1), d && rt("shown");
|
|
637
637
|
return;
|
|
638
638
|
}
|
|
639
639
|
ee !== null && (window.clearTimeout(ee), ee = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), I.hidden = !1, m.hidden = !0, L.hidden = !0, I.tabIndex = 0, f.value = "", Ae(
|
|
640
640
|
i,
|
|
641
|
-
|
|
641
|
+
qt(
|
|
642
642
|
i,
|
|
643
643
|
s,
|
|
644
644
|
t.position
|
|
645
645
|
)
|
|
646
|
-
),
|
|
646
|
+
), Jn(i), F(), d && rt("minimized");
|
|
647
647
|
}, Te = (a, d = {}) => {
|
|
648
|
-
|
|
649
|
-
debugVersion:
|
|
648
|
+
Ta(a, {
|
|
649
|
+
debugVersion: ua,
|
|
650
650
|
launcherPosition: s,
|
|
651
651
|
rootClasses: i.className,
|
|
652
652
|
rootStyle: {
|
|
@@ -655,9 +655,9 @@ async function ga(e = {}) {
|
|
|
655
655
|
right: i.style.right,
|
|
656
656
|
bottom: i.style.bottom
|
|
657
657
|
},
|
|
658
|
-
rootRect:
|
|
659
|
-
launcherRect:
|
|
660
|
-
panelRect:
|
|
658
|
+
rootRect: Vt(i),
|
|
659
|
+
launcherRect: Vt(I),
|
|
660
|
+
panelRect: Vt(m),
|
|
661
661
|
viewport: Z(),
|
|
662
662
|
panelHidden: m.hidden,
|
|
663
663
|
closeHidden: L.hidden,
|
|
@@ -672,21 +672,21 @@ async function ga(e = {}) {
|
|
|
672
672
|
}), d;
|
|
673
673
|
}, kt = (a, d) => {
|
|
674
674
|
if (!a || !d) {
|
|
675
|
-
|
|
675
|
+
Jn(i);
|
|
676
676
|
return;
|
|
677
677
|
}
|
|
678
|
-
|
|
678
|
+
La(i, {
|
|
679
679
|
x: a.x - d.x,
|
|
680
680
|
y: a.y - d.y
|
|
681
681
|
});
|
|
682
682
|
}, Lt = () => {
|
|
683
|
-
const a =
|
|
683
|
+
const a = et(c).width;
|
|
684
684
|
return t.layout === "page" && m.getBoundingClientRect().width || a;
|
|
685
|
-
},
|
|
685
|
+
}, vn = () => {
|
|
686
686
|
if (i.classList.contains("pluno-pa-widget--minimized")) {
|
|
687
687
|
Ae(
|
|
688
688
|
i,
|
|
689
|
-
|
|
689
|
+
qt(
|
|
690
690
|
i,
|
|
691
691
|
s,
|
|
692
692
|
t.position
|
|
@@ -696,14 +696,14 @@ async function ga(e = {}) {
|
|
|
696
696
|
}
|
|
697
697
|
const a = je();
|
|
698
698
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
699
|
-
|
|
700
|
-
const d =
|
|
701
|
-
|
|
699
|
+
Gt(i, c);
|
|
700
|
+
const d = et(c);
|
|
701
|
+
Yt(
|
|
702
702
|
S,
|
|
703
703
|
Lt()
|
|
704
704
|
);
|
|
705
705
|
const _ = mt(
|
|
706
|
-
h ??
|
|
706
|
+
h ?? jt(
|
|
707
707
|
i,
|
|
708
708
|
a,
|
|
709
709
|
t.position,
|
|
@@ -720,20 +720,20 @@ async function ga(e = {}) {
|
|
|
720
720
|
{ visibleLauncherPosition: a }
|
|
721
721
|
);
|
|
722
722
|
};
|
|
723
|
-
let
|
|
723
|
+
let Cn = () => {
|
|
724
724
|
};
|
|
725
|
-
window.addEventListener("resize",
|
|
725
|
+
window.addEventListener("resize", vn), t.movableLauncher && D ? (je(), Cn = _a({
|
|
726
726
|
root: i,
|
|
727
727
|
launcher: I,
|
|
728
728
|
launcherDragHandle: D,
|
|
729
729
|
getPosition: () => Ge(),
|
|
730
730
|
setPosition: (a) => {
|
|
731
|
-
const d = a, _ = bt(i), k =
|
|
731
|
+
const d = a, _ = bt(i), k = ln(
|
|
732
732
|
i,
|
|
733
733
|
a,
|
|
734
734
|
_
|
|
735
735
|
);
|
|
736
|
-
s =
|
|
736
|
+
s = Sa(
|
|
737
737
|
k,
|
|
738
738
|
_
|
|
739
739
|
), Ae(i, k), Te("Dragging closed launcher", {
|
|
@@ -743,12 +743,12 @@ async function ga(e = {}) {
|
|
|
743
743
|
persist: () => {
|
|
744
744
|
g = !0, F(), Te("Persisted closed launcher drag position");
|
|
745
745
|
}
|
|
746
|
-
})) : Ae(i, null),
|
|
747
|
-
const
|
|
748
|
-
const a =
|
|
746
|
+
})) : Ae(i, null), Gt(i, c);
|
|
747
|
+
const Zo = () => {
|
|
748
|
+
const a = et(c), d = Ge();
|
|
749
749
|
return {
|
|
750
750
|
position: mt(
|
|
751
|
-
h ??
|
|
751
|
+
h ?? jt(
|
|
752
752
|
i,
|
|
753
753
|
d,
|
|
754
754
|
t.position,
|
|
@@ -758,37 +758,37 @@ async function ga(e = {}) {
|
|
|
758
758
|
),
|
|
759
759
|
size: a
|
|
760
760
|
};
|
|
761
|
-
},
|
|
762
|
-
c = xt(a.size),
|
|
761
|
+
}, Jo = (a) => {
|
|
762
|
+
c = xt(a.size), Gt(i, c), Yt(
|
|
763
763
|
S,
|
|
764
764
|
Lt()
|
|
765
765
|
), h = mt(
|
|
766
766
|
a.position,
|
|
767
|
-
|
|
767
|
+
et(c)
|
|
768
768
|
);
|
|
769
769
|
const d = Ge();
|
|
770
770
|
kt(h, d);
|
|
771
|
-
},
|
|
771
|
+
}, Qo = z.length > 0 ? xa({
|
|
772
772
|
root: i,
|
|
773
773
|
handles: z,
|
|
774
|
-
getBounds:
|
|
775
|
-
setBounds:
|
|
774
|
+
getBounds: Zo,
|
|
775
|
+
setBounds: Jo,
|
|
776
776
|
persist: F
|
|
777
777
|
}) : () => {
|
|
778
778
|
};
|
|
779
779
|
let Tt = !1;
|
|
780
|
-
const
|
|
780
|
+
const Sn = async () => {
|
|
781
781
|
if (!(!t.billingStatusLoader || Tt)) {
|
|
782
782
|
Tt = !0;
|
|
783
783
|
try {
|
|
784
784
|
const a = await t.billingStatusLoader();
|
|
785
785
|
if (re)
|
|
786
786
|
return;
|
|
787
|
-
|
|
787
|
+
oo(
|
|
788
788
|
t.billingStatus,
|
|
789
789
|
a,
|
|
790
790
|
b.getState().lastErrorCode
|
|
791
|
-
) && (t.billingStatus = a,
|
|
791
|
+
) && (t.billingStatus = a, Zt(
|
|
792
792
|
Re,
|
|
793
793
|
t.billingStatus,
|
|
794
794
|
b.getState().lastErrorCode
|
|
@@ -804,11 +804,11 @@ async function ga(e = {}) {
|
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
806
|
}, he = (a = "", d = !0) => {
|
|
807
|
-
|
|
807
|
+
Sn(), Ye && (Ye = !1, At()), i.classList.contains("pluno-pa-widget--open") || (h = null), ee !== null && (window.clearTimeout(ee), ee = null), qe("shown", !1), m.hidden = !1, L.hidden = !1, Yt(
|
|
808
808
|
S,
|
|
809
809
|
Lt()
|
|
810
810
|
), i.classList.remove("pluno-pa-widget--closing");
|
|
811
|
-
const _ = je(), k =
|
|
811
|
+
const _ = je(), k = jt(
|
|
812
812
|
i,
|
|
813
813
|
_,
|
|
814
814
|
t.position,
|
|
@@ -818,12 +818,12 @@ async function ga(e = {}) {
|
|
|
818
818
|
openPanelPosition: k,
|
|
819
819
|
visibleLauncherPosition: _
|
|
820
820
|
}), te(!0, "open"), ne(), !d) {
|
|
821
|
-
i.classList.add("pluno-pa-widget--open"), I.hidden = !0, a && (f.value = a,
|
|
821
|
+
i.classList.add("pluno-pa-widget--open"), I.hidden = !0, a && (f.value = a, Qe(f)), tt(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0);
|
|
822
822
|
return;
|
|
823
823
|
}
|
|
824
824
|
window.requestAnimationFrame(() => {
|
|
825
|
-
i.classList.add("pluno-pa-widget--open"), a && (f.value = a,
|
|
826
|
-
I.hidden = !0,
|
|
825
|
+
i.classList.add("pluno-pa-widget--open"), a && (f.value = a, Qe(f)), tt(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), rt("shown"), t.onPanelOpenChange?.(!0), ee = window.setTimeout(() => {
|
|
826
|
+
I.hidden = !0, tt(T, () => Ee.enabled), ke = T.scrollTop;
|
|
827
827
|
}, 220);
|
|
828
828
|
});
|
|
829
829
|
}, Pt = () => {
|
|
@@ -845,21 +845,21 @@ async function ga(e = {}) {
|
|
|
845
845
|
const a = u.value;
|
|
846
846
|
he(a), u.value = "";
|
|
847
847
|
});
|
|
848
|
-
let It = null,
|
|
849
|
-
const
|
|
848
|
+
let It = null, lt = null, Pe = null;
|
|
849
|
+
const En = (a) => a === u || a === f, ei = (a) => {
|
|
850
850
|
if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
|
|
851
851
|
return null;
|
|
852
852
|
let d = a;
|
|
853
853
|
for (; d; ) {
|
|
854
|
-
const _ = d.closest(
|
|
854
|
+
const _ = d.closest(Wn);
|
|
855
855
|
if (_)
|
|
856
856
|
return _;
|
|
857
857
|
const k = d.getRootNode();
|
|
858
858
|
d = k instanceof ShadowRoot ? k.host : null;
|
|
859
859
|
}
|
|
860
860
|
return null;
|
|
861
|
-
},
|
|
862
|
-
if (!a.isConnected || !a.matches(
|
|
861
|
+
}, ti = (a) => {
|
|
862
|
+
if (!a.isConnected || !a.matches(Wn))
|
|
863
863
|
return !1;
|
|
864
864
|
if (!(a instanceof HTMLElement))
|
|
865
865
|
return !0;
|
|
@@ -869,31 +869,31 @@ async function ga(e = {}) {
|
|
|
869
869
|
return a.checkVisibility();
|
|
870
870
|
const d = window.getComputedStyle(a);
|
|
871
871
|
return d.display !== "none" && d.visibility !== "hidden";
|
|
872
|
-
},
|
|
872
|
+
}, kn = (a) => {
|
|
873
873
|
Ke !== a && (Ke = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ie(), a !== null ? Pe = window.setInterval(() => {
|
|
874
874
|
const d = Ke;
|
|
875
|
-
(!d || !
|
|
876
|
-
},
|
|
877
|
-
},
|
|
875
|
+
(!d || !ti(d)) && kn(null);
|
|
876
|
+
}, Qi) : Pe !== null && (window.clearInterval(Pe), Pe = null, lt = null));
|
|
877
|
+
}, ni = () => {
|
|
878
878
|
Pe !== null && (window.clearInterval(Pe), Pe = null);
|
|
879
879
|
};
|
|
880
880
|
i.addEventListener("focusin", (a) => {
|
|
881
|
-
|
|
881
|
+
En(a.target) && (It = Date.now(), F());
|
|
882
882
|
}), i.addEventListener("focusout", (a) => {
|
|
883
|
-
if (!
|
|
883
|
+
if (!En(a.target) || Ke !== null)
|
|
884
884
|
return;
|
|
885
885
|
const d = It;
|
|
886
|
-
if (It = null, d === null || Date.now() - d >
|
|
886
|
+
if (It = null, d === null || Date.now() - d > Zi)
|
|
887
887
|
return;
|
|
888
|
-
const _ =
|
|
888
|
+
const _ = ei(a.relatedTarget);
|
|
889
889
|
if (!_)
|
|
890
890
|
return;
|
|
891
891
|
const k = Date.now();
|
|
892
|
-
if (
|
|
893
|
-
|
|
892
|
+
if (lt !== null && k - lt <= Ji) {
|
|
893
|
+
kn(_);
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
|
-
|
|
896
|
+
lt = k;
|
|
897
897
|
}), I.addEventListener("keydown", (a) => {
|
|
898
898
|
!i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), he());
|
|
899
899
|
}), v?.addEventListener("pointerdown", (a) => {
|
|
@@ -903,20 +903,20 @@ async function ga(e = {}) {
|
|
|
903
903
|
}), L.addEventListener("click", Pt), T.addEventListener("scroll", () => {
|
|
904
904
|
T.scrollTop < ke - 1 && te(!1, "userScroll"), ke = T.scrollTop;
|
|
905
905
|
}), x.addEventListener("click", () => {
|
|
906
|
-
|
|
906
|
+
Yo();
|
|
907
907
|
});
|
|
908
|
-
const
|
|
908
|
+
const Ln = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
909
909
|
([a]) => {
|
|
910
910
|
a?.isIntersecting && (te(!0, "bottom"), ne());
|
|
911
911
|
},
|
|
912
912
|
{ root: T, threshold: 0 }
|
|
913
913
|
);
|
|
914
|
-
|
|
914
|
+
Ln?.observe(ae);
|
|
915
915
|
const Ve = () => t.loginRequired || t.signupRequired;
|
|
916
916
|
let Ke = null, Ye = !1;
|
|
917
|
-
const V = () =>
|
|
917
|
+
const V = () => at || b.getState().status !== "connected", Ie = () => {
|
|
918
918
|
const a = Ve(), d = Ke !== null, _ = !a && V();
|
|
919
|
-
u.readOnly = a || d || _, f.readOnly = d || _, u.placeholder = d ?
|
|
919
|
+
u.readOnly = a || d || _, f.readOnly = d || _, u.placeholder = d ? Hn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ye ? "New update" : t.launcherLabel, f.placeholder = d ? Hn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : pe.launcherLabel, oe.hidden = a;
|
|
920
920
|
}, $ = () => {
|
|
921
921
|
Q.disabled = V() || de(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && q.length === 0, B.disabled = Ve() || V() || de(t.billingStatus);
|
|
922
922
|
};
|
|
@@ -930,12 +930,12 @@ async function ga(e = {}) {
|
|
|
930
930
|
};
|
|
931
931
|
At();
|
|
932
932
|
const Nt = () => {
|
|
933
|
-
Ve() || re || (
|
|
933
|
+
Ve() || re || (at = !0, Ie(), $(), b.connect().then(
|
|
934
934
|
() => {
|
|
935
|
-
re || (
|
|
935
|
+
re || (at = !1, Ie(), $());
|
|
936
936
|
},
|
|
937
937
|
(a) => {
|
|
938
|
-
re || (
|
|
938
|
+
re || (at = !1, Ie(), $(), K(
|
|
939
939
|
"web-sdk.widget",
|
|
940
940
|
"Failed to connect Product Agent widget",
|
|
941
941
|
{
|
|
@@ -954,26 +954,27 @@ async function ga(e = {}) {
|
|
|
954
954
|
t.onSignupClick?.();
|
|
955
955
|
return;
|
|
956
956
|
}
|
|
957
|
-
V() || de(t.billingStatus) || (be = !0, te(!0, "send"), ne(), q =
|
|
957
|
+
V() || de(t.billingStatus) || (be = !0, te(!0, "send"), ne(), q = Kt(
|
|
958
958
|
b,
|
|
959
959
|
f,
|
|
960
|
-
q
|
|
960
|
+
q,
|
|
961
|
+
ct
|
|
961
962
|
), ze(), $());
|
|
962
963
|
});
|
|
963
964
|
let Xe = 0;
|
|
964
|
-
const
|
|
965
|
+
const oi = () => {
|
|
965
966
|
Xe = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
966
967
|
}, Rt = (a) => {
|
|
967
968
|
ue !== null && window.clearTimeout(ue), J.textContent = a, J.hidden = !1, ue = window.setTimeout(() => {
|
|
968
969
|
J.textContent = "", J.hidden = !0, ue = null;
|
|
969
970
|
}, 3e3);
|
|
970
|
-
},
|
|
971
|
+
}, ii = () => {
|
|
971
972
|
ue !== null && (window.clearTimeout(ue), ue = null), J.textContent = "", J.hidden = !0;
|
|
972
973
|
}, Dt = async (a) => {
|
|
973
974
|
if (!t.attachmentsEnabled || a.length === 0)
|
|
974
975
|
return;
|
|
975
|
-
const d =
|
|
976
|
-
q = [...q, ...d], ze(),
|
|
976
|
+
const d = ar(b, a);
|
|
977
|
+
q = [...q, ...d], ze(), ii(), $(), W(b.getState()), i.classList.contains("pluno-pa-widget--open") || he();
|
|
977
978
|
};
|
|
978
979
|
B.addEventListener("click", () => {
|
|
979
980
|
t.loginRequired || V() || de(t.billingStatus) || we.click();
|
|
@@ -995,7 +996,7 @@ async function ga(e = {}) {
|
|
|
995
996
|
ut(a.dataTransfer) && (a.stopPropagation(), Xe = Math.max(0, Xe - 1), Xe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
996
997
|
}), i.addEventListener("drop", (a) => {
|
|
997
998
|
const d = a.dataTransfer;
|
|
998
|
-
!t.attachmentsEnabled || !ut(d) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(),
|
|
999
|
+
!t.attachmentsEnabled || !ut(d) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), oi(), Dt(d.files).catch((_) => {
|
|
999
1000
|
Rt(
|
|
1000
1001
|
_ instanceof Error ? _.message : "Failed to attach file"
|
|
1001
1002
|
), K("web-sdk.widget", "Attachment failed", {
|
|
@@ -1021,42 +1022,44 @@ async function ga(e = {}) {
|
|
|
1021
1022
|
b.stop();
|
|
1022
1023
|
return;
|
|
1023
1024
|
}
|
|
1024
|
-
V() || (be = !0, te(!0, "send"), ne(), q =
|
|
1025
|
+
V() || (be = !0, te(!0, "send"), ne(), q = Kt(
|
|
1025
1026
|
b,
|
|
1026
1027
|
f,
|
|
1027
|
-
q
|
|
1028
|
+
q,
|
|
1029
|
+
ct
|
|
1028
1030
|
), ze(), $(), W(b.getState()));
|
|
1029
1031
|
}), Ce.addEventListener("click", () => {
|
|
1030
|
-
_e = !_e, $e = null, Le(), _e && xe.length === 0 &&
|
|
1031
|
-
}),
|
|
1032
|
+
_e = !_e, $e = null, Le(), _e && xe.length === 0 && _n(null);
|
|
1033
|
+
}), ot.addEventListener("click", () => {
|
|
1032
1034
|
_e = !1, Le();
|
|
1033
|
-
}), j.addEventListener("scroll",
|
|
1034
|
-
|
|
1035
|
+
}), j.addEventListener("scroll", Xo), f.addEventListener("input", () => {
|
|
1036
|
+
Qe(f), F(), $(), li();
|
|
1035
1037
|
}), f.addEventListener("keydown", (a) => {
|
|
1036
1038
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
1037
1039
|
if (a.preventDefault(), t.loginRequired) {
|
|
1038
1040
|
t.onLoginClick?.();
|
|
1039
1041
|
return;
|
|
1040
1042
|
}
|
|
1041
|
-
V() || (be = !0, te(!0, "send"), ne(), q =
|
|
1043
|
+
V() || (be = !0, te(!0, "send"), ne(), q = Kt(
|
|
1042
1044
|
b,
|
|
1043
1045
|
f,
|
|
1044
|
-
q
|
|
1046
|
+
q,
|
|
1047
|
+
ct
|
|
1045
1048
|
), ze(), $(), W(b.getState()));
|
|
1046
1049
|
}
|
|
1047
1050
|
}), i.addEventListener("click", (a) => {
|
|
1048
1051
|
(a.target instanceof Element ? a.target : null)?.closest("a[href]") && F();
|
|
1049
|
-
}), l.composerValue && (f.value = l.composerValue,
|
|
1050
|
-
const
|
|
1051
|
-
let zt = b.getState().appearance !== null,
|
|
1052
|
+
}), l.composerValue && (f.value = l.composerValue, Qe(f)), t.layout === "page" ? he(f.value, !1) : p === "minimized" ? qe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(f.value, !1), Ia(l, i, u, f);
|
|
1053
|
+
const pt = () => r;
|
|
1054
|
+
let zt = b.getState().appearance !== null, st = null, Ze = null, Oe = null, Tn = b.getState().isThinking, Ue = null;
|
|
1052
1055
|
const Je = t.taskNotifications;
|
|
1053
1056
|
let Be = null, Fe = !1;
|
|
1054
|
-
const
|
|
1057
|
+
const Pn = () => {
|
|
1055
1058
|
Be !== null && (window.clearTimeout(Be), Be = null);
|
|
1056
|
-
},
|
|
1059
|
+
}, dt = () => {
|
|
1057
1060
|
H && (H.hidden = !0);
|
|
1058
|
-
},
|
|
1059
|
-
if (!Je || !H || Fe || re || !b.getState().isThinking ||
|
|
1061
|
+
}, In = () => b.getState().assistantDraft.trim().length > 0, ai = async () => {
|
|
1062
|
+
if (!Je || !H || Fe || re || !b.getState().isThinking || In())
|
|
1060
1063
|
return;
|
|
1061
1064
|
let a;
|
|
1062
1065
|
try {
|
|
@@ -1064,26 +1067,28 @@ async function ga(e = {}) {
|
|
|
1064
1067
|
} catch {
|
|
1065
1068
|
return;
|
|
1066
1069
|
}
|
|
1067
|
-
a.enabled || a.neverSuggest || !b.getState().isThinking ||
|
|
1070
|
+
a.enabled || a.neverSuggest || !b.getState().isThinking || In() || Fe || re || (H.hidden = !1);
|
|
1068
1071
|
};
|
|
1069
1072
|
y?.addEventListener("click", () => {
|
|
1070
|
-
Fe = !0,
|
|
1073
|
+
Fe = !0, dt(), Je?.enable().catch(() => {
|
|
1071
1074
|
});
|
|
1072
1075
|
}), A?.addEventListener("click", () => {
|
|
1073
|
-
Fe = !0,
|
|
1074
|
-
}),
|
|
1075
|
-
Fe = !0,
|
|
1076
|
+
Fe = !0, dt();
|
|
1077
|
+
}), jo?.addEventListener("click", () => {
|
|
1078
|
+
Fe = !0, dt(), Je?.dismissForever().catch(() => {
|
|
1076
1079
|
});
|
|
1077
1080
|
});
|
|
1078
|
-
let We = null,
|
|
1081
|
+
let We = null, An = () => {
|
|
1079
1082
|
};
|
|
1080
|
-
const
|
|
1081
|
-
const a = We !== null &&
|
|
1082
|
-
R.hidden = !a, a && We !== null &&
|
|
1083
|
+
const ri = !!t.socialPostDraftHandler, Mt = /* @__PURE__ */ new Map(), Ot = () => f.value.trim().length > 0 || q.length > 0, li = () => {
|
|
1084
|
+
const a = We !== null && Jt(b.getState(), Ot());
|
|
1085
|
+
R.hidden = !a, a && We !== null && Ao(R, We);
|
|
1083
1086
|
};
|
|
1084
1087
|
let He = null;
|
|
1085
1088
|
const Ut = (a = {}) => {
|
|
1086
|
-
be = !0, te(!0, "newSession"), ne(), _e = !1, Le(), b.startNewSession(a), Ct.clear(), f.value = "", q = [], ze(),
|
|
1089
|
+
be = !0, te(!0, "newSession"), ne(), _e = !1, Le(), b.startNewSession(a), Ct.clear(), f.value = "", q = [], ze(), Qe(f), F(), $(), f.focus(), W(b.getState());
|
|
1090
|
+
}, ct = () => {
|
|
1091
|
+
t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), Ut());
|
|
1087
1092
|
}, Bt = (a) => {
|
|
1088
1093
|
if (!a || t.layout === "page") {
|
|
1089
1094
|
He?.remove(), He = null;
|
|
@@ -1092,20 +1097,20 @@ async function ga(e = {}) {
|
|
|
1092
1097
|
He || (He = yt(
|
|
1093
1098
|
"pluno-pa-widget__new-chat",
|
|
1094
1099
|
"New chat",
|
|
1095
|
-
|
|
1100
|
+
Ka(),
|
|
1096
1101
|
!1
|
|
1097
1102
|
), He.addEventListener("click", () => Ut()), De.insertBefore(He, Ce));
|
|
1098
1103
|
}, W = (a) => {
|
|
1099
|
-
if (Le(),
|
|
1104
|
+
if (Le(), mn(a.lastErrorCode) ? Ue = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null), Zt(
|
|
1100
1105
|
Re,
|
|
1101
1106
|
t.billingStatus,
|
|
1102
1107
|
Ue
|
|
1103
1108
|
), t.loginRequired) {
|
|
1104
|
-
Mt.clear(),
|
|
1109
|
+
Mt.clear(), lo(
|
|
1105
1110
|
T,
|
|
1106
1111
|
Q,
|
|
1107
1112
|
Bt,
|
|
1108
|
-
|
|
1113
|
+
pt,
|
|
1109
1114
|
"Log in to use Pluno on this page.",
|
|
1110
1115
|
t.loginButtonLabel,
|
|
1111
1116
|
t.loginUrl,
|
|
@@ -1114,11 +1119,11 @@ async function ga(e = {}) {
|
|
|
1114
1119
|
return;
|
|
1115
1120
|
}
|
|
1116
1121
|
if (t.signupRequired) {
|
|
1117
|
-
Mt.clear(),
|
|
1122
|
+
Mt.clear(), lo(
|
|
1118
1123
|
T,
|
|
1119
1124
|
Q,
|
|
1120
1125
|
Bt,
|
|
1121
|
-
|
|
1126
|
+
pt,
|
|
1122
1127
|
"Complete signup to unlock your free trial credits.",
|
|
1123
1128
|
t.signupButtonLabel,
|
|
1124
1129
|
t.signupUrl,
|
|
@@ -1126,10 +1131,10 @@ async function ga(e = {}) {
|
|
|
1126
1131
|
);
|
|
1127
1132
|
return;
|
|
1128
1133
|
}
|
|
1129
|
-
const d =
|
|
1130
|
-
|
|
1134
|
+
const d = Na(a), _ = d !== bn;
|
|
1135
|
+
bn = d;
|
|
1131
1136
|
const k = be || Ee.enabled;
|
|
1132
|
-
be = !1,
|
|
1137
|
+
be = !1, ur(
|
|
1133
1138
|
T,
|
|
1134
1139
|
ae,
|
|
1135
1140
|
Q,
|
|
@@ -1137,18 +1142,15 @@ async function ga(e = {}) {
|
|
|
1137
1142
|
R,
|
|
1138
1143
|
a,
|
|
1139
1144
|
We,
|
|
1140
|
-
We !== null &&
|
|
1145
|
+
We !== null && Jt(a, Ot()),
|
|
1141
1146
|
k,
|
|
1142
1147
|
() => Ee.enabled,
|
|
1143
1148
|
Ct,
|
|
1144
1149
|
Mt,
|
|
1145
1150
|
F,
|
|
1146
|
-
|
|
1151
|
+
pt,
|
|
1147
1152
|
(M) => {
|
|
1148
|
-
|
|
1149
|
-
return;
|
|
1150
|
-
const Qe = t.morningReport !== null;
|
|
1151
|
-
t.morningReport = null, Qe && (t.onMorningReportTaskStart?.(), Ut()), be = !0, te(!0, "send"), ne(), b.sendMessage(M);
|
|
1153
|
+
V() || (ct(), be = !0, te(!0, "send"), ne(), b.sendMessage(M));
|
|
1152
1154
|
},
|
|
1153
1155
|
() => {
|
|
1154
1156
|
be = !0, te(!0, "send"), ne(), b.retryLastMessage();
|
|
@@ -1158,40 +1160,40 @@ async function ga(e = {}) {
|
|
|
1158
1160
|
t.morningReport = null, t.onMorningReportSnooze?.(), Pt(), W(b.getState());
|
|
1159
1161
|
},
|
|
1160
1162
|
Nt,
|
|
1161
|
-
|
|
1162
|
-
dismissedCandidateIds:
|
|
1163
|
-
draftingCandidateId:
|
|
1163
|
+
ri && !St ? {
|
|
1164
|
+
dismissedCandidateIds: it,
|
|
1165
|
+
draftingCandidateId: st,
|
|
1164
1166
|
error: Ze,
|
|
1165
|
-
characterIconOptions:
|
|
1167
|
+
characterIconOptions: pt(),
|
|
1166
1168
|
onSeen: (M) => {
|
|
1167
1169
|
Me.add(M.id), F();
|
|
1168
1170
|
},
|
|
1169
1171
|
onDraft: (M) => {
|
|
1170
|
-
|
|
1172
|
+
pi(M);
|
|
1171
1173
|
},
|
|
1172
1174
|
onDismiss: (M) => {
|
|
1173
|
-
Me.add(M.id),
|
|
1175
|
+
Me.add(M.id), it.add(M.id), F(), Ze = null, W(b.getState());
|
|
1174
1176
|
},
|
|
1175
1177
|
onDisable: (M) => {
|
|
1176
|
-
St = !0, Me.add(M.id),
|
|
1178
|
+
St = !0, Me.add(M.id), it.add(M.id), F(), Mr(t, !0), Ze = null, W(b.getState());
|
|
1177
1179
|
}
|
|
1178
1180
|
} : void 0
|
|
1179
|
-
), k ? (ke = T.scrollTop, ne()) : _ &&
|
|
1181
|
+
), k ? (ke = T.scrollTop, ne()) : _ && Ra(a) && Ko();
|
|
1180
1182
|
};
|
|
1181
|
-
return
|
|
1183
|
+
return An = Li(
|
|
1182
1184
|
(a) => {
|
|
1183
|
-
We = a, !re &&
|
|
1185
|
+
We = a, !re && Jt(b.getState(), Ot()) && W(b.getState());
|
|
1184
1186
|
},
|
|
1185
1187
|
{
|
|
1186
1188
|
backendUrl: t.backendUrl,
|
|
1187
|
-
fetcher:
|
|
1189
|
+
fetcher: Vo,
|
|
1188
1190
|
loader: t.activeUsersLoader
|
|
1189
1191
|
}
|
|
1190
1192
|
), b.on("state", (a) => {
|
|
1191
|
-
const d =
|
|
1192
|
-
|
|
1193
|
-
Be = null,
|
|
1194
|
-
},
|
|
1193
|
+
const d = Tn && !a.isThinking;
|
|
1194
|
+
Tn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Je && !Fe && Be === null && H?.hidden !== !1 && (Be = window.setTimeout(() => {
|
|
1195
|
+
Be = null, ai();
|
|
1196
|
+
}, Mi)), (!a.isThinking || a.assistantDraft.trim()) && (Pn(), dt()), d && !i.classList.contains("pluno-pa-widget--open") && (Ye = !0), At(), a.appearance ? (zt = !0, K(
|
|
1195
1197
|
"web-sdk.widget",
|
|
1196
1198
|
"Agent state supplied appearance",
|
|
1197
1199
|
{
|
|
@@ -1205,7 +1207,7 @@ async function ga(e = {}) {
|
|
|
1205
1207
|
fallbackColorScheme: t.colorScheme,
|
|
1206
1208
|
fallbackFontFamily: t.fontFamily
|
|
1207
1209
|
}
|
|
1208
|
-
), Ft({}, "agent.state.appearance-cleared")), W(a), $(), d &&
|
|
1210
|
+
), Ft({}, "agent.state.appearance-cleared")), W(a), $(), d && Sn();
|
|
1209
1211
|
}), W(b.getState()), $(), Nt(), {
|
|
1210
1212
|
agent: b,
|
|
1211
1213
|
startNewChat: Ut,
|
|
@@ -1215,11 +1217,11 @@ async function ga(e = {}) {
|
|
|
1215
1217
|
},
|
|
1216
1218
|
updateBillingStatus: (a) => {
|
|
1217
1219
|
const d = a ?? null;
|
|
1218
|
-
|
|
1220
|
+
oo(
|
|
1219
1221
|
t.billingStatus,
|
|
1220
1222
|
d,
|
|
1221
1223
|
Ue
|
|
1222
|
-
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null),
|
|
1224
|
+
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null), Zt(
|
|
1223
1225
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
1224
1226
|
t.billingStatus,
|
|
1225
1227
|
Ue
|
|
@@ -1244,19 +1246,19 @@ async function ga(e = {}) {
|
|
|
1244
1246
|
t.morningReport = a ?? null, W(b.getState());
|
|
1245
1247
|
},
|
|
1246
1248
|
destroy: () => {
|
|
1247
|
-
re || (F(), re = !0,
|
|
1249
|
+
re || (F(), re = !0, yn.disconnect(), Ln?.disconnect(), ni(), window.removeEventListener("resize", vn), Cn(), Qo(), ue !== null && window.clearTimeout(ue), Pn(), An(), Oe?.remove(), b.destroy(), vt.release(), n.remove());
|
|
1248
1250
|
}
|
|
1249
1251
|
};
|
|
1250
|
-
async function
|
|
1251
|
-
if (!
|
|
1252
|
-
|
|
1252
|
+
async function pi(a) {
|
|
1253
|
+
if (!st) {
|
|
1254
|
+
st = a.id, Ze = null, W(b.getState());
|
|
1253
1255
|
try {
|
|
1254
1256
|
if (!t.socialPostDraftHandler)
|
|
1255
1257
|
throw new Error("Social post drafting is not available here.");
|
|
1256
1258
|
const d = await t.socialPostDraftHandler(a);
|
|
1257
1259
|
if (!d.linkedinPost || !d.xPost)
|
|
1258
1260
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1259
|
-
Me.add(a.id),
|
|
1261
|
+
Me.add(a.id), it.add(a.id), F(), Oe?.remove(), Oe = xr(d, {
|
|
1260
1262
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1261
1263
|
onClose: () => {
|
|
1262
1264
|
Oe?.remove(), Oe = null;
|
|
@@ -1265,39 +1267,39 @@ async function ga(e = {}) {
|
|
|
1265
1267
|
} catch (d) {
|
|
1266
1268
|
Ze = d instanceof Error ? d.message : "Could not draft social post.";
|
|
1267
1269
|
} finally {
|
|
1268
|
-
|
|
1270
|
+
st = null, W(b.getState());
|
|
1269
1271
|
}
|
|
1270
1272
|
}
|
|
1271
1273
|
}
|
|
1272
1274
|
function Ft(a, d) {
|
|
1273
|
-
const _ = a.accentColor ?? t.accentColor, k = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily,
|
|
1274
|
-
r =
|
|
1275
|
+
const _ = a.accentColor ?? t.accentColor, k = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, Wt = a.scribbleStyle ?? t.scribbleStyle;
|
|
1276
|
+
r = Vn(
|
|
1275
1277
|
_,
|
|
1276
|
-
|
|
1277
|
-
),
|
|
1278
|
+
Wt
|
|
1279
|
+
), Kn(i, r, {
|
|
1278
1280
|
accentColor: _,
|
|
1279
1281
|
colorScheme: k,
|
|
1280
1282
|
fontFamily: M,
|
|
1281
|
-
scribbleStyle:
|
|
1283
|
+
scribbleStyle: Wt
|
|
1282
1284
|
}), K("web-sdk.widget", "Updated widget appearance", {
|
|
1283
1285
|
source: d,
|
|
1284
1286
|
inputAppearance: a,
|
|
1285
1287
|
appliedAccentColor: _,
|
|
1286
1288
|
appliedColorScheme: k,
|
|
1287
1289
|
appliedFontFamily: M,
|
|
1288
|
-
appliedScribbleStyle:
|
|
1290
|
+
appliedScribbleStyle: Wt,
|
|
1289
1291
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
1290
1292
|
});
|
|
1291
1293
|
}
|
|
1292
1294
|
}
|
|
1293
|
-
function
|
|
1295
|
+
function Vn(e, t) {
|
|
1294
1296
|
return { accentColor: e, scribbleStyle: t };
|
|
1295
1297
|
}
|
|
1296
|
-
function ha(e) {
|
|
1297
|
-
const t = ma(e);
|
|
1298
|
-
return t === null ? "#fafafa" : fa(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1299
|
-
}
|
|
1300
1298
|
function ma(e) {
|
|
1299
|
+
const t = fa(e);
|
|
1300
|
+
return t === null ? "#fafafa" : wa(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1301
|
+
}
|
|
1302
|
+
function fa(e) {
|
|
1301
1303
|
const t = e.trim();
|
|
1302
1304
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1303
1305
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1309,14 +1311,14 @@ function ma(e) {
|
|
|
1309
1311
|
Number.parseInt(t[3] + t[3], 16)
|
|
1310
1312
|
] : null;
|
|
1311
1313
|
}
|
|
1312
|
-
function
|
|
1314
|
+
function wa([e, t, n]) {
|
|
1313
1315
|
const o = (i) => {
|
|
1314
1316
|
const r = i / 255;
|
|
1315
1317
|
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
1316
1318
|
};
|
|
1317
1319
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
1318
1320
|
}
|
|
1319
|
-
function
|
|
1321
|
+
function Kn(e, t, n) {
|
|
1320
1322
|
e.classList.toggle(
|
|
1321
1323
|
"pluno-pa-widget--dark",
|
|
1322
1324
|
n.colorScheme === "dark"
|
|
@@ -1324,11 +1326,11 @@ function Vn(e, t, n) {
|
|
|
1324
1326
|
"pluno-pa-widget--light",
|
|
1325
1327
|
n.colorScheme !== "dark"
|
|
1326
1328
|
), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
1327
|
-
const o = n.scribbleStyle ?
|
|
1329
|
+
const o = n.scribbleStyle ? fo(n.accentColor) : n.accentColor;
|
|
1328
1330
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1329
1331
|
"--pluno-pa-accent-contrast",
|
|
1330
|
-
|
|
1331
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ?
|
|
1332
|
+
ma(o)
|
|
1333
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ta : n.fontFamily, n.scribbleStyle && ba(e.ownerDocument);
|
|
1332
1334
|
const i = Array.from(
|
|
1333
1335
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1334
1336
|
);
|
|
@@ -1340,11 +1342,11 @@ function Vn(e, t, n) {
|
|
|
1340
1342
|
)
|
|
1341
1343
|
);
|
|
1342
1344
|
}
|
|
1343
|
-
function
|
|
1344
|
-
if (e.getElementById(
|
|
1345
|
+
function ba(e) {
|
|
1346
|
+
if (e.getElementById($n))
|
|
1345
1347
|
return;
|
|
1346
1348
|
const t = e.createElement("style");
|
|
1347
|
-
t.id =
|
|
1349
|
+
t.id = $n, t.textContent = `@font-face {
|
|
1348
1350
|
font-family: "Architects Daughter";
|
|
1349
1351
|
font-style: normal;
|
|
1350
1352
|
font-weight: 400;
|
|
@@ -1352,7 +1354,7 @@ function wa(e) {
|
|
|
1352
1354
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1353
1355
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1354
1356
|
}
|
|
1355
|
-
function
|
|
1357
|
+
function _a({
|
|
1356
1358
|
root: e,
|
|
1357
1359
|
launcher: t,
|
|
1358
1360
|
launcherDragHandle: n,
|
|
@@ -1370,7 +1372,7 @@ function ba({
|
|
|
1370
1372
|
return;
|
|
1371
1373
|
m.preventDefault();
|
|
1372
1374
|
const S = m.clientX - p.x, z = m.clientY - p.y;
|
|
1373
|
-
!g && Math.hypot(S, z) <
|
|
1375
|
+
!g && Math.hypot(S, z) < rn || (g = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + S, y: s.y + z }));
|
|
1374
1376
|
}, I = (m) => {
|
|
1375
1377
|
l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
|
|
1376
1378
|
}, D = (m) => {
|
|
@@ -1381,12 +1383,12 @@ function ba({
|
|
|
1381
1383
|
const S = Math.hypot(
|
|
1382
1384
|
m.clientX - c.x,
|
|
1383
1385
|
m.clientY - c.y
|
|
1384
|
-
) <=
|
|
1386
|
+
) <= rn;
|
|
1385
1387
|
c = null, S && (m.preventDefault(), m.stopPropagation());
|
|
1386
1388
|
}, v = (m) => {
|
|
1387
1389
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1388
1390
|
return;
|
|
1389
|
-
const S = m.shiftKey ?
|
|
1391
|
+
const S = m.shiftKey ? ko : Eo, z = o();
|
|
1390
1392
|
let L = null;
|
|
1391
1393
|
m.key === "ArrowUp" ? L = { x: z.x, y: z.y - S } : m.key === "ArrowDown" ? L = { x: z.x, y: z.y + S } : m.key === "ArrowLeft" ? L = { x: z.x - S, y: z.y } : m.key === "ArrowRight" && (L = { x: z.x + S, y: z.y }), L && (m.preventDefault(), m.stopPropagation(), i(L), r());
|
|
1392
1394
|
};
|
|
@@ -1394,7 +1396,7 @@ function ba({
|
|
|
1394
1396
|
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", I), t.removeEventListener("pointercancel", D), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", v);
|
|
1395
1397
|
};
|
|
1396
1398
|
}
|
|
1397
|
-
function
|
|
1399
|
+
function xa({
|
|
1398
1400
|
root: e,
|
|
1399
1401
|
handles: t,
|
|
1400
1402
|
getBounds: n,
|
|
@@ -1406,23 +1408,23 @@ function _a({
|
|
|
1406
1408
|
r = null, l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
|
|
1407
1409
|
}, h = (u) => {
|
|
1408
1410
|
const v = u.currentTarget, m = v.dataset.resizeDirection;
|
|
1409
|
-
!e.classList.contains("pluno-pa-widget--open") || !
|
|
1411
|
+
!e.classList.contains("pluno-pa-widget--open") || !Yn(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, p = { x: u.clientX, y: u.clientY }, s = n(), g = !1, v.setPointerCapture?.(u.pointerId));
|
|
1410
1412
|
}, C = (u) => {
|
|
1411
1413
|
if (r !== u.pointerId || !l || !p || !s)
|
|
1412
1414
|
return;
|
|
1413
1415
|
u.preventDefault(), u.stopPropagation();
|
|
1414
1416
|
const v = u.clientX - p.x, m = u.clientY - p.y;
|
|
1415
|
-
!g && Math.hypot(v, m) <
|
|
1416
|
-
|
|
1417
|
+
!g && Math.hypot(v, m) < rn || (g = !0, e.classList.add("pluno-pa-widget--resizing"), o(
|
|
1418
|
+
Xn(s, l, v, m)
|
|
1417
1419
|
));
|
|
1418
1420
|
}, P = (u) => {
|
|
1419
1421
|
r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && i(), c());
|
|
1420
1422
|
}, I = (u) => {
|
|
1421
1423
|
r === u.pointerId && (u.preventDefault(), c());
|
|
1422
1424
|
}, D = (u) => {
|
|
1423
|
-
const m = u.currentTarget.dataset.resizeDirection, S = u.shiftKey ?
|
|
1425
|
+
const m = u.currentTarget.dataset.resizeDirection, S = u.shiftKey ? ko : Eo, z = n();
|
|
1424
1426
|
let L = 0, oe = 0;
|
|
1425
|
-
|
|
1427
|
+
Yn(m) && (u.key === "ArrowLeft" ? L = -S : u.key === "ArrowRight" ? L = S : u.key === "ArrowUp" ? oe = -S : u.key === "ArrowDown" && (oe = S), !(L === 0 && oe === 0) && (u.preventDefault(), u.stopPropagation(), o(Xn(z, m, L, oe)), i()));
|
|
1426
1428
|
};
|
|
1427
1429
|
for (const u of t)
|
|
1428
1430
|
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", C), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", I), u.addEventListener("keydown", D);
|
|
@@ -1431,11 +1433,11 @@ function _a({
|
|
|
1431
1433
|
u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", C), u.removeEventListener("pointerup", P), u.removeEventListener("pointercancel", I), u.removeEventListener("keydown", D);
|
|
1432
1434
|
};
|
|
1433
1435
|
}
|
|
1434
|
-
function
|
|
1436
|
+
function Yn(e) {
|
|
1435
1437
|
return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
|
|
1436
1438
|
}
|
|
1437
|
-
function
|
|
1438
|
-
const i = Z(), r =
|
|
1439
|
+
function Xn(e, t, n, o) {
|
|
1440
|
+
const i = Z(), r = Zn({
|
|
1439
1441
|
leading: e.position.x,
|
|
1440
1442
|
length: e.size.width,
|
|
1441
1443
|
delta: n,
|
|
@@ -1444,10 +1446,10 @@ function Yn(e, t, n, o) {
|
|
|
1444
1446
|
minLeading: N,
|
|
1445
1447
|
maxTrailing: i.width - N,
|
|
1446
1448
|
minLength: Math.min(
|
|
1447
|
-
|
|
1449
|
+
un,
|
|
1448
1450
|
i.width - N * 2
|
|
1449
1451
|
)
|
|
1450
|
-
}), l =
|
|
1452
|
+
}), l = Zn({
|
|
1451
1453
|
leading: e.position.y,
|
|
1452
1454
|
length: e.size.height,
|
|
1453
1455
|
delta: o,
|
|
@@ -1456,7 +1458,7 @@ function Yn(e, t, n, o) {
|
|
|
1456
1458
|
minLeading: Ne,
|
|
1457
1459
|
maxTrailing: i.height - N,
|
|
1458
1460
|
minLength: Math.min(
|
|
1459
|
-
|
|
1461
|
+
gn,
|
|
1460
1462
|
i.height - Ne - N
|
|
1461
1463
|
)
|
|
1462
1464
|
});
|
|
@@ -1465,7 +1467,7 @@ function Yn(e, t, n, o) {
|
|
|
1465
1467
|
size: { width: r.length, height: l.length }
|
|
1466
1468
|
};
|
|
1467
1469
|
}
|
|
1468
|
-
function
|
|
1470
|
+
function Zn({
|
|
1469
1471
|
leading: e,
|
|
1470
1472
|
length: t,
|
|
1471
1473
|
delta: n,
|
|
@@ -1511,36 +1513,36 @@ function Xn({
|
|
|
1511
1513
|
function bt(e, t = !0) {
|
|
1512
1514
|
const n = Z();
|
|
1513
1515
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1514
|
-
return { width:
|
|
1516
|
+
return { width: Gn, height: Gn };
|
|
1515
1517
|
const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1516
1518
|
return {
|
|
1517
|
-
width: t && i && o.width > 0 ? o.width : Math.min(
|
|
1518
|
-
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1519
|
+
width: t && i && o.width > 0 ? o.width : Math.min(vo, n.width - 36),
|
|
1520
|
+
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? oa : Co
|
|
1519
1521
|
};
|
|
1520
1522
|
}
|
|
1521
|
-
function
|
|
1523
|
+
function ya() {
|
|
1522
1524
|
const e = Z();
|
|
1523
1525
|
return {
|
|
1524
1526
|
width: Math.min(
|
|
1525
1527
|
X(
|
|
1526
|
-
e.width *
|
|
1527
|
-
|
|
1528
|
-
|
|
1528
|
+
e.width * aa,
|
|
1529
|
+
un,
|
|
1530
|
+
ia
|
|
1529
1531
|
),
|
|
1530
1532
|
e.width - N * 2
|
|
1531
1533
|
),
|
|
1532
1534
|
height: Math.min(
|
|
1533
1535
|
X(
|
|
1534
|
-
e.height *
|
|
1535
|
-
|
|
1536
|
-
|
|
1536
|
+
e.height * la,
|
|
1537
|
+
gn,
|
|
1538
|
+
ra
|
|
1537
1539
|
),
|
|
1538
1540
|
e.height - Ne - N
|
|
1539
1541
|
)
|
|
1540
1542
|
};
|
|
1541
1543
|
}
|
|
1542
|
-
function
|
|
1543
|
-
return e ? xt(e) :
|
|
1544
|
+
function et(e = null) {
|
|
1545
|
+
return e ? xt(e) : ya();
|
|
1544
1546
|
}
|
|
1545
1547
|
function xt(e) {
|
|
1546
1548
|
const t = Z();
|
|
@@ -1548,7 +1550,7 @@ function xt(e) {
|
|
|
1548
1550
|
width: X(
|
|
1549
1551
|
e.width,
|
|
1550
1552
|
Math.min(
|
|
1551
|
-
|
|
1553
|
+
un,
|
|
1552
1554
|
t.width - N * 2
|
|
1553
1555
|
),
|
|
1554
1556
|
Math.max(
|
|
@@ -1559,7 +1561,7 @@ function xt(e) {
|
|
|
1559
1561
|
height: X(
|
|
1560
1562
|
e.height,
|
|
1561
1563
|
Math.min(
|
|
1562
|
-
|
|
1564
|
+
gn,
|
|
1563
1565
|
t.height - Ne - N
|
|
1564
1566
|
),
|
|
1565
1567
|
Math.max(
|
|
@@ -1569,7 +1571,7 @@ function xt(e) {
|
|
|
1569
1571
|
)
|
|
1570
1572
|
};
|
|
1571
1573
|
}
|
|
1572
|
-
function
|
|
1574
|
+
function Gt(e, t) {
|
|
1573
1575
|
if (!t) {
|
|
1574
1576
|
e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
|
|
1575
1577
|
return;
|
|
@@ -1577,7 +1579,7 @@ function $t(e, t) {
|
|
|
1577
1579
|
const n = xt(t);
|
|
1578
1580
|
e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
|
|
1579
1581
|
}
|
|
1580
|
-
function
|
|
1582
|
+
function va(e, t, n) {
|
|
1581
1583
|
const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1582
1584
|
if (Number.isFinite(o) && Number.isFinite(i))
|
|
1583
1585
|
return { x: o, y: i };
|
|
@@ -1590,23 +1592,23 @@ function ya(e, t, n) {
|
|
|
1590
1592
|
y: l.height - 24 - n.height
|
|
1591
1593
|
};
|
|
1592
1594
|
}
|
|
1593
|
-
function
|
|
1595
|
+
function qt(e, t, n) {
|
|
1594
1596
|
const o = bt(e, !1);
|
|
1595
|
-
return t ?
|
|
1597
|
+
return t ? ln(
|
|
1596
1598
|
e,
|
|
1597
|
-
|
|
1599
|
+
Po(t, o),
|
|
1598
1600
|
o
|
|
1599
|
-
) :
|
|
1601
|
+
) : Ca(n === "bottom-left" ? "bottom-left" : "bottom-right", o, na);
|
|
1600
1602
|
}
|
|
1601
|
-
function
|
|
1603
|
+
function Ca(e, t, n) {
|
|
1602
1604
|
const o = Z();
|
|
1603
1605
|
return {
|
|
1604
1606
|
x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
|
|
1605
1607
|
y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
|
|
1606
1608
|
};
|
|
1607
1609
|
}
|
|
1608
|
-
function
|
|
1609
|
-
const o = Z(), i = N +
|
|
1610
|
+
function ln(e, t, n) {
|
|
1611
|
+
const o = Z(), i = N + ka(e);
|
|
1610
1612
|
return {
|
|
1611
1613
|
x: X(
|
|
1612
1614
|
t.x,
|
|
@@ -1626,30 +1628,30 @@ function rn(e, t, n) {
|
|
|
1626
1628
|
)
|
|
1627
1629
|
};
|
|
1628
1630
|
}
|
|
1629
|
-
function
|
|
1631
|
+
function Po(e, t) {
|
|
1630
1632
|
const n = Z();
|
|
1631
1633
|
return {
|
|
1632
1634
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
1633
1635
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
1634
1636
|
};
|
|
1635
1637
|
}
|
|
1636
|
-
function
|
|
1637
|
-
const n =
|
|
1638
|
+
function Sa(e, t) {
|
|
1639
|
+
const n = Ea(e, t), o = Z();
|
|
1638
1640
|
return {
|
|
1639
1641
|
anchor: n,
|
|
1640
1642
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
1641
1643
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
1642
1644
|
};
|
|
1643
1645
|
}
|
|
1644
|
-
function
|
|
1646
|
+
function Ea(e, t) {
|
|
1645
1647
|
const n = Z(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
1646
1648
|
return `${r}-${l}`;
|
|
1647
1649
|
}
|
|
1648
|
-
function
|
|
1649
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1650
|
+
function ka(e) {
|
|
1651
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? ca : da;
|
|
1650
1652
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const i = bt(e), r =
|
|
1653
|
+
function jt(e, t, n, o = null) {
|
|
1654
|
+
const i = bt(e), r = et(o), l = {
|
|
1653
1655
|
x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
|
|
1654
1656
|
y: t.y + i.height - r.height
|
|
1655
1657
|
};
|
|
@@ -1683,19 +1685,19 @@ function Ae(e, t) {
|
|
|
1683
1685
|
}
|
|
1684
1686
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1685
1687
|
}
|
|
1686
|
-
function
|
|
1688
|
+
function La(e, t) {
|
|
1687
1689
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1688
1690
|
}
|
|
1689
|
-
function
|
|
1691
|
+
function Jn(e) {
|
|
1690
1692
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1691
1693
|
}
|
|
1692
1694
|
function Z() {
|
|
1693
1695
|
return {
|
|
1694
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1695
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1696
|
+
width: window.innerWidth || document.documentElement.clientWidth || vo + N * 2,
|
|
1697
|
+
height: window.innerHeight || document.documentElement.clientHeight || Co + N * 2
|
|
1696
1698
|
};
|
|
1697
1699
|
}
|
|
1698
|
-
function
|
|
1700
|
+
function Vt(e) {
|
|
1699
1701
|
const t = e.getBoundingClientRect();
|
|
1700
1702
|
return {
|
|
1701
1703
|
x: Math.round(t.x),
|
|
@@ -1717,44 +1719,44 @@ function K(e, t, n) {
|
|
|
1717
1719
|
details: n
|
|
1718
1720
|
}, r = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1719
1721
|
r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
|
|
1720
|
-
new CustomEvent(
|
|
1722
|
+
new CustomEvent(Yi, { detail: i })
|
|
1721
1723
|
);
|
|
1722
1724
|
}
|
|
1723
|
-
function
|
|
1725
|
+
function Ta(e, t) {
|
|
1724
1726
|
K("web-sdk.widget.position", e, t);
|
|
1725
1727
|
}
|
|
1726
|
-
function
|
|
1727
|
-
const
|
|
1728
|
-
return !
|
|
1729
|
-
attachments: n.length > 0 ? n.map(
|
|
1728
|
+
function Kt(e, t, n, o) {
|
|
1729
|
+
const i = t.value.trim();
|
|
1730
|
+
return !i && n.length === 0 ? n : (o(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(i, {
|
|
1731
|
+
attachments: n.length > 0 ? n.map(Aa) : void 0
|
|
1730
1732
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1731
1733
|
}
|
|
1732
|
-
function
|
|
1734
|
+
function Pa(e, t, n) {
|
|
1733
1735
|
const o = e.activeElement;
|
|
1734
1736
|
return o === n ? "composer" : o === t ? "launcher" : null;
|
|
1735
1737
|
}
|
|
1736
|
-
function
|
|
1737
|
-
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt >
|
|
1738
|
+
function Ia(e, t, n, o) {
|
|
1739
|
+
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Oi)
|
|
1738
1740
|
return;
|
|
1739
1741
|
const i = e.focusedInput === "composer" ? o : n;
|
|
1740
1742
|
i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
|
|
1741
1743
|
!i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
|
|
1742
1744
|
});
|
|
1743
1745
|
}
|
|
1744
|
-
function
|
|
1746
|
+
function Aa(e) {
|
|
1745
1747
|
return e;
|
|
1746
1748
|
}
|
|
1747
|
-
function
|
|
1749
|
+
function Qe(e) {
|
|
1748
1750
|
e.style.height = "0px";
|
|
1749
1751
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1750
1752
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1751
1753
|
}
|
|
1752
|
-
function
|
|
1754
|
+
function tt(e, t = () => !0) {
|
|
1753
1755
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1754
1756
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1755
1757
|
});
|
|
1756
1758
|
}
|
|
1757
|
-
function
|
|
1759
|
+
function Na(e) {
|
|
1758
1760
|
const t = e.messages[e.messages.length - 1];
|
|
1759
1761
|
return [
|
|
1760
1762
|
e.messages.length,
|
|
@@ -1765,13 +1767,13 @@ function Aa(e) {
|
|
|
1765
1767
|
e.lastError ?? ""
|
|
1766
1768
|
].join(":");
|
|
1767
1769
|
}
|
|
1768
|
-
function
|
|
1770
|
+
function Ra(e) {
|
|
1769
1771
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1770
1772
|
}
|
|
1771
|
-
function
|
|
1773
|
+
function Da(e) {
|
|
1772
1774
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1773
1775
|
}
|
|
1774
|
-
function
|
|
1776
|
+
function za(e) {
|
|
1775
1777
|
const t = e.currentPage;
|
|
1776
1778
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1777
1779
|
try {
|
|
@@ -1782,7 +1784,7 @@ function Da(e) {
|
|
|
1782
1784
|
}
|
|
1783
1785
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1784
1786
|
}
|
|
1785
|
-
function
|
|
1787
|
+
function Ma(e, t) {
|
|
1786
1788
|
const n = new Date(e).getTime();
|
|
1787
1789
|
if (!Number.isFinite(n))
|
|
1788
1790
|
return "now";
|
|
@@ -1798,9 +1800,9 @@ function za(e, t) {
|
|
|
1798
1800
|
}
|
|
1799
1801
|
return "now";
|
|
1800
1802
|
}
|
|
1801
|
-
function
|
|
1802
|
-
e.appendChild(
|
|
1803
|
-
|
|
1803
|
+
function Oa(e, t, n, o, i) {
|
|
1804
|
+
e.appendChild(ja()), e.appendChild(
|
|
1805
|
+
Ua(
|
|
1804
1806
|
t,
|
|
1805
1807
|
n,
|
|
1806
1808
|
o,
|
|
@@ -1810,19 +1812,19 @@ function Ma(e, t, n, o, i) {
|
|
|
1810
1812
|
yt(
|
|
1811
1813
|
"pluno-pa-widget__close",
|
|
1812
1814
|
"Close",
|
|
1813
|
-
|
|
1815
|
+
Va(16),
|
|
1814
1816
|
!0
|
|
1815
1817
|
)
|
|
1816
|
-
), e.appendChild(
|
|
1818
|
+
), e.appendChild(Ba(n));
|
|
1817
1819
|
}
|
|
1818
|
-
function
|
|
1820
|
+
function Ua(e, t, n, o) {
|
|
1819
1821
|
const i = document.createElement("form");
|
|
1820
1822
|
if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
|
|
1821
1823
|
const s = document.createElement("button");
|
|
1822
1824
|
s.type = "button", s.className = "pluno-pa-widget__launcher-drag-handle", s.setAttribute("aria-label", "Move Pluno launcher"), s.title = "Move Pluno launcher", i.appendChild(s);
|
|
1823
1825
|
}
|
|
1824
1826
|
i.appendChild(
|
|
1825
|
-
|
|
1827
|
+
Ro(
|
|
1826
1828
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1827
1829
|
10
|
|
1828
1830
|
)
|
|
@@ -1843,15 +1845,15 @@ function Oa(e, t, n, o) {
|
|
|
1843
1845
|
}
|
|
1844
1846
|
return i;
|
|
1845
1847
|
}
|
|
1846
|
-
function
|
|
1848
|
+
function Ba(e) {
|
|
1847
1849
|
const t = document.createElement("section");
|
|
1848
1850
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1849
|
-
|
|
1851
|
+
Ro("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1850
1852
|
);
|
|
1851
1853
|
const n = document.createElement("div");
|
|
1852
1854
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1853
1855
|
const o = document.createElement("main");
|
|
1854
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1856
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild($a(e));
|
|
1855
1857
|
const i = document.createElement("div");
|
|
1856
1858
|
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
|
|
1857
1859
|
const r = document.createElement("div");
|
|
@@ -1862,11 +1864,11 @@ function Ua(e) {
|
|
|
1862
1864
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
1863
1865
|
yt(
|
|
1864
1866
|
"pluno-pa-widget__history",
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
+
pn(),
|
|
1868
|
+
Ya(),
|
|
1867
1869
|
!0
|
|
1868
1870
|
)
|
|
1869
|
-
), n.appendChild(p), n.appendChild(
|
|
1871
|
+
), n.appendChild(p), n.appendChild(Ha()), t.appendChild(n), t.appendChild(Fa()), t.appendChild(Wa()), t.appendChild(ye("left", "Resize Pluno from left")), t.appendChild(
|
|
1870
1872
|
ye("right", "Resize Pluno from right")
|
|
1871
1873
|
), t.appendChild(ye("top", "Resize Pluno from top")), t.appendChild(
|
|
1872
1874
|
ye("bottom", "Resize Pluno from bottom")
|
|
@@ -1887,7 +1889,7 @@ function ye(e, t) {
|
|
|
1887
1889
|
`pluno-pa-widget__resize-handle--${e}`
|
|
1888
1890
|
].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
|
|
1889
1891
|
}
|
|
1890
|
-
function
|
|
1892
|
+
function Fa() {
|
|
1891
1893
|
const e = document.createElement("div");
|
|
1892
1894
|
e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
|
|
1893
1895
|
const t = document.createElement("span");
|
|
@@ -1901,7 +1903,7 @@ function Ba() {
|
|
|
1901
1903
|
const r = document.createElement("button");
|
|
1902
1904
|
return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(o, i, r), e.append(t, n), e;
|
|
1903
1905
|
}
|
|
1904
|
-
function
|
|
1906
|
+
function Wa() {
|
|
1905
1907
|
const e = document.createElement("form");
|
|
1906
1908
|
e.className = "pluno-pa-widget__composer";
|
|
1907
1909
|
const t = document.createElement("div");
|
|
@@ -1915,11 +1917,11 @@ function Fa() {
|
|
|
1915
1917
|
const r = document.createElement("input");
|
|
1916
1918
|
r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
|
|
1917
1919
|
const l = document.createElement("button");
|
|
1918
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1920
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Za()), l.appendChild(Ja()), i.appendChild(l);
|
|
1919
1921
|
const p = document.createElement("textarea");
|
|
1920
1922
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1921
1923
|
const s = document.createElement("button");
|
|
1922
|
-
s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(
|
|
1924
|
+
s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(zo()), i.appendChild(s), e.appendChild(i);
|
|
1923
1925
|
const g = document.createElement("div");
|
|
1924
1926
|
g.className = "pluno-pa-widget__composer-meta";
|
|
1925
1927
|
const c = document.createElement("a");
|
|
@@ -1927,20 +1929,20 @@ function Fa() {
|
|
|
1927
1929
|
const h = document.createElement("span");
|
|
1928
1930
|
return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", g.appendChild(h), e.appendChild(g), e;
|
|
1929
1931
|
}
|
|
1930
|
-
function
|
|
1932
|
+
function pn() {
|
|
1931
1933
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
1932
1934
|
}
|
|
1933
|
-
function
|
|
1935
|
+
function Ha() {
|
|
1934
1936
|
const e = document.createElement("section");
|
|
1935
|
-
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label",
|
|
1937
|
+
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", pn());
|
|
1936
1938
|
const t = document.createElement("div");
|
|
1937
1939
|
t.className = "pluno-pa-widget__history-header";
|
|
1938
1940
|
const n = document.createElement("strong");
|
|
1939
|
-
n.textContent =
|
|
1941
|
+
n.textContent = pn();
|
|
1940
1942
|
const o = yt(
|
|
1941
1943
|
"pluno-pa-widget__history-close",
|
|
1942
1944
|
"Close recent chats",
|
|
1943
|
-
|
|
1945
|
+
Xa(),
|
|
1944
1946
|
!1
|
|
1945
1947
|
);
|
|
1946
1948
|
t.append(n, o);
|
|
@@ -1949,20 +1951,20 @@ function Wa() {
|
|
|
1949
1951
|
const r = document.createElement("p");
|
|
1950
1952
|
return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
|
|
1951
1953
|
}
|
|
1952
|
-
function
|
|
1954
|
+
function $a(e) {
|
|
1953
1955
|
const t = document.createElement("div");
|
|
1954
1956
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1955
1957
|
ve(
|
|
1956
1958
|
"pluno-pa-widget__character--empty",
|
|
1957
1959
|
e
|
|
1958
1960
|
)
|
|
1959
|
-
), t.appendChild(
|
|
1961
|
+
), t.appendChild(Io()), t;
|
|
1960
1962
|
}
|
|
1961
|
-
function
|
|
1963
|
+
function Io() {
|
|
1962
1964
|
const e = document.createElement("div");
|
|
1963
1965
|
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;
|
|
1964
1966
|
}
|
|
1965
|
-
function
|
|
1967
|
+
function Ao(e, t) {
|
|
1966
1968
|
e.replaceChildren(), e.setAttribute(
|
|
1967
1969
|
"aria-label",
|
|
1968
1970
|
`${t.toLocaleString("en-US")} users currently active`
|
|
@@ -1975,16 +1977,16 @@ function Io(e, t) {
|
|
|
1975
1977
|
);
|
|
1976
1978
|
}
|
|
1977
1979
|
function ve(e, t) {
|
|
1978
|
-
const n = `pluno-pa-character-${
|
|
1979
|
-
|
|
1980
|
-
const o = t.scribbleStyle ?
|
|
1980
|
+
const n = `pluno-pa-character-${jn}`;
|
|
1981
|
+
jn += 1;
|
|
1982
|
+
const o = t.scribbleStyle ? qa(t.accentColor, n) : Ga(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
|
|
1981
1983
|
return o.setAttribute(
|
|
1982
1984
|
"class",
|
|
1983
1985
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1984
1986
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1985
1987
|
}
|
|
1986
|
-
function
|
|
1987
|
-
const n =
|
|
1988
|
+
function Ga(e, t) {
|
|
1989
|
+
const n = gi(e), o = {
|
|
1988
1990
|
boltFill: `${t}-boltFill`,
|
|
1989
1991
|
boltEdge: `${t}-boltEdge`,
|
|
1990
1992
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1995,7 +1997,7 @@ function $a(e, t) {
|
|
|
1995
1997
|
eyeShadow: `${t}-eyeShadow`,
|
|
1996
1998
|
pupilGloss: `${t}-pupilGloss`,
|
|
1997
1999
|
boltClip: `${t}-boltClip`
|
|
1998
|
-
}, i =
|
|
2000
|
+
}, i = No(), r = w(i, "defs"), l = w(r, "linearGradient", {
|
|
1999
2001
|
id: o.boltFill,
|
|
2000
2002
|
x1: "420",
|
|
2001
2003
|
y1: "180",
|
|
@@ -2158,7 +2160,7 @@ function $a(e, t) {
|
|
|
2158
2160
|
opacity: "0.48"
|
|
2159
2161
|
});
|
|
2160
2162
|
const S = w(i, "g", { filter: Y(o.eyeShadow) });
|
|
2161
|
-
return
|
|
2163
|
+
return Qn(
|
|
2162
2164
|
S,
|
|
2163
2165
|
"rotate(-2 528 463)",
|
|
2164
2166
|
"528",
|
|
@@ -2168,7 +2170,7 @@ function $a(e, t) {
|
|
|
2168
2170
|
"557",
|
|
2169
2171
|
"447",
|
|
2170
2172
|
o
|
|
2171
|
-
),
|
|
2173
|
+
), Qn(
|
|
2172
2174
|
S,
|
|
2173
2175
|
"rotate(2 717 462)",
|
|
2174
2176
|
"717",
|
|
@@ -2180,11 +2182,11 @@ function $a(e, t) {
|
|
|
2180
2182
|
o
|
|
2181
2183
|
), i;
|
|
2182
2184
|
}
|
|
2183
|
-
function
|
|
2184
|
-
const n =
|
|
2185
|
+
function qa(e, t) {
|
|
2186
|
+
const n = fo(e), o = {
|
|
2185
2187
|
clip: `${t}-scribbleBoltClip`,
|
|
2186
2188
|
wobble: `${t}-scribbleBoltWobble`
|
|
2187
|
-
}, i =
|
|
2189
|
+
}, i = No(), r = w(i, "defs"), l = w(r, "clipPath", { id: o.clip });
|
|
2188
2190
|
w(l, "path", { d: ft });
|
|
2189
2191
|
const p = w(r, "filter", {
|
|
2190
2192
|
id: o.wobble,
|
|
@@ -2211,7 +2213,7 @@ function Ga(e, t) {
|
|
|
2211
2213
|
"clip-path": Y(o.clip)
|
|
2212
2214
|
});
|
|
2213
2215
|
return w(g, "path", {
|
|
2214
|
-
d:
|
|
2216
|
+
d: ui(),
|
|
2215
2217
|
fill: "none",
|
|
2216
2218
|
stroke: n,
|
|
2217
2219
|
"stroke-width": "56",
|
|
@@ -2225,7 +2227,7 @@ function Ga(e, t) {
|
|
|
2225
2227
|
stroke: wt,
|
|
2226
2228
|
"stroke-width": "18",
|
|
2227
2229
|
"stroke-linejoin": "round"
|
|
2228
|
-
}),
|
|
2230
|
+
}), eo(
|
|
2229
2231
|
s,
|
|
2230
2232
|
"rotate(-2 528 463)",
|
|
2231
2233
|
"528",
|
|
@@ -2234,7 +2236,7 @@ function Ga(e, t) {
|
|
|
2234
2236
|
"473",
|
|
2235
2237
|
"557",
|
|
2236
2238
|
"447"
|
|
2237
|
-
),
|
|
2239
|
+
), eo(
|
|
2238
2240
|
s,
|
|
2239
2241
|
"rotate(2 717 462)",
|
|
2240
2242
|
"717",
|
|
@@ -2245,13 +2247,13 @@ function Ga(e, t) {
|
|
|
2245
2247
|
"447"
|
|
2246
2248
|
), i;
|
|
2247
2249
|
}
|
|
2248
|
-
function
|
|
2250
|
+
function No() {
|
|
2249
2251
|
return E("svg", {
|
|
2250
|
-
xmlns:
|
|
2252
|
+
xmlns: So,
|
|
2251
2253
|
viewBox: "0 0 1254 1254"
|
|
2252
2254
|
});
|
|
2253
2255
|
}
|
|
2254
|
-
function
|
|
2256
|
+
function Qn(e, t, n, o, i, r, l, p, s) {
|
|
2255
2257
|
const g = w(e, "g", { transform: t });
|
|
2256
2258
|
w(g, "ellipse", {
|
|
2257
2259
|
cx: n,
|
|
@@ -2273,7 +2275,7 @@ function Jn(e, t, n, o, i, r, l, p, s) {
|
|
|
2273
2275
|
fill: "#ffffff"
|
|
2274
2276
|
});
|
|
2275
2277
|
}
|
|
2276
|
-
function
|
|
2278
|
+
function eo(e, t, n, o, i, r, l, p) {
|
|
2277
2279
|
const s = w(e, "g", { transform: t });
|
|
2278
2280
|
w(s, "ellipse", {
|
|
2279
2281
|
cx: n,
|
|
@@ -2311,7 +2313,7 @@ function yt(e, t, n, o) {
|
|
|
2311
2313
|
const i = document.createElement("button");
|
|
2312
2314
|
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
|
|
2313
2315
|
}
|
|
2314
|
-
function
|
|
2316
|
+
function ja() {
|
|
2315
2317
|
const e = E("svg", {
|
|
2316
2318
|
class: "pluno-pa-widget__scribble-defs",
|
|
2317
2319
|
"aria-hidden": "true",
|
|
@@ -2319,46 +2321,46 @@ function qa() {
|
|
|
2319
2321
|
width: "0",
|
|
2320
2322
|
height: "0"
|
|
2321
2323
|
}), t = E("defs");
|
|
2322
|
-
return t.appendChild(
|
|
2323
|
-
|
|
2324
|
+
return t.appendChild(Xt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
2325
|
+
Xt("pluno-pa-scribble-wobble-2", "5", "15")
|
|
2324
2326
|
), t.appendChild(
|
|
2325
|
-
|
|
2327
|
+
Xt("pluno-pa-scribble-wobble-3", "9", "19")
|
|
2326
2328
|
), e.appendChild(t), e;
|
|
2327
2329
|
}
|
|
2328
|
-
function
|
|
2330
|
+
function Ro(e, t) {
|
|
2329
2331
|
const n = E("svg", {
|
|
2330
2332
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
2331
2333
|
preserveAspectRatio: "xMidYMid meet",
|
|
2332
2334
|
"aria-hidden": "true",
|
|
2333
2335
|
focusable: "false"
|
|
2334
2336
|
});
|
|
2335
|
-
return
|
|
2337
|
+
return Do(n, t), n;
|
|
2336
2338
|
}
|
|
2337
|
-
function
|
|
2339
|
+
function Yt(e, t) {
|
|
2338
2340
|
if (!e)
|
|
2339
2341
|
return;
|
|
2340
2342
|
const n = Math.max(
|
|
2341
2343
|
0,
|
|
2342
|
-
t -
|
|
2344
|
+
t - an * 2
|
|
2343
2345
|
), o = Math.max(
|
|
2344
|
-
|
|
2346
|
+
sa,
|
|
2345
2347
|
Math.floor(
|
|
2346
|
-
(n -
|
|
2348
|
+
(n - on * 2) / nn
|
|
2347
2349
|
)
|
|
2348
2350
|
);
|
|
2349
|
-
|
|
2351
|
+
Do(e, o);
|
|
2350
2352
|
}
|
|
2351
|
-
function
|
|
2353
|
+
function Do(e, t) {
|
|
2352
2354
|
if (e.dataset.spiralCount === `${t}`)
|
|
2353
2355
|
return;
|
|
2354
|
-
const n = t *
|
|
2356
|
+
const n = t * nn + on * 2;
|
|
2355
2357
|
e.dataset.spiralCount = `${t}`, e.setAttribute(
|
|
2356
2358
|
"viewBox",
|
|
2357
|
-
`0 0 ${n} ${
|
|
2359
|
+
`0 0 ${n} ${pa}`
|
|
2358
2360
|
), e.replaceChildren();
|
|
2359
2361
|
for (let o = 0; o < t; o += 1) {
|
|
2360
|
-
const i =
|
|
2361
|
-
transform: `translate(${
|
|
2362
|
+
const i = qn[o % qn.length], r = E("g", {
|
|
2363
|
+
transform: `translate(${on + o * nn} 0)`
|
|
2362
2364
|
});
|
|
2363
2365
|
r.appendChild(
|
|
2364
2366
|
E("ellipse", {
|
|
@@ -2382,7 +2384,7 @@ function Ro(e, t) {
|
|
|
2382
2384
|
), e.appendChild(r);
|
|
2383
2385
|
}
|
|
2384
2386
|
}
|
|
2385
|
-
function
|
|
2387
|
+
function Xt(e, t, n) {
|
|
2386
2388
|
const o = E("filter", {
|
|
2387
2389
|
id: e,
|
|
2388
2390
|
x: "-8%",
|
|
@@ -2425,7 +2427,7 @@ function Yt(e, t, n) {
|
|
|
2425
2427
|
})
|
|
2426
2428
|
), o;
|
|
2427
2429
|
}
|
|
2428
|
-
function
|
|
2430
|
+
function Va(e) {
|
|
2429
2431
|
const t = ce(
|
|
2430
2432
|
"0 0 24 24",
|
|
2431
2433
|
e,
|
|
@@ -2436,7 +2438,7 @@ function ja(e) {
|
|
|
2436
2438
|
);
|
|
2437
2439
|
return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
|
|
2438
2440
|
}
|
|
2439
|
-
function
|
|
2441
|
+
function Ka() {
|
|
2440
2442
|
const e = ce(
|
|
2441
2443
|
"0 0 24 24",
|
|
2442
2444
|
17,
|
|
@@ -2455,7 +2457,7 @@ function Va() {
|
|
|
2455
2457
|
})
|
|
2456
2458
|
), e;
|
|
2457
2459
|
}
|
|
2458
|
-
function
|
|
2460
|
+
function Ya() {
|
|
2459
2461
|
const e = ce(
|
|
2460
2462
|
"0 0 24 24",
|
|
2461
2463
|
17,
|
|
@@ -2466,7 +2468,7 @@ function Ka() {
|
|
|
2466
2468
|
);
|
|
2467
2469
|
return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
|
|
2468
2470
|
}
|
|
2469
|
-
function
|
|
2471
|
+
function Xa() {
|
|
2470
2472
|
const e = ce(
|
|
2471
2473
|
"0 0 24 24",
|
|
2472
2474
|
15,
|
|
@@ -2477,7 +2479,7 @@ function Ya() {
|
|
|
2477
2479
|
);
|
|
2478
2480
|
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
2479
2481
|
}
|
|
2480
|
-
function
|
|
2482
|
+
function zo() {
|
|
2481
2483
|
const e = ce(
|
|
2482
2484
|
"0 0 24 24",
|
|
2483
2485
|
14,
|
|
@@ -2490,7 +2492,7 @@ function Do() {
|
|
|
2490
2492
|
E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2491
2493
|
), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2492
2494
|
}
|
|
2493
|
-
function
|
|
2495
|
+
function Za() {
|
|
2494
2496
|
const e = ce(
|
|
2495
2497
|
"0 0 24 24",
|
|
2496
2498
|
16,
|
|
@@ -2508,7 +2510,7 @@ function Xa() {
|
|
|
2508
2510
|
})
|
|
2509
2511
|
), e;
|
|
2510
2512
|
}
|
|
2511
|
-
function
|
|
2513
|
+
function Ja() {
|
|
2512
2514
|
const e = ce("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2513
2515
|
return e.setAttribute(
|
|
2514
2516
|
"class",
|
|
@@ -2523,7 +2525,7 @@ function Za() {
|
|
|
2523
2525
|
})
|
|
2524
2526
|
), e;
|
|
2525
2527
|
}
|
|
2526
|
-
function
|
|
2528
|
+
function Qa() {
|
|
2527
2529
|
const e = ce("0 0 24 24", 18, 18, "currentColor");
|
|
2528
2530
|
return e.appendChild(
|
|
2529
2531
|
E("rect", {
|
|
@@ -2535,7 +2537,7 @@ function Ja() {
|
|
|
2535
2537
|
})
|
|
2536
2538
|
), e;
|
|
2537
2539
|
}
|
|
2538
|
-
function
|
|
2540
|
+
function er() {
|
|
2539
2541
|
const e = ce(
|
|
2540
2542
|
"0 0 24 24",
|
|
2541
2543
|
12,
|
|
@@ -2546,7 +2548,7 @@ function Qa() {
|
|
|
2546
2548
|
);
|
|
2547
2549
|
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
2548
2550
|
}
|
|
2549
|
-
function
|
|
2551
|
+
function tr() {
|
|
2550
2552
|
const e = ce(
|
|
2551
2553
|
"0 0 24 24",
|
|
2552
2554
|
13,
|
|
@@ -2581,30 +2583,30 @@ function ce(e, t, n, o, i, r) {
|
|
|
2581
2583
|
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
|
|
2582
2584
|
}
|
|
2583
2585
|
function E(e, t = {}) {
|
|
2584
|
-
const n = document.createElementNS(
|
|
2586
|
+
const n = document.createElementNS(So, e);
|
|
2585
2587
|
for (const [o, i] of Object.entries(t))
|
|
2586
2588
|
n.setAttribute(o, i);
|
|
2587
2589
|
return n;
|
|
2588
2590
|
}
|
|
2589
|
-
function
|
|
2591
|
+
function to(e) {
|
|
2590
2592
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2591
2593
|
e.addEventListener(t, (n) => {
|
|
2592
2594
|
n.stopPropagation();
|
|
2593
2595
|
});
|
|
2594
2596
|
}
|
|
2595
|
-
function
|
|
2597
|
+
function nr(e, t, n) {
|
|
2596
2598
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2597
2599
|
for (const [o, i] of t.entries()) {
|
|
2598
2600
|
const r = document.createElement("div");
|
|
2599
|
-
r.className = "pluno-pa-widget__attachment", r.appendChild(
|
|
2601
|
+
r.className = "pluno-pa-widget__attachment", r.appendChild(or(i));
|
|
2600
2602
|
const l = document.createElement("span");
|
|
2601
2603
|
l.textContent = i.name, r.appendChild(l);
|
|
2602
2604
|
const p = document.createElement("button");
|
|
2603
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2605
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(er()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
|
|
2604
2606
|
}
|
|
2605
2607
|
}
|
|
2606
|
-
function
|
|
2607
|
-
const t =
|
|
2608
|
+
function or(e) {
|
|
2609
|
+
const t = hn(e), n = Mo(e);
|
|
2608
2610
|
if (t === "image" && n) {
|
|
2609
2611
|
const o = document.createElement("img");
|
|
2610
2612
|
return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(se(e))), o;
|
|
@@ -2615,8 +2617,8 @@ function nr(e) {
|
|
|
2615
2617
|
}
|
|
2616
2618
|
return se(e);
|
|
2617
2619
|
}
|
|
2618
|
-
function
|
|
2619
|
-
const t =
|
|
2620
|
+
function ir(e) {
|
|
2621
|
+
const t = hn(e), n = Mo(e);
|
|
2620
2622
|
if (t === "image" && n) {
|
|
2621
2623
|
const o = document.createElement("img");
|
|
2622
2624
|
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(se(e, "message"))), o;
|
|
@@ -2634,109 +2636,109 @@ function or(e) {
|
|
|
2634
2636
|
function se(e, t = "composer") {
|
|
2635
2637
|
if (t === "composer") {
|
|
2636
2638
|
const r = document.createElement("span");
|
|
2637
|
-
return r.className = "pluno-pa-widget__attachment-file", r.textContent =
|
|
2639
|
+
return r.className = "pluno-pa-widget__attachment-file", r.textContent = no(e), r;
|
|
2638
2640
|
}
|
|
2639
2641
|
const n = document.createElement("div");
|
|
2640
2642
|
n.className = "pluno-pa-widget__message-attachment-file";
|
|
2641
2643
|
const o = document.createElement("span");
|
|
2642
|
-
o.textContent =
|
|
2644
|
+
o.textContent = no(e);
|
|
2643
2645
|
const i = document.createElement("strong");
|
|
2644
2646
|
return i.textContent = e.name, n.append(o, i), n;
|
|
2645
2647
|
}
|
|
2646
|
-
function
|
|
2648
|
+
function hn(e) {
|
|
2647
2649
|
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2648
2650
|
}
|
|
2649
|
-
function
|
|
2651
|
+
function Mo(e) {
|
|
2650
2652
|
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2651
2653
|
}
|
|
2652
|
-
function
|
|
2653
|
-
const t =
|
|
2654
|
+
function no(e) {
|
|
2655
|
+
const t = hn(e);
|
|
2654
2656
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2655
2657
|
}
|
|
2656
|
-
function
|
|
2658
|
+
function ar(e, t) {
|
|
2657
2659
|
return t ? Array.from(t).map((o) => ({
|
|
2658
2660
|
...e.createLocalAttachment(o),
|
|
2659
|
-
previewUrl:
|
|
2661
|
+
previewUrl: rr(o)
|
|
2660
2662
|
})) : [];
|
|
2661
2663
|
}
|
|
2662
|
-
function
|
|
2664
|
+
function rr(e) {
|
|
2663
2665
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2664
2666
|
}
|
|
2665
2667
|
function ut(e) {
|
|
2666
2668
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2667
2669
|
}
|
|
2668
|
-
function
|
|
2669
|
-
if (!e || !
|
|
2670
|
+
function Zt(e, t, n = null) {
|
|
2671
|
+
if (!e || !sn(t, n)) {
|
|
2670
2672
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2671
2673
|
return;
|
|
2672
2674
|
}
|
|
2673
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", de(t) ||
|
|
2674
|
-
|
|
2675
|
-
) :
|
|
2675
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", de(t) || mn(n) ? e.appendChild(
|
|
2676
|
+
lr(t, n)
|
|
2677
|
+
) : Oo(t) && e.appendChild(pr(t));
|
|
2676
2678
|
}
|
|
2677
|
-
function
|
|
2679
|
+
function lr(e, t) {
|
|
2678
2680
|
const n = document.createElement("div");
|
|
2679
2681
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
2680
2682
|
const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2681
2683
|
i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
|
|
2682
2684
|
const r = document.createElement("span");
|
|
2683
2685
|
return r.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
|
|
2684
|
-
|
|
2686
|
+
Uo(
|
|
2685
2687
|
e,
|
|
2686
2688
|
"Upgrade plan",
|
|
2687
2689
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2688
2690
|
)
|
|
2689
2691
|
), n;
|
|
2690
2692
|
}
|
|
2691
|
-
function
|
|
2693
|
+
function pr(e) {
|
|
2692
2694
|
const t = document.createElement("div");
|
|
2693
2695
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2694
2696
|
const n = document.createElement("strong");
|
|
2695
2697
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2696
2698
|
const o = document.createElement("span");
|
|
2697
|
-
return o.textContent =
|
|
2698
|
-
|
|
2699
|
+
return o.textContent = dr(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
|
|
2700
|
+
Uo(
|
|
2699
2701
|
e,
|
|
2700
2702
|
"Upgrade",
|
|
2701
2703
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2702
2704
|
)
|
|
2703
2705
|
), t;
|
|
2704
2706
|
}
|
|
2705
|
-
function
|
|
2706
|
-
return e !== null && (de(e) ||
|
|
2707
|
+
function sn(e, t) {
|
|
2708
|
+
return e !== null && (de(e) || Oo(e) || mn(t));
|
|
2707
2709
|
}
|
|
2708
|
-
function
|
|
2709
|
-
return
|
|
2710
|
+
function oo(e, t, n) {
|
|
2711
|
+
return sn(t, n) || sr(t) ? !0 : !sn(e, n);
|
|
2710
2712
|
}
|
|
2711
|
-
function
|
|
2713
|
+
function sr(e) {
|
|
2712
2714
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || de(e));
|
|
2713
2715
|
}
|
|
2714
2716
|
function de(e) {
|
|
2715
2717
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2716
2718
|
}
|
|
2717
|
-
function
|
|
2719
|
+
function mn(e) {
|
|
2718
2720
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2719
2721
|
}
|
|
2720
|
-
function
|
|
2722
|
+
function Oo(e) {
|
|
2721
2723
|
return !de(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2722
2724
|
}
|
|
2723
|
-
function sr(e) {
|
|
2724
|
-
return e.creditsRemaining === null ? null : `${dr(e.creditsRemaining)} credits left`;
|
|
2725
|
-
}
|
|
2726
2725
|
function dr(e) {
|
|
2726
|
+
return e.creditsRemaining === null ? null : `${cr(e.creditsRemaining)} credits left`;
|
|
2727
|
+
}
|
|
2728
|
+
function cr(e) {
|
|
2727
2729
|
return new Intl.NumberFormat("en-US", {
|
|
2728
2730
|
maximumFractionDigits: 0
|
|
2729
2731
|
}).format(Math.ceil(e));
|
|
2730
2732
|
}
|
|
2731
|
-
function
|
|
2733
|
+
function Uo(e, t, n) {
|
|
2732
2734
|
const o = document.createElement("div");
|
|
2733
2735
|
return o.className = n, o.appendChild(
|
|
2734
|
-
|
|
2736
|
+
io(t, e.pricingUrl)
|
|
2735
2737
|
), o.appendChild(
|
|
2736
|
-
|
|
2738
|
+
io("Earn credits", e.earnCreditsUrl)
|
|
2737
2739
|
), o;
|
|
2738
2740
|
}
|
|
2739
|
-
function
|
|
2741
|
+
function io(e, t) {
|
|
2740
2742
|
const n = document.createElement("button");
|
|
2741
2743
|
if (n.type = "button", e === "Earn credits") {
|
|
2742
2744
|
const o = document.createElement("span");
|
|
@@ -2747,18 +2749,18 @@ function oo(e, t) {
|
|
|
2747
2749
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
2748
2750
|
}), n;
|
|
2749
2751
|
}
|
|
2750
|
-
function
|
|
2752
|
+
function Jt(e, t) {
|
|
2751
2753
|
return e.messages.filter(
|
|
2752
|
-
(o) => !
|
|
2754
|
+
(o) => !Bo(o)
|
|
2753
2755
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2754
2756
|
}
|
|
2755
|
-
function
|
|
2756
|
-
const z =
|
|
2757
|
-
(x) => !
|
|
2757
|
+
function ur(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
2758
|
+
const z = fr(r), L = z.filter(
|
|
2759
|
+
(x) => !Bo(x)
|
|
2758
2760
|
), oe = e.scrollTop, J = [], Re = /* @__PURE__ */ new Set(), U = (x) => {
|
|
2759
2761
|
J.push(x);
|
|
2760
2762
|
};
|
|
2761
|
-
|
|
2763
|
+
Wo(n, r.isThinking), i.hidden = !p, p && l !== null && Ao(i, l);
|
|
2762
2764
|
const we = L.length > 0 || !!r.assistantDraft || r.isThinking;
|
|
2763
2765
|
if (o(we), u || L.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
|
|
2764
2766
|
const x = document.createElement("div");
|
|
@@ -2773,7 +2775,7 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2773
2775
|
const y = document.createElement("h2");
|
|
2774
2776
|
y.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", y.textContent = u.opening, x.appendChild(y);
|
|
2775
2777
|
} else
|
|
2776
|
-
x.appendChild(
|
|
2778
|
+
x.appendChild(Io());
|
|
2777
2779
|
const ae = u?.prompts ?? r.starterPrompts, H = document.createElement("div");
|
|
2778
2780
|
if (H.className = ae.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", ae.length === 0 && !r.starterPromptsLoading && H.setAttribute("aria-hidden", "true"), ae.length > 0)
|
|
2779
2781
|
for (const y of ae) {
|
|
@@ -2786,7 +2788,7 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2786
2788
|
const y = document.createElement("button");
|
|
2787
2789
|
y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", y.disabled = !0, y.tabIndex = -1, y.textContent = "Generating example tasks...", H.appendChild(y);
|
|
2788
2790
|
} else
|
|
2789
|
-
for (let y = 0; y <
|
|
2791
|
+
for (let y = 0; y < Xi; y += 1) {
|
|
2790
2792
|
const A = document.createElement("button");
|
|
2791
2793
|
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", H.appendChild(A);
|
|
2792
2794
|
}
|
|
@@ -2794,14 +2796,14 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2794
2796
|
const y = document.createElement("button");
|
|
2795
2797
|
y.type = "button", y.className = "pluno-pa-widget__morning-report-snooze", y.textContent = "Snooze morning report", y.addEventListener("click", v), x.appendChild(y);
|
|
2796
2798
|
}
|
|
2797
|
-
h.clear(), U(x), U(t),
|
|
2799
|
+
h.clear(), U(x), U(t), ao(e, J);
|
|
2798
2800
|
return;
|
|
2799
2801
|
}
|
|
2800
2802
|
let B = null, f = null, Q = [];
|
|
2801
|
-
const De = L.length - 1, Ce = De >= 0 &&
|
|
2803
|
+
const De = L.length - 1, Ce = De >= 0 && dn(L[De]), Se = () => {
|
|
2802
2804
|
if (Q.length === 0)
|
|
2803
2805
|
return !1;
|
|
2804
|
-
const x =
|
|
2806
|
+
const x = Er(
|
|
2805
2807
|
Q,
|
|
2806
2808
|
c,
|
|
2807
2809
|
C,
|
|
@@ -2815,14 +2817,14 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2815
2817
|
Q.push(R);
|
|
2816
2818
|
continue;
|
|
2817
2819
|
}
|
|
2818
|
-
if (
|
|
2820
|
+
if (dn(R)) {
|
|
2819
2821
|
if (x !== De)
|
|
2820
2822
|
continue;
|
|
2821
2823
|
if (Se()) {
|
|
2822
2824
|
const A = _t();
|
|
2823
2825
|
U(A), B = null, f = A;
|
|
2824
2826
|
} else {
|
|
2825
|
-
const A =
|
|
2827
|
+
const A = so(P());
|
|
2826
2828
|
U(A), B = null, f = A;
|
|
2827
2829
|
}
|
|
2828
2830
|
continue;
|
|
@@ -2831,25 +2833,25 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2831
2833
|
if (R.dataType === "run_error" || R.dataType === "run_status") {
|
|
2832
2834
|
Se();
|
|
2833
2835
|
const y = document.createElement("div"), A = R.dataType === "run_error";
|
|
2834
|
-
y.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent =
|
|
2836
|
+
y.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent = po(R.content), U(y), B = A ? y : null, f = A ? null : y;
|
|
2835
2837
|
}
|
|
2836
2838
|
continue;
|
|
2837
2839
|
}
|
|
2838
|
-
const T = Se(), ae =
|
|
2840
|
+
const T = Se(), ae = po(R.content);
|
|
2839
2841
|
if (R.role === "assistant" && !T) {
|
|
2840
|
-
const y =
|
|
2842
|
+
const y = Fo(P());
|
|
2841
2843
|
U(y), B = null, f = y;
|
|
2842
2844
|
}
|
|
2843
|
-
const H =
|
|
2845
|
+
const H = gr(R, ae, h, Re);
|
|
2844
2846
|
U(H), B = H, f = null;
|
|
2845
2847
|
}
|
|
2846
|
-
const j = Se(),
|
|
2847
|
-
if (r.isThinking && !
|
|
2848
|
+
const j = Se(), ot = L[L.length - 1]?.id === "assistant-draft";
|
|
2849
|
+
if (r.isThinking && !ot && !Ce)
|
|
2848
2850
|
if (j) {
|
|
2849
2851
|
const x = _t();
|
|
2850
2852
|
U(x), B = null, f = x;
|
|
2851
2853
|
} else {
|
|
2852
|
-
const x =
|
|
2854
|
+
const x = so(P());
|
|
2853
2855
|
U(x), B = null, f = x;
|
|
2854
2856
|
}
|
|
2855
2857
|
if (r.lastError) {
|
|
@@ -2865,9 +2867,9 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2865
2867
|
}
|
|
2866
2868
|
U(x), B = x, f = null;
|
|
2867
2869
|
}
|
|
2868
|
-
const ie = S && !r.isThinking ?
|
|
2870
|
+
const ie = S && !r.isThinking ? wi(z) : null;
|
|
2869
2871
|
if (S && ie && !S.dismissedCandidateIds.has(ie.id)) {
|
|
2870
|
-
const x =
|
|
2872
|
+
const x = _r(ie, {
|
|
2871
2873
|
isDrafting: S.draftingCandidateId === ie.id,
|
|
2872
2874
|
error: S.error,
|
|
2873
2875
|
characterIconOptions: S.characterIconOptions,
|
|
@@ -2877,18 +2879,18 @@ function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
|
2877
2879
|
});
|
|
2878
2880
|
U(x), S.onSeen(ie), B = null, f = x;
|
|
2879
2881
|
}
|
|
2880
|
-
B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t),
|
|
2882
|
+
B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), mr(h, Re), ao(e, J), s ? tt(e, g) : e.scrollTop = oe;
|
|
2881
2883
|
}
|
|
2882
|
-
function
|
|
2883
|
-
const i =
|
|
2884
|
+
function gr(e, t, n, o) {
|
|
2885
|
+
const i = hr(e, t), r = i ? n.get(i) : void 0;
|
|
2884
2886
|
if (i && r)
|
|
2885
2887
|
return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
|
|
2886
2888
|
const l = document.createElement("div");
|
|
2887
|
-
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ?
|
|
2889
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Lr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(wr(e.attachments));
|
|
2888
2890
|
const p = document.createElement("div");
|
|
2889
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
2891
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(br(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
|
|
2890
2892
|
}
|
|
2891
|
-
function
|
|
2893
|
+
function hr(e, t) {
|
|
2892
2894
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2893
2895
|
id: e.id,
|
|
2894
2896
|
content: t,
|
|
@@ -2906,11 +2908,11 @@ function gr(e, t) {
|
|
|
2906
2908
|
})
|
|
2907
2909
|
});
|
|
2908
2910
|
}
|
|
2909
|
-
function
|
|
2911
|
+
function mr(e, t) {
|
|
2910
2912
|
for (const n of e.keys())
|
|
2911
2913
|
t.has(n) || e.delete(n);
|
|
2912
2914
|
}
|
|
2913
|
-
function
|
|
2915
|
+
function ao(e, t) {
|
|
2914
2916
|
let n = e.firstChild;
|
|
2915
2917
|
for (const o of t) {
|
|
2916
2918
|
if (o === n) {
|
|
@@ -2924,7 +2926,7 @@ function io(e, t) {
|
|
|
2924
2926
|
n = n.nextSibling, e.removeChild(o);
|
|
2925
2927
|
}
|
|
2926
2928
|
}
|
|
2927
|
-
function
|
|
2929
|
+
function fr(e) {
|
|
2928
2930
|
if (!e.assistantDraft)
|
|
2929
2931
|
return [...e.messages];
|
|
2930
2932
|
const t = {
|
|
@@ -2944,7 +2946,7 @@ function mr(e) {
|
|
|
2944
2946
|
if (n === -1)
|
|
2945
2947
|
return [...e.messages, t];
|
|
2946
2948
|
const o = e.messages.findIndex(
|
|
2947
|
-
(r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2949
|
+
(r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && ro(r, t) && dn(r)
|
|
2948
2950
|
);
|
|
2949
2951
|
if (o !== -1)
|
|
2950
2952
|
return [
|
|
@@ -2953,7 +2955,7 @@ function mr(e) {
|
|
|
2953
2955
|
...e.messages.slice(o + 1)
|
|
2954
2956
|
];
|
|
2955
2957
|
let i = n + 1;
|
|
2956
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2958
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && ro(e.messages[i], t); )
|
|
2957
2959
|
i += 1;
|
|
2958
2960
|
return [
|
|
2959
2961
|
...e.messages.slice(0, i),
|
|
@@ -2961,14 +2963,14 @@ function mr(e) {
|
|
|
2961
2963
|
...e.messages.slice(i)
|
|
2962
2964
|
];
|
|
2963
2965
|
}
|
|
2964
|
-
function
|
|
2966
|
+
function dn(e) {
|
|
2965
2967
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2966
2968
|
}
|
|
2967
|
-
function
|
|
2969
|
+
function ro(e, t) {
|
|
2968
2970
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2969
2971
|
}
|
|
2970
|
-
function
|
|
2971
|
-
e.replaceChildren(),
|
|
2972
|
+
function lo(e, t, n, o, i, r, l, p) {
|
|
2973
|
+
e.replaceChildren(), Wo(t, !1), t.disabled = !0, n(!1);
|
|
2972
2974
|
const s = document.createElement("div");
|
|
2973
2975
|
s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2974
2976
|
const g = ve(
|
|
@@ -2986,20 +2988,20 @@ function ro(e, t, n, o, i, r, l, p) {
|
|
|
2986
2988
|
}
|
|
2987
2989
|
e.appendChild(s);
|
|
2988
2990
|
}
|
|
2989
|
-
function
|
|
2991
|
+
function wr(e) {
|
|
2990
2992
|
const t = document.createElement("div");
|
|
2991
2993
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2992
2994
|
for (const n of e)
|
|
2993
|
-
t.appendChild(
|
|
2995
|
+
t.appendChild(ir(n));
|
|
2994
2996
|
return t;
|
|
2995
2997
|
}
|
|
2996
|
-
function
|
|
2998
|
+
function br(e) {
|
|
2997
2999
|
const t = document.createElement("button");
|
|
2998
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
3000
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(tr()), t.addEventListener("click", (n) => {
|
|
2999
3001
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
3000
3002
|
}), t;
|
|
3001
3003
|
}
|
|
3002
|
-
function
|
|
3004
|
+
function _r(e, t) {
|
|
3003
3005
|
const n = document.createElement("article");
|
|
3004
3006
|
n.className = "pluno-pa-widget__share-prompt";
|
|
3005
3007
|
const o = document.createElement("div");
|
|
@@ -3026,7 +3028,7 @@ function br(e, t) {
|
|
|
3026
3028
|
const g = document.createElement("button");
|
|
3027
3029
|
if (g.type = "button", g.disabled = t.isDrafting, g.addEventListener("click", () => {
|
|
3028
3030
|
t.onDraft(e);
|
|
3029
|
-
}), t.isDrafting ? (g.appendChild(
|
|
3031
|
+
}), t.isDrafting ? (g.appendChild(cn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
|
|
3030
3032
|
p.appendChild(s);
|
|
3031
3033
|
else {
|
|
3032
3034
|
const c = document.createElement("button");
|
|
@@ -3040,7 +3042,7 @@ function br(e, t) {
|
|
|
3040
3042
|
}
|
|
3041
3043
|
return o.appendChild(p), n.appendChild(o), n;
|
|
3042
3044
|
}
|
|
3043
|
-
function
|
|
3045
|
+
function xr(e, t) {
|
|
3044
3046
|
const n = document.createElement("div");
|
|
3045
3047
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (u) => {
|
|
3046
3048
|
u.target === n && t.onClose();
|
|
@@ -3059,11 +3061,11 @@ function _r(e, t) {
|
|
|
3059
3061
|
g.className = "pluno-pa-widget__share-dialog-step-header";
|
|
3060
3062
|
const c = document.createElement("strong");
|
|
3061
3063
|
c.textContent = "1) Copy Screenshot", g.appendChild(c);
|
|
3062
|
-
const h =
|
|
3064
|
+
const h = yr(
|
|
3063
3065
|
"Copy Screenshot",
|
|
3064
3066
|
async () => {
|
|
3065
3067
|
try {
|
|
3066
|
-
return await
|
|
3068
|
+
return await bi(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
3067
3069
|
} catch {
|
|
3068
3070
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
3069
3071
|
}
|
|
@@ -3084,9 +3086,9 @@ function _r(e, t) {
|
|
|
3084
3086
|
I.className = "pluno-pa-widget__share-dialog-hint", I.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(I);
|
|
3085
3087
|
const D = document.createElement("footer");
|
|
3086
3088
|
D.className = "pluno-pa-widget__share-dialog-platforms";
|
|
3087
|
-
for (const u of
|
|
3089
|
+
for (const u of vr(e)) {
|
|
3088
3090
|
const v = document.createElement("a");
|
|
3089
|
-
v.href = u.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = u.label, v.setAttribute("aria-label", `Open ${u.label}`), v.appendChild(
|
|
3091
|
+
v.href = u.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = u.label, v.setAttribute("aria-label", `Open ${u.label}`), v.appendChild(Cr(u.id)), D.appendChild(v);
|
|
3090
3092
|
}
|
|
3091
3093
|
if (C.appendChild(D), o.appendChild(C), t.socialPostRewardsUrl) {
|
|
3092
3094
|
const u = document.createElement("div");
|
|
@@ -3094,17 +3096,17 @@ function _r(e, t) {
|
|
|
3094
3096
|
const v = document.createElement("strong");
|
|
3095
3097
|
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", u.appendChild(v);
|
|
3096
3098
|
const m = document.createElement("a");
|
|
3097
|
-
m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(
|
|
3099
|
+
m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Sr()), u.appendChild(m), o.appendChild(u);
|
|
3098
3100
|
}
|
|
3099
3101
|
return n.appendChild(o), n;
|
|
3100
3102
|
}
|
|
3101
|
-
function
|
|
3103
|
+
function yr(e, t) {
|
|
3102
3104
|
const n = document.createElement("button");
|
|
3103
3105
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
3104
3106
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
3105
3107
|
}), n;
|
|
3106
3108
|
}
|
|
3107
|
-
function
|
|
3109
|
+
function vr(e) {
|
|
3108
3110
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
3109
3111
|
return [
|
|
3110
3112
|
{
|
|
@@ -3124,7 +3126,7 @@ function yr(e) {
|
|
|
3124
3126
|
}
|
|
3125
3127
|
];
|
|
3126
3128
|
}
|
|
3127
|
-
function
|
|
3129
|
+
function Cr(e) {
|
|
3128
3130
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3129
3131
|
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" ? (G(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), G(
|
|
3130
3132
|
t,
|
|
@@ -3151,20 +3153,20 @@ function G(e, t, n) {
|
|
|
3151
3153
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3152
3154
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
3153
3155
|
}
|
|
3154
|
-
function
|
|
3156
|
+
function Sr() {
|
|
3155
3157
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3156
3158
|
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), G(e, "M14 5h5v5"), G(e, "M19 5l-8 8"), G(
|
|
3157
3159
|
e,
|
|
3158
3160
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
3159
3161
|
), e;
|
|
3160
3162
|
}
|
|
3161
|
-
function
|
|
3162
|
-
return e.role === "tool" && e.toolName ===
|
|
3163
|
+
function Bo(e) {
|
|
3164
|
+
return e.role === "tool" && e.toolName === bo;
|
|
3163
3165
|
}
|
|
3164
|
-
function
|
|
3166
|
+
function po(e) {
|
|
3165
3167
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
3166
3168
|
}
|
|
3167
|
-
function
|
|
3169
|
+
function Er(e, t, n, o) {
|
|
3168
3170
|
const i = document.createElement("article");
|
|
3169
3171
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
3170
3172
|
e[e.length - 1].createdAt
|
|
@@ -3174,19 +3176,19 @@ function Sr(e, t, n, o) {
|
|
|
3174
3176
|
o
|
|
3175
3177
|
)
|
|
3176
3178
|
);
|
|
3177
|
-
const r = document.createElement("details"), l =
|
|
3179
|
+
const r = document.createElement("details"), l = kr(e);
|
|
3178
3180
|
r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
|
|
3179
3181
|
i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
|
|
3180
3182
|
});
|
|
3181
3183
|
const p = document.createElement("summary");
|
|
3182
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(
|
|
3184
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(cn());
|
|
3183
3185
|
const g = document.createElement("span");
|
|
3184
3186
|
if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = e[e.length - 1].content || "Run tool", p.appendChild(g), r.appendChild(p), e.length > 0) {
|
|
3185
3187
|
const c = document.createElement("div");
|
|
3186
3188
|
c.className = "pluno-pa-widget__tool-lines";
|
|
3187
3189
|
for (const h of e) {
|
|
3188
3190
|
const C = document.createElement("div");
|
|
3189
|
-
C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(
|
|
3191
|
+
C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(cn());
|
|
3190
3192
|
const P = document.createElement("span");
|
|
3191
3193
|
P.textContent = h.content || "Run tool", C.appendChild(P), c.appendChild(C);
|
|
3192
3194
|
}
|
|
@@ -3194,7 +3196,7 @@ function Sr(e, t, n, o) {
|
|
|
3194
3196
|
}
|
|
3195
3197
|
return i.appendChild(r), i;
|
|
3196
3198
|
}
|
|
3197
|
-
function
|
|
3199
|
+
function Fo(e) {
|
|
3198
3200
|
const t = document.createElement("article");
|
|
3199
3201
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
3200
3202
|
ve(
|
|
@@ -3203,8 +3205,8 @@ function Bo(e) {
|
|
|
3203
3205
|
)
|
|
3204
3206
|
), t;
|
|
3205
3207
|
}
|
|
3206
|
-
function
|
|
3207
|
-
const t =
|
|
3208
|
+
function so(e) {
|
|
3209
|
+
const t = Fo(e);
|
|
3208
3210
|
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(_t()), t;
|
|
3209
3211
|
}
|
|
3210
3212
|
function _t(e = "Thinking...") {
|
|
@@ -3215,18 +3217,18 @@ function _t(e = "Thinking...") {
|
|
|
3215
3217
|
const o = document.createElement("span");
|
|
3216
3218
|
return o.textContent = e, t.appendChild(o), t;
|
|
3217
3219
|
}
|
|
3218
|
-
function
|
|
3220
|
+
function kr(e) {
|
|
3219
3221
|
return `tools:${e[0]?.id ?? ""}`;
|
|
3220
3222
|
}
|
|
3221
|
-
function
|
|
3223
|
+
function cn() {
|
|
3222
3224
|
const e = document.createElement("span");
|
|
3223
3225
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
3224
3226
|
}
|
|
3225
|
-
function
|
|
3226
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
3227
|
+
function Wo(e, t) {
|
|
3228
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Qa() : zo());
|
|
3227
3229
|
}
|
|
3228
|
-
function
|
|
3229
|
-
const n =
|
|
3230
|
+
function Lr(e, t) {
|
|
3231
|
+
const n = Ri(t).replace(/\r\n/g, `
|
|
3230
3232
|
`).split(`
|
|
3231
3233
|
`);
|
|
3232
3234
|
let o = 0;
|
|
@@ -3300,7 +3302,7 @@ function gt(e, t) {
|
|
|
3300
3302
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
3301
3303
|
} else {
|
|
3302
3304
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
3303
|
-
if (p &&
|
|
3305
|
+
if (p && Tr(p[2])) {
|
|
3304
3306
|
const s = document.createElement("a");
|
|
3305
3307
|
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
|
|
3306
3308
|
} else
|
|
@@ -3310,7 +3312,7 @@ function gt(e, t) {
|
|
|
3310
3312
|
}
|
|
3311
3313
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
3312
3314
|
}
|
|
3313
|
-
function
|
|
3315
|
+
function Tr(e) {
|
|
3314
3316
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
3315
3317
|
return !0;
|
|
3316
3318
|
try {
|
|
@@ -3320,8 +3322,8 @@ function Lr(e) {
|
|
|
3320
3322
|
return !1;
|
|
3321
3323
|
}
|
|
3322
3324
|
}
|
|
3323
|
-
function
|
|
3324
|
-
if (
|
|
3325
|
+
function co(e, t) {
|
|
3326
|
+
if (Pr(e))
|
|
3325
3327
|
return;
|
|
3326
3328
|
const n = `
|
|
3327
3329
|
:host {
|
|
@@ -5326,8 +5328,8 @@ function so(e, t) {
|
|
|
5326
5328
|
.pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
|
|
5327
5329
|
position: absolute;
|
|
5328
5330
|
top: -16px;
|
|
5329
|
-
left: ${
|
|
5330
|
-
width: calc(100% - ${
|
|
5331
|
+
left: ${an}px;
|
|
5332
|
+
width: calc(100% - ${an * 2}px);
|
|
5331
5333
|
height: 36px;
|
|
5332
5334
|
z-index: 3;
|
|
5333
5335
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -5687,28 +5689,28 @@ function so(e, t) {
|
|
|
5687
5689
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
5688
5690
|
}
|
|
5689
5691
|
`;
|
|
5690
|
-
if (
|
|
5692
|
+
if (Ir(e, n))
|
|
5691
5693
|
return;
|
|
5692
5694
|
const o = e.ownerDocument.createElement("style");
|
|
5693
|
-
o.id =
|
|
5695
|
+
o.id = Lo, o.textContent = n, e.appendChild(o), Ho(e);
|
|
5694
5696
|
}
|
|
5695
|
-
function
|
|
5696
|
-
return e.getElementById(
|
|
5697
|
+
function Pr(e) {
|
|
5698
|
+
return e.getElementById(Lo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(To) === "true";
|
|
5697
5699
|
}
|
|
5698
|
-
function
|
|
5699
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
5700
|
+
function Ho(e) {
|
|
5701
|
+
e.host instanceof HTMLElement && e.host.setAttribute(To, "true");
|
|
5700
5702
|
}
|
|
5701
|
-
function
|
|
5703
|
+
function Ir(e, t) {
|
|
5702
5704
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5703
5705
|
return !1;
|
|
5704
5706
|
try {
|
|
5705
5707
|
const n = new CSSStyleSheet();
|
|
5706
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
5708
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Ho(e), !0;
|
|
5707
5709
|
} catch {
|
|
5708
5710
|
return !1;
|
|
5709
5711
|
}
|
|
5710
5712
|
}
|
|
5711
|
-
async function
|
|
5713
|
+
async function Ar() {
|
|
5712
5714
|
return document.body ? document.body : await new Promise((e) => {
|
|
5713
5715
|
const t = new MutationObserver(() => {
|
|
5714
5716
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -5716,25 +5718,25 @@ async function Ir() {
|
|
|
5716
5718
|
t.observe(document.documentElement, { childList: !0 });
|
|
5717
5719
|
});
|
|
5718
5720
|
}
|
|
5719
|
-
function
|
|
5721
|
+
function fn(e) {
|
|
5720
5722
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5721
5723
|
}
|
|
5722
|
-
function
|
|
5723
|
-
return `${
|
|
5724
|
+
function $o(e) {
|
|
5725
|
+
return `${fn(e)}.displayState`;
|
|
5724
5726
|
}
|
|
5725
|
-
function
|
|
5727
|
+
function Nr(e) {
|
|
5726
5728
|
try {
|
|
5727
5729
|
return window.sessionStorage.getItem(
|
|
5728
|
-
|
|
5730
|
+
$o(e)
|
|
5729
5731
|
) === "minimized" ? "minimized" : "shown";
|
|
5730
5732
|
} catch {
|
|
5731
5733
|
return "shown";
|
|
5732
5734
|
}
|
|
5733
5735
|
}
|
|
5734
|
-
function
|
|
5736
|
+
function uo(e, t) {
|
|
5735
5737
|
if (e.layout === "floating")
|
|
5736
5738
|
try {
|
|
5737
|
-
const n =
|
|
5739
|
+
const n = $o(e);
|
|
5738
5740
|
if (t === "minimized") {
|
|
5739
5741
|
window.sessionStorage.setItem(n, t);
|
|
5740
5742
|
return;
|
|
@@ -5744,15 +5746,15 @@ function co(e, t) {
|
|
|
5744
5746
|
return;
|
|
5745
5747
|
}
|
|
5746
5748
|
}
|
|
5747
|
-
function
|
|
5749
|
+
function Rr(e) {
|
|
5748
5750
|
if (e)
|
|
5749
5751
|
return { clientId: e, release: () => {
|
|
5750
5752
|
} };
|
|
5751
5753
|
let t = 0;
|
|
5752
|
-
for (;
|
|
5754
|
+
for (; $t.has(t); )
|
|
5753
5755
|
t += 1;
|
|
5754
|
-
|
|
5755
|
-
const n = `${
|
|
5756
|
+
$t.add(t);
|
|
5757
|
+
const n = `${Ki}${t}`;
|
|
5756
5758
|
let o = crypto.randomUUID();
|
|
5757
5759
|
try {
|
|
5758
5760
|
o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
|
|
@@ -5762,15 +5764,15 @@ function Nr(e) {
|
|
|
5762
5764
|
return {
|
|
5763
5765
|
clientId: o,
|
|
5764
5766
|
release: () => {
|
|
5765
|
-
i || (i = !0,
|
|
5767
|
+
i || (i = !0, $t.delete(t));
|
|
5766
5768
|
}
|
|
5767
5769
|
};
|
|
5768
5770
|
}
|
|
5769
|
-
function
|
|
5771
|
+
function Dr(e) {
|
|
5770
5772
|
try {
|
|
5771
|
-
const t = window.localStorage.getItem(
|
|
5773
|
+
const t = window.localStorage.getItem(fn(e));
|
|
5772
5774
|
if (!t)
|
|
5773
|
-
return
|
|
5775
|
+
return go();
|
|
5774
5776
|
const n = JSON.parse(t);
|
|
5775
5777
|
return {
|
|
5776
5778
|
isOpen: n.isOpen === !0,
|
|
@@ -5780,25 +5782,25 @@ function Rr(e) {
|
|
|
5780
5782
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
|
|
5781
5783
|
(o) => typeof o == "string"
|
|
5782
5784
|
) : [],
|
|
5783
|
-
launcherPosition:
|
|
5784
|
-
panelSize:
|
|
5785
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
5785
|
+
launcherPosition: Ur(n.launcherPosition) ? n.launcherPosition : null,
|
|
5786
|
+
panelSize: Br(n.panelSize) ? xt(n.panelSize) : null,
|
|
5787
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-_o) : [],
|
|
5786
5788
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
5787
5789
|
};
|
|
5788
5790
|
} catch {
|
|
5789
|
-
return
|
|
5791
|
+
return go();
|
|
5790
5792
|
}
|
|
5791
5793
|
}
|
|
5792
|
-
async function
|
|
5794
|
+
async function zr(e) {
|
|
5793
5795
|
if (e.loadSharePromptsDisabled)
|
|
5794
5796
|
return e.loadSharePromptsDisabled();
|
|
5795
5797
|
try {
|
|
5796
|
-
return window.localStorage.getItem(
|
|
5798
|
+
return window.localStorage.getItem(yo) === "true";
|
|
5797
5799
|
} catch {
|
|
5798
5800
|
return !1;
|
|
5799
5801
|
}
|
|
5800
5802
|
}
|
|
5801
|
-
function
|
|
5803
|
+
function Mr(e, t) {
|
|
5802
5804
|
if (e.persistSharePromptsDisabled) {
|
|
5803
5805
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
5804
5806
|
() => {
|
|
@@ -5807,12 +5809,12 @@ function zr(e, t) {
|
|
|
5807
5809
|
return;
|
|
5808
5810
|
}
|
|
5809
5811
|
try {
|
|
5810
|
-
t && window.localStorage.setItem(
|
|
5812
|
+
t && window.localStorage.setItem(yo, "true");
|
|
5811
5813
|
} catch {
|
|
5812
5814
|
return;
|
|
5813
5815
|
}
|
|
5814
5816
|
}
|
|
5815
|
-
function
|
|
5817
|
+
function go() {
|
|
5816
5818
|
return {
|
|
5817
5819
|
isOpen: !1,
|
|
5818
5820
|
composerValue: "",
|
|
@@ -5825,29 +5827,29 @@ function uo() {
|
|
|
5825
5827
|
sharePromptsDisabled: !1
|
|
5826
5828
|
};
|
|
5827
5829
|
}
|
|
5828
|
-
function
|
|
5830
|
+
function Or(e, t) {
|
|
5829
5831
|
try {
|
|
5830
5832
|
window.localStorage.setItem(
|
|
5831
|
-
|
|
5833
|
+
fn(e),
|
|
5832
5834
|
JSON.stringify(t)
|
|
5833
5835
|
);
|
|
5834
5836
|
} catch {
|
|
5835
5837
|
return;
|
|
5836
5838
|
}
|
|
5837
5839
|
}
|
|
5838
|
-
function
|
|
5840
|
+
function Ur(e) {
|
|
5839
5841
|
if (!e || typeof e != "object")
|
|
5840
5842
|
return !1;
|
|
5841
5843
|
const t = e;
|
|
5842
5844
|
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");
|
|
5843
5845
|
}
|
|
5844
|
-
function
|
|
5846
|
+
function Br(e) {
|
|
5845
5847
|
if (!e || typeof e != "object")
|
|
5846
5848
|
return !1;
|
|
5847
5849
|
const t = e;
|
|
5848
5850
|
return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
|
|
5849
5851
|
}
|
|
5850
|
-
async function
|
|
5852
|
+
async function Go(e, t) {
|
|
5851
5853
|
const n = await fetch(e, {
|
|
5852
5854
|
method: "POST",
|
|
5853
5855
|
credentials: "include",
|
|
@@ -5859,7 +5861,7 @@ async function $o(e, t) {
|
|
|
5859
5861
|
...t ? { signal: t } : {}
|
|
5860
5862
|
});
|
|
5861
5863
|
if (!n.ok) {
|
|
5862
|
-
const i = await n.text(), r =
|
|
5864
|
+
const i = await n.text(), r = di(i);
|
|
5863
5865
|
throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
|
|
5864
5866
|
}
|
|
5865
5867
|
const o = await n.json();
|
|
@@ -5867,15 +5869,15 @@ async function $o(e, t) {
|
|
|
5867
5869
|
throw new Error("Pluno token endpoint did not return a token");
|
|
5868
5870
|
return o.token;
|
|
5869
5871
|
}
|
|
5870
|
-
function
|
|
5872
|
+
function Fr(e) {
|
|
5871
5873
|
let t = !1, n = !1;
|
|
5872
5874
|
const o = async () => {
|
|
5873
5875
|
const i = new AbortController();
|
|
5874
5876
|
let r = !1;
|
|
5875
5877
|
const l = new Promise((p, s) => {
|
|
5876
5878
|
const g = window.setTimeout(() => {
|
|
5877
|
-
r = !0, i.abort(), s(new Error(
|
|
5878
|
-
},
|
|
5879
|
+
r = !0, i.abort(), s(new Error(Fn));
|
|
5880
|
+
}, ji);
|
|
5879
5881
|
i.signal.addEventListener(
|
|
5880
5882
|
"abort",
|
|
5881
5883
|
() => window.clearTimeout(g),
|
|
@@ -5884,12 +5886,12 @@ function Br(e) {
|
|
|
5884
5886
|
});
|
|
5885
5887
|
try {
|
|
5886
5888
|
const p = await Promise.race([
|
|
5887
|
-
|
|
5889
|
+
Go(e, i.signal),
|
|
5888
5890
|
l
|
|
5889
5891
|
]);
|
|
5890
5892
|
return i.abort(), p;
|
|
5891
5893
|
} catch (p) {
|
|
5892
|
-
throw i.abort(), r ? new Error(
|
|
5894
|
+
throw i.abort(), r ? new Error(Fn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Vi);
|
|
5893
5895
|
}
|
|
5894
5896
|
};
|
|
5895
5897
|
return {
|
|
@@ -5912,30 +5914,30 @@ function Br(e) {
|
|
|
5912
5914
|
}
|
|
5913
5915
|
};
|
|
5914
5916
|
}
|
|
5915
|
-
const
|
|
5916
|
-
function
|
|
5917
|
+
const ho = /* @__PURE__ */ new WeakSet();
|
|
5918
|
+
function Wr(e) {
|
|
5917
5919
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5918
5920
|
}
|
|
5919
|
-
function
|
|
5921
|
+
function mo(e) {
|
|
5920
5922
|
const t = e.pathname.split("/");
|
|
5921
5923
|
return t[t.length - 1] ?? "";
|
|
5922
5924
|
}
|
|
5923
|
-
function
|
|
5925
|
+
function Hr(e, t) {
|
|
5924
5926
|
const n = new URL(e.src, document.baseURI);
|
|
5925
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
5927
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : mo(n) === mo(t);
|
|
5926
5928
|
}
|
|
5927
5929
|
class fe extends EventTarget {
|
|
5928
5930
|
constructor(t, n) {
|
|
5929
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
5931
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Wi, () => {
|
|
5930
5932
|
this.readyState = fe.OPEN, this.dispatchEvent(new Event("open"));
|
|
5931
|
-
}), this.addPreviewListener(
|
|
5933
|
+
}), this.addPreviewListener(Hi, (o) => {
|
|
5932
5934
|
const i = o;
|
|
5933
5935
|
this.dispatchEvent(
|
|
5934
5936
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5935
5937
|
);
|
|
5936
|
-
}), this.addPreviewListener(
|
|
5938
|
+
}), this.addPreviewListener($i, () => {
|
|
5937
5939
|
this.readyState = fe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5938
|
-
}), this.addPreviewListener(
|
|
5940
|
+
}), this.addPreviewListener(Gi, (o) => {
|
|
5939
5941
|
const i = o;
|
|
5940
5942
|
this.readyState = fe.CLOSED, this.dispatchEvent(
|
|
5941
5943
|
new CloseEvent("close", {
|
|
@@ -5947,7 +5949,7 @@ class fe extends EventTarget {
|
|
|
5947
5949
|
}), window.dispatchEvent(
|
|
5948
5950
|
new CustomEvent(
|
|
5949
5951
|
ht(
|
|
5950
|
-
|
|
5952
|
+
Ui,
|
|
5951
5953
|
this.channelId
|
|
5952
5954
|
),
|
|
5953
5955
|
{
|
|
@@ -5967,7 +5969,7 @@ class fe extends EventTarget {
|
|
|
5967
5969
|
binaryType = "blob";
|
|
5968
5970
|
bufferedAmount = 0;
|
|
5969
5971
|
readyState = fe.CONNECTING;
|
|
5970
|
-
socketId =
|
|
5972
|
+
socketId = $r();
|
|
5971
5973
|
listeners = /* @__PURE__ */ new Map();
|
|
5972
5974
|
send(t) {
|
|
5973
5975
|
if (this.readyState !== fe.OPEN)
|
|
@@ -5977,7 +5979,7 @@ class fe extends EventTarget {
|
|
|
5977
5979
|
);
|
|
5978
5980
|
window.dispatchEvent(
|
|
5979
5981
|
new CustomEvent(
|
|
5980
|
-
ht(
|
|
5982
|
+
ht(Bi, this.channelId),
|
|
5981
5983
|
{
|
|
5982
5984
|
detail: {
|
|
5983
5985
|
socketId: this.socketId,
|
|
@@ -5990,7 +5992,7 @@ class fe extends EventTarget {
|
|
|
5990
5992
|
close(t, n) {
|
|
5991
5993
|
this.readyState !== fe.CLOSED && (this.readyState = fe.CLOSING, window.dispatchEvent(
|
|
5992
5994
|
new CustomEvent(
|
|
5993
|
-
ht(
|
|
5995
|
+
ht(Fi, this.channelId),
|
|
5994
5996
|
{
|
|
5995
5997
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
5996
5998
|
}
|
|
@@ -6012,19 +6014,19 @@ class fe extends EventTarget {
|
|
|
6012
6014
|
this.listeners.clear();
|
|
6013
6015
|
}
|
|
6014
6016
|
}
|
|
6015
|
-
function
|
|
6017
|
+
function $r() {
|
|
6016
6018
|
const e = window.sessionStorage.getItem(
|
|
6017
|
-
|
|
6019
|
+
Bn
|
|
6018
6020
|
);
|
|
6019
6021
|
if (e)
|
|
6020
6022
|
return e;
|
|
6021
6023
|
const t = crypto.randomUUID();
|
|
6022
|
-
return window.sessionStorage.setItem(
|
|
6024
|
+
return window.sessionStorage.setItem(Bn, t), t;
|
|
6023
6025
|
}
|
|
6024
6026
|
function ht(e, t) {
|
|
6025
6027
|
return `${e}:${t}`;
|
|
6026
6028
|
}
|
|
6027
|
-
function
|
|
6029
|
+
function Gr(e) {
|
|
6028
6030
|
const t = document.currentScript;
|
|
6029
6031
|
if (t instanceof HTMLScriptElement)
|
|
6030
6032
|
return [t];
|
|
@@ -6032,35 +6034,35 @@ function $r(e) {
|
|
|
6032
6034
|
return Array.from(
|
|
6033
6035
|
document.querySelectorAll("script[type='module'][src]")
|
|
6034
6036
|
).filter(
|
|
6035
|
-
(i) => i instanceof HTMLScriptElement &&
|
|
6037
|
+
(i) => i instanceof HTMLScriptElement && Wr(i) && Hr(i, o)
|
|
6036
6038
|
);
|
|
6037
6039
|
}
|
|
6038
|
-
function
|
|
6039
|
-
for (const t of
|
|
6040
|
-
|
|
6040
|
+
function qr(e) {
|
|
6041
|
+
for (const t of Gr(e))
|
|
6042
|
+
ho.has(t) || t.dataset.plunoAutoMount === "false" || (ho.add(t), qo(t).catch((n) => {
|
|
6041
6043
|
console.error("Failed to mount Pluno widget", n);
|
|
6042
6044
|
}));
|
|
6043
6045
|
}
|
|
6044
|
-
function
|
|
6046
|
+
function qo(e) {
|
|
6045
6047
|
const t = window, n = t[me];
|
|
6046
6048
|
if (n) {
|
|
6047
6049
|
if (n.host === null)
|
|
6048
6050
|
return n.mountPromise.catch(() => {
|
|
6049
6051
|
const s = t[me];
|
|
6050
|
-
return s ? s.mountPromise :
|
|
6052
|
+
return s ? s.mountPromise : qo(e);
|
|
6051
6053
|
});
|
|
6052
|
-
if (
|
|
6054
|
+
if (jr(n.host))
|
|
6053
6055
|
return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
|
|
6054
6056
|
n.destroy?.(), delete t[me];
|
|
6055
6057
|
}
|
|
6056
|
-
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ?
|
|
6058
|
+
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Fr(i) : null;
|
|
6057
6059
|
let l;
|
|
6058
|
-
const p =
|
|
6060
|
+
const p = ha({
|
|
6059
6061
|
token: e.dataset.plunoToken,
|
|
6060
6062
|
tokenProvider: r?.loadToken,
|
|
6061
6063
|
tokenEndpoint: i,
|
|
6062
6064
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
6063
|
-
webSocketFactory: o ?
|
|
6065
|
+
webSocketFactory: o ? ga(o) : void 0,
|
|
6064
6066
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
6065
6067
|
accentColor: e.dataset.plunoAccentColor,
|
|
6066
6068
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -6073,7 +6075,7 @@ function Go(e) {
|
|
|
6073
6075
|
return;
|
|
6074
6076
|
}
|
|
6075
6077
|
const g = s.host;
|
|
6076
|
-
g.setAttribute(
|
|
6078
|
+
g.setAttribute(xo, "true"), l.host = g, l.destroy = () => {
|
|
6077
6079
|
t[me] === l && delete t[me], l.host = null, l.destroy = null, s.destroy();
|
|
6078
6080
|
};
|
|
6079
6081
|
}).catch((s) => {
|
|
@@ -6086,11 +6088,11 @@ function Go(e) {
|
|
|
6086
6088
|
retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
|
|
6087
6089
|
}, t[me] = l, p;
|
|
6088
6090
|
}
|
|
6089
|
-
function
|
|
6090
|
-
return e.isConnected && e.getAttribute(
|
|
6091
|
+
function jr(e) {
|
|
6092
|
+
return e.isConnected && e.getAttribute(xo) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|
|
6091
6093
|
}
|
|
6092
|
-
|
|
6094
|
+
qr(import.meta.url);
|
|
6093
6095
|
export {
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
+
ga as createProductAgentPreviewBridgeWebSocketFactory,
|
|
6097
|
+
ha as mountPlunoProductAgentWidget
|
|
6096
6098
|
};
|