@pluno/product-agent-web 0.1.23 → 0.1.24
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/index.d.ts +16 -0
- package/dist/product-agent-sdk.js +207 -169
- package/dist/product-agent-widget.js +813 -801
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { PlunoProductAgent as Ot } from "./product-agent-sdk.js";
|
|
2
2
|
const Bt = "#7c3aed";
|
|
3
|
-
function Ft(
|
|
4
|
-
const
|
|
3
|
+
function Ft(t) {
|
|
4
|
+
const e = Ht(t);
|
|
5
5
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
6
6
|
<defs>
|
|
7
7
|
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
8
|
-
<stop offset="0" stop-color="${
|
|
9
|
-
<stop offset="0.36" stop-color="${
|
|
10
|
-
<stop offset="0.72" stop-color="${
|
|
11
|
-
<stop offset="1" stop-color="${
|
|
8
|
+
<stop offset="0" stop-color="${e.top}"/>
|
|
9
|
+
<stop offset="0.36" stop-color="${e.middle}"/>
|
|
10
|
+
<stop offset="0.72" stop-color="${e.bottom}"/>
|
|
11
|
+
<stop offset="1" stop-color="${e.bottom}"/>
|
|
12
12
|
</linearGradient>
|
|
13
13
|
<linearGradient id="boltEdge" x1="470" y1="145" x2="900" y2="980" gradientUnits="userSpaceOnUse">
|
|
14
|
-
<stop offset="0" stop-color="${
|
|
15
|
-
<stop offset="0.32" stop-color="${
|
|
16
|
-
<stop offset="0.78" stop-color="${
|
|
17
|
-
<stop offset="1" stop-color="${
|
|
14
|
+
<stop offset="0" stop-color="${e.edgeStart}"/>
|
|
15
|
+
<stop offset="0.32" stop-color="${e.edgeMiddle}"/>
|
|
16
|
+
<stop offset="0.78" stop-color="${e.edgeEnd}"/>
|
|
17
|
+
<stop offset="1" stop-color="${e.edgeEnd}"/>
|
|
18
18
|
</linearGradient>
|
|
19
19
|
<radialGradient id="boltGlow" cx="50%" cy="22%" r="82%">
|
|
20
|
-
<stop offset="0" stop-color="${
|
|
21
|
-
<stop offset="0.5" stop-color="${
|
|
22
|
-
<stop offset="1" stop-color="${
|
|
20
|
+
<stop offset="0" stop-color="${e.glow}" stop-opacity="0.72"/>
|
|
21
|
+
<stop offset="0.5" stop-color="${e.middle}" stop-opacity="0.44"/>
|
|
22
|
+
<stop offset="1" stop-color="${e.bottom}" stop-opacity="0"/>
|
|
23
23
|
</radialGradient>
|
|
24
24
|
<radialGradient id="eyeWhite" cx="35%" cy="25%" r="70%">
|
|
25
25
|
<stop offset="0" stop-color="#ffffff"/>
|
|
@@ -32,7 +32,7 @@ function Ft(e) {
|
|
|
32
32
|
<stop offset="1" stop-color="#000000"/>
|
|
33
33
|
</radialGradient>
|
|
34
34
|
<filter id="softDropShadow" x="-18%" y="-12%" width="136%" height="136%" color-interpolation-filters="sRGB">
|
|
35
|
-
<feDropShadow dx="0" dy="12" stdDeviation="18" flood-color="${
|
|
35
|
+
<feDropShadow dx="0" dy="12" stdDeviation="18" flood-color="${e.shadow}" flood-opacity="0.24"/>
|
|
36
36
|
</filter>
|
|
37
37
|
<filter id="innerDepth" x="-8%" y="-8%" width="116%" height="116%" color-interpolation-filters="sRGB">
|
|
38
38
|
<feGaussianBlur in="SourceAlpha" stdDeviation="8" result="blur"/>
|
|
@@ -42,7 +42,7 @@ function Ft(e) {
|
|
|
42
42
|
<feBlend in="SourceGraphic" in2="innerLight" mode="screen"/>
|
|
43
43
|
</filter>
|
|
44
44
|
<filter id="eyeShadow" x="-24%" y="-20%" width="148%" height="148%" color-interpolation-filters="sRGB">
|
|
45
|
-
<feDropShadow dx="0" dy="8" stdDeviation="5" flood-color="${
|
|
45
|
+
<feDropShadow dx="0" dy="8" stdDeviation="5" flood-color="${e.shadow}" flood-opacity="0.3"/>
|
|
46
46
|
</filter>
|
|
47
47
|
<filter id="pupilGloss" x="-15%" y="-15%" width="130%" height="130%" color-interpolation-filters="sRGB">
|
|
48
48
|
<feDropShadow dx="0" dy="3" stdDeviation="3" flood-color="#000000" flood-opacity="0.22"/>
|
|
@@ -56,9 +56,9 @@ function Ft(e) {
|
|
|
56
56
|
<path d="M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z" fill="url(#boltFill)" filter="url(#innerDepth)"/>
|
|
57
57
|
<path d="M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z" fill="url(#boltGlow)" opacity="0.74"/>
|
|
58
58
|
<g clip-path="url(#boltClip)" opacity="0.42">
|
|
59
|
-
<path d="M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626" fill="none" stroke="${
|
|
60
|
-
<path d="M556 685 L501 994" fill="none" stroke="${
|
|
61
|
-
<path d="M858 160 C882 166 893 181 883 204" fill="none" stroke="${
|
|
59
|
+
<path d="M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626" fill="none" stroke="${e.highlight}" stroke-width="22" stroke-linecap="round" opacity="0.65"/>
|
|
60
|
+
<path d="M556 685 L501 994" fill="none" stroke="${e.highlight}" stroke-width="20" stroke-linecap="round" opacity="0.55"/>
|
|
61
|
+
<path d="M858 160 C882 166 893 181 883 204" fill="none" stroke="${e.inner}" stroke-width="18" stroke-linecap="round" opacity="0.48"/>
|
|
62
62
|
</g>
|
|
63
63
|
</g>
|
|
64
64
|
<g filter="url(#eyeShadow)">
|
|
@@ -75,23 +75,23 @@ function Ft(e) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function zt(
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(Ft(
|
|
78
|
+
function zt(t) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(Ft(t))}`;
|
|
80
80
|
}
|
|
81
|
-
const j = "#2c2a1e",
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
86
|
-
let o = te(
|
|
81
|
+
const j = "#2c2a1e", $e = [253, 250, 241], He = 3.5;
|
|
82
|
+
function dt(t) {
|
|
83
|
+
const e = ct(t);
|
|
84
|
+
if (We(te(e), $e) >= He)
|
|
85
|
+
return e;
|
|
86
|
+
let o = te(e);
|
|
87
87
|
const a = te(j);
|
|
88
88
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o =
|
|
89
|
+
if (o = Wt(o, a, 0.22), We(o, $e) >= He)
|
|
90
90
|
return Ce(o);
|
|
91
91
|
return Ce(o);
|
|
92
92
|
}
|
|
93
|
-
function Gt(
|
|
94
|
-
const
|
|
93
|
+
function Gt(t) {
|
|
94
|
+
const e = dt(t), n = "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";
|
|
95
95
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
96
|
<defs>
|
|
97
97
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,7 +104,7 @@ function Gt(e) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${$t()}" fill="none" stroke="${
|
|
107
|
+
<path d="${$t()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
108
|
</g>
|
|
109
109
|
<path d="${n}" fill="none" stroke="${j}" stroke-width="18" stroke-linejoin="round"/>
|
|
110
110
|
<g transform="rotate(-2 528 463)">
|
|
@@ -120,8 +120,8 @@ function Gt(e) {
|
|
|
120
120
|
</g>
|
|
121
121
|
</svg>`;
|
|
122
122
|
}
|
|
123
|
-
function Ut(
|
|
124
|
-
return `data:image/svg+xml,${encodeURIComponent(Gt(
|
|
123
|
+
function Ut(t) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(Gt(t))}`;
|
|
125
125
|
}
|
|
126
126
|
function $t() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
@@ -131,8 +131,8 @@ function $t() {
|
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const
|
|
134
|
+
function Ht(t) {
|
|
135
|
+
const e = ct(t), n = Ee(te(e));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -156,90 +156,90 @@ function Wt(e) {
|
|
|
156
156
|
inner: "#4b4b4b",
|
|
157
157
|
shadow: "#000000"
|
|
158
158
|
} : {
|
|
159
|
-
top: I(
|
|
160
|
-
middle: I(
|
|
161
|
-
bottom: I(
|
|
162
|
-
edgeStart: I(
|
|
163
|
-
edgeMiddle: I(
|
|
164
|
-
edgeEnd: I(
|
|
165
|
-
glow: I(
|
|
166
|
-
highlight: I(
|
|
167
|
-
inner: I(
|
|
168
|
-
shadow: I(
|
|
159
|
+
top: I(e, 0.28, -0.03),
|
|
160
|
+
middle: I(e, 0.08, 0.04),
|
|
161
|
+
bottom: I(e, -0.1, 0.02),
|
|
162
|
+
edgeStart: I(e, 0.08, 0.08),
|
|
163
|
+
edgeMiddle: I(e, -0.08, 0.08),
|
|
164
|
+
edgeEnd: I(e, -0.18, 0.05),
|
|
165
|
+
glow: I(e, 0.32, -0.12),
|
|
166
|
+
highlight: I(e, 0.38, -0.18),
|
|
167
|
+
inner: I(e, 0.24, -0.1),
|
|
168
|
+
shadow: I(e, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
173
|
-
return /^#[0-9a-f]{6}$/i.test(
|
|
171
|
+
function ct(t) {
|
|
172
|
+
const e = t.trim();
|
|
173
|
+
return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Bt;
|
|
174
174
|
}
|
|
175
|
-
function te(
|
|
175
|
+
function te(t) {
|
|
176
176
|
return [
|
|
177
|
-
Number.parseInt(
|
|
178
|
-
Number.parseInt(
|
|
179
|
-
Number.parseInt(
|
|
177
|
+
Number.parseInt(t.slice(1, 3), 16),
|
|
178
|
+
Number.parseInt(t.slice(3, 5), 16),
|
|
179
|
+
Number.parseInt(t.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function Ce([
|
|
182
|
+
function Ce([t, e, n]) {
|
|
183
183
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
|
-
return `#${o(
|
|
184
|
+
return `#${o(t)}${o(e)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function Ee([
|
|
186
|
+
function Ee([t, e, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
188
|
const i = a / 255;
|
|
189
189
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
|
-
return 0.2126 * o(
|
|
191
|
+
return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n = Ee(
|
|
193
|
+
function We(t, e) {
|
|
194
|
+
const n = Ee(t), o = Ee(e), [a, i] = n > o ? [n, o] : [o, n];
|
|
195
195
|
return (a + 0.05) / (i + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Wt(t, e, n) {
|
|
198
198
|
const o = ke(n);
|
|
199
199
|
return [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
t[0] + (e[0] - t[0]) * o,
|
|
201
|
+
t[1] + (e[1] - t[1]) * o,
|
|
202
|
+
t[2] + (e[2] - t[2]) * o
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
|
-
function I(
|
|
206
|
-
const [o, a, i] = Vt(te(
|
|
207
|
-
return Ce(qt(o, ke(a + n), ke(i +
|
|
205
|
+
function I(t, e, n) {
|
|
206
|
+
const [o, a, i] = Vt(te(t));
|
|
207
|
+
return Ce(qt(o, ke(a + n), ke(i + e)));
|
|
208
208
|
}
|
|
209
|
-
function Vt([
|
|
210
|
-
const o =
|
|
209
|
+
function Vt([t, e, n]) {
|
|
210
|
+
const o = t / 255, a = e / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), s = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
212
|
return [0, 0, s];
|
|
213
|
-
const g = l - p,
|
|
214
|
-
return [(l === o ? (a - i) / g + (a < i ? 6 : 0) : l === a ? (i - o) / g + 2 : (o - a) / g + 4) / 6,
|
|
213
|
+
const g = l - p, u = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
214
|
+
return [(l === o ? (a - i) / g + (a < i ? 6 : 0) : l === a ? (i - o) / g + 2 : (o - a) / g + 4) / 6, u, s];
|
|
215
215
|
}
|
|
216
|
-
function qt(
|
|
217
|
-
if (
|
|
216
|
+
function qt(t, e, n) {
|
|
217
|
+
if (e === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
|
-
const o = n < 0.5 ? n * (1 +
|
|
219
|
+
const o = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
we(a, o,
|
|
222
|
-
we(a, o,
|
|
223
|
-
we(a, o,
|
|
221
|
+
we(a, o, t + 1 / 3) * 255,
|
|
222
|
+
we(a, o, t) * 255,
|
|
223
|
+
we(a, o, t - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function we(
|
|
226
|
+
function we(t, e, n) {
|
|
227
227
|
let o = n;
|
|
228
|
-
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ?
|
|
228
|
+
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? t + (e - t) * 6 * o : o < 1 / 2 ? e : o < 2 / 3 ? t + (e - t) * (2 / 3 - o) * 6 : t;
|
|
229
229
|
}
|
|
230
|
-
function ke(
|
|
231
|
-
return Math.max(0, Math.min(1,
|
|
230
|
+
function ke(t) {
|
|
231
|
+
return Math.max(0, Math.min(1, t));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function jt(
|
|
235
|
-
for (let
|
|
236
|
-
const n = e
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
233
|
+
const ut = "suggest_share_on_socials";
|
|
234
|
+
function jt(t) {
|
|
235
|
+
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
236
|
+
const n = t[e];
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== ut)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = Ve(t, e, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = Ve(t, o.index, "user");
|
|
243
243
|
return a ? {
|
|
244
244
|
id: `share:${n.callId ?? n.id}`,
|
|
245
245
|
userPrompt: a.content,
|
|
@@ -248,24 +248,24 @@ function jt(e) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
async function Kt(
|
|
252
|
-
const
|
|
251
|
+
async function Kt(t) {
|
|
252
|
+
const e = await Yt(t);
|
|
253
253
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
254
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
|
-
await navigator.clipboard.write([new ClipboardItem({ [
|
|
255
|
+
await navigator.clipboard.write([new ClipboardItem({ [e.type || "image/png"]: e })]);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
for (let o =
|
|
259
|
-
const a =
|
|
257
|
+
function Ve(t, e, n) {
|
|
258
|
+
for (let o = e - 1; o >= 0; o -= 1) {
|
|
259
|
+
const a = t[o];
|
|
260
260
|
if (a.role === n && a.content.trim())
|
|
261
261
|
return { index: o, content: a.content.trim() };
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function Yt(
|
|
266
|
-
return await (await fetch(
|
|
265
|
+
async function Yt(t) {
|
|
266
|
+
return await (await fetch(t)).blob();
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const gt = 100, Xt = "product-agent:sdk-preview-socket-connect", Zt = "product-agent:sdk-preview-socket-send", Jt = "product-agent:sdk-preview-socket-close", Qt = "product-agent:sdk-preview-socket-open", en = "product-agent:sdk-preview-socket-message", tn = "product-agent:sdk-preview-socket-error", nn = "product-agent:sdk-preview-socket-closed", qe = "product-agent:sdk-preview-socket-id", on = "product-agent:preview-diagnostic", ht = "pluno.productAgent.sharePromptsDisabled", de = 10, an = 10 * 1024 * 1024, rn = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), M = {
|
|
269
269
|
launcherLabel: "Ask for anything...",
|
|
270
270
|
accentColor: "#7c3aed",
|
|
271
271
|
colorScheme: "light",
|
|
@@ -273,83 +273,83 @@ const ht = 100, Xt = "product-agent:sdk-preview-socket-connect", Zt = "product-a
|
|
|
273
273
|
scribbleStyle: !1,
|
|
274
274
|
position: "bottom-right",
|
|
275
275
|
movableLauncher: !1
|
|
276
|
-
},
|
|
277
|
-
function yn(
|
|
278
|
-
return (
|
|
279
|
-
}
|
|
280
|
-
async function Cn(
|
|
281
|
-
const
|
|
282
|
-
launcherLabel:
|
|
283
|
-
accentColor:
|
|
284
|
-
colorScheme:
|
|
285
|
-
fontFamily:
|
|
286
|
-
scribbleStyle:
|
|
287
|
-
position:
|
|
288
|
-
movableLauncher:
|
|
289
|
-
token:
|
|
290
|
-
tokenProvider:
|
|
291
|
-
tokenEndpoint:
|
|
292
|
-
backendUrl:
|
|
293
|
-
metadata:
|
|
294
|
-
initialStarterPrompts:
|
|
295
|
-
clientId:
|
|
296
|
-
restorePersistedState:
|
|
297
|
-
expectedPersistedSessionId:
|
|
298
|
-
webSocketFactory:
|
|
299
|
-
loginRequired:
|
|
300
|
-
loginButtonLabel:
|
|
301
|
-
onLoginClick:
|
|
302
|
-
socialPostDraftHandler:
|
|
303
|
-
billingStatus:
|
|
304
|
-
billingStatusLoader:
|
|
305
|
-
socialPostRewardsUrl:
|
|
306
|
-
loadSharePromptsDisabled:
|
|
307
|
-
persistSharePromptsDisabled:
|
|
276
|
+
}, je = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', ln = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Ke = "pluno-pa-scribble-font", mt = 190, ft = 41, pn = 48, sn = 420, dn = 520, cn = 0.24, un = 680, gn = 800, hn = 0.76, A = 8, Se = 50, mn = "http://www.w3.org/2000/svg", fn = 11, bn = 13, wn = 4, _n = 10, xn = 40, vn = "movable-launcher-position-v2";
|
|
277
|
+
function yn(t) {
|
|
278
|
+
return (e) => new O(e, t);
|
|
279
|
+
}
|
|
280
|
+
async function Cn(t = {}) {
|
|
281
|
+
const e = {
|
|
282
|
+
launcherLabel: t.launcherLabel ?? M.launcherLabel,
|
|
283
|
+
accentColor: t.accentColor ?? M.accentColor,
|
|
284
|
+
colorScheme: t.colorScheme ?? M.colorScheme,
|
|
285
|
+
fontFamily: t.fontFamily ?? M.fontFamily,
|
|
286
|
+
scribbleStyle: t.scribbleStyle ?? M.scribbleStyle,
|
|
287
|
+
position: t.position ?? M.position,
|
|
288
|
+
movableLauncher: t.movableLauncher ?? M.movableLauncher,
|
|
289
|
+
token: t.token,
|
|
290
|
+
tokenProvider: t.tokenProvider,
|
|
291
|
+
tokenEndpoint: t.tokenEndpoint,
|
|
292
|
+
backendUrl: t.backendUrl,
|
|
293
|
+
metadata: t.metadata,
|
|
294
|
+
initialStarterPrompts: t.initialStarterPrompts,
|
|
295
|
+
clientId: t.clientId,
|
|
296
|
+
restorePersistedState: t.restorePersistedState,
|
|
297
|
+
expectedPersistedSessionId: t.expectedPersistedSessionId,
|
|
298
|
+
webSocketFactory: t.webSocketFactory,
|
|
299
|
+
loginRequired: t.loginRequired === !0,
|
|
300
|
+
loginButtonLabel: t.loginButtonLabel ?? "Log in to Pluno",
|
|
301
|
+
onLoginClick: t.onLoginClick,
|
|
302
|
+
socialPostDraftHandler: t.socialPostDraftHandler,
|
|
303
|
+
billingStatus: t.billingStatus ?? null,
|
|
304
|
+
billingStatusLoader: t.billingStatusLoader,
|
|
305
|
+
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
306
|
+
loadSharePromptsDisabled: t.loadSharePromptsDisabled,
|
|
307
|
+
persistSharePromptsDisabled: t.persistSharePromptsDisabled
|
|
308
308
|
};
|
|
309
309
|
U("web-sdk.widget", "Mounting widget with merged options", {
|
|
310
|
-
accentColor:
|
|
311
|
-
colorScheme:
|
|
312
|
-
fontFamily:
|
|
313
|
-
backendUrl:
|
|
314
|
-
hasToken: !!
|
|
315
|
-
hasTokenProvider: !!
|
|
316
|
-
hasTokenEndpoint: !!
|
|
317
|
-
hasWebSocketFactory: !!
|
|
318
|
-
initialStarterPromptCount:
|
|
310
|
+
accentColor: e.accentColor,
|
|
311
|
+
colorScheme: e.colorScheme,
|
|
312
|
+
fontFamily: e.fontFamily,
|
|
313
|
+
backendUrl: e.backendUrl,
|
|
314
|
+
hasToken: !!e.token,
|
|
315
|
+
hasTokenProvider: !!e.tokenProvider,
|
|
316
|
+
hasTokenEndpoint: !!e.tokenEndpoint,
|
|
317
|
+
hasWebSocketFactory: !!e.webSocketFactory,
|
|
318
|
+
initialStarterPromptCount: e.initialStarterPrompts?.length ?? 0
|
|
319
319
|
});
|
|
320
320
|
const n = document.createElement("div");
|
|
321
|
-
n.className = "pluno-pa-widget-host";
|
|
321
|
+
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
322
322
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
323
|
-
a.className = `pluno-pa-widget pluno-pa-widget--${
|
|
324
|
-
let i =
|
|
325
|
-
|
|
326
|
-
const l = await
|
|
327
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${
|
|
328
|
-
accentColor:
|
|
329
|
-
colorScheme:
|
|
330
|
-
fontFamily:
|
|
331
|
-
scribbleStyle:
|
|
323
|
+
a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
324
|
+
let i = Ye(e.accentColor, e.scribbleStyle);
|
|
325
|
+
Tn(a, e.launcherLabel, i, e.movableLauncher), o.appendChild(a);
|
|
326
|
+
const l = await xo(), p = l.ownerDocument;
|
|
327
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), rt(o, e.accentColor), Xe(a, i, {
|
|
328
|
+
accentColor: e.accentColor,
|
|
329
|
+
colorScheme: e.colorScheme,
|
|
330
|
+
fontFamily: e.fontFamily,
|
|
331
|
+
scribbleStyle: e.scribbleStyle
|
|
332
332
|
}), U("web-sdk.widget", "Applied initial widget appearance", {
|
|
333
|
-
accentColor:
|
|
334
|
-
colorScheme:
|
|
335
|
-
fontFamily:
|
|
333
|
+
accentColor: e.accentColor,
|
|
334
|
+
colorScheme: e.colorScheme,
|
|
335
|
+
fontFamily: e.fontFamily,
|
|
336
336
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
337
337
|
});
|
|
338
|
-
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"),
|
|
339
|
-
if (!s || !
|
|
338
|
+
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), u = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), w = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), m = a.querySelector(".pluno-pa-widget__billing-status"), f = a.querySelector(".pluno-pa-widget__attachments"), d = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), _ = a.querySelector(".pluno-pa-widget__new-chat"), k = a.querySelector(".pluno-pa-widget__timeline");
|
|
339
|
+
if (!s || !u || !b || !w || !x || !C || !m || !f || !d || !h || !_ || !k)
|
|
340
340
|
throw new Error("Failed to mount Pluno widget");
|
|
341
|
-
if (
|
|
341
|
+
if (e.movableLauncher && !g)
|
|
342
342
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
343
|
-
|
|
343
|
+
Qe(u), Qe(d);
|
|
344
344
|
let v = [], y = null;
|
|
345
345
|
const T = () => {
|
|
346
|
-
|
|
347
|
-
v = v.filter((
|
|
346
|
+
Hn(f, v, (r) => {
|
|
347
|
+
v = v.filter((c, L) => L !== r), T(), D();
|
|
348
348
|
});
|
|
349
|
-
}, ne =
|
|
350
|
-
if (!
|
|
349
|
+
}, ne = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
|
|
350
|
+
if (!e.tokenEndpoint)
|
|
351
351
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
352
|
-
const r = await fetch(
|
|
352
|
+
const r = await fetch(e.tokenEndpoint, {
|
|
353
353
|
method: "POST",
|
|
354
354
|
credentials: "include",
|
|
355
355
|
headers: { "content-type": "application/json" },
|
|
@@ -357,51 +357,51 @@ async function Cn(e = {}) {
|
|
|
357
357
|
});
|
|
358
358
|
if (!r.ok)
|
|
359
359
|
throw new Error("Failed to load Pluno token");
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
360
|
+
const c = await r.json();
|
|
361
|
+
if (!c.token)
|
|
362
362
|
throw new Error("Pluno token endpoint did not return a token");
|
|
363
|
-
return
|
|
363
|
+
return c.token;
|
|
364
364
|
});
|
|
365
365
|
let E;
|
|
366
366
|
E = await Ot.init({
|
|
367
|
-
token:
|
|
367
|
+
token: e.token,
|
|
368
368
|
tokenProvider: ne,
|
|
369
|
-
backendUrl:
|
|
369
|
+
backendUrl: e.backendUrl,
|
|
370
370
|
metadata: () => ({
|
|
371
|
-
...
|
|
372
|
-
...!E.getState().sessionId &&
|
|
371
|
+
...e.metadata ?? {},
|
|
372
|
+
...!E.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
373
373
|
}),
|
|
374
|
-
initialStarterPrompts:
|
|
375
|
-
clientId:
|
|
376
|
-
restorePersistedState:
|
|
377
|
-
expectedPersistedSessionId:
|
|
378
|
-
webSocketFactory:
|
|
379
|
-
autoConnect:
|
|
374
|
+
initialStarterPrompts: e.initialStarterPrompts,
|
|
375
|
+
clientId: e.clientId,
|
|
376
|
+
restorePersistedState: e.restorePersistedState,
|
|
377
|
+
expectedPersistedSessionId: e.expectedPersistedSessionId,
|
|
378
|
+
webSocketFactory: e.webSocketFactory,
|
|
379
|
+
autoConnect: e.loginRequired ? !1 : void 0
|
|
380
380
|
});
|
|
381
|
-
const z =
|
|
382
|
-
let ue = z.sharePromptsDisabled || await
|
|
381
|
+
const z = vo(e), ce = new Set(z.openToolGroupKeys), $ = new Set(z.seenShareCandidateIds), oe = new Set($);
|
|
382
|
+
let ue = z.sharePromptsDisabled || await yo(e), R = e.movableLauncher ? z.launcherPosition : null, Te = R !== null, B = null, Ie = !1;
|
|
383
383
|
const Pt = () => {
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
384
|
+
Ie || typeof document > "u" || (rt(o, e.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
385
|
+
}, Re = new MutationObserver(Pt);
|
|
386
|
+
Re.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
387
387
|
const ge = (r = !0) => {
|
|
388
|
-
const
|
|
388
|
+
const c = Le(a, r);
|
|
389
389
|
return Ze(
|
|
390
390
|
a,
|
|
391
|
-
R ??
|
|
392
|
-
|
|
391
|
+
R ?? Sn(a, e.position, c),
|
|
392
|
+
c
|
|
393
393
|
);
|
|
394
|
-
},
|
|
395
|
-
|
|
394
|
+
}, N = () => {
|
|
395
|
+
Eo(e, {
|
|
396
396
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
397
|
-
composerValue:
|
|
397
|
+
composerValue: d.value,
|
|
398
398
|
openToolGroupKeys: [...ce],
|
|
399
|
-
launcherPosition:
|
|
400
|
-
seenShareCandidateIds: [...$].slice(-
|
|
399
|
+
launcherPosition: Te ? R : null,
|
|
400
|
+
seenShareCandidateIds: [...$].slice(-gt),
|
|
401
401
|
sharePromptsDisabled: ue
|
|
402
402
|
});
|
|
403
|
-
}, G = (r,
|
|
404
|
-
|
|
403
|
+
}, G = (r, c = {}) => {
|
|
404
|
+
Dn(r, {
|
|
405
405
|
debugVersion: vn,
|
|
406
406
|
launcherPosition: R,
|
|
407
407
|
rootClasses: a.className,
|
|
@@ -417,97 +417,94 @@ async function Cn(e = {}) {
|
|
|
417
417
|
viewport: Y(),
|
|
418
418
|
panelHidden: b.hidden,
|
|
419
419
|
closeHidden: w.hidden,
|
|
420
|
-
...
|
|
420
|
+
...c
|
|
421
421
|
});
|
|
422
422
|
}, ae = (r = !0) => {
|
|
423
423
|
if (!R)
|
|
424
424
|
return re(a, null), ge(r);
|
|
425
|
-
const
|
|
426
|
-
return re(a,
|
|
427
|
-
},
|
|
428
|
-
if (!r || !
|
|
429
|
-
|
|
425
|
+
const c = ge(r);
|
|
426
|
+
return re(a, c), G("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
|
|
427
|
+
}, Me = (r, c) => {
|
|
428
|
+
if (!r || !c) {
|
|
429
|
+
Nn(a);
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
432
|
An(a, {
|
|
433
|
-
x: r.x -
|
|
434
|
-
y: r.y -
|
|
433
|
+
x: r.x - c.x,
|
|
434
|
+
y: r.y - c.y
|
|
435
435
|
});
|
|
436
|
-
},
|
|
436
|
+
}, Oe = () => {
|
|
437
437
|
const r = ae();
|
|
438
438
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
439
|
-
const
|
|
440
|
-
|
|
439
|
+
const c = Je(a, r, e.position);
|
|
440
|
+
Me(c, r), G("Applied open panel position after viewport resize", { openPanelPosition: c });
|
|
441
441
|
} else R && G("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
442
442
|
};
|
|
443
|
-
let
|
|
443
|
+
let Be = () => {
|
|
444
444
|
};
|
|
445
|
-
|
|
445
|
+
window.addEventListener("resize", Oe), e.movableLauncher && g ? (ae(), Be = kn({
|
|
446
446
|
root: a,
|
|
447
447
|
launcherDragHandle: g,
|
|
448
448
|
getPosition: () => ge(),
|
|
449
449
|
setPosition: (r) => {
|
|
450
|
-
const
|
|
451
|
-
R = Ze(a, r,
|
|
450
|
+
const c = r;
|
|
451
|
+
R = Ze(a, r, Le(a)), re(a, R), G("Dragging closed launcher", { requestedPosition: c });
|
|
452
452
|
},
|
|
453
453
|
persist: () => {
|
|
454
|
-
|
|
454
|
+
Te = !0, N(), G("Persisted closed launcher drag position");
|
|
455
455
|
}
|
|
456
456
|
})) : re(a, null);
|
|
457
457
|
let he = !1;
|
|
458
|
-
const
|
|
459
|
-
if (!(!
|
|
458
|
+
const Fe = async () => {
|
|
459
|
+
if (!(!e.billingStatusLoader || he)) {
|
|
460
460
|
he = !0;
|
|
461
461
|
try {
|
|
462
|
-
const r = await
|
|
463
|
-
|
|
462
|
+
const r = await e.billingStatusLoader();
|
|
463
|
+
tt(e.billingStatus, r, E.getState().lastErrorCode) && (e.billingStatus = r, ye(m, e.billingStatus, E.getState().lastErrorCode), D());
|
|
464
464
|
} finally {
|
|
465
465
|
he = !1;
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
},
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
Qe(a);
|
|
474
|
-
if (!d) {
|
|
475
|
-
a.classList.add("pluno-pa-widget--open"), s.hidden = !0, r && (u.value = r, ee(u)), k.scrollTop = k.scrollHeight, u.focus(), u.setSelectionRange(u.value.length, u.value.length), A();
|
|
468
|
+
}, H = (r = "", c = !0) => {
|
|
469
|
+
Fe(), B !== null && (window.clearTimeout(B), B = null), b.hidden = !1, w.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
470
|
+
const L = ae(), Q = Je(a, L, e.position);
|
|
471
|
+
if (Me(Q, L), G("Opening launcher at clamped open panel position", { openPanelPosition: Q, visibleLauncherPosition: L }), !c) {
|
|
472
|
+
a.classList.add("pluno-pa-widget--open"), s.hidden = !0, r && (d.value = r, ee(d)), k.scrollTop = k.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), N();
|
|
476
473
|
return;
|
|
477
474
|
}
|
|
478
475
|
window.requestAnimationFrame(() => {
|
|
479
|
-
a.classList.add("pluno-pa-widget--open"), r && (
|
|
476
|
+
a.classList.add("pluno-pa-widget--open"), r && (d.value = r, ee(d)), k.scrollTop = k.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), N(), B = window.setTimeout(() => {
|
|
480
477
|
s.hidden = !0, k.scrollTop = k.scrollHeight;
|
|
481
478
|
}, 220);
|
|
482
479
|
});
|
|
483
480
|
}, At = () => {
|
|
484
|
-
B !== null && (window.clearTimeout(B), B = null), s.hidden = !1, R && (ae(!1), G("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"),
|
|
481
|
+
B !== null && (window.clearTimeout(B), B = null), s.hidden = !1, R && (ae(!1), G("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), N(), B = window.setTimeout(() => {
|
|
485
482
|
b.hidden = !0, w.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
486
483
|
}, 220);
|
|
487
484
|
};
|
|
488
485
|
s.addEventListener("submit", (r) => {
|
|
489
|
-
r.preventDefault(),
|
|
486
|
+
r.preventDefault(), H(u.value), u.value = "";
|
|
490
487
|
}), g?.addEventListener("click", (r) => {
|
|
491
488
|
r.preventDefault(), r.stopPropagation();
|
|
492
489
|
}), s.addEventListener("click", (r) => {
|
|
493
|
-
r.target !==
|
|
494
|
-
}),
|
|
495
|
-
|
|
496
|
-
}),
|
|
497
|
-
if (!
|
|
490
|
+
r.target !== u && (H(u.value), u.value = "");
|
|
491
|
+
}), u.addEventListener("focus", () => {
|
|
492
|
+
H(u.value), u.value = "";
|
|
493
|
+
}), u.addEventListener("input", () => {
|
|
494
|
+
if (!u.value)
|
|
498
495
|
return;
|
|
499
|
-
const r =
|
|
500
|
-
|
|
496
|
+
const r = u.value;
|
|
497
|
+
H(r), u.value = "";
|
|
501
498
|
}), w.addEventListener("click", At);
|
|
502
|
-
const
|
|
503
|
-
|
|
499
|
+
const D = () => {
|
|
500
|
+
h.disabled = F(e.billingStatus) || !E.getState().isThinking && d.value.trim().length === 0 && v.length === 0;
|
|
504
501
|
};
|
|
505
|
-
|
|
506
|
-
if (r.preventDefault(),
|
|
507
|
-
|
|
502
|
+
e.loginRequired && (u.readOnly = !0, u.placeholder = e.loginButtonLabel, d.placeholder = e.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (r) => {
|
|
503
|
+
if (r.preventDefault(), e.loginRequired) {
|
|
504
|
+
e.onLoginClick?.();
|
|
508
505
|
return;
|
|
509
506
|
}
|
|
510
|
-
F(
|
|
507
|
+
F(e.billingStatus) || (v = xe(E, d, v), T(), D());
|
|
511
508
|
});
|
|
512
509
|
let Z = 0;
|
|
513
510
|
const Nt = () => {
|
|
@@ -521,397 +518,404 @@ async function Cn(e = {}) {
|
|
|
521
518
|
}, It = async (r) => {
|
|
522
519
|
if (r.length === 0)
|
|
523
520
|
return;
|
|
524
|
-
const
|
|
525
|
-
if (v.length +
|
|
521
|
+
const c = await jn(r);
|
|
522
|
+
if (v.length + c.length > de)
|
|
526
523
|
throw new Error(`Attach up to ${de} files per message.`);
|
|
527
|
-
v = [...v, ...
|
|
524
|
+
v = [...v, ...c], T(), Tt(), D();
|
|
528
525
|
};
|
|
529
526
|
a.addEventListener("dragenter", (r) => {
|
|
530
|
-
!le(r.dataTransfer) ||
|
|
527
|
+
!le(r.dataTransfer) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), Z += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
531
528
|
}), a.addEventListener("dragover", (r) => {
|
|
532
|
-
const
|
|
533
|
-
!le(
|
|
529
|
+
const c = r.dataTransfer;
|
|
530
|
+
!le(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
|
|
534
531
|
}), a.addEventListener("dragleave", (r) => {
|
|
535
532
|
le(r.dataTransfer) && (r.stopPropagation(), Z = Math.max(0, Z - 1), Z === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
536
533
|
}), a.addEventListener("drop", (r) => {
|
|
537
|
-
const
|
|
538
|
-
!le(
|
|
534
|
+
const c = r.dataTransfer;
|
|
535
|
+
!le(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), Nt(), It(c.files).catch((L) => {
|
|
539
536
|
Dt(L instanceof Error ? L.message : "Failed to attach file"), U("web-sdk.widget", "Attachment failed", {
|
|
540
537
|
message: L instanceof Error ? L.message : String(L)
|
|
541
538
|
});
|
|
542
539
|
}));
|
|
543
|
-
}),
|
|
544
|
-
if (
|
|
545
|
-
|
|
540
|
+
}), h.addEventListener("click", () => {
|
|
541
|
+
if (e.loginRequired) {
|
|
542
|
+
e.onLoginClick?.();
|
|
546
543
|
return;
|
|
547
544
|
}
|
|
548
545
|
if (E.getState().isThinking) {
|
|
549
546
|
E.stop();
|
|
550
547
|
return;
|
|
551
548
|
}
|
|
552
|
-
v = xe(E,
|
|
549
|
+
v = xe(E, d, v), T(), D();
|
|
553
550
|
}), _.addEventListener("click", () => {
|
|
554
|
-
E.startNewSession(), ce.clear(),
|
|
555
|
-
}),
|
|
556
|
-
ee(
|
|
557
|
-
}),
|
|
551
|
+
E.startNewSession(), ce.clear(), d.value = "", v = [], T(), ee(d), N(), D(), d.focus();
|
|
552
|
+
}), d.addEventListener("input", () => {
|
|
553
|
+
ee(d), N(), D();
|
|
554
|
+
}), d.addEventListener("keydown", (r) => {
|
|
558
555
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
559
|
-
if (r.preventDefault(),
|
|
560
|
-
|
|
556
|
+
if (r.preventDefault(), e.loginRequired) {
|
|
557
|
+
e.onLoginClick?.();
|
|
561
558
|
return;
|
|
562
559
|
}
|
|
563
|
-
v = xe(E,
|
|
560
|
+
v = xe(E, d, v), T(), D();
|
|
564
561
|
}
|
|
565
562
|
}), a.addEventListener("click", (r) => {
|
|
566
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
567
|
-
}), z.composerValue && (
|
|
568
|
-
const
|
|
569
|
-
let me = E.getState().appearance !== null, ie = null, J = null,
|
|
570
|
-
const Rt = !!
|
|
571
|
-
if (
|
|
572
|
-
|
|
563
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && N();
|
|
564
|
+
}), z.composerValue && (d.value = z.composerValue, ee(d)), z.isOpen && H(d.value, !1);
|
|
565
|
+
const ze = () => i;
|
|
566
|
+
let me = E.getState().appearance !== null, ie = null, J = null, W = null, Ge = E.getState().isThinking, V = null;
|
|
567
|
+
const Rt = !!e.socialPostDraftHandler, q = (r) => {
|
|
568
|
+
if (De(r.lastErrorCode) ? V = r.lastErrorCode : e.billingStatus?.creditsUsed !== null && !F(e.billingStatus) && (V = null), ye(m, e.billingStatus, V), e.loginRequired) {
|
|
569
|
+
ro(k, h, _, ze, e.loginButtonLabel, e.onLoginClick);
|
|
573
570
|
return;
|
|
574
571
|
}
|
|
575
|
-
|
|
572
|
+
io(
|
|
576
573
|
k,
|
|
577
|
-
|
|
574
|
+
h,
|
|
578
575
|
_,
|
|
579
576
|
r,
|
|
580
577
|
ce,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
(
|
|
584
|
-
E.sendMessage(
|
|
578
|
+
N,
|
|
579
|
+
ze,
|
|
580
|
+
(c) => {
|
|
581
|
+
E.sendMessage(c);
|
|
585
582
|
},
|
|
586
583
|
Rt && !ue ? {
|
|
587
584
|
dismissedCandidateIds: oe,
|
|
588
585
|
draftingCandidateId: ie,
|
|
589
586
|
error: J,
|
|
590
|
-
onSeen: (
|
|
591
|
-
$.add(
|
|
587
|
+
onSeen: (c) => {
|
|
588
|
+
$.add(c.id), N();
|
|
592
589
|
},
|
|
593
|
-
onDraft: (
|
|
594
|
-
Mt(
|
|
590
|
+
onDraft: (c) => {
|
|
591
|
+
Mt(c);
|
|
595
592
|
},
|
|
596
|
-
onDismiss: (
|
|
597
|
-
$.add(
|
|
593
|
+
onDismiss: (c) => {
|
|
594
|
+
$.add(c.id), oe.add(c.id), N(), J = null, q(E.getState());
|
|
598
595
|
},
|
|
599
|
-
onDisable: (
|
|
600
|
-
ue = !0, $.add(
|
|
596
|
+
onDisable: (c) => {
|
|
597
|
+
ue = !0, $.add(c.id), oe.add(c.id), N(), Co(e, !0), J = null, q(E.getState());
|
|
601
598
|
}
|
|
602
599
|
} : void 0
|
|
603
600
|
);
|
|
604
601
|
};
|
|
605
602
|
return E.on("state", (r) => {
|
|
606
|
-
const
|
|
607
|
-
|
|
603
|
+
const c = Ge && !r.isThinking;
|
|
604
|
+
Ge = r.isThinking, r.appearance ? (me = !0, U("web-sdk.widget", "Agent state supplied appearance", {
|
|
608
605
|
appearance: r.appearance
|
|
609
606
|
}), fe(r.appearance, "agent.state.appearance")) : me && (me = !1, U("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
610
|
-
fallbackAccentColor:
|
|
611
|
-
fallbackColorScheme:
|
|
612
|
-
fallbackFontFamily:
|
|
613
|
-
}), fe({}, "agent.state.appearance-cleared")), q(r),
|
|
614
|
-
}), q(E.getState()),
|
|
607
|
+
fallbackAccentColor: e.accentColor,
|
|
608
|
+
fallbackColorScheme: e.colorScheme,
|
|
609
|
+
fallbackFontFamily: e.fontFamily
|
|
610
|
+
}), fe({}, "agent.state.appearance-cleared")), q(r), D(), c && Fe();
|
|
611
|
+
}), q(E.getState()), D(), {
|
|
615
612
|
agent: E,
|
|
616
613
|
updateAppearance: (r) => {
|
|
617
|
-
r.scribbleStyle !== void 0 && (
|
|
614
|
+
r.scribbleStyle !== void 0 && (e.scribbleStyle = r.scribbleStyle), fe(r, "widgetHandle.updateAppearance");
|
|
618
615
|
},
|
|
619
616
|
updateBillingStatus: (r) => {
|
|
620
|
-
const
|
|
621
|
-
|
|
617
|
+
const c = r ?? null;
|
|
618
|
+
tt(e.billingStatus, c, V) && (e.billingStatus = c, e.billingStatus?.creditsUsed !== null && !F(e.billingStatus) && (V = null), ye(
|
|
622
619
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
623
|
-
|
|
620
|
+
e.billingStatus,
|
|
624
621
|
V
|
|
625
|
-
),
|
|
622
|
+
), D());
|
|
626
623
|
},
|
|
627
624
|
openPanel: () => {
|
|
628
|
-
|
|
625
|
+
H(d.value, !1);
|
|
629
626
|
},
|
|
630
627
|
destroy: () => {
|
|
631
|
-
|
|
628
|
+
Ie = !0, Re.disconnect(), window.removeEventListener("resize", Oe), Be(), y !== null && window.clearTimeout(y), W?.remove(), E.destroy(), n.remove();
|
|
632
629
|
}
|
|
633
630
|
};
|
|
634
631
|
async function Mt(r) {
|
|
635
632
|
if (!ie) {
|
|
636
633
|
ie = r.id, J = null, q(E.getState());
|
|
637
634
|
try {
|
|
638
|
-
if (!
|
|
635
|
+
if (!e.socialPostDraftHandler)
|
|
639
636
|
throw new Error("Social post drafting is not available here.");
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
637
|
+
const c = await e.socialPostDraftHandler(r);
|
|
638
|
+
if (!c.linkedinPost || !c.xPost)
|
|
642
639
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
643
|
-
$.add(r.id), oe.add(r.id),
|
|
644
|
-
socialPostRewardsUrl:
|
|
640
|
+
$.add(r.id), oe.add(r.id), N(), W?.remove(), W = so(c, {
|
|
641
|
+
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
645
642
|
onClose: () => {
|
|
646
|
-
|
|
643
|
+
W?.remove(), W = null;
|
|
647
644
|
}
|
|
648
|
-
}), a.appendChild(
|
|
649
|
-
} catch (
|
|
650
|
-
J =
|
|
645
|
+
}), a.appendChild(W);
|
|
646
|
+
} catch (c) {
|
|
647
|
+
J = c instanceof Error ? c.message : "Could not draft social post.";
|
|
651
648
|
} finally {
|
|
652
649
|
ie = null, q(E.getState());
|
|
653
650
|
}
|
|
654
651
|
}
|
|
655
652
|
}
|
|
656
|
-
function fe(r,
|
|
657
|
-
const L = r.accentColor ??
|
|
658
|
-
i =
|
|
653
|
+
function fe(r, c) {
|
|
654
|
+
const L = r.accentColor ?? e.accentColor, Q = r.colorScheme ?? e.colorScheme, Ue = r.fontFamily ?? e.fontFamily, be = r.scribbleStyle ?? e.scribbleStyle;
|
|
655
|
+
i = Ye(L, be), Xe(a, i, {
|
|
659
656
|
accentColor: L,
|
|
660
657
|
colorScheme: Q,
|
|
661
|
-
fontFamily:
|
|
658
|
+
fontFamily: Ue,
|
|
662
659
|
scribbleStyle: be
|
|
663
660
|
}), U("web-sdk.widget", "Updated widget appearance", {
|
|
664
|
-
source:
|
|
661
|
+
source: c,
|
|
665
662
|
inputAppearance: r,
|
|
666
663
|
appliedAccentColor: L,
|
|
667
664
|
appliedColorScheme: Q,
|
|
668
|
-
appliedFontFamily:
|
|
665
|
+
appliedFontFamily: Ue,
|
|
669
666
|
appliedScribbleStyle: be,
|
|
670
667
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
671
668
|
});
|
|
672
669
|
}
|
|
673
670
|
}
|
|
674
|
-
function
|
|
675
|
-
return
|
|
671
|
+
function Ye(t, e) {
|
|
672
|
+
return e ? Ut(t) : zt(t);
|
|
676
673
|
}
|
|
677
|
-
function
|
|
678
|
-
|
|
679
|
-
const o = n.scribbleStyle ?
|
|
680
|
-
|
|
681
|
-
const a = Array.from(
|
|
674
|
+
function Xe(t, e, n) {
|
|
675
|
+
t.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), t.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
676
|
+
const o = n.scribbleStyle ? dt(n.accentColor) : n.accentColor;
|
|
677
|
+
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? ln : n.fontFamily, n.scribbleStyle && En(t.ownerDocument);
|
|
678
|
+
const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
|
|
682
679
|
for (const i of a)
|
|
683
|
-
i.src =
|
|
680
|
+
i.src = e;
|
|
684
681
|
}
|
|
685
|
-
function En(
|
|
686
|
-
if (
|
|
682
|
+
function En(t) {
|
|
683
|
+
if (t.getElementById(Ke))
|
|
687
684
|
return;
|
|
688
|
-
const
|
|
689
|
-
|
|
685
|
+
const e = t.createElement("style");
|
|
686
|
+
e.id = Ke, e.textContent = `@font-face {
|
|
690
687
|
font-family: "Architects Daughter";
|
|
691
688
|
font-style: normal;
|
|
692
689
|
font-weight: 400;
|
|
693
690
|
font-display: swap;
|
|
694
691
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
695
|
-
}`,
|
|
692
|
+
}`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
|
|
696
693
|
}
|
|
697
694
|
function kn({
|
|
698
|
-
root:
|
|
699
|
-
launcherDragHandle:
|
|
695
|
+
root: t,
|
|
696
|
+
launcherDragHandle: e,
|
|
700
697
|
getPosition: n,
|
|
701
698
|
setPosition: o,
|
|
702
699
|
persist: a
|
|
703
700
|
}) {
|
|
704
701
|
let i = null, l = null, p = null, s = !1;
|
|
705
702
|
const g = () => {
|
|
706
|
-
i = null, l = null, p = null, s = !1,
|
|
707
|
-
},
|
|
708
|
-
|
|
709
|
-
}, b = (
|
|
710
|
-
if (i !==
|
|
703
|
+
i = null, l = null, p = null, s = !1, t.classList.remove("pluno-pa-widget--dragging");
|
|
704
|
+
}, u = (m) => {
|
|
705
|
+
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), i = m.pointerId, l = { x: m.clientX, y: m.clientY }, p = n(), s = !1, e.setPointerCapture?.(m.pointerId));
|
|
706
|
+
}, b = (m) => {
|
|
707
|
+
if (i !== m.pointerId || !l || !p)
|
|
711
708
|
return;
|
|
712
|
-
|
|
713
|
-
const f =
|
|
714
|
-
!s && Math.hypot(f,
|
|
715
|
-
}, w = (
|
|
716
|
-
i ===
|
|
717
|
-
}, x = (
|
|
718
|
-
i ===
|
|
719
|
-
}, C = (
|
|
720
|
-
if (
|
|
709
|
+
m.preventDefault();
|
|
710
|
+
const f = m.clientX - l.x, d = m.clientY - l.y;
|
|
711
|
+
!s && Math.hypot(f, d) < wn || (s = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + f, y: p.y + d }));
|
|
712
|
+
}, w = (m) => {
|
|
713
|
+
i === m.pointerId && (m.preventDefault(), m.stopPropagation(), s && a(), g());
|
|
714
|
+
}, x = (m) => {
|
|
715
|
+
i === m.pointerId && (m.preventDefault(), g());
|
|
716
|
+
}, C = (m) => {
|
|
717
|
+
if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
|
|
721
718
|
return;
|
|
722
|
-
const f =
|
|
723
|
-
let
|
|
724
|
-
|
|
719
|
+
const f = m.shiftKey ? xn : _n, d = n();
|
|
720
|
+
let h = null;
|
|
721
|
+
m.key === "ArrowUp" ? h = { x: d.x, y: d.y - f } : m.key === "ArrowDown" ? h = { x: d.x, y: d.y + f } : m.key === "ArrowLeft" ? h = { x: d.x - f, y: d.y } : m.key === "ArrowRight" && (h = { x: d.x + f, y: d.y }), h && (m.preventDefault(), m.stopPropagation(), o(h), a());
|
|
725
722
|
};
|
|
726
|
-
return
|
|
727
|
-
|
|
723
|
+
return e.addEventListener("pointerdown", u), e.addEventListener("pointermove", b), e.addEventListener("pointerup", w), e.addEventListener("pointercancel", x), e.addEventListener("keydown", C), () => {
|
|
724
|
+
e.removeEventListener("pointerdown", u), e.removeEventListener("pointermove", b), e.removeEventListener("pointerup", w), e.removeEventListener("pointercancel", x), e.removeEventListener("keydown", C);
|
|
728
725
|
};
|
|
729
726
|
}
|
|
730
|
-
function
|
|
731
|
-
const n = Y(), o =
|
|
727
|
+
function Le(t, e = !0) {
|
|
728
|
+
const n = Y(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
|
|
732
729
|
return {
|
|
733
|
-
width:
|
|
734
|
-
height:
|
|
730
|
+
width: e && a && o.width > 0 ? o.width : Math.min(mt, n.width - 36),
|
|
731
|
+
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? pn : ft
|
|
735
732
|
};
|
|
736
733
|
}
|
|
737
|
-
function
|
|
738
|
-
const
|
|
734
|
+
function bt() {
|
|
735
|
+
const t = Y();
|
|
739
736
|
return {
|
|
740
737
|
width: Math.min(
|
|
741
|
-
K(
|
|
742
|
-
|
|
738
|
+
K(t.width * cn, sn, dn),
|
|
739
|
+
t.width - A * 2
|
|
743
740
|
),
|
|
744
741
|
height: Math.min(
|
|
745
|
-
K(
|
|
746
|
-
|
|
742
|
+
K(t.height * hn, un, gn),
|
|
743
|
+
t.height - Se - A
|
|
747
744
|
)
|
|
748
745
|
};
|
|
749
746
|
}
|
|
750
|
-
function
|
|
751
|
-
const o = Number.parseFloat(
|
|
747
|
+
function Sn(t, e, n) {
|
|
748
|
+
const o = Number.parseFloat(t.style.left), a = Number.parseFloat(t.style.top);
|
|
752
749
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
753
750
|
return { x: o, y: a };
|
|
754
|
-
const i =
|
|
751
|
+
const i = t.getBoundingClientRect();
|
|
755
752
|
if (i.width > 0 || i.height > 0)
|
|
756
753
|
return { x: i.left, y: i.top };
|
|
757
754
|
const l = Y();
|
|
758
755
|
return {
|
|
759
|
-
x:
|
|
756
|
+
x: e === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
760
757
|
y: l.height - 24 - n.height
|
|
761
758
|
};
|
|
762
759
|
}
|
|
763
|
-
function Ze(
|
|
764
|
-
const o = Y(), a =
|
|
760
|
+
function Ze(t, e, n) {
|
|
761
|
+
const o = Y(), a = A + Ln(t);
|
|
765
762
|
return {
|
|
766
|
-
x: K(
|
|
767
|
-
y: K(
|
|
763
|
+
x: K(e.x, A, Math.max(A, o.width - n.width - A)),
|
|
764
|
+
y: K(e.y, a, Math.max(a, o.height - n.height - A))
|
|
768
765
|
};
|
|
769
766
|
}
|
|
770
|
-
function
|
|
771
|
-
return
|
|
767
|
+
function Ln(t) {
|
|
768
|
+
return t.classList.contains("pluno-pa-widget--scribble") ? bn : fn;
|
|
772
769
|
}
|
|
773
|
-
function Je(e) {
|
|
774
|
-
const
|
|
770
|
+
function Je(t, e, n) {
|
|
771
|
+
const o = Le(t), a = bt(), i = {
|
|
772
|
+
x: n === "bottom-left" ? e.x : e.x + o.width - a.width,
|
|
773
|
+
y: e.y + o.height - a.height
|
|
774
|
+
};
|
|
775
|
+
return Pn(i);
|
|
776
|
+
}
|
|
777
|
+
function Pn(t) {
|
|
778
|
+
const e = Y(), n = bt();
|
|
775
779
|
return {
|
|
776
|
-
x: K(
|
|
780
|
+
x: K(t.x, A, Math.max(A, e.width - n.width - A)),
|
|
777
781
|
y: K(
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
Math.max(
|
|
782
|
+
t.y,
|
|
783
|
+
Se,
|
|
784
|
+
Math.max(Se, e.height - n.height - A)
|
|
781
785
|
)
|
|
782
786
|
};
|
|
783
787
|
}
|
|
784
|
-
function re(
|
|
785
|
-
if (
|
|
786
|
-
|
|
788
|
+
function re(t, e) {
|
|
789
|
+
if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), !e) {
|
|
790
|
+
t.style.removeProperty("left"), t.style.removeProperty("top"), t.style.removeProperty("right"), t.style.removeProperty("bottom");
|
|
787
791
|
return;
|
|
788
792
|
}
|
|
789
|
-
|
|
793
|
+
t.style.left = `${e.x}px`, t.style.top = `${e.y}px`, t.style.right = "auto", t.style.bottom = "auto";
|
|
790
794
|
}
|
|
791
|
-
function An(
|
|
792
|
-
|
|
795
|
+
function An(t, e) {
|
|
796
|
+
t.style.setProperty("--pluno-pa-panel-offset-x", `${e.x}px`), t.style.setProperty("--pluno-pa-panel-offset-y", `${e.y}px`);
|
|
793
797
|
}
|
|
794
|
-
function
|
|
795
|
-
|
|
798
|
+
function Nn(t) {
|
|
799
|
+
t.style.removeProperty("--pluno-pa-panel-offset-x"), t.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
796
800
|
}
|
|
797
801
|
function Y() {
|
|
798
802
|
return {
|
|
799
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
800
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
803
|
+
width: window.innerWidth || document.documentElement.clientWidth || mt + A * 2,
|
|
804
|
+
height: window.innerHeight || document.documentElement.clientHeight || ft + A * 2
|
|
801
805
|
};
|
|
802
806
|
}
|
|
803
|
-
function _e(
|
|
804
|
-
const
|
|
807
|
+
function _e(t) {
|
|
808
|
+
const e = t.getBoundingClientRect();
|
|
805
809
|
return {
|
|
806
|
-
x: Math.round(
|
|
807
|
-
y: Math.round(
|
|
808
|
-
width: Math.round(
|
|
809
|
-
height: Math.round(
|
|
810
|
+
x: Math.round(e.x),
|
|
811
|
+
y: Math.round(e.y),
|
|
812
|
+
width: Math.round(e.width),
|
|
813
|
+
height: Math.round(e.height)
|
|
810
814
|
};
|
|
811
815
|
}
|
|
812
|
-
function K(
|
|
813
|
-
return Math.min(Math.max(
|
|
816
|
+
function K(t, e, n) {
|
|
817
|
+
return Math.min(Math.max(t, e), n);
|
|
814
818
|
}
|
|
815
|
-
function U(
|
|
819
|
+
function U(t, e, n) {
|
|
816
820
|
if (typeof window > "u")
|
|
817
821
|
return;
|
|
818
822
|
const o = window, a = {
|
|
819
823
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
820
|
-
source:
|
|
821
|
-
message:
|
|
824
|
+
source: t,
|
|
825
|
+
message: e,
|
|
822
826
|
details: n
|
|
823
827
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
824
828
|
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(on, { detail: a }));
|
|
825
829
|
}
|
|
826
|
-
function
|
|
827
|
-
U("web-sdk.widget.position",
|
|
830
|
+
function Dn(t, e) {
|
|
831
|
+
U("web-sdk.widget.position", t, e);
|
|
828
832
|
}
|
|
829
|
-
function xe(
|
|
830
|
-
const o =
|
|
831
|
-
return !o && n.length === 0 ? n : (
|
|
833
|
+
function xe(t, e, n) {
|
|
834
|
+
const o = e.value.trim();
|
|
835
|
+
return !o && n.length === 0 ? n : (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), e.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
832
836
|
}
|
|
833
|
-
function ee(
|
|
834
|
-
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
+
function ee(t) {
|
|
838
|
+
t.style.height = "0px";
|
|
839
|
+
const e = Math.max(22, Math.min(t.scrollHeight, 140));
|
|
840
|
+
t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
|
|
837
841
|
}
|
|
838
|
-
function
|
|
839
|
-
|
|
842
|
+
function Tn(t, e, n, o) {
|
|
843
|
+
t.appendChild(Bn()), t.appendChild(In(e, n, o)), t.appendChild(xt("pluno-pa-widget__close", "Close", Fn(16), !0)), t.appendChild(Rn(n));
|
|
840
844
|
}
|
|
841
|
-
function
|
|
845
|
+
function In(t, e, n) {
|
|
842
846
|
const o = document.createElement("form");
|
|
843
847
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
844
848
|
const i = document.createElement("button");
|
|
845
849
|
i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
|
|
846
850
|
}
|
|
847
|
-
o.appendChild(_t("pluno-pa-widget__character--launcher",
|
|
851
|
+
o.appendChild(_t("pluno-pa-widget__character--launcher", e));
|
|
848
852
|
const a = document.createElement("input");
|
|
849
|
-
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder =
|
|
853
|
+
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), o.appendChild(a), o;
|
|
850
854
|
}
|
|
851
|
-
function
|
|
852
|
-
const
|
|
853
|
-
|
|
855
|
+
function Rn(t) {
|
|
856
|
+
const e = document.createElement("section");
|
|
857
|
+
e.className = "pluno-pa-widget__panel", e.hidden = !0;
|
|
854
858
|
const n = document.createElement("div");
|
|
855
859
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
856
860
|
const o = document.createElement("main");
|
|
857
|
-
return o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
861
|
+
return o.className = "pluno-pa-widget__timeline", o.appendChild(On(t)), n.appendChild(o), n.appendChild(xt("pluno-pa-widget__new-chat", "New chat", zn(), !0)), e.appendChild(n), e.appendChild(Mn()), e;
|
|
858
862
|
}
|
|
859
|
-
function
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
const
|
|
863
|
-
|
|
863
|
+
function Mn() {
|
|
864
|
+
const t = document.createElement("form");
|
|
865
|
+
t.className = "pluno-pa-widget__composer";
|
|
866
|
+
const e = document.createElement("div");
|
|
867
|
+
e.className = "pluno-pa-widget__billing-status", e.hidden = !0, t.appendChild(e);
|
|
864
868
|
const n = document.createElement("div");
|
|
865
|
-
n.className = "pluno-pa-widget__attachment-error", n.hidden = !0,
|
|
869
|
+
n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, t.appendChild(n);
|
|
866
870
|
const o = document.createElement("div");
|
|
867
|
-
o.className = "pluno-pa-widget__attachments", o.hidden = !0,
|
|
871
|
+
o.className = "pluno-pa-widget__attachments", o.hidden = !0, t.appendChild(o);
|
|
868
872
|
const a = document.createElement("div");
|
|
869
873
|
a.className = "pluno-pa-widget__composer-inner";
|
|
870
874
|
const i = document.createElement("textarea");
|
|
871
875
|
i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
|
|
872
876
|
const l = document.createElement("button");
|
|
873
|
-
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(vt()), a.appendChild(l),
|
|
877
|
+
l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(vt()), a.appendChild(l), t.appendChild(a);
|
|
874
878
|
const p = document.createElement("div");
|
|
875
879
|
p.className = "pluno-pa-widget__composer-meta";
|
|
876
880
|
const s = document.createElement("a");
|
|
877
881
|
s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai.", p.appendChild(s);
|
|
878
882
|
const g = document.createElement("span");
|
|
879
|
-
return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(g),
|
|
883
|
+
return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(g), t.appendChild(p), t;
|
|
880
884
|
}
|
|
881
|
-
function
|
|
882
|
-
const
|
|
883
|
-
return
|
|
885
|
+
function On(t) {
|
|
886
|
+
const e = document.createElement("div");
|
|
887
|
+
return e.className = "pluno-pa-widget__empty-state", e.appendChild(_t("pluno-pa-widget__character--empty", t)), e.appendChild(wt()), e;
|
|
884
888
|
}
|
|
885
889
|
function wt() {
|
|
886
|
-
const
|
|
887
|
-
return
|
|
890
|
+
const t = document.createElement("div");
|
|
891
|
+
return t.className = "pluno-pa-widget__empty", t.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), t.appendChild(document.createElement("br")), t.appendChild(document.createTextNode("What do you want to do today?")), t;
|
|
888
892
|
}
|
|
889
|
-
function _t(
|
|
893
|
+
function _t(t, e) {
|
|
890
894
|
const n = document.createElement("img");
|
|
891
|
-
return n.className = `pluno-pa-widget__character ${
|
|
895
|
+
return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
892
896
|
}
|
|
893
|
-
function xt(
|
|
897
|
+
function xt(t, e, n, o) {
|
|
894
898
|
const a = document.createElement("button");
|
|
895
|
-
return a.type = "button", a.className =
|
|
899
|
+
return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
|
|
896
900
|
}
|
|
897
|
-
function
|
|
898
|
-
const
|
|
901
|
+
function Bn() {
|
|
902
|
+
const t = S("svg", {
|
|
899
903
|
class: "pluno-pa-widget__scribble-defs",
|
|
900
904
|
"aria-hidden": "true",
|
|
901
905
|
focusable: "false",
|
|
902
906
|
width: "0",
|
|
903
907
|
height: "0"
|
|
904
|
-
}),
|
|
905
|
-
return
|
|
908
|
+
}), e = S("defs");
|
|
909
|
+
return e.appendChild(ve("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(ve("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(ve("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
|
|
906
910
|
}
|
|
907
|
-
function ve(
|
|
908
|
-
const o = S("filter", { id:
|
|
911
|
+
function ve(t, e, n) {
|
|
912
|
+
const o = S("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
909
913
|
return o.appendChild(
|
|
910
914
|
S("feTurbulence", {
|
|
911
915
|
type: "fractalNoise",
|
|
912
916
|
baseFrequency: "0.012 0.028",
|
|
913
917
|
numOctaves: "3",
|
|
914
|
-
seed:
|
|
918
|
+
seed: e,
|
|
915
919
|
result: "stroke-noise"
|
|
916
920
|
})
|
|
917
921
|
), o.appendChild(
|
|
@@ -941,265 +945,265 @@ function ve(e, t, n) {
|
|
|
941
945
|
})
|
|
942
946
|
), o;
|
|
943
947
|
}
|
|
944
|
-
function
|
|
945
|
-
const
|
|
946
|
-
return
|
|
948
|
+
function Fn(t) {
|
|
949
|
+
const e = X("0 0 24 24", t, t, "none", "currentColor", "2.25");
|
|
950
|
+
return e.appendChild(S("path", { d: "m6 9 6 6 6-6" })), e;
|
|
947
951
|
}
|
|
948
|
-
function
|
|
949
|
-
const
|
|
950
|
-
return
|
|
952
|
+
function zn() {
|
|
953
|
+
const t = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
954
|
+
return t.appendChild(S("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), t.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
|
|
951
955
|
}
|
|
952
956
|
function vt() {
|
|
953
|
-
const
|
|
954
|
-
return
|
|
955
|
-
}
|
|
956
|
-
function zn() {
|
|
957
|
-
const e = X("0 0 24 24", 18, 18, "currentColor");
|
|
958
|
-
return e.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
957
|
+
const t = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
958
|
+
return t.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), t;
|
|
959
959
|
}
|
|
960
960
|
function Gn() {
|
|
961
|
-
const
|
|
962
|
-
return
|
|
961
|
+
const t = X("0 0 24 24", 18, 18, "currentColor");
|
|
962
|
+
return t.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
|
|
963
963
|
}
|
|
964
964
|
function Un() {
|
|
965
|
-
const
|
|
966
|
-
return
|
|
965
|
+
const t = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
966
|
+
return t.appendChild(S("path", { d: "M18 6 6 18" })), t.appendChild(S("path", { d: "m6 6 12 12" })), t;
|
|
967
|
+
}
|
|
968
|
+
function $n() {
|
|
969
|
+
const t = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
970
|
+
return t.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
|
|
967
971
|
}
|
|
968
|
-
function X(
|
|
972
|
+
function X(t, e, n, o, a, i) {
|
|
969
973
|
const l = {
|
|
970
|
-
viewBox:
|
|
971
|
-
width: String(
|
|
974
|
+
viewBox: t,
|
|
975
|
+
width: String(e),
|
|
972
976
|
height: String(n),
|
|
973
977
|
fill: o,
|
|
974
978
|
"aria-hidden": "true"
|
|
975
979
|
};
|
|
976
980
|
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
|
|
977
981
|
}
|
|
978
|
-
function S(
|
|
979
|
-
const n = document.createElementNS(mn,
|
|
980
|
-
for (const [o, a] of Object.entries(
|
|
982
|
+
function S(t, e = {}) {
|
|
983
|
+
const n = document.createElementNS(mn, t);
|
|
984
|
+
for (const [o, a] of Object.entries(e))
|
|
981
985
|
n.setAttribute(o, a);
|
|
982
986
|
return n;
|
|
983
987
|
}
|
|
984
|
-
function
|
|
985
|
-
for (const
|
|
986
|
-
|
|
988
|
+
function Qe(t) {
|
|
989
|
+
for (const e of ["keydown", "keypress", "keyup"])
|
|
990
|
+
t.addEventListener(e, (n) => {
|
|
987
991
|
n.stopPropagation();
|
|
988
992
|
});
|
|
989
993
|
}
|
|
990
|
-
function
|
|
991
|
-
|
|
992
|
-
for (const [o, a] of
|
|
994
|
+
function Hn(t, e, n) {
|
|
995
|
+
t.replaceChildren(), t.hidden = e.length === 0;
|
|
996
|
+
for (const [o, a] of e.entries()) {
|
|
993
997
|
const i = document.createElement("div");
|
|
994
998
|
i.className = "pluno-pa-widget__attachment", i.appendChild(Wn(a));
|
|
995
999
|
const l = document.createElement("span");
|
|
996
1000
|
l.textContent = a.name, i.appendChild(l);
|
|
997
1001
|
const p = document.createElement("button");
|
|
998
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1002
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Un()), p.addEventListener("click", () => n(o)), i.appendChild(p), t.appendChild(i);
|
|
999
1003
|
}
|
|
1000
1004
|
}
|
|
1001
|
-
function Wn(
|
|
1002
|
-
if (yt(
|
|
1005
|
+
function Wn(t) {
|
|
1006
|
+
if (yt(t)) {
|
|
1003
1007
|
const n = document.createElement("img");
|
|
1004
|
-
return n.src =
|
|
1008
|
+
return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1005
1009
|
}
|
|
1006
|
-
const
|
|
1007
|
-
return
|
|
1010
|
+
const e = document.createElement("span");
|
|
1011
|
+
return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
|
|
1008
1012
|
}
|
|
1009
|
-
function
|
|
1010
|
-
if (yt(
|
|
1013
|
+
function Vn(t) {
|
|
1014
|
+
if (yt(t)) {
|
|
1011
1015
|
const a = document.createElement("img");
|
|
1012
|
-
return a.src =
|
|
1016
|
+
return a.src = t.dataUrl, a.alt = t.name, a;
|
|
1013
1017
|
}
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1018
|
+
const e = document.createElement("div");
|
|
1019
|
+
e.className = "pluno-pa-widget__message-attachment-file";
|
|
1016
1020
|
const n = document.createElement("span");
|
|
1017
1021
|
n.textContent = "PDF";
|
|
1018
1022
|
const o = document.createElement("strong");
|
|
1019
|
-
return o.textContent =
|
|
1023
|
+
return o.textContent = t.name, e.append(n, o), e;
|
|
1020
1024
|
}
|
|
1021
|
-
function yt(
|
|
1022
|
-
return
|
|
1025
|
+
function yt(t) {
|
|
1026
|
+
return t.mimeType.startsWith("image/");
|
|
1023
1027
|
}
|
|
1024
|
-
function
|
|
1025
|
-
return
|
|
1028
|
+
function qn(t) {
|
|
1029
|
+
return t === "application/pdf" ? "document.pdf" : "image";
|
|
1026
1030
|
}
|
|
1027
|
-
async function
|
|
1028
|
-
if (!
|
|
1031
|
+
async function jn(t) {
|
|
1032
|
+
if (!t)
|
|
1029
1033
|
return [];
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1034
|
+
const e = Array.from(t);
|
|
1035
|
+
if (e.length > de)
|
|
1032
1036
|
throw new Error(`Attach up to ${de} files per message.`);
|
|
1033
1037
|
return Promise.all(
|
|
1034
|
-
|
|
1035
|
-
const o =
|
|
1038
|
+
e.map(async (n) => {
|
|
1039
|
+
const o = Kn(n);
|
|
1036
1040
|
if (!o)
|
|
1037
1041
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1038
1042
|
if (n.size > an)
|
|
1039
1043
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1040
1044
|
if (o === "image/gif") {
|
|
1041
|
-
const a = new Uint8Array(await
|
|
1042
|
-
if (
|
|
1045
|
+
const a = new Uint8Array(await oo(n));
|
|
1046
|
+
if (Xn(a))
|
|
1043
1047
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1044
1048
|
}
|
|
1045
1049
|
return {
|
|
1046
|
-
name: n.name ||
|
|
1050
|
+
name: n.name || qn(o),
|
|
1047
1051
|
mimeType: o,
|
|
1048
1052
|
sizeBytes: n.size,
|
|
1049
|
-
dataUrl:
|
|
1053
|
+
dataUrl: Yn(await ao(n), o)
|
|
1050
1054
|
};
|
|
1051
1055
|
})
|
|
1052
1056
|
);
|
|
1053
1057
|
}
|
|
1054
|
-
function
|
|
1055
|
-
if (rn.has(
|
|
1056
|
-
return
|
|
1057
|
-
const
|
|
1058
|
-
return
|
|
1058
|
+
function Kn(t) {
|
|
1059
|
+
if (rn.has(t.type))
|
|
1060
|
+
return t.type;
|
|
1061
|
+
const e = t.name.toLowerCase();
|
|
1062
|
+
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
1059
1063
|
}
|
|
1060
|
-
function
|
|
1061
|
-
const n = `data:${
|
|
1062
|
-
return
|
|
1064
|
+
function Yn(t, e) {
|
|
1065
|
+
const n = `data:${e};base64,`;
|
|
1066
|
+
return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
|
|
1063
1067
|
}
|
|
1064
|
-
function
|
|
1065
|
-
if (
|
|
1068
|
+
function Xn(t) {
|
|
1069
|
+
if (t.length < 14 || !Zn(t))
|
|
1066
1070
|
return !1;
|
|
1067
|
-
const
|
|
1071
|
+
const e = t[10];
|
|
1068
1072
|
let n = 13;
|
|
1069
|
-
|
|
1073
|
+
e & 128 && (n += 3 * 2 ** ((e & 7) + 1));
|
|
1070
1074
|
let o = 0;
|
|
1071
|
-
for (; n <
|
|
1072
|
-
const a =
|
|
1075
|
+
for (; n < t.length; ) {
|
|
1076
|
+
const a = t[n];
|
|
1073
1077
|
if (n += 1, a === 59)
|
|
1074
1078
|
return !1;
|
|
1075
1079
|
if (a === 33) {
|
|
1076
|
-
n += 1, n =
|
|
1080
|
+
n += 1, n = et(t, n);
|
|
1077
1081
|
continue;
|
|
1078
1082
|
}
|
|
1079
1083
|
if (a !== 44)
|
|
1080
1084
|
return !1;
|
|
1081
1085
|
if (o += 1, o > 1)
|
|
1082
1086
|
return !0;
|
|
1083
|
-
if (n + 9 >=
|
|
1087
|
+
if (n + 9 >= t.length)
|
|
1084
1088
|
return !1;
|
|
1085
|
-
const i =
|
|
1086
|
-
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >=
|
|
1089
|
+
const i = t[n + 8];
|
|
1090
|
+
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= t.length)
|
|
1087
1091
|
return !1;
|
|
1088
|
-
n += 1, n =
|
|
1092
|
+
n += 1, n = et(t, n);
|
|
1089
1093
|
}
|
|
1090
1094
|
return !1;
|
|
1091
1095
|
}
|
|
1092
|
-
function
|
|
1093
|
-
return
|
|
1096
|
+
function Zn(t) {
|
|
1097
|
+
return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
|
|
1094
1098
|
}
|
|
1095
|
-
function
|
|
1096
|
-
for (;
|
|
1097
|
-
const n = e
|
|
1098
|
-
if (
|
|
1099
|
-
return
|
|
1100
|
-
|
|
1099
|
+
function et(t, e) {
|
|
1100
|
+
for (; e < t.length; ) {
|
|
1101
|
+
const n = t[e];
|
|
1102
|
+
if (e += 1, n === 0)
|
|
1103
|
+
return e;
|
|
1104
|
+
e += n;
|
|
1101
1105
|
}
|
|
1102
|
-
return
|
|
1106
|
+
return e;
|
|
1103
1107
|
}
|
|
1104
|
-
function le(
|
|
1105
|
-
return !!(
|
|
1108
|
+
function le(t) {
|
|
1109
|
+
return !!(t && Array.from(t.types).includes("Files"));
|
|
1106
1110
|
}
|
|
1107
|
-
function ye(
|
|
1108
|
-
if (!
|
|
1109
|
-
|
|
1111
|
+
function ye(t, e, n = null) {
|
|
1112
|
+
if (!t || !Pe(e, n)) {
|
|
1113
|
+
t && (t.hidden = !0, t.replaceChildren());
|
|
1110
1114
|
return;
|
|
1111
1115
|
}
|
|
1112
|
-
|
|
1116
|
+
t.hidden = !1, t.replaceChildren(), t.className = "pluno-pa-widget__billing-status", F(e) || De(n) ? t.appendChild(Jn(e, n)) : Ct(e) && t.appendChild(Qn(e));
|
|
1113
1117
|
}
|
|
1114
|
-
function
|
|
1118
|
+
function Jn(t, e) {
|
|
1115
1119
|
const n = document.createElement("div");
|
|
1116
1120
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1117
|
-
const o =
|
|
1121
|
+
const o = t.limitExceeded || e === "limit_exceeded", a = document.createElement("strong");
|
|
1118
1122
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1119
1123
|
const i = document.createElement("span");
|
|
1120
|
-
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." :
|
|
1124
|
+
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : t.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Et(t, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1121
1125
|
}
|
|
1122
|
-
function
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1126
|
+
function Qn(t) {
|
|
1127
|
+
const e = document.createElement("div");
|
|
1128
|
+
e.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1125
1129
|
const n = document.createElement("strong");
|
|
1126
|
-
n.textContent = "Credits running low",
|
|
1130
|
+
n.textContent = "Credits running low", e.appendChild(n);
|
|
1127
1131
|
const o = document.createElement("span");
|
|
1128
|
-
return o.textContent =
|
|
1132
|
+
return o.textContent = to(t) ?? "Credits are running low for this period.", e.appendChild(o), e.appendChild(Et(t, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), e;
|
|
1129
1133
|
}
|
|
1130
|
-
function
|
|
1131
|
-
return
|
|
1134
|
+
function Pe(t, e) {
|
|
1135
|
+
return t !== null && (F(t) || Ct(t) || De(e));
|
|
1132
1136
|
}
|
|
1133
|
-
function
|
|
1134
|
-
return
|
|
1137
|
+
function tt(t, e, n) {
|
|
1138
|
+
return Pe(e, n) || eo(e) ? !0 : !Pe(t, n);
|
|
1135
1139
|
}
|
|
1136
|
-
function
|
|
1137
|
-
return
|
|
1140
|
+
function eo(t) {
|
|
1141
|
+
return t != null && (t.creditsUsed !== null || t.creditLimit !== null || t.creditsRemaining !== null || F(t));
|
|
1138
1142
|
}
|
|
1139
|
-
function F(
|
|
1140
|
-
return
|
|
1143
|
+
function F(t) {
|
|
1144
|
+
return t?.limitExceeded === !0 || !!t?.paymentIssue;
|
|
1141
1145
|
}
|
|
1142
|
-
function
|
|
1143
|
-
return
|
|
1146
|
+
function De(t) {
|
|
1147
|
+
return t === "limit_exceeded" || t === "subscription_required" || t === "subscription_inactive" || t === "payment_issue" || t === "subscription_invalid" || t === "payment_required";
|
|
1144
1148
|
}
|
|
1145
|
-
function Ct(
|
|
1146
|
-
return !F(
|
|
1149
|
+
function Ct(t) {
|
|
1150
|
+
return !F(t) && t.creditLimit !== null && t.creditLimit > 0 && t.creditsRemaining !== null && t.creditsRemaining > 0 && t.creditsRemaining / t.creditLimit <= 0.2;
|
|
1147
1151
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return
|
|
1152
|
+
function to(t) {
|
|
1153
|
+
return t.creditsRemaining === null ? null : `${no(t.creditsRemaining)} credits left`;
|
|
1150
1154
|
}
|
|
1151
|
-
function
|
|
1155
|
+
function no(t) {
|
|
1152
1156
|
return new Intl.NumberFormat("en-US", {
|
|
1153
1157
|
maximumFractionDigits: 0
|
|
1154
|
-
}).format(Math.ceil(
|
|
1158
|
+
}).format(Math.ceil(t));
|
|
1155
1159
|
}
|
|
1156
|
-
function Et(
|
|
1160
|
+
function Et(t, e, n) {
|
|
1157
1161
|
const o = document.createElement("div");
|
|
1158
|
-
return o.className = n, o.appendChild(
|
|
1162
|
+
return o.className = n, o.appendChild(nt(e, t.pricingUrl)), o.appendChild(nt("Earn credits", t.earnCreditsUrl)), o;
|
|
1159
1163
|
}
|
|
1160
|
-
function
|
|
1164
|
+
function nt(t, e) {
|
|
1161
1165
|
const n = document.createElement("button");
|
|
1162
|
-
return n.type = "button", n.textContent =
|
|
1163
|
-
|
|
1166
|
+
return n.type = "button", n.textContent = t, n.disabled = e.trim().length === 0, n.addEventListener("click", () => {
|
|
1167
|
+
e.trim().length !== 0 && window.open(e, "_blank", "noopener,noreferrer");
|
|
1164
1168
|
}), n;
|
|
1165
1169
|
}
|
|
1166
|
-
function
|
|
1167
|
-
return new Promise((
|
|
1170
|
+
function oo(t) {
|
|
1171
|
+
return new Promise((e, n) => {
|
|
1168
1172
|
const o = new FileReader();
|
|
1169
1173
|
o.addEventListener("load", () => {
|
|
1170
1174
|
if (o.result instanceof ArrayBuffer) {
|
|
1171
|
-
|
|
1175
|
+
e(o.result);
|
|
1172
1176
|
return;
|
|
1173
1177
|
}
|
|
1174
1178
|
n(new Error("Failed to read file"));
|
|
1175
1179
|
}), o.addEventListener("error", () => {
|
|
1176
1180
|
n(o.error ?? new Error("Failed to read file"));
|
|
1177
|
-
}), o.readAsArrayBuffer(
|
|
1181
|
+
}), o.readAsArrayBuffer(t);
|
|
1178
1182
|
});
|
|
1179
1183
|
}
|
|
1180
|
-
function
|
|
1181
|
-
return new Promise((
|
|
1184
|
+
function ao(t) {
|
|
1185
|
+
return new Promise((e, n) => {
|
|
1182
1186
|
const o = new FileReader();
|
|
1183
1187
|
o.addEventListener("load", () => {
|
|
1184
1188
|
if (typeof o.result == "string") {
|
|
1185
|
-
|
|
1189
|
+
e(o.result);
|
|
1186
1190
|
return;
|
|
1187
1191
|
}
|
|
1188
1192
|
n(new Error("Failed to read file"));
|
|
1189
1193
|
}), o.addEventListener("error", () => {
|
|
1190
1194
|
n(o.error ?? new Error("Failed to read file"));
|
|
1191
|
-
}), o.readAsDataURL(
|
|
1195
|
+
}), o.readAsDataURL(t);
|
|
1192
1196
|
});
|
|
1193
1197
|
}
|
|
1194
|
-
function
|
|
1195
|
-
const g = [...o.messages],
|
|
1196
|
-
|
|
1197
|
-
const b =
|
|
1198
|
-
if (n.hidden = !b,
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1198
|
+
function io(t, e, n, o, a, i, l, p, s) {
|
|
1199
|
+
const g = [...o.messages], u = g.filter((h) => !mo(h));
|
|
1200
|
+
t.replaceChildren(), St(e, o.isThinking);
|
|
1201
|
+
const b = u.length > 0 || !!o.assistantDraft || o.isThinking;
|
|
1202
|
+
if (n.hidden = !b, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
|
|
1203
|
+
const h = document.createElement("div");
|
|
1204
|
+
h.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1201
1205
|
const _ = document.createElement("img");
|
|
1202
|
-
_.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", _.src = l(), _.alt = "", _.setAttribute("aria-hidden", "true"),
|
|
1206
|
+
_.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", _.src = l(), _.alt = "", _.setAttribute("aria-hidden", "true"), h.appendChild(_), h.appendChild(wt());
|
|
1203
1207
|
const k = document.createElement("div");
|
|
1204
1208
|
k.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && k.setAttribute("aria-hidden", "true");
|
|
1205
1209
|
for (const v of o.starterPrompts) {
|
|
@@ -1208,72 +1212,72 @@ function ao(e, t, n, o, a, i, l, p, s) {
|
|
|
1208
1212
|
p(v);
|
|
1209
1213
|
}), k.appendChild(y);
|
|
1210
1214
|
}
|
|
1211
|
-
|
|
1215
|
+
h.appendChild(k), t.appendChild(h);
|
|
1212
1216
|
return;
|
|
1213
1217
|
}
|
|
1214
1218
|
let w = null, x = null, C = [];
|
|
1215
|
-
const
|
|
1219
|
+
const m = () => {
|
|
1216
1220
|
if (C.length === 0)
|
|
1217
1221
|
return !1;
|
|
1218
|
-
const
|
|
1219
|
-
return
|
|
1222
|
+
const h = fo(C, a, i, l());
|
|
1223
|
+
return t.appendChild(h), w = null, x = h, C = [], !0;
|
|
1220
1224
|
};
|
|
1221
|
-
for (let
|
|
1222
|
-
const _ =
|
|
1225
|
+
for (let h = 0; h < u.length; h += 1) {
|
|
1226
|
+
const _ = u[h];
|
|
1223
1227
|
if (_.role === "tool") {
|
|
1224
1228
|
C.push(_);
|
|
1225
1229
|
continue;
|
|
1226
1230
|
}
|
|
1227
1231
|
if (_.role === "system")
|
|
1228
1232
|
continue;
|
|
1229
|
-
const k =
|
|
1233
|
+
const k = m(), v = at(_.content);
|
|
1230
1234
|
if (_.role === "assistant" && !k) {
|
|
1231
|
-
const ne =
|
|
1232
|
-
|
|
1235
|
+
const ne = Ae(l());
|
|
1236
|
+
t.appendChild(ne), w = null, x = ne;
|
|
1233
1237
|
}
|
|
1234
1238
|
const y = document.createElement("div");
|
|
1235
|
-
y.className = `pluno-pa-widget__message pluno-pa-widget__message--${_.role}`, _.role === "assistant" ?
|
|
1239
|
+
y.className = `pluno-pa-widget__message pluno-pa-widget__message--${_.role}`, _.role === "assistant" ? it(y, v) : y.textContent = v, _.role === "user" && _.attachments?.length && y.appendChild(lo(_.attachments));
|
|
1236
1240
|
const T = document.createElement("div");
|
|
1237
|
-
T.className = "pluno-pa-widget__message-actions", T.appendChild(
|
|
1241
|
+
T.className = "pluno-pa-widget__message-actions", T.appendChild(ot(v)), y.appendChild(T), t.appendChild(y), w = y, x = null;
|
|
1238
1242
|
}
|
|
1239
|
-
const f =
|
|
1243
|
+
const f = m();
|
|
1240
1244
|
if (o.assistantDraft) {
|
|
1241
1245
|
if (!f) {
|
|
1242
|
-
const v =
|
|
1243
|
-
|
|
1246
|
+
const v = Ae(l());
|
|
1247
|
+
t.appendChild(v), w = null, x = v;
|
|
1244
1248
|
}
|
|
1245
|
-
const
|
|
1246
|
-
_.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
1249
|
+
const h = at(o.assistantDraft), _ = document.createElement("div");
|
|
1250
|
+
_.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", it(_, h);
|
|
1247
1251
|
const k = document.createElement("div");
|
|
1248
|
-
k.className = "pluno-pa-widget__message-actions", k.appendChild(
|
|
1252
|
+
k.className = "pluno-pa-widget__message-actions", k.appendChild(ot(h)), _.appendChild(k), t.appendChild(_), w = _, x = null;
|
|
1249
1253
|
}
|
|
1250
1254
|
if (o.isThinking && !o.assistantDraft)
|
|
1251
1255
|
if (f) {
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1256
|
+
const h = kt();
|
|
1257
|
+
t.appendChild(h), w = null, x = h;
|
|
1254
1258
|
} else {
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1259
|
+
const h = bo(l());
|
|
1260
|
+
t.appendChild(h), w = null, x = h;
|
|
1257
1261
|
}
|
|
1258
1262
|
if (o.lastError) {
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1263
|
+
const h = document.createElement("div");
|
|
1264
|
+
h.className = "pluno-pa-widget__error", h.textContent = o.lastError, t.appendChild(h), w = h, x = null;
|
|
1261
1265
|
}
|
|
1262
|
-
const
|
|
1263
|
-
if (s &&
|
|
1264
|
-
const
|
|
1265
|
-
isDrafting: s.draftingCandidateId ===
|
|
1266
|
+
const d = s && !o.isThinking ? jt(g) : null;
|
|
1267
|
+
if (s && d && !s.dismissedCandidateIds.has(d.id)) {
|
|
1268
|
+
const h = po(d, {
|
|
1269
|
+
isDrafting: s.draftingCandidateId === d.id,
|
|
1266
1270
|
error: s.error,
|
|
1267
1271
|
onDraft: s.onDraft,
|
|
1268
1272
|
onDismiss: s.onDismiss,
|
|
1269
1273
|
onDisable: s.onDisable
|
|
1270
1274
|
});
|
|
1271
|
-
|
|
1275
|
+
t.appendChild(h), s.onSeen(d), w = null, x = h;
|
|
1272
1276
|
}
|
|
1273
|
-
w?.classList.add("pluno-pa-widget__message--bottom-reserve"), x?.classList.add("pluno-pa-widget__bottom-reserve-compact"),
|
|
1277
|
+
w?.classList.add("pluno-pa-widget__message--bottom-reserve"), x?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
|
|
1274
1278
|
}
|
|
1275
|
-
function
|
|
1276
|
-
|
|
1279
|
+
function ro(t, e, n, o, a, i) {
|
|
1280
|
+
t.replaceChildren(), St(e, !1), e.disabled = !0, n.hidden = !0;
|
|
1277
1281
|
const l = document.createElement("div");
|
|
1278
1282
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1279
1283
|
const p = document.createElement("img");
|
|
@@ -1281,22 +1285,22 @@ function io(e, t, n, o, a, i) {
|
|
|
1281
1285
|
const s = document.createElement("div");
|
|
1282
1286
|
s.className = "pluno-pa-widget__empty", s.textContent = "Log in to use Pluno on this page.", l.appendChild(s);
|
|
1283
1287
|
const g = document.createElement("button");
|
|
1284
|
-
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => i?.()), l.appendChild(g),
|
|
1288
|
+
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => i?.()), l.appendChild(g), t.appendChild(l);
|
|
1285
1289
|
}
|
|
1286
|
-
function
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1289
|
-
for (const n of
|
|
1290
|
-
|
|
1291
|
-
return
|
|
1292
|
-
}
|
|
1293
|
-
function
|
|
1294
|
-
const
|
|
1295
|
-
return
|
|
1296
|
-
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(
|
|
1297
|
-
}),
|
|
1298
|
-
}
|
|
1299
|
-
function
|
|
1290
|
+
function lo(t) {
|
|
1291
|
+
const e = document.createElement("div");
|
|
1292
|
+
e.className = "pluno-pa-widget__message-attachments";
|
|
1293
|
+
for (const n of t)
|
|
1294
|
+
e.appendChild(Vn(n));
|
|
1295
|
+
return e;
|
|
1296
|
+
}
|
|
1297
|
+
function ot(t) {
|
|
1298
|
+
const e = document.createElement("button");
|
|
1299
|
+
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild($n()), e.addEventListener("click", (n) => {
|
|
1300
|
+
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
|
|
1301
|
+
}), e;
|
|
1302
|
+
}
|
|
1303
|
+
function po(t, e) {
|
|
1300
1304
|
const n = document.createElement("article");
|
|
1301
1305
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1302
1306
|
const o = document.createElement("div");
|
|
@@ -1306,9 +1310,9 @@ function lo(e, t) {
|
|
|
1306
1310
|
const i = document.createElement("strong");
|
|
1307
1311
|
i.textContent = "Share this win?", a.appendChild(i);
|
|
1308
1312
|
const l = document.createElement("span");
|
|
1309
|
-
if (l.textContent =
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1313
|
+
if (l.textContent = e.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), e.error) {
|
|
1314
|
+
const u = document.createElement("span");
|
|
1315
|
+
u.className = "pluno-pa-widget__share-prompt-error", u.textContent = e.error, a.appendChild(u);
|
|
1312
1316
|
}
|
|
1313
1317
|
o.appendChild(a);
|
|
1314
1318
|
const p = document.createElement("div");
|
|
@@ -1316,88 +1320,90 @@ function lo(e, t) {
|
|
|
1316
1320
|
const s = document.createElement("div");
|
|
1317
1321
|
s.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
1318
1322
|
const g = document.createElement("button");
|
|
1319
|
-
if (g.type = "button", g.disabled =
|
|
1320
|
-
|
|
1321
|
-
}),
|
|
1323
|
+
if (g.type = "button", g.disabled = e.isDrafting, g.addEventListener("click", () => {
|
|
1324
|
+
e.onDraft(t);
|
|
1325
|
+
}), e.isDrafting ? (g.appendChild(Ne()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), e.isDrafting)
|
|
1322
1326
|
p.appendChild(s);
|
|
1323
1327
|
else {
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
}), s.appendChild(
|
|
1328
|
+
const u = document.createElement("button");
|
|
1329
|
+
u.type = "button", u.className = "pluno-pa-widget__share-prompt-dismiss", u.setAttribute("aria-label", "Dismiss share prompt"), u.title = "Dismiss", u.textContent = "Dismiss", u.addEventListener("click", () => {
|
|
1330
|
+
e.onDismiss(t);
|
|
1331
|
+
}), s.appendChild(u), p.appendChild(s);
|
|
1328
1332
|
const b = document.createElement("button");
|
|
1329
1333
|
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1330
|
-
|
|
1334
|
+
e.onDisable(t);
|
|
1331
1335
|
}), p.appendChild(b);
|
|
1332
1336
|
}
|
|
1333
1337
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1334
1338
|
}
|
|
1335
|
-
function
|
|
1339
|
+
function so(t, e) {
|
|
1336
1340
|
const n = document.createElement("div");
|
|
1337
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1338
|
-
|
|
1341
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (f) => {
|
|
1342
|
+
f.target === n && e.onClose();
|
|
1339
1343
|
});
|
|
1340
1344
|
const o = document.createElement("section");
|
|
1341
1345
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
1342
1346
|
const a = document.createElement("header"), i = document.createElement("strong");
|
|
1343
1347
|
i.textContent = "Share this win", a.appendChild(i);
|
|
1344
1348
|
const l = document.createElement("button");
|
|
1345
|
-
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click",
|
|
1349
|
+
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", e.onClose), a.appendChild(l), o.appendChild(a);
|
|
1346
1350
|
const p = document.createElement("p");
|
|
1347
1351
|
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
1348
1352
|
const s = document.createElement("div");
|
|
1349
1353
|
s.className = "pluno-pa-widget__share-dialog-step";
|
|
1350
1354
|
const g = document.createElement("div");
|
|
1351
1355
|
g.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
const b =
|
|
1356
|
+
const u = document.createElement("strong");
|
|
1357
|
+
u.textContent = "1) Copy Screenshot", g.appendChild(u);
|
|
1358
|
+
const b = co("Copy Screenshot", async () => {
|
|
1355
1359
|
try {
|
|
1356
|
-
return await Kt(
|
|
1360
|
+
return await Kt(t.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1357
1361
|
} catch {
|
|
1358
1362
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1359
1363
|
}
|
|
1360
1364
|
});
|
|
1361
|
-
if (g.appendChild(b), s.appendChild(g),
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1365
|
+
if (g.appendChild(b), s.appendChild(g), t.screenshotDataUrl) {
|
|
1366
|
+
const f = document.createElement("div");
|
|
1367
|
+
f.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1368
|
+
const d = document.createElement("img");
|
|
1369
|
+
d.src = t.screenshotDataUrl, d.alt = "Product page with Pluno open", f.appendChild(d), s.appendChild(f);
|
|
1366
1370
|
}
|
|
1367
1371
|
o.appendChild(s), o.appendChild(p);
|
|
1368
1372
|
const w = document.createElement("div");
|
|
1369
1373
|
w.className = "pluno-pa-widget__share-dialog-step";
|
|
1370
1374
|
const x = document.createElement("strong");
|
|
1371
1375
|
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", w.appendChild(x);
|
|
1372
|
-
const C = document.createElement("
|
|
1373
|
-
C.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1376
|
+
const C = document.createElement("p");
|
|
1377
|
+
C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", w.appendChild(C);
|
|
1378
|
+
const m = document.createElement("footer");
|
|
1379
|
+
m.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1380
|
+
for (const f of uo(t)) {
|
|
1381
|
+
const d = document.createElement("a");
|
|
1382
|
+
d.href = f.href, d.target = "_blank", d.rel = "noopener noreferrer", d.title = f.label, d.setAttribute("aria-label", `Open ${f.label}`), d.appendChild(go(f.id)), m.appendChild(d);
|
|
1377
1383
|
}
|
|
1378
|
-
if (w.appendChild(
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1384
|
+
if (w.appendChild(m), o.appendChild(w), e.socialPostRewardsUrl) {
|
|
1385
|
+
const f = document.createElement("div");
|
|
1386
|
+
f.className = "pluno-pa-widget__share-dialog-step";
|
|
1387
|
+
const d = document.createElement("strong");
|
|
1388
|
+
d.className = "pluno-pa-widget__share-dialog-step-title", d.textContent = "3) Submit post to get 2000 free credits!", f.appendChild(d);
|
|
1389
|
+
const h = document.createElement("a");
|
|
1390
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = e.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(ho()), f.appendChild(h), o.appendChild(f);
|
|
1385
1391
|
}
|
|
1386
1392
|
return n.appendChild(o), n;
|
|
1387
1393
|
}
|
|
1388
|
-
function
|
|
1394
|
+
function co(t, e) {
|
|
1389
1395
|
const n = document.createElement("button");
|
|
1390
|
-
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent =
|
|
1391
|
-
o.preventDefault(), o.stopPropagation(), await
|
|
1396
|
+
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = t, n.addEventListener("click", async (o) => {
|
|
1397
|
+
o.preventDefault(), o.stopPropagation(), await e() && (n.textContent = "Copied ✓");
|
|
1392
1398
|
}), n;
|
|
1393
1399
|
}
|
|
1394
|
-
function
|
|
1395
|
-
const
|
|
1400
|
+
function uo(t) {
|
|
1401
|
+
const e = t.linkedinPost.trim(), n = t.xPost.trim();
|
|
1396
1402
|
return [
|
|
1397
1403
|
{
|
|
1398
1404
|
id: "linkedin",
|
|
1399
1405
|
label: "LinkedIn",
|
|
1400
|
-
href: `https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(
|
|
1406
|
+
href: `https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(e)}`
|
|
1401
1407
|
},
|
|
1402
1408
|
{
|
|
1403
1409
|
id: "x",
|
|
@@ -1411,42 +1417,42 @@ function co(e) {
|
|
|
1411
1417
|
}
|
|
1412
1418
|
];
|
|
1413
1419
|
}
|
|
1414
|
-
function
|
|
1415
|
-
const
|
|
1416
|
-
return
|
|
1420
|
+
function go(t) {
|
|
1421
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1422
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), e.setAttribute("viewBox", "0 0 32 32"), e.setAttribute("aria-hidden", "true"), t === "linkedin" ? (P(e, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), P(e, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), P(e, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), P(e, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), P(e, "M20 18c.1 2.2.1 4.7 0 7.2"), e) : t === "x" ? (P(e, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), P(e, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), P(e, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), e) : (P(e, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), P(e, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), P(e, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), P(e, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), e);
|
|
1417
1423
|
}
|
|
1418
|
-
function P(
|
|
1424
|
+
function P(t, e, n) {
|
|
1419
1425
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1420
|
-
o.setAttribute("d",
|
|
1426
|
+
o.setAttribute("d", e), n && o.setAttribute("opacity", n), t.appendChild(o);
|
|
1421
1427
|
}
|
|
1422
|
-
function
|
|
1423
|
-
const
|
|
1424
|
-
return
|
|
1428
|
+
function ho() {
|
|
1429
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1430
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), t.setAttribute("viewBox", "0 0 24 24"), t.setAttribute("aria-hidden", "true"), P(t, "M14 5h5v5"), P(t, "M19 5l-8 8"), P(t, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), t;
|
|
1425
1431
|
}
|
|
1426
|
-
function
|
|
1427
|
-
return
|
|
1432
|
+
function mo(t) {
|
|
1433
|
+
return t.role === "tool" && t.toolName === ut;
|
|
1428
1434
|
}
|
|
1429
|
-
function
|
|
1430
|
-
return
|
|
1435
|
+
function at(t) {
|
|
1436
|
+
return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1431
1437
|
}
|
|
1432
|
-
function
|
|
1438
|
+
function fo(t, e, n, o) {
|
|
1433
1439
|
const a = document.createElement("article");
|
|
1434
|
-
a.className = "pluno-pa-widget__tool-group", a.title = new Date(
|
|
1440
|
+
a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
|
|
1435
1441
|
const i = document.createElement("img");
|
|
1436
1442
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1437
|
-
const l = document.createElement("details"), p =
|
|
1438
|
-
l.open =
|
|
1439
|
-
l.open ?
|
|
1443
|
+
const l = document.createElement("details"), p = wo(t);
|
|
1444
|
+
l.open = e.has(p), l.addEventListener("toggle", () => {
|
|
1445
|
+
l.open ? e.add(p) : e.delete(p), n();
|
|
1440
1446
|
});
|
|
1441
1447
|
const s = document.createElement("summary");
|
|
1442
|
-
s.className = "pluno-pa-widget__tool-summary",
|
|
1443
|
-
const
|
|
1444
|
-
if (
|
|
1448
|
+
s.className = "pluno-pa-widget__tool-summary", t.some((b) => b.loading) && s.appendChild(Ne());
|
|
1449
|
+
const u = document.createElement("span");
|
|
1450
|
+
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = t[t.length - 1].content || "Run tool", s.appendChild(u), l.appendChild(s), t.length > 0) {
|
|
1445
1451
|
const b = document.createElement("div");
|
|
1446
1452
|
b.className = "pluno-pa-widget__tool-lines";
|
|
1447
|
-
for (const w of
|
|
1453
|
+
for (const w of t) {
|
|
1448
1454
|
const x = document.createElement("div");
|
|
1449
|
-
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(
|
|
1455
|
+
x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ne());
|
|
1450
1456
|
const C = document.createElement("span");
|
|
1451
1457
|
C.textContent = w.content || "Run tool", x.appendChild(C), b.appendChild(x);
|
|
1452
1458
|
}
|
|
@@ -1454,36 +1460,36 @@ function mo(e, t, n, o) {
|
|
|
1454
1460
|
}
|
|
1455
1461
|
return a.appendChild(l), a;
|
|
1456
1462
|
}
|
|
1457
|
-
function
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1463
|
+
function Ae(t) {
|
|
1464
|
+
const e = document.createElement("article");
|
|
1465
|
+
e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1460
1466
|
const n = document.createElement("img");
|
|
1461
|
-
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src =
|
|
1467
|
+
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e;
|
|
1462
1468
|
}
|
|
1463
|
-
function
|
|
1464
|
-
const
|
|
1465
|
-
return
|
|
1469
|
+
function bo(t) {
|
|
1470
|
+
const e = Ae(t);
|
|
1471
|
+
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(kt()), e;
|
|
1466
1472
|
}
|
|
1467
1473
|
function kt() {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1474
|
+
const t = document.createElement("div");
|
|
1475
|
+
t.className = "pluno-pa-widget__status";
|
|
1476
|
+
const e = document.createElement("span");
|
|
1477
|
+
e.className = "pluno-pa-widget__thinking-dot", e.setAttribute("aria-hidden", "true"), t.appendChild(e);
|
|
1472
1478
|
const n = document.createElement("span");
|
|
1473
|
-
return n.textContent = "Thinking...",
|
|
1479
|
+
return n.textContent = "Thinking...", t.appendChild(n), t;
|
|
1474
1480
|
}
|
|
1475
|
-
function
|
|
1476
|
-
return `tools:${
|
|
1481
|
+
function wo(t) {
|
|
1482
|
+
return `tools:${t.map((e) => e.id).join("|")}`;
|
|
1477
1483
|
}
|
|
1478
|
-
function
|
|
1479
|
-
const
|
|
1480
|
-
return
|
|
1484
|
+
function Ne() {
|
|
1485
|
+
const t = document.createElement("span");
|
|
1486
|
+
return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
|
|
1481
1487
|
}
|
|
1482
|
-
function St(
|
|
1483
|
-
|
|
1488
|
+
function St(t, e) {
|
|
1489
|
+
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? Gn() : vt());
|
|
1484
1490
|
}
|
|
1485
|
-
function
|
|
1486
|
-
const n =
|
|
1491
|
+
function it(t, e) {
|
|
1492
|
+
const n = e.replace(/\r\n/g, `
|
|
1487
1493
|
`).split(`
|
|
1488
1494
|
`);
|
|
1489
1495
|
let o = 0;
|
|
@@ -1498,86 +1504,86 @@ function rt(e, t) {
|
|
|
1498
1504
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1499
1505
|
g.push(n[o]), o += 1;
|
|
1500
1506
|
o += o < n.length ? 1 : 0;
|
|
1501
|
-
const
|
|
1507
|
+
const u = document.createElement("pre"), b = document.createElement("code");
|
|
1502
1508
|
b.textContent = g.join(`
|
|
1503
|
-
`),
|
|
1509
|
+
`), u.appendChild(b), t.appendChild(u);
|
|
1504
1510
|
continue;
|
|
1505
1511
|
}
|
|
1506
1512
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1507
1513
|
if (l) {
|
|
1508
1514
|
const g = document.createElement(`h${l[1].length + 2}`);
|
|
1509
|
-
pe(g, l[2]),
|
|
1515
|
+
pe(g, l[2]), t.appendChild(g), o += 1;
|
|
1510
1516
|
continue;
|
|
1511
1517
|
}
|
|
1512
1518
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1513
1519
|
const g = document.createElement("ul");
|
|
1514
1520
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1515
|
-
const
|
|
1516
|
-
pe(
|
|
1521
|
+
const u = document.createElement("li");
|
|
1522
|
+
pe(u, n[o].replace(/^\s*[-*+]\s+/, "")), g.appendChild(u), o += 1;
|
|
1517
1523
|
}
|
|
1518
|
-
|
|
1524
|
+
t.appendChild(g);
|
|
1519
1525
|
continue;
|
|
1520
1526
|
}
|
|
1521
1527
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1522
1528
|
const g = document.createElement("ol");
|
|
1523
1529
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1524
|
-
const
|
|
1525
|
-
pe(
|
|
1530
|
+
const u = document.createElement("li");
|
|
1531
|
+
pe(u, n[o].replace(/^\s*\d+\.\s+/, "")), g.appendChild(u), o += 1;
|
|
1526
1532
|
}
|
|
1527
|
-
|
|
1533
|
+
t.appendChild(g);
|
|
1528
1534
|
continue;
|
|
1529
1535
|
}
|
|
1530
1536
|
const p = [a];
|
|
1531
1537
|
for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
|
|
1532
1538
|
p.push(n[o]), o += 1;
|
|
1533
1539
|
const s = document.createElement("p");
|
|
1534
|
-
p.forEach((g,
|
|
1535
|
-
|
|
1536
|
-
}),
|
|
1540
|
+
p.forEach((g, u) => {
|
|
1541
|
+
u > 0 && s.appendChild(document.createElement("br")), pe(s, g);
|
|
1542
|
+
}), t.appendChild(s);
|
|
1537
1543
|
}
|
|
1538
1544
|
}
|
|
1539
|
-
function pe(
|
|
1545
|
+
function pe(t, e) {
|
|
1540
1546
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1541
1547
|
let o = 0;
|
|
1542
|
-
for (const a of
|
|
1548
|
+
for (const a of e.matchAll(n)) {
|
|
1543
1549
|
const i = a.index ?? 0;
|
|
1544
|
-
i > o &&
|
|
1550
|
+
i > o && t.appendChild(document.createTextNode(e.slice(o, i)));
|
|
1545
1551
|
const l = a[0];
|
|
1546
1552
|
if (l.startsWith("`")) {
|
|
1547
1553
|
const p = document.createElement("code");
|
|
1548
|
-
p.textContent = l.slice(1, -1),
|
|
1554
|
+
p.textContent = l.slice(1, -1), t.appendChild(p);
|
|
1549
1555
|
} else if (l.startsWith("**")) {
|
|
1550
1556
|
const p = document.createElement("strong");
|
|
1551
|
-
p.textContent = l.slice(2, -2),
|
|
1557
|
+
p.textContent = l.slice(2, -2), t.appendChild(p);
|
|
1552
1558
|
} else if (l.startsWith("*")) {
|
|
1553
1559
|
const p = document.createElement("em");
|
|
1554
|
-
p.textContent = l.slice(1, -1),
|
|
1560
|
+
p.textContent = l.slice(1, -1), t.appendChild(p);
|
|
1555
1561
|
} else {
|
|
1556
1562
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1557
|
-
if (p &&
|
|
1563
|
+
if (p && _o(p[2])) {
|
|
1558
1564
|
const s = document.createElement("a");
|
|
1559
|
-
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1],
|
|
1565
|
+
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], t.appendChild(s);
|
|
1560
1566
|
} else
|
|
1561
|
-
|
|
1567
|
+
t.appendChild(document.createTextNode(l));
|
|
1562
1568
|
}
|
|
1563
1569
|
o = i + l.length;
|
|
1564
1570
|
}
|
|
1565
|
-
o <
|
|
1571
|
+
o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
|
|
1566
1572
|
}
|
|
1567
|
-
function
|
|
1568
|
-
if (
|
|
1573
|
+
function _o(t) {
|
|
1574
|
+
if (t.startsWith("/") || t.startsWith("#"))
|
|
1569
1575
|
return !0;
|
|
1570
1576
|
try {
|
|
1571
|
-
const
|
|
1572
|
-
return ["http:", "https:", "mailto:"].includes(
|
|
1577
|
+
const e = new URL(t);
|
|
1578
|
+
return ["http:", "https:", "mailto:"].includes(e.protocol);
|
|
1573
1579
|
} catch {
|
|
1574
1580
|
return !1;
|
|
1575
1581
|
}
|
|
1576
1582
|
}
|
|
1577
|
-
function
|
|
1578
|
-
if (
|
|
1583
|
+
function rt(t, e) {
|
|
1584
|
+
if (t.getElementById("pluno-pa-widget-styles"))
|
|
1579
1585
|
return;
|
|
1580
|
-
const n =
|
|
1586
|
+
const n = t.ownerDocument.createElement("style");
|
|
1581
1587
|
n.id = "pluno-pa-widget-styles", n.textContent = `
|
|
1582
1588
|
:host {
|
|
1583
1589
|
all: initial;
|
|
@@ -1610,7 +1616,7 @@ function lt(e, t) {
|
|
|
1610
1616
|
flex: 0 0 auto;
|
|
1611
1617
|
}
|
|
1612
1618
|
.pluno-pa-widget {
|
|
1613
|
-
--pluno-pa-accent: ${
|
|
1619
|
+
--pluno-pa-accent: ${e};
|
|
1614
1620
|
--pluno-pa-bg: #fafaf9;
|
|
1615
1621
|
--pluno-pa-surface: #f4f4f2;
|
|
1616
1622
|
--pluno-pa-bubble: #eeeded;
|
|
@@ -1621,8 +1627,8 @@ function lt(e, t) {
|
|
|
1621
1627
|
--pluno-pa-launcher-hairline: rgba(24, 24, 27, 0.06);
|
|
1622
1628
|
--pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
|
|
1623
1629
|
--pluno-pa-launcher-height: 41px;
|
|
1624
|
-
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw -
|
|
1625
|
-
--pluno-pa-panel-height: min(clamp(680px, 76vh, 800px), calc(100vh -
|
|
1630
|
+
--pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
|
|
1631
|
+
--pluno-pa-panel-height: min(clamp(680px, 76vh, 800px), calc(100vh - 58px));
|
|
1626
1632
|
--pluno-pa-panel-offset-x: calc(var(--pluno-pa-launcher-width) - var(--pluno-pa-panel-width));
|
|
1627
1633
|
--pluno-pa-panel-offset-y: calc(var(--pluno-pa-launcher-height) - var(--pluno-pa-panel-height));
|
|
1628
1634
|
--pluno-pa-accent-soft: rgba(24, 24, 27, 0.12);
|
|
@@ -2444,6 +2450,12 @@ function lt(e, t) {
|
|
|
2444
2450
|
.pluno-pa-widget__share-dialog-status[hidden] {
|
|
2445
2451
|
display: none;
|
|
2446
2452
|
}
|
|
2453
|
+
.pluno-pa-widget__share-dialog-hint {
|
|
2454
|
+
margin: -2px 0 0;
|
|
2455
|
+
color: var(--pluno-pa-share-muted);
|
|
2456
|
+
font-size: 12px;
|
|
2457
|
+
line-height: 1.3;
|
|
2458
|
+
}
|
|
2447
2459
|
.pluno-pa-widget__share-dialog-copy {
|
|
2448
2460
|
display: inline-flex;
|
|
2449
2461
|
align-items: center;
|
|
@@ -2961,7 +2973,7 @@ function lt(e, t) {
|
|
|
2961
2973
|
right: 16px;
|
|
2962
2974
|
height: 36px;
|
|
2963
2975
|
z-index: 3;
|
|
2964
|
-
background-image: url('${
|
|
2976
|
+
background-image: url('${je}');
|
|
2965
2977
|
background-repeat: repeat-x;
|
|
2966
2978
|
background-size: 104px 36px;
|
|
2967
2979
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3208,7 +3220,7 @@ function lt(e, t) {
|
|
|
3208
3220
|
right: 12px;
|
|
3209
3221
|
height: 22px;
|
|
3210
3222
|
z-index: 1;
|
|
3211
|
-
background-image: url('${
|
|
3223
|
+
background-image: url('${je}');
|
|
3212
3224
|
background-repeat: repeat-x;
|
|
3213
3225
|
background-size: 62px 21.5px;
|
|
3214
3226
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3220,59 +3232,59 @@ function lt(e, t) {
|
|
|
3220
3232
|
.pluno-pa-widget--scribble .pluno-pa-widget__close svg {
|
|
3221
3233
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3222
3234
|
}
|
|
3223
|
-
`,
|
|
3235
|
+
`, t.appendChild(n);
|
|
3224
3236
|
}
|
|
3225
|
-
async function
|
|
3226
|
-
return document.body ? document.body : await new Promise((
|
|
3227
|
-
const
|
|
3228
|
-
document.body && (
|
|
3237
|
+
async function xo() {
|
|
3238
|
+
return document.body ? document.body : await new Promise((t) => {
|
|
3239
|
+
const e = new MutationObserver(() => {
|
|
3240
|
+
document.body && (e.disconnect(), t(document.body));
|
|
3229
3241
|
});
|
|
3230
|
-
|
|
3242
|
+
e.observe(document.documentElement, { childList: !0 });
|
|
3231
3243
|
});
|
|
3232
3244
|
}
|
|
3233
|
-
function Lt(
|
|
3234
|
-
return `pluno.productAgent.widgetState.${location.origin}.${
|
|
3245
|
+
function Lt(t) {
|
|
3246
|
+
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
3235
3247
|
}
|
|
3236
|
-
function
|
|
3248
|
+
function vo(t) {
|
|
3237
3249
|
try {
|
|
3238
|
-
const
|
|
3239
|
-
if (!
|
|
3240
|
-
return
|
|
3241
|
-
const n = JSON.parse(
|
|
3250
|
+
const e = window.localStorage.getItem(Lt(t));
|
|
3251
|
+
if (!e)
|
|
3252
|
+
return lt();
|
|
3253
|
+
const n = JSON.parse(e);
|
|
3242
3254
|
return {
|
|
3243
3255
|
isOpen: n.isOpen === !0,
|
|
3244
3256
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3245
3257
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3246
|
-
launcherPosition:
|
|
3247
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3258
|
+
launcherPosition: ko(n.launcherPosition) ? n.launcherPosition : null,
|
|
3259
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-gt) : [],
|
|
3248
3260
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3249
3261
|
};
|
|
3250
3262
|
} catch {
|
|
3251
|
-
return
|
|
3263
|
+
return lt();
|
|
3252
3264
|
}
|
|
3253
3265
|
}
|
|
3254
|
-
async function
|
|
3255
|
-
if (
|
|
3256
|
-
return
|
|
3266
|
+
async function yo(t) {
|
|
3267
|
+
if (t.loadSharePromptsDisabled)
|
|
3268
|
+
return t.loadSharePromptsDisabled();
|
|
3257
3269
|
try {
|
|
3258
|
-
return window.localStorage.getItem(
|
|
3270
|
+
return window.localStorage.getItem(ht) === "true";
|
|
3259
3271
|
} catch {
|
|
3260
3272
|
return !1;
|
|
3261
3273
|
}
|
|
3262
3274
|
}
|
|
3263
|
-
function
|
|
3264
|
-
if (
|
|
3265
|
-
Promise.resolve(
|
|
3275
|
+
function Co(t, e) {
|
|
3276
|
+
if (t.persistSharePromptsDisabled) {
|
|
3277
|
+
Promise.resolve(t.persistSharePromptsDisabled(e)).catch(() => {
|
|
3266
3278
|
});
|
|
3267
3279
|
return;
|
|
3268
3280
|
}
|
|
3269
3281
|
try {
|
|
3270
|
-
|
|
3282
|
+
e && window.localStorage.setItem(ht, "true");
|
|
3271
3283
|
} catch {
|
|
3272
3284
|
return;
|
|
3273
3285
|
}
|
|
3274
3286
|
}
|
|
3275
|
-
function
|
|
3287
|
+
function lt() {
|
|
3276
3288
|
return {
|
|
3277
3289
|
isOpen: !1,
|
|
3278
3290
|
composerValue: "",
|
|
@@ -3282,34 +3294,34 @@ function pt() {
|
|
|
3282
3294
|
sharePromptsDisabled: !1
|
|
3283
3295
|
};
|
|
3284
3296
|
}
|
|
3285
|
-
function
|
|
3297
|
+
function Eo(t, e) {
|
|
3286
3298
|
try {
|
|
3287
|
-
window.localStorage.setItem(Lt(
|
|
3299
|
+
window.localStorage.setItem(Lt(t), JSON.stringify(e));
|
|
3288
3300
|
} catch {
|
|
3289
3301
|
return;
|
|
3290
3302
|
}
|
|
3291
3303
|
}
|
|
3292
|
-
function
|
|
3293
|
-
if (!
|
|
3304
|
+
function ko(t) {
|
|
3305
|
+
if (!t || typeof t != "object")
|
|
3294
3306
|
return !1;
|
|
3295
|
-
const
|
|
3296
|
-
return Number.isFinite(
|
|
3307
|
+
const e = t;
|
|
3308
|
+
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
3297
3309
|
}
|
|
3298
|
-
const
|
|
3299
|
-
function
|
|
3300
|
-
return Object.keys(
|
|
3310
|
+
const pt = /* @__PURE__ */ new WeakSet();
|
|
3311
|
+
function So(t) {
|
|
3312
|
+
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
3301
3313
|
}
|
|
3302
|
-
function
|
|
3303
|
-
const
|
|
3304
|
-
return
|
|
3314
|
+
function st(t) {
|
|
3315
|
+
const e = t.pathname.split("/");
|
|
3316
|
+
return e[e.length - 1] ?? "";
|
|
3305
3317
|
}
|
|
3306
|
-
function
|
|
3307
|
-
const n = new URL(
|
|
3308
|
-
return n.href ===
|
|
3318
|
+
function Lo(t, e) {
|
|
3319
|
+
const n = new URL(t.src, document.baseURI);
|
|
3320
|
+
return n.href === e.href || n.pathname === e.pathname ? !0 : st(n) === st(e);
|
|
3309
3321
|
}
|
|
3310
3322
|
class O extends EventTarget {
|
|
3311
|
-
constructor(
|
|
3312
|
-
super(), this.channelId = n, this.url =
|
|
3323
|
+
constructor(e, n) {
|
|
3324
|
+
super(), this.channelId = n, this.url = e, this.addPreviewListener(Qt, () => {
|
|
3313
3325
|
this.readyState = O.OPEN, this.dispatchEvent(new Event("open"));
|
|
3314
3326
|
}), this.addPreviewListener(en, (o) => {
|
|
3315
3327
|
const a = o;
|
|
@@ -3327,7 +3339,7 @@ class O extends EventTarget {
|
|
|
3327
3339
|
), this.cleanup();
|
|
3328
3340
|
}), window.dispatchEvent(
|
|
3329
3341
|
new CustomEvent(se(Xt, this.channelId), {
|
|
3330
|
-
detail: { socketId: this.socketId, url:
|
|
3342
|
+
detail: { socketId: this.socketId, url: e }
|
|
3331
3343
|
})
|
|
3332
3344
|
);
|
|
3333
3345
|
}
|
|
@@ -3342,78 +3354,78 @@ class O extends EventTarget {
|
|
|
3342
3354
|
binaryType = "blob";
|
|
3343
3355
|
bufferedAmount = 0;
|
|
3344
3356
|
readyState = O.CONNECTING;
|
|
3345
|
-
socketId =
|
|
3357
|
+
socketId = Po();
|
|
3346
3358
|
listeners = /* @__PURE__ */ new Map();
|
|
3347
|
-
send(
|
|
3359
|
+
send(e) {
|
|
3348
3360
|
if (this.readyState !== O.OPEN)
|
|
3349
3361
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3350
3362
|
window.dispatchEvent(
|
|
3351
3363
|
new CustomEvent(se(Zt, this.channelId), {
|
|
3352
|
-
detail: { socketId: this.socketId, data: typeof
|
|
3364
|
+
detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
|
|
3353
3365
|
})
|
|
3354
3366
|
);
|
|
3355
3367
|
}
|
|
3356
|
-
close(
|
|
3368
|
+
close(e, n) {
|
|
3357
3369
|
this.readyState !== O.CLOSED && (this.readyState = O.CLOSING, window.dispatchEvent(
|
|
3358
3370
|
new CustomEvent(se(Jt, this.channelId), {
|
|
3359
|
-
detail: { socketId: this.socketId, code:
|
|
3371
|
+
detail: { socketId: this.socketId, code: e, reason: n }
|
|
3360
3372
|
})
|
|
3361
3373
|
), this.cleanup());
|
|
3362
3374
|
}
|
|
3363
|
-
addPreviewListener(
|
|
3364
|
-
const o = se(
|
|
3375
|
+
addPreviewListener(e, n) {
|
|
3376
|
+
const o = se(e, this.channelId), a = (i) => {
|
|
3365
3377
|
i.detail?.socketId === this.socketId && n(i);
|
|
3366
3378
|
};
|
|
3367
3379
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
3368
3380
|
}
|
|
3369
3381
|
cleanup() {
|
|
3370
|
-
for (const [
|
|
3371
|
-
window.removeEventListener(
|
|
3382
|
+
for (const [e, n] of this.listeners.entries())
|
|
3383
|
+
window.removeEventListener(e, n);
|
|
3372
3384
|
this.listeners.clear();
|
|
3373
3385
|
}
|
|
3374
3386
|
}
|
|
3375
|
-
function
|
|
3376
|
-
const
|
|
3377
|
-
if (
|
|
3378
|
-
return
|
|
3379
|
-
const
|
|
3380
|
-
return window.sessionStorage.setItem(
|
|
3387
|
+
function Po() {
|
|
3388
|
+
const t = window.sessionStorage.getItem(qe);
|
|
3389
|
+
if (t)
|
|
3390
|
+
return t;
|
|
3391
|
+
const e = crypto.randomUUID();
|
|
3392
|
+
return window.sessionStorage.setItem(qe, e), e;
|
|
3381
3393
|
}
|
|
3382
|
-
function se(
|
|
3383
|
-
return `${
|
|
3394
|
+
function se(t, e) {
|
|
3395
|
+
return `${t}:${e}`;
|
|
3384
3396
|
}
|
|
3385
|
-
function
|
|
3386
|
-
const
|
|
3387
|
-
if (
|
|
3388
|
-
return [
|
|
3389
|
-
const n = new URL(
|
|
3397
|
+
function Ao(t) {
|
|
3398
|
+
const e = document.currentScript;
|
|
3399
|
+
if (e instanceof HTMLScriptElement)
|
|
3400
|
+
return [e];
|
|
3401
|
+
const n = new URL(t, document.baseURI).href, o = new URL(n);
|
|
3390
3402
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3391
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3403
|
+
(a) => a instanceof HTMLScriptElement && So(a) && Lo(a, o)
|
|
3392
3404
|
);
|
|
3393
3405
|
}
|
|
3394
|
-
function
|
|
3395
|
-
for (const
|
|
3396
|
-
if (
|
|
3406
|
+
function No(t) {
|
|
3407
|
+
for (const e of Ao(t)) {
|
|
3408
|
+
if (pt.has(e) || e.dataset.plunoAutoMount === "false")
|
|
3397
3409
|
continue;
|
|
3398
|
-
|
|
3399
|
-
const n =
|
|
3410
|
+
pt.add(e);
|
|
3411
|
+
const n = e.dataset.plunoPreviewChannel;
|
|
3400
3412
|
Cn({
|
|
3401
|
-
token:
|
|
3402
|
-
tokenEndpoint:
|
|
3403
|
-
backendUrl:
|
|
3413
|
+
token: e.dataset.plunoToken,
|
|
3414
|
+
tokenEndpoint: e.dataset.plunoTokenEndpoint,
|
|
3415
|
+
backendUrl: e.dataset.plunoBackendUrl,
|
|
3404
3416
|
webSocketFactory: n ? yn(n) : void 0,
|
|
3405
|
-
launcherLabel:
|
|
3406
|
-
accentColor:
|
|
3407
|
-
colorScheme:
|
|
3408
|
-
fontFamily:
|
|
3409
|
-
scribbleStyle:
|
|
3410
|
-
position:
|
|
3417
|
+
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
3418
|
+
accentColor: e.dataset.plunoAccentColor,
|
|
3419
|
+
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
3420
|
+
fontFamily: e.dataset.plunoFontFamily,
|
|
3421
|
+
scribbleStyle: e.dataset.plunoScribbleStyle === "true",
|
|
3422
|
+
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
3411
3423
|
}).catch((o) => {
|
|
3412
3424
|
console.error("Failed to mount Pluno widget", o);
|
|
3413
3425
|
});
|
|
3414
3426
|
}
|
|
3415
3427
|
}
|
|
3416
|
-
|
|
3428
|
+
No(import.meta.url);
|
|
3417
3429
|
export {
|
|
3418
3430
|
yn as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3419
3431
|
Cn as mountPlunoProductAgentWidget
|