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