@pluno/product-agent-web 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-widget.js +932 -709
- package/dist/widget.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const e =
|
|
1
|
+
import { PlunoProductAgent as Ct } from "./product-agent-sdk.js";
|
|
2
|
+
const Et = "#7c3aed";
|
|
3
|
+
function kt(t) {
|
|
4
|
+
const e = Nt(t);
|
|
5
5
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
6
6
|
<defs>
|
|
7
7
|
<linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
|
|
@@ -75,23 +75,23 @@ function Ct(t) {
|
|
|
75
75
|
</g>
|
|
76
76
|
</svg>`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return `data:image/svg+xml,${encodeURIComponent(
|
|
78
|
+
function St(t) {
|
|
79
|
+
return `data:image/svg+xml,${encodeURIComponent(kt(t))}`;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
const e =
|
|
84
|
-
if (
|
|
81
|
+
const H = "#2c2a1e", De = [253, 250, 241], Te = 3.5;
|
|
82
|
+
function et(t) {
|
|
83
|
+
const e = tt(t);
|
|
84
|
+
if (Ie(J(e), De) >= Te)
|
|
85
85
|
return e;
|
|
86
|
-
let o =
|
|
87
|
-
const a =
|
|
88
|
-
for (let
|
|
89
|
-
if (o =
|
|
90
|
-
return
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
function
|
|
94
|
-
const e =
|
|
86
|
+
let o = J(e);
|
|
87
|
+
const a = J(H);
|
|
88
|
+
for (let r = 0; r < 6; r += 1)
|
|
89
|
+
if (o = Dt(o, a, 0.22), Ie(o, De) >= Te)
|
|
90
|
+
return be(o);
|
|
91
|
+
return be(o);
|
|
92
|
+
}
|
|
93
|
+
function Lt(t) {
|
|
94
|
+
const e = et(t), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
|
|
95
95
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
|
|
96
96
|
<defs>
|
|
97
97
|
<clipPath id="scribbleBoltClip">
|
|
@@ -104,35 +104,35 @@ function kt(t) {
|
|
|
104
104
|
</defs>
|
|
105
105
|
<g filter="url(#scribbleBoltWobble)">
|
|
106
106
|
<g clip-path="url(#scribbleBoltClip)">
|
|
107
|
-
<path d="${
|
|
107
|
+
<path d="${At()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
|
|
108
108
|
</g>
|
|
109
|
-
<path d="${n}" fill="none" stroke="${
|
|
109
|
+
<path d="${n}" fill="none" stroke="${H}" 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="${H}" stroke-width="13"/>
|
|
112
|
+
<ellipse cx="533" cy="473" rx="45" ry="53" fill="${H}"/>
|
|
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="${H}" stroke-width="13"/>
|
|
117
|
+
<ellipse cx="712" cy="473" rx="45" ry="53" fill="${H}"/>
|
|
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 Pt(t) {
|
|
124
|
+
return `data:image/svg+xml,${encodeURIComponent(Lt(t))}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function At() {
|
|
127
127
|
let n = "M 280 120", o = !1, a = 0;
|
|
128
|
-
for (let
|
|
128
|
+
for (let r = 150; r <= 1170; r += 62) {
|
|
129
129
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
130
|
-
n += ` L ${p} ${
|
|
130
|
+
n += ` L ${p} ${r}`, o = !o, a += 1;
|
|
131
131
|
}
|
|
132
132
|
return n;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const e =
|
|
134
|
+
function Nt(t) {
|
|
135
|
+
const e = tt(t), n = _e(J(e));
|
|
136
136
|
return n > 0.86 ? {
|
|
137
137
|
top: "#ffffff",
|
|
138
138
|
middle: "#f6f6f6",
|
|
@@ -156,90 +156,90 @@ function Pt(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: D(e, 0.28, -0.03),
|
|
160
|
+
middle: D(e, 0.08, 0.04),
|
|
161
|
+
bottom: D(e, -0.1, 0.02),
|
|
162
|
+
edgeStart: D(e, 0.08, 0.08),
|
|
163
|
+
edgeMiddle: D(e, -0.08, 0.08),
|
|
164
|
+
edgeEnd: D(e, -0.18, 0.05),
|
|
165
|
+
glow: D(e, 0.32, -0.12),
|
|
166
|
+
highlight: D(e, 0.38, -0.18),
|
|
167
|
+
inner: D(e, 0.24, -0.1),
|
|
168
|
+
shadow: D(e, -0.25, -0.08)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function tt(t) {
|
|
172
172
|
const e = t.trim();
|
|
173
|
-
return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
173
|
+
return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Et;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function J(t) {
|
|
176
176
|
return [
|
|
177
177
|
Number.parseInt(t.slice(1, 3), 16),
|
|
178
178
|
Number.parseInt(t.slice(3, 5), 16),
|
|
179
179
|
Number.parseInt(t.slice(5, 7), 16)
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function be([t, e, n]) {
|
|
183
183
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
184
184
|
return `#${o(t)}${o(e)}${o(n)}`;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function _e([t, e, n]) {
|
|
187
187
|
const o = (a) => {
|
|
188
|
-
const
|
|
189
|
-
return
|
|
188
|
+
const r = a / 255;
|
|
189
|
+
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
190
190
|
};
|
|
191
191
|
return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const n =
|
|
195
|
-
return (a + 0.05) / (
|
|
193
|
+
function Ie(t, e) {
|
|
194
|
+
const n = _e(t), o = _e(e), [a, r] = n > o ? [n, o] : [o, n];
|
|
195
|
+
return (a + 0.05) / (r + 0.05);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const o =
|
|
197
|
+
function Dt(t, e, n) {
|
|
198
|
+
const o = xe(n);
|
|
199
199
|
return [
|
|
200
200
|
t[0] + (e[0] - t[0]) * o,
|
|
201
201
|
t[1] + (e[1] - t[1]) * o,
|
|
202
202
|
t[2] + (e[2] - t[2]) * o
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
const [o, a,
|
|
207
|
-
return
|
|
205
|
+
function D(t, e, n) {
|
|
206
|
+
const [o, a, r] = Tt(J(t));
|
|
207
|
+
return be(It(o, xe(a + n), xe(r + e)));
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
const o = t / 255, a = e / 255,
|
|
209
|
+
function Tt([t, e, n]) {
|
|
210
|
+
const o = t / 255, a = e / 255, r = n / 255, l = Math.max(o, a, r), p = Math.min(o, a, r), s = (l + p) / 2;
|
|
211
211
|
if (l === p)
|
|
212
212
|
return [0, 0, s];
|
|
213
|
-
const
|
|
214
|
-
return [(l === o ? (a -
|
|
213
|
+
const g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
214
|
+
return [(l === o ? (a - r) / g + (a < r ? 6 : 0) : l === a ? (r - o) / g + 2 : (o - a) / g + 4) / 6, c, s];
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function It(t, e, n) {
|
|
217
217
|
if (e === 0)
|
|
218
218
|
return [n * 255, n * 255, n * 255];
|
|
219
219
|
const o = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - o;
|
|
220
220
|
return [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
he(a, o, t + 1 / 3) * 255,
|
|
222
|
+
he(a, o, t) * 255,
|
|
223
|
+
he(a, o, t - 1 / 3) * 255
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function he(t, e, n) {
|
|
227
227
|
let o = n;
|
|
228
228
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? t + (e - t) * 6 * o : o < 1 / 2 ? e : o < 2 / 3 ? t + (e - t) * (2 / 3 - o) * 6 : t;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function xe(t) {
|
|
231
231
|
return Math.max(0, Math.min(1, t));
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
233
|
+
const nt = "suggest_share_on_socials";
|
|
234
|
+
function Mt(t) {
|
|
235
235
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
236
236
|
const n = t[e];
|
|
237
|
-
if (n.role !== "tool" || n.toolName !==
|
|
237
|
+
if (n.role !== "tool" || n.toolName !== nt)
|
|
238
238
|
continue;
|
|
239
|
-
const o =
|
|
239
|
+
const o = Me(t, e, "assistant");
|
|
240
240
|
if (!o)
|
|
241
241
|
return null;
|
|
242
|
-
const a =
|
|
242
|
+
const a = Me(t, o.index, "user");
|
|
243
243
|
return a ? {
|
|
244
244
|
id: `share:${n.callId ?? n.id}`,
|
|
245
245
|
userPrompt: a.content,
|
|
@@ -248,7 +248,13 @@ function Dt(t) {
|
|
|
248
248
|
}
|
|
249
249
|
return null;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
async function Rt(t) {
|
|
252
|
+
const e = await Ot(t);
|
|
253
|
+
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
254
|
+
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
255
|
+
await navigator.clipboard.write([new ClipboardItem({ [e.type || "image/png"]: e })]);
|
|
256
|
+
}
|
|
257
|
+
function Me(t, e, n) {
|
|
252
258
|
for (let o = e - 1; o >= 0; o -= 1) {
|
|
253
259
|
const a = t[o];
|
|
254
260
|
if (a.role === n && a.content.trim())
|
|
@@ -256,7 +262,10 @@ function De(t, e, n) {
|
|
|
256
262
|
}
|
|
257
263
|
return null;
|
|
258
264
|
}
|
|
259
|
-
|
|
265
|
+
async function Ot(t) {
|
|
266
|
+
return await (await fetch(t)).blob();
|
|
267
|
+
}
|
|
268
|
+
const ot = 100, Ft = "product-agent:sdk-preview-socket-connect", Bt = "product-agent:sdk-preview-socket-send", zt = "product-agent:sdk-preview-socket-close", Gt = "product-agent:sdk-preview-socket-open", $t = "product-agent:sdk-preview-socket-message", Ut = "product-agent:sdk-preview-socket-error", Wt = "product-agent:sdk-preview-socket-closed", Re = "product-agent:sdk-preview-socket-id", Ht = "product-agent:preview-diagnostic", at = "pluno.productAgent.sharePromptsDisabled", ie = 10, Vt = 10 * 1024 * 1024, jt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), M = {
|
|
260
269
|
launcherLabel: "Ask for anything...",
|
|
261
270
|
accentColor: "#7c3aed",
|
|
262
271
|
colorScheme: "light",
|
|
@@ -264,19 +273,19 @@ const nt = 100, It = "product-agent:sdk-preview-socket-connect", Rt = "product-a
|
|
|
264
273
|
scribbleStyle: !1,
|
|
265
274
|
position: "bottom-right",
|
|
266
275
|
movableLauncher: !1
|
|
267
|
-
},
|
|
268
|
-
function
|
|
276
|
+
}, Oe = '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>', qt = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Fe = "pluno-pa-scribble-font", rt = 190, it = 41, Kt = 48, Yt = 420, Xt = 680, N = 8, Be = 50, Zt = "http://www.w3.org/2000/svg", Jt = 11, Qt = 13, en = 4, tn = 10, nn = 40, on = "movable-launcher-position-v2";
|
|
277
|
+
function an(t) {
|
|
269
278
|
return (e) => new R(e, t);
|
|
270
279
|
}
|
|
271
|
-
async function
|
|
280
|
+
async function rn(t = {}) {
|
|
272
281
|
const e = {
|
|
273
|
-
launcherLabel: t.launcherLabel ??
|
|
274
|
-
accentColor: t.accentColor ??
|
|
275
|
-
colorScheme: t.colorScheme ??
|
|
276
|
-
fontFamily: t.fontFamily ??
|
|
277
|
-
scribbleStyle: t.scribbleStyle ??
|
|
278
|
-
position: t.position ??
|
|
279
|
-
movableLauncher: t.movableLauncher ??
|
|
282
|
+
launcherLabel: t.launcherLabel ?? M.launcherLabel,
|
|
283
|
+
accentColor: t.accentColor ?? M.accentColor,
|
|
284
|
+
colorScheme: t.colorScheme ?? M.colorScheme,
|
|
285
|
+
fontFamily: t.fontFamily ?? M.fontFamily,
|
|
286
|
+
scribbleStyle: t.scribbleStyle ?? M.scribbleStyle,
|
|
287
|
+
position: t.position ?? M.position,
|
|
288
|
+
movableLauncher: t.movableLauncher ?? M.movableLauncher,
|
|
280
289
|
token: t.token,
|
|
281
290
|
tokenProvider: t.tokenProvider,
|
|
282
291
|
tokenEndpoint: t.tokenEndpoint,
|
|
@@ -287,9 +296,12 @@ async function tn(t = {}) {
|
|
|
287
296
|
loginRequired: t.loginRequired === !0,
|
|
288
297
|
loginButtonLabel: t.loginButtonLabel ?? "Log in to Pluno",
|
|
289
298
|
onLoginClick: t.onLoginClick,
|
|
290
|
-
socialPostDraftHandler: t.socialPostDraftHandler
|
|
299
|
+
socialPostDraftHandler: t.socialPostDraftHandler,
|
|
300
|
+
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
301
|
+
loadSharePromptsDisabled: t.loadSharePromptsDisabled,
|
|
302
|
+
persistSharePromptsDisabled: t.persistSharePromptsDisabled
|
|
291
303
|
};
|
|
292
|
-
|
|
304
|
+
z("web-sdk.widget", "Mounting widget with merged options", {
|
|
293
305
|
accentColor: e.accentColor,
|
|
294
306
|
colorScheme: e.colorScheme,
|
|
295
307
|
fontFamily: e.fontFamily,
|
|
@@ -304,84 +316,85 @@ async function tn(t = {}) {
|
|
|
304
316
|
n.className = "pluno-pa-widget-host";
|
|
305
317
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
306
318
|
a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`;
|
|
307
|
-
let
|
|
308
|
-
|
|
309
|
-
const l = await
|
|
310
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), Xe(o, e.accentColor),
|
|
319
|
+
let r = ze(e.accentColor, e.scribbleStyle);
|
|
320
|
+
hn(a, e.launcherLabel, r, e.movableLauncher), o.appendChild(a);
|
|
321
|
+
const l = await Xn(), p = l.ownerDocument;
|
|
322
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), Xe(o, e.accentColor), Ge(a, r, {
|
|
311
323
|
accentColor: e.accentColor,
|
|
312
324
|
colorScheme: e.colorScheme,
|
|
313
325
|
fontFamily: e.fontFamily,
|
|
314
326
|
scribbleStyle: e.scribbleStyle
|
|
315
|
-
}),
|
|
327
|
+
}), z("web-sdk.widget", "Applied initial widget appearance", {
|
|
316
328
|
accentColor: e.accentColor,
|
|
317
329
|
colorScheme: e.colorScheme,
|
|
318
330
|
fontFamily: e.fontFamily,
|
|
319
331
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
320
332
|
});
|
|
321
|
-
const s = a.querySelector(".pluno-pa-widget__launcher"),
|
|
322
|
-
if (!s || !
|
|
333
|
+
const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), c = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), _ = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), y = a.querySelector(".pluno-pa-widget__attachment-error"), h = a.querySelector(".pluno-pa-widget__attachments"), d = a.querySelector(".pluno-pa-widget__input"), w = a.querySelector(".pluno-pa-widget__send"), m = a.querySelector(".pluno-pa-widget__new-chat"), f = a.querySelector(".pluno-pa-widget__timeline");
|
|
334
|
+
if (!s || !c || !b || !_ || !x || !y || !h || !d || !w || !m || !f)
|
|
323
335
|
throw new Error("Failed to mount Pluno widget");
|
|
324
|
-
if (e.movableLauncher && !
|
|
336
|
+
if (e.movableLauncher && !g)
|
|
325
337
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
326
|
-
|
|
327
|
-
let
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
338
|
+
Ve(c), Ve(d);
|
|
339
|
+
let v = [], k = null;
|
|
340
|
+
const E = () => {
|
|
341
|
+
kn(h, v, (i) => {
|
|
342
|
+
v = v.filter((u, L) => L !== i), E(), I();
|
|
331
343
|
});
|
|
332
|
-
},
|
|
344
|
+
}, q = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
|
|
333
345
|
if (!e.tokenEndpoint)
|
|
334
346
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
335
|
-
const
|
|
347
|
+
const i = await fetch(e.tokenEndpoint, {
|
|
336
348
|
method: "POST",
|
|
337
349
|
credentials: "include",
|
|
338
350
|
headers: { "content-type": "application/json" },
|
|
339
351
|
body: JSON.stringify({ origin: location.origin, url: location.href })
|
|
340
352
|
});
|
|
341
|
-
if (!
|
|
353
|
+
if (!i.ok)
|
|
342
354
|
throw new Error("Failed to load Pluno token");
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
355
|
+
const u = await i.json();
|
|
356
|
+
if (!u.token)
|
|
345
357
|
throw new Error("Pluno token endpoint did not return a token");
|
|
346
|
-
return
|
|
358
|
+
return u.token;
|
|
347
359
|
});
|
|
348
|
-
let
|
|
349
|
-
|
|
360
|
+
let C;
|
|
361
|
+
C = await Ct.init({
|
|
350
362
|
token: e.token,
|
|
351
|
-
tokenProvider:
|
|
363
|
+
tokenProvider: q,
|
|
352
364
|
backendUrl: e.backendUrl,
|
|
353
365
|
metadata: () => ({
|
|
354
366
|
...e.metadata ?? {},
|
|
355
|
-
...!
|
|
367
|
+
...!C.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
356
368
|
}),
|
|
357
369
|
initialStarterPrompts: e.initialStarterPrompts,
|
|
358
370
|
webSocketFactory: e.webSocketFactory,
|
|
359
371
|
autoConnect: e.loginRequired ? !1 : void 0
|
|
360
372
|
});
|
|
361
|
-
const
|
|
362
|
-
let T = e.movableLauncher ?
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
return
|
|
373
|
+
const F = Zn(e), pe = new Set(F.openToolGroupKeys), G = new Set(F.seenShareCandidateIds), Q = new Set(G);
|
|
374
|
+
let se = F.sharePromptsDisabled || await Jn(e), T = e.movableLauncher ? F.launcherPosition : null, Ce = T !== null, O = null, Ee = !1;
|
|
375
|
+
const mt = () => {
|
|
376
|
+
Ee || typeof document > "u" || (Xe(o, e.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
377
|
+
}, ke = new MutationObserver(mt);
|
|
378
|
+
ke.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
379
|
+
const de = (i = !0) => {
|
|
380
|
+
const u = $e(a, i);
|
|
381
|
+
return Ue(
|
|
370
382
|
a,
|
|
371
|
-
T ??
|
|
372
|
-
|
|
383
|
+
T ?? dn(a, e.position, u),
|
|
384
|
+
u
|
|
373
385
|
);
|
|
374
|
-
},
|
|
375
|
-
|
|
386
|
+
}, A = () => {
|
|
387
|
+
eo(e, {
|
|
376
388
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
377
|
-
composerValue:
|
|
378
|
-
openToolGroupKeys: [...
|
|
379
|
-
launcherPosition:
|
|
380
|
-
seenShareCandidateIds: [...
|
|
389
|
+
composerValue: d.value,
|
|
390
|
+
openToolGroupKeys: [...pe],
|
|
391
|
+
launcherPosition: Ce ? T : null,
|
|
392
|
+
seenShareCandidateIds: [...G].slice(-ot),
|
|
393
|
+
sharePromptsDisabled: se
|
|
381
394
|
});
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
debugVersion:
|
|
395
|
+
}, B = (i, u = {}) => {
|
|
396
|
+
gn(i, {
|
|
397
|
+
debugVersion: on,
|
|
385
398
|
launcherPosition: T,
|
|
386
399
|
rootClasses: a.className,
|
|
387
400
|
rootStyle: {
|
|
@@ -390,258 +403,262 @@ async function tn(t = {}) {
|
|
|
390
403
|
right: a.style.right,
|
|
391
404
|
bottom: a.style.bottom
|
|
392
405
|
},
|
|
393
|
-
rootRect:
|
|
394
|
-
launcherRect:
|
|
395
|
-
panelRect:
|
|
396
|
-
viewport:
|
|
397
|
-
panelHidden:
|
|
398
|
-
closeHidden:
|
|
399
|
-
...
|
|
406
|
+
rootRect: me(a),
|
|
407
|
+
launcherRect: me(s),
|
|
408
|
+
panelRect: me(b),
|
|
409
|
+
viewport: V(),
|
|
410
|
+
panelHidden: b.hidden,
|
|
411
|
+
closeHidden: _.hidden,
|
|
412
|
+
...u
|
|
400
413
|
});
|
|
401
|
-
},
|
|
414
|
+
}, ee = (i = !0) => {
|
|
402
415
|
if (!T)
|
|
403
|
-
return
|
|
404
|
-
const
|
|
405
|
-
return
|
|
406
|
-
},
|
|
407
|
-
if (!
|
|
408
|
-
|
|
416
|
+
return ne(a, null), de(i);
|
|
417
|
+
const u = de(i);
|
|
418
|
+
return ne(a, u), B("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
|
|
419
|
+
}, Se = (i, u) => {
|
|
420
|
+
if (!i || !u) {
|
|
421
|
+
He(a);
|
|
409
422
|
return;
|
|
410
423
|
}
|
|
411
|
-
|
|
412
|
-
x:
|
|
413
|
-
y:
|
|
424
|
+
un(a, {
|
|
425
|
+
x: i.x - u.x,
|
|
426
|
+
y: i.y - u.y
|
|
414
427
|
});
|
|
415
|
-
},
|
|
416
|
-
const
|
|
428
|
+
}, Le = () => {
|
|
429
|
+
const i = ee();
|
|
417
430
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
} else T &&
|
|
431
|
+
const u = We(i);
|
|
432
|
+
Se(u, i), B("Applied open panel position after viewport resize", { openPanelPosition: u });
|
|
433
|
+
} else T && B("Applied visible launcher position after viewport resize", { visibleLauncherPosition: i });
|
|
421
434
|
};
|
|
422
|
-
let
|
|
435
|
+
let Pe = () => {
|
|
423
436
|
};
|
|
424
|
-
e.movableLauncher &&
|
|
437
|
+
e.movableLauncher && g ? (ee(), window.addEventListener("resize", Le), Pe = pn({
|
|
425
438
|
root: a,
|
|
426
|
-
launcherDragHandle:
|
|
427
|
-
getPosition: () =>
|
|
428
|
-
setPosition: (
|
|
429
|
-
const
|
|
430
|
-
T =
|
|
439
|
+
launcherDragHandle: g,
|
|
440
|
+
getPosition: () => de(),
|
|
441
|
+
setPosition: (i) => {
|
|
442
|
+
const u = i;
|
|
443
|
+
T = Ue(a, i, $e(a)), ne(a, T), B("Dragging closed launcher", { requestedPosition: u });
|
|
431
444
|
},
|
|
432
445
|
persist: () => {
|
|
433
|
-
|
|
446
|
+
Ce = !0, A(), B("Persisted closed launcher drag position");
|
|
434
447
|
}
|
|
435
|
-
})) :
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
const L =
|
|
439
|
-
|
|
448
|
+
})) : ne(a, null);
|
|
449
|
+
const $ = (i = "", u = !0) => {
|
|
450
|
+
if (O !== null && (window.clearTimeout(O), O = null), b.hidden = !1, _.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
|
|
451
|
+
const L = ee(), X = We(L);
|
|
452
|
+
Se(X, L), B("Opening launcher at clamped open panel position", { openPanelPosition: X, visibleLauncherPosition: L });
|
|
440
453
|
} else
|
|
441
|
-
|
|
442
|
-
if (!
|
|
443
|
-
a.classList.add("pluno-pa-widget--open"), s.hidden = !0,
|
|
454
|
+
He(a);
|
|
455
|
+
if (!u) {
|
|
456
|
+
a.classList.add("pluno-pa-widget--open"), s.hidden = !0, i && (d.value = i, Z(d)), f.scrollTop = f.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), A();
|
|
444
457
|
return;
|
|
445
458
|
}
|
|
446
459
|
window.requestAnimationFrame(() => {
|
|
447
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
460
|
+
a.classList.add("pluno-pa-widget--open"), i && (d.value = i, Z(d)), f.scrollTop = f.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), A(), O = window.setTimeout(() => {
|
|
448
461
|
s.hidden = !0, f.scrollTop = f.scrollHeight;
|
|
449
462
|
}, 220);
|
|
450
463
|
});
|
|
451
|
-
},
|
|
452
|
-
|
|
453
|
-
|
|
464
|
+
}, ft = () => {
|
|
465
|
+
O !== null && (window.clearTimeout(O), O = null), s.hidden = !1, T && (ee(!1), B("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), A(), O = window.setTimeout(() => {
|
|
466
|
+
b.hidden = !0, _.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
454
467
|
}, 220);
|
|
455
468
|
};
|
|
456
|
-
s.addEventListener("submit", (
|
|
457
|
-
|
|
458
|
-
}),
|
|
459
|
-
|
|
460
|
-
}), s.addEventListener("click", (
|
|
461
|
-
|
|
462
|
-
}),
|
|
463
|
-
|
|
464
|
-
}),
|
|
465
|
-
if (!
|
|
469
|
+
s.addEventListener("submit", (i) => {
|
|
470
|
+
i.preventDefault(), $(c.value), c.value = "";
|
|
471
|
+
}), g?.addEventListener("click", (i) => {
|
|
472
|
+
i.preventDefault(), i.stopPropagation();
|
|
473
|
+
}), s.addEventListener("click", (i) => {
|
|
474
|
+
i.target !== c && ($(c.value), c.value = "");
|
|
475
|
+
}), c.addEventListener("focus", () => {
|
|
476
|
+
$(c.value), c.value = "";
|
|
477
|
+
}), c.addEventListener("input", () => {
|
|
478
|
+
if (!c.value)
|
|
466
479
|
return;
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
}),
|
|
470
|
-
const
|
|
471
|
-
|
|
480
|
+
const i = c.value;
|
|
481
|
+
$(i), c.value = "";
|
|
482
|
+
}), _.addEventListener("click", ft);
|
|
483
|
+
const I = () => {
|
|
484
|
+
w.disabled = !C.getState().isThinking && d.value.trim().length === 0 && v.length === 0;
|
|
472
485
|
};
|
|
473
|
-
e.loginRequired && (
|
|
474
|
-
if (
|
|
486
|
+
e.loginRequired && (c.readOnly = !0, c.placeholder = e.loginButtonLabel, d.placeholder = e.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (i) => {
|
|
487
|
+
if (i.preventDefault(), e.loginRequired) {
|
|
475
488
|
e.onLoginClick?.();
|
|
476
489
|
return;
|
|
477
490
|
}
|
|
478
|
-
|
|
491
|
+
v = fe(C, d, v), E(), I();
|
|
479
492
|
});
|
|
480
|
-
let
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
|
|
493
|
+
let K = 0;
|
|
494
|
+
const wt = () => {
|
|
495
|
+
K = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
496
|
+
}, bt = (i) => {
|
|
497
|
+
k !== null && window.clearTimeout(k), y.textContent = i, y.hidden = !1, k = window.setTimeout(() => {
|
|
498
|
+
y.textContent = "", y.hidden = !0, k = null;
|
|
486
499
|
}, 3e3);
|
|
487
|
-
},
|
|
488
|
-
|
|
489
|
-
},
|
|
490
|
-
if (
|
|
500
|
+
}, _t = () => {
|
|
501
|
+
k !== null && (window.clearTimeout(k), k = null), y.textContent = "", y.hidden = !0;
|
|
502
|
+
}, xt = async (i) => {
|
|
503
|
+
if (i.length === 0)
|
|
491
504
|
return;
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
494
|
-
throw new Error(`Attach up to ${
|
|
495
|
-
|
|
505
|
+
const u = await An(i);
|
|
506
|
+
if (v.length + u.length > ie)
|
|
507
|
+
throw new Error(`Attach up to ${ie} files per message.`);
|
|
508
|
+
v = [...v, ...u], E(), _t(), I();
|
|
496
509
|
};
|
|
497
|
-
a.addEventListener("dragenter", (
|
|
498
|
-
!
|
|
499
|
-
}), a.addEventListener("dragover", (
|
|
500
|
-
const
|
|
501
|
-
!
|
|
502
|
-
}), a.addEventListener("dragleave", (
|
|
503
|
-
|
|
504
|
-
}), a.addEventListener("drop", (
|
|
505
|
-
const
|
|
506
|
-
!
|
|
507
|
-
|
|
510
|
+
a.addEventListener("dragenter", (i) => {
|
|
511
|
+
!oe(i.dataTransfer) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), K += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
512
|
+
}), a.addEventListener("dragover", (i) => {
|
|
513
|
+
const u = i.dataTransfer;
|
|
514
|
+
!oe(u) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), u.dropEffect = "copy");
|
|
515
|
+
}), a.addEventListener("dragleave", (i) => {
|
|
516
|
+
oe(i.dataTransfer) && (i.stopPropagation(), K = Math.max(0, K - 1), K === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
517
|
+
}), a.addEventListener("drop", (i) => {
|
|
518
|
+
const u = i.dataTransfer;
|
|
519
|
+
!oe(u) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), wt(), xt(u.files).catch((L) => {
|
|
520
|
+
bt(L instanceof Error ? L.message : "Failed to attach file"), z("web-sdk.widget", "Attachment failed", {
|
|
508
521
|
message: L instanceof Error ? L.message : String(L)
|
|
509
522
|
});
|
|
510
523
|
}));
|
|
511
|
-
}),
|
|
524
|
+
}), w.addEventListener("click", () => {
|
|
512
525
|
if (e.loginRequired) {
|
|
513
526
|
e.onLoginClick?.();
|
|
514
527
|
return;
|
|
515
528
|
}
|
|
516
|
-
if (
|
|
517
|
-
|
|
529
|
+
if (C.getState().isThinking) {
|
|
530
|
+
C.stop();
|
|
518
531
|
return;
|
|
519
532
|
}
|
|
520
|
-
|
|
521
|
-
}),
|
|
522
|
-
|
|
523
|
-
}),
|
|
524
|
-
|
|
525
|
-
}),
|
|
526
|
-
if (!(
|
|
527
|
-
if (
|
|
533
|
+
v = fe(C, d, v), E(), I();
|
|
534
|
+
}), m.addEventListener("click", () => {
|
|
535
|
+
C.startNewSession(), pe.clear(), d.value = "", v = [], E(), Z(d), A(), I(), d.focus();
|
|
536
|
+
}), d.addEventListener("input", () => {
|
|
537
|
+
Z(d), A(), I();
|
|
538
|
+
}), d.addEventListener("keydown", (i) => {
|
|
539
|
+
if (!(i.key !== "Enter" || i.shiftKey)) {
|
|
540
|
+
if (i.preventDefault(), e.loginRequired) {
|
|
528
541
|
e.onLoginClick?.();
|
|
529
542
|
return;
|
|
530
543
|
}
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
}), a.addEventListener("click", (
|
|
534
|
-
(
|
|
535
|
-
}),
|
|
536
|
-
const
|
|
537
|
-
let
|
|
538
|
-
const
|
|
544
|
+
v = fe(C, d, v), E(), I();
|
|
545
|
+
}
|
|
546
|
+
}), a.addEventListener("click", (i) => {
|
|
547
|
+
(i.target instanceof Element ? i.target : null)?.closest("a[href]") && A();
|
|
548
|
+
}), F.composerValue && (d.value = F.composerValue, Z(d)), F.isOpen && $(d.value, !1);
|
|
549
|
+
const Ae = () => r;
|
|
550
|
+
let ce = C.getState().appearance !== null, te = null, Y = null, U = null;
|
|
551
|
+
const vt = !!e.socialPostDraftHandler, W = (i) => {
|
|
539
552
|
if (e.loginRequired) {
|
|
540
|
-
|
|
553
|
+
Fn(f, w, m, Ae, e.loginButtonLabel, e.onLoginClick);
|
|
541
554
|
return;
|
|
542
555
|
}
|
|
543
|
-
|
|
556
|
+
On(
|
|
544
557
|
f,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
(
|
|
552
|
-
|
|
558
|
+
w,
|
|
559
|
+
m,
|
|
560
|
+
i,
|
|
561
|
+
pe,
|
|
562
|
+
A,
|
|
563
|
+
Ae,
|
|
564
|
+
(u) => {
|
|
565
|
+
C.sendMessage(u);
|
|
553
566
|
},
|
|
554
|
-
|
|
555
|
-
dismissedCandidateIds:
|
|
556
|
-
draftingCandidateId:
|
|
557
|
-
error:
|
|
558
|
-
onSeen: (
|
|
559
|
-
|
|
567
|
+
vt && !se ? {
|
|
568
|
+
dismissedCandidateIds: Q,
|
|
569
|
+
draftingCandidateId: te,
|
|
570
|
+
error: Y,
|
|
571
|
+
onSeen: (u) => {
|
|
572
|
+
G.add(u.id), A();
|
|
573
|
+
},
|
|
574
|
+
onDraft: (u) => {
|
|
575
|
+
yt(u);
|
|
560
576
|
},
|
|
561
|
-
|
|
562
|
-
|
|
577
|
+
onDismiss: (u) => {
|
|
578
|
+
G.add(u.id), Q.add(u.id), A(), Y = null, W(C.getState());
|
|
563
579
|
},
|
|
564
|
-
|
|
565
|
-
|
|
580
|
+
onDisable: (u) => {
|
|
581
|
+
se = !0, G.add(u.id), Q.add(u.id), A(), Qn(e, !0), Y = null, W(C.getState());
|
|
566
582
|
}
|
|
567
583
|
} : void 0
|
|
568
584
|
);
|
|
569
585
|
};
|
|
570
|
-
return
|
|
571
|
-
|
|
572
|
-
appearance:
|
|
573
|
-
}),
|
|
586
|
+
return C.on("state", (i) => {
|
|
587
|
+
i.appearance ? (ce = !0, z("web-sdk.widget", "Agent state supplied appearance", {
|
|
588
|
+
appearance: i.appearance
|
|
589
|
+
}), ue(i.appearance, "agent.state.appearance")) : ce && (ce = !1, z("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
574
590
|
fallbackAccentColor: e.accentColor,
|
|
575
591
|
fallbackColorScheme: e.colorScheme,
|
|
576
592
|
fallbackFontFamily: e.fontFamily
|
|
577
|
-
}),
|
|
578
|
-
}),
|
|
579
|
-
agent:
|
|
580
|
-
updateAppearance: (
|
|
581
|
-
|
|
593
|
+
}), ue({}, "agent.state.appearance-cleared")), W(i), I();
|
|
594
|
+
}), W(C.getState()), I(), {
|
|
595
|
+
agent: C,
|
|
596
|
+
updateAppearance: (i) => {
|
|
597
|
+
i.scribbleStyle !== void 0 && (e.scribbleStyle = i.scribbleStyle), ue(i, "widgetHandle.updateAppearance");
|
|
582
598
|
},
|
|
583
599
|
openPanel: () => {
|
|
584
|
-
|
|
600
|
+
$(d.value, !1);
|
|
585
601
|
},
|
|
586
602
|
destroy: () => {
|
|
587
|
-
|
|
603
|
+
Ee = !0, ke.disconnect(), e.movableLauncher && window.removeEventListener("resize", Le), Pe(), k !== null && window.clearTimeout(k), U?.remove(), C.destroy(), n.remove();
|
|
588
604
|
}
|
|
589
605
|
};
|
|
590
|
-
async function
|
|
591
|
-
if (!
|
|
592
|
-
|
|
606
|
+
async function yt(i) {
|
|
607
|
+
if (!te) {
|
|
608
|
+
te = i.id, Y = null, W(C.getState());
|
|
593
609
|
try {
|
|
594
610
|
if (!e.socialPostDraftHandler)
|
|
595
611
|
throw new Error("Social post drafting is not available here.");
|
|
596
|
-
const
|
|
597
|
-
if (!
|
|
612
|
+
const u = await e.socialPostDraftHandler(i);
|
|
613
|
+
if (!u.linkedinPost || !u.xPost)
|
|
598
614
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
599
|
-
|
|
615
|
+
G.add(i.id), Q.add(i.id), A(), U?.remove(), U = Gn(u, {
|
|
616
|
+
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
600
617
|
onClose: () => {
|
|
601
|
-
|
|
618
|
+
U?.remove(), U = null;
|
|
602
619
|
}
|
|
603
|
-
}), a.appendChild(
|
|
604
|
-
} catch (
|
|
605
|
-
|
|
620
|
+
}), a.appendChild(U);
|
|
621
|
+
} catch (u) {
|
|
622
|
+
Y = u instanceof Error ? u.message : "Could not draft social post.";
|
|
606
623
|
} finally {
|
|
607
|
-
|
|
624
|
+
te = null, W(C.getState());
|
|
608
625
|
}
|
|
609
626
|
}
|
|
610
627
|
}
|
|
611
|
-
function
|
|
612
|
-
const L =
|
|
613
|
-
|
|
628
|
+
function ue(i, u) {
|
|
629
|
+
const L = i.accentColor ?? e.accentColor, X = i.colorScheme ?? e.colorScheme, Ne = i.fontFamily ?? e.fontFamily, ge = i.scribbleStyle ?? e.scribbleStyle;
|
|
630
|
+
r = ze(L, ge), Ge(a, r, {
|
|
614
631
|
accentColor: L,
|
|
615
|
-
colorScheme:
|
|
616
|
-
fontFamily:
|
|
617
|
-
scribbleStyle:
|
|
618
|
-
}),
|
|
619
|
-
source:
|
|
620
|
-
inputAppearance:
|
|
632
|
+
colorScheme: X,
|
|
633
|
+
fontFamily: Ne,
|
|
634
|
+
scribbleStyle: ge
|
|
635
|
+
}), z("web-sdk.widget", "Updated widget appearance", {
|
|
636
|
+
source: u,
|
|
637
|
+
inputAppearance: i,
|
|
621
638
|
appliedAccentColor: L,
|
|
622
|
-
appliedColorScheme:
|
|
623
|
-
appliedFontFamily:
|
|
624
|
-
appliedScribbleStyle:
|
|
639
|
+
appliedColorScheme: X,
|
|
640
|
+
appliedFontFamily: Ne,
|
|
641
|
+
appliedScribbleStyle: ge,
|
|
625
642
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
626
643
|
});
|
|
627
644
|
}
|
|
628
645
|
}
|
|
629
|
-
function
|
|
630
|
-
return e ?
|
|
646
|
+
function ze(t, e) {
|
|
647
|
+
return e ? Pt(t) : St(t);
|
|
631
648
|
}
|
|
632
|
-
function
|
|
649
|
+
function Ge(t, e, n) {
|
|
633
650
|
t.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), t.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
634
|
-
const o = n.scribbleStyle ?
|
|
635
|
-
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ?
|
|
651
|
+
const o = n.scribbleStyle ? et(n.accentColor) : n.accentColor;
|
|
652
|
+
t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? qt : n.fontFamily, n.scribbleStyle && ln(t.ownerDocument);
|
|
636
653
|
const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
|
|
637
|
-
for (const
|
|
638
|
-
|
|
654
|
+
for (const r of a)
|
|
655
|
+
r.src = e;
|
|
639
656
|
}
|
|
640
|
-
function
|
|
641
|
-
if (t.getElementById(
|
|
657
|
+
function ln(t) {
|
|
658
|
+
if (t.getElementById(Fe))
|
|
642
659
|
return;
|
|
643
660
|
const e = t.createElement("style");
|
|
644
|
-
e.id =
|
|
661
|
+
e.id = Fe, e.textContent = `@font-face {
|
|
645
662
|
font-family: "Architects Daughter";
|
|
646
663
|
font-style: normal;
|
|
647
664
|
font-weight: 400;
|
|
@@ -649,107 +666,107 @@ function nn(t) {
|
|
|
649
666
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
650
667
|
}`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
|
|
651
668
|
}
|
|
652
|
-
function
|
|
669
|
+
function pn({
|
|
653
670
|
root: t,
|
|
654
671
|
launcherDragHandle: e,
|
|
655
672
|
getPosition: n,
|
|
656
673
|
setPosition: o,
|
|
657
674
|
persist: a
|
|
658
675
|
}) {
|
|
659
|
-
let
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
},
|
|
663
|
-
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (
|
|
664
|
-
},
|
|
665
|
-
if (
|
|
676
|
+
let r = null, l = null, p = null, s = !1;
|
|
677
|
+
const g = () => {
|
|
678
|
+
r = null, l = null, p = null, s = !1, t.classList.remove("pluno-pa-widget--dragging");
|
|
679
|
+
}, c = (h) => {
|
|
680
|
+
t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), r = h.pointerId, l = { x: h.clientX, y: h.clientY }, p = n(), s = !1, e.setPointerCapture?.(h.pointerId));
|
|
681
|
+
}, b = (h) => {
|
|
682
|
+
if (r !== h.pointerId || !l || !p)
|
|
666
683
|
return;
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
!s && Math.hypot(
|
|
670
|
-
},
|
|
671
|
-
|
|
672
|
-
},
|
|
673
|
-
|
|
674
|
-
},
|
|
684
|
+
h.preventDefault();
|
|
685
|
+
const d = h.clientX - l.x, w = h.clientY - l.y;
|
|
686
|
+
!s && Math.hypot(d, w) < en || (s = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + d, y: p.y + w }));
|
|
687
|
+
}, _ = (h) => {
|
|
688
|
+
r === h.pointerId && (h.preventDefault(), h.stopPropagation(), s && a(), g());
|
|
689
|
+
}, x = (h) => {
|
|
690
|
+
r === h.pointerId && (h.preventDefault(), g());
|
|
691
|
+
}, y = (h) => {
|
|
675
692
|
if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
|
|
676
693
|
return;
|
|
677
|
-
const
|
|
678
|
-
let
|
|
679
|
-
|
|
694
|
+
const d = h.shiftKey ? nn : tn, w = n();
|
|
695
|
+
let m = null;
|
|
696
|
+
h.key === "ArrowUp" ? m = { x: w.x, y: w.y - d } : h.key === "ArrowDown" ? m = { x: w.x, y: w.y + d } : h.key === "ArrowLeft" ? m = { x: w.x - d, y: w.y } : h.key === "ArrowRight" && (m = { x: w.x + d, y: w.y }), m && (h.preventDefault(), h.stopPropagation(), o(m), a());
|
|
680
697
|
};
|
|
681
|
-
return e.addEventListener("pointerdown",
|
|
682
|
-
e.removeEventListener("pointerdown",
|
|
698
|
+
return e.addEventListener("pointerdown", c), e.addEventListener("pointermove", b), e.addEventListener("pointerup", _), e.addEventListener("pointercancel", x), e.addEventListener("keydown", y), () => {
|
|
699
|
+
e.removeEventListener("pointerdown", c), e.removeEventListener("pointermove", b), e.removeEventListener("pointerup", _), e.removeEventListener("pointercancel", x), e.removeEventListener("keydown", y);
|
|
683
700
|
};
|
|
684
701
|
}
|
|
685
|
-
function
|
|
686
|
-
const n =
|
|
702
|
+
function $e(t, e = !0) {
|
|
703
|
+
const n = V(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
|
|
687
704
|
return {
|
|
688
|
-
width: e && a && o.width > 0 ? o.width : Math.min(
|
|
689
|
-
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ?
|
|
705
|
+
width: e && a && o.width > 0 ? o.width : Math.min(rt, n.width - 36),
|
|
706
|
+
height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? Kt : it
|
|
690
707
|
};
|
|
691
708
|
}
|
|
692
|
-
function
|
|
693
|
-
const t =
|
|
709
|
+
function sn() {
|
|
710
|
+
const t = V();
|
|
694
711
|
return {
|
|
695
|
-
width: Math.min(
|
|
696
|
-
height: Math.min(
|
|
712
|
+
width: Math.min(Yt, t.width - 28),
|
|
713
|
+
height: Math.min(Xt, t.height - 28)
|
|
697
714
|
};
|
|
698
715
|
}
|
|
699
|
-
function
|
|
716
|
+
function dn(t, e, n) {
|
|
700
717
|
const o = Number.parseFloat(t.style.left), a = Number.parseFloat(t.style.top);
|
|
701
718
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
702
719
|
return { x: o, y: a };
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
return { x:
|
|
706
|
-
const l =
|
|
720
|
+
const r = t.getBoundingClientRect();
|
|
721
|
+
if (r.width > 0 || r.height > 0)
|
|
722
|
+
return { x: r.left, y: r.top };
|
|
723
|
+
const l = V();
|
|
707
724
|
return {
|
|
708
725
|
x: e === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
709
726
|
y: l.height - 24 - n.height
|
|
710
727
|
};
|
|
711
728
|
}
|
|
712
|
-
function
|
|
713
|
-
const o =
|
|
729
|
+
function Ue(t, e, n) {
|
|
730
|
+
const o = V(), a = N + cn(t);
|
|
714
731
|
return {
|
|
715
|
-
x:
|
|
716
|
-
y:
|
|
732
|
+
x: le(e.x, N, Math.max(N, o.width - n.width - N)),
|
|
733
|
+
y: le(e.y, a, Math.max(a, o.height - n.height - N))
|
|
717
734
|
};
|
|
718
735
|
}
|
|
719
|
-
function
|
|
720
|
-
return t.classList.contains("pluno-pa-widget--scribble") ?
|
|
736
|
+
function cn(t) {
|
|
737
|
+
return t.classList.contains("pluno-pa-widget--scribble") ? Qt : Jt;
|
|
721
738
|
}
|
|
722
|
-
function
|
|
723
|
-
const e =
|
|
739
|
+
function We(t) {
|
|
740
|
+
const e = V(), n = sn();
|
|
724
741
|
return {
|
|
725
|
-
x:
|
|
726
|
-
y:
|
|
742
|
+
x: le(t.x, N, Math.max(N, e.width - n.width - N)),
|
|
743
|
+
y: le(
|
|
727
744
|
t.y,
|
|
728
|
-
|
|
729
|
-
Math.max(
|
|
745
|
+
Be,
|
|
746
|
+
Math.max(Be, e.height - n.height - N)
|
|
730
747
|
)
|
|
731
748
|
};
|
|
732
749
|
}
|
|
733
|
-
function
|
|
750
|
+
function ne(t, e) {
|
|
734
751
|
if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), !e) {
|
|
735
752
|
t.style.removeProperty("left"), t.style.removeProperty("top"), t.style.removeProperty("right"), t.style.removeProperty("bottom");
|
|
736
753
|
return;
|
|
737
754
|
}
|
|
738
755
|
t.style.left = `${e.x}px`, t.style.top = `${e.y}px`, t.style.right = "auto", t.style.bottom = "auto";
|
|
739
756
|
}
|
|
740
|
-
function
|
|
757
|
+
function un(t, e) {
|
|
741
758
|
t.style.setProperty("--pluno-pa-panel-offset-x", `${e.x}px`), t.style.setProperty("--pluno-pa-panel-offset-y", `${e.y}px`);
|
|
742
759
|
}
|
|
743
|
-
function
|
|
760
|
+
function He(t) {
|
|
744
761
|
t.style.removeProperty("--pluno-pa-panel-offset-x"), t.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
745
762
|
}
|
|
746
|
-
function
|
|
763
|
+
function V() {
|
|
747
764
|
return {
|
|
748
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
749
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
765
|
+
width: window.innerWidth || document.documentElement.clientWidth || rt + N * 2,
|
|
766
|
+
height: window.innerHeight || document.documentElement.clientHeight || it + N * 2
|
|
750
767
|
};
|
|
751
768
|
}
|
|
752
|
-
function
|
|
769
|
+
function me(t) {
|
|
753
770
|
const e = t.getBoundingClientRect();
|
|
754
771
|
return {
|
|
755
772
|
x: Math.round(e.x),
|
|
@@ -758,10 +775,10 @@ function ge(t) {
|
|
|
758
775
|
height: Math.round(e.height)
|
|
759
776
|
};
|
|
760
777
|
}
|
|
761
|
-
function
|
|
778
|
+
function le(t, e, n) {
|
|
762
779
|
return Math.min(Math.max(t, e), n);
|
|
763
780
|
}
|
|
764
|
-
function
|
|
781
|
+
function z(t, e, n) {
|
|
765
782
|
if (typeof window > "u")
|
|
766
783
|
return;
|
|
767
784
|
const o = window, a = {
|
|
@@ -769,43 +786,43 @@ function F(t, e, n) {
|
|
|
769
786
|
source: t,
|
|
770
787
|
message: e,
|
|
771
788
|
details: n
|
|
772
|
-
},
|
|
773
|
-
|
|
789
|
+
}, r = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
790
|
+
r.push(a), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent(Ht, { detail: a }));
|
|
774
791
|
}
|
|
775
|
-
function
|
|
776
|
-
|
|
792
|
+
function gn(t, e) {
|
|
793
|
+
z("web-sdk.widget.position", t, e);
|
|
777
794
|
}
|
|
778
|
-
function
|
|
795
|
+
function fe(t, e, n) {
|
|
779
796
|
const o = e.value.trim();
|
|
780
797
|
return !o && n.length === 0 ? n : (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), e.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
781
798
|
}
|
|
782
|
-
function
|
|
799
|
+
function Z(t) {
|
|
783
800
|
t.style.height = "0px";
|
|
784
801
|
const e = Math.max(22, Math.min(t.scrollHeight, 140));
|
|
785
802
|
t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
|
|
786
803
|
}
|
|
787
|
-
function
|
|
788
|
-
t.appendChild(
|
|
804
|
+
function hn(t, e, n, o) {
|
|
805
|
+
t.appendChild(_n()), t.appendChild(mn(e, n, o)), t.appendChild(st("pluno-pa-widget__close", "Close", xn(16), !0)), t.appendChild(fn(n));
|
|
789
806
|
}
|
|
790
|
-
function
|
|
807
|
+
function mn(t, e, n) {
|
|
791
808
|
const o = document.createElement("form");
|
|
792
809
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
793
|
-
const
|
|
794
|
-
|
|
810
|
+
const r = document.createElement("button");
|
|
811
|
+
r.type = "button", r.className = "pluno-pa-widget__launcher-drag-handle", r.setAttribute("aria-label", "Move Pluno launcher"), r.title = "Move Pluno launcher", o.appendChild(r);
|
|
795
812
|
}
|
|
796
|
-
o.appendChild(
|
|
813
|
+
o.appendChild(pt("pluno-pa-widget__character--launcher", e));
|
|
797
814
|
const a = document.createElement("input");
|
|
798
815
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), o.appendChild(a), o;
|
|
799
816
|
}
|
|
800
|
-
function
|
|
817
|
+
function fn(t) {
|
|
801
818
|
const e = document.createElement("section");
|
|
802
819
|
e.className = "pluno-pa-widget__panel", e.hidden = !0;
|
|
803
820
|
const n = document.createElement("div");
|
|
804
821
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
805
822
|
const o = document.createElement("main");
|
|
806
|
-
return o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
823
|
+
return o.className = "pluno-pa-widget__timeline", o.appendChild(bn(t)), n.appendChild(o), n.appendChild(st("pluno-pa-widget__new-chat", "New chat", vn(), !0)), e.appendChild(n), e.appendChild(wn()), e;
|
|
807
824
|
}
|
|
808
|
-
function
|
|
825
|
+
function wn() {
|
|
809
826
|
const t = document.createElement("form");
|
|
810
827
|
t.className = "pluno-pa-widget__composer";
|
|
811
828
|
const e = document.createElement("div");
|
|
@@ -816,34 +833,32 @@ function gn() {
|
|
|
816
833
|
o.className = "pluno-pa-widget__composer-inner";
|
|
817
834
|
const a = document.createElement("textarea");
|
|
818
835
|
a.className = "pluno-pa-widget__input", a.rows = 1, a.placeholder = "Ask for anything...", o.appendChild(a);
|
|
819
|
-
const
|
|
820
|
-
|
|
836
|
+
const r = document.createElement("button");
|
|
837
|
+
r.type = "button", r.className = "pluno-pa-widget__send", r.setAttribute("aria-label", "Send"), r.appendChild(dt()), o.appendChild(r), t.appendChild(o);
|
|
821
838
|
const l = document.createElement("div");
|
|
822
839
|
l.className = "pluno-pa-widget__composer-meta";
|
|
823
840
|
const p = document.createElement("a");
|
|
824
|
-
p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai", l.appendChild(p);
|
|
841
|
+
p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", l.appendChild(p);
|
|
825
842
|
const s = document.createElement("span");
|
|
826
|
-
s.className = "pluno-pa-
|
|
827
|
-
const d = document.createElement("span");
|
|
828
|
-
return d.className = "pluno-pa-widget__ai-disclaimer", d.textContent = "AI can make mistakes. Verify outputs.", l.appendChild(d), t.appendChild(l), t;
|
|
843
|
+
return s.className = "pluno-pa-widget__ai-disclaimer", s.textContent = "AI can make mistakes. Verify outputs.", l.appendChild(s), t.appendChild(l), t;
|
|
829
844
|
}
|
|
830
|
-
function
|
|
845
|
+
function bn(t) {
|
|
831
846
|
const e = document.createElement("div");
|
|
832
|
-
return e.className = "pluno-pa-widget__empty-state", e.appendChild(
|
|
847
|
+
return e.className = "pluno-pa-widget__empty-state", e.appendChild(pt("pluno-pa-widget__character--empty", t)), e.appendChild(lt()), e;
|
|
833
848
|
}
|
|
834
|
-
function
|
|
849
|
+
function lt() {
|
|
835
850
|
const t = document.createElement("div");
|
|
836
851
|
return t.className = "pluno-pa-widget__empty", t.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), t.appendChild(document.createElement("br")), t.appendChild(document.createTextNode("What do you want to do today?")), t;
|
|
837
852
|
}
|
|
838
|
-
function
|
|
853
|
+
function pt(t, e) {
|
|
839
854
|
const n = document.createElement("img");
|
|
840
855
|
return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
841
856
|
}
|
|
842
|
-
function
|
|
857
|
+
function st(t, e, n, o) {
|
|
843
858
|
const a = document.createElement("button");
|
|
844
859
|
return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
|
|
845
860
|
}
|
|
846
|
-
function
|
|
861
|
+
function _n() {
|
|
847
862
|
const t = S("svg", {
|
|
848
863
|
class: "pluno-pa-widget__scribble-defs",
|
|
849
864
|
"aria-hidden": "true",
|
|
@@ -851,9 +866,9 @@ function mn() {
|
|
|
851
866
|
width: "0",
|
|
852
867
|
height: "0"
|
|
853
868
|
}), e = S("defs");
|
|
854
|
-
return e.appendChild(
|
|
869
|
+
return e.appendChild(we("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(we("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(we("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
|
|
855
870
|
}
|
|
856
|
-
function
|
|
871
|
+
function we(t, e, n) {
|
|
857
872
|
const o = S("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
858
873
|
return o.appendChild(
|
|
859
874
|
S("feTurbulence", {
|
|
@@ -890,31 +905,31 @@ function me(t, e, n) {
|
|
|
890
905
|
})
|
|
891
906
|
), o;
|
|
892
907
|
}
|
|
893
|
-
function
|
|
894
|
-
const e =
|
|
908
|
+
function xn(t) {
|
|
909
|
+
const e = j("0 0 24 24", t, t, "none", "currentColor", "2.25");
|
|
895
910
|
return e.appendChild(S("path", { d: "m6 9 6 6 6-6" })), e;
|
|
896
911
|
}
|
|
897
|
-
function
|
|
898
|
-
const t =
|
|
912
|
+
function vn() {
|
|
913
|
+
const t = j("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
899
914
|
return t.appendChild(S("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), t.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
|
|
900
915
|
}
|
|
901
|
-
function
|
|
902
|
-
const t =
|
|
916
|
+
function dt() {
|
|
917
|
+
const t = j("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
903
918
|
return t.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), t;
|
|
904
919
|
}
|
|
905
|
-
function
|
|
906
|
-
const t =
|
|
920
|
+
function yn() {
|
|
921
|
+
const t = j("0 0 24 24", 18, 18, "currentColor");
|
|
907
922
|
return t.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
|
|
908
923
|
}
|
|
909
|
-
function
|
|
910
|
-
const t =
|
|
924
|
+
function Cn() {
|
|
925
|
+
const t = j("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
911
926
|
return t.appendChild(S("path", { d: "M18 6 6 18" })), t.appendChild(S("path", { d: "m6 6 12 12" })), t;
|
|
912
927
|
}
|
|
913
|
-
function
|
|
914
|
-
const t =
|
|
928
|
+
function En() {
|
|
929
|
+
const t = j("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
915
930
|
return t.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
|
|
916
931
|
}
|
|
917
|
-
function
|
|
932
|
+
function j(t, e, n, o, a, r) {
|
|
918
933
|
const l = {
|
|
919
934
|
viewBox: t,
|
|
920
935
|
width: String(e),
|
|
@@ -922,41 +937,41 @@ function W(t, e, n, o, a, i) {
|
|
|
922
937
|
fill: o,
|
|
923
938
|
"aria-hidden": "true"
|
|
924
939
|
};
|
|
925
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"),
|
|
940
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), S("svg", l);
|
|
926
941
|
}
|
|
927
942
|
function S(t, e = {}) {
|
|
928
|
-
const n = document.createElementNS(
|
|
943
|
+
const n = document.createElementNS(Zt, t);
|
|
929
944
|
for (const [o, a] of Object.entries(e))
|
|
930
945
|
n.setAttribute(o, a);
|
|
931
946
|
return n;
|
|
932
947
|
}
|
|
933
|
-
function
|
|
948
|
+
function Ve(t) {
|
|
934
949
|
for (const e of ["keydown", "keypress", "keyup"])
|
|
935
950
|
t.addEventListener(e, (n) => {
|
|
936
951
|
n.stopPropagation();
|
|
937
952
|
});
|
|
938
953
|
}
|
|
939
|
-
function
|
|
954
|
+
function kn(t, e, n) {
|
|
940
955
|
t.replaceChildren(), t.hidden = e.length === 0;
|
|
941
956
|
for (const [o, a] of e.entries()) {
|
|
942
|
-
const
|
|
943
|
-
|
|
957
|
+
const r = document.createElement("div");
|
|
958
|
+
r.className = "pluno-pa-widget__attachment", r.appendChild(Sn(a));
|
|
944
959
|
const l = document.createElement("span");
|
|
945
|
-
l.textContent = a.name,
|
|
960
|
+
l.textContent = a.name, r.appendChild(l);
|
|
946
961
|
const p = document.createElement("button");
|
|
947
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
962
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Cn()), p.addEventListener("click", () => n(o)), r.appendChild(p), t.appendChild(r);
|
|
948
963
|
}
|
|
949
964
|
}
|
|
950
|
-
function
|
|
951
|
-
if (
|
|
965
|
+
function Sn(t) {
|
|
966
|
+
if (ct(t)) {
|
|
952
967
|
const n = document.createElement("img");
|
|
953
968
|
return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
954
969
|
}
|
|
955
970
|
const e = document.createElement("span");
|
|
956
971
|
return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
|
|
957
972
|
}
|
|
958
|
-
function
|
|
959
|
-
if (
|
|
973
|
+
function Ln(t) {
|
|
974
|
+
if (ct(t)) {
|
|
960
975
|
const a = document.createElement("img");
|
|
961
976
|
return a.src = t.dataUrl, a.alt = t.name, a;
|
|
962
977
|
}
|
|
@@ -967,51 +982,51 @@ function Cn(t) {
|
|
|
967
982
|
const o = document.createElement("strong");
|
|
968
983
|
return o.textContent = t.name, e.append(n, o), e;
|
|
969
984
|
}
|
|
970
|
-
function
|
|
985
|
+
function ct(t) {
|
|
971
986
|
return t.mimeType.startsWith("image/");
|
|
972
987
|
}
|
|
973
|
-
function
|
|
988
|
+
function Pn(t) {
|
|
974
989
|
return t === "application/pdf" ? "document.pdf" : "image";
|
|
975
990
|
}
|
|
976
|
-
async function
|
|
991
|
+
async function An(t) {
|
|
977
992
|
if (!t)
|
|
978
993
|
return [];
|
|
979
994
|
const e = Array.from(t);
|
|
980
|
-
if (e.length >
|
|
981
|
-
throw new Error(`Attach up to ${
|
|
995
|
+
if (e.length > ie)
|
|
996
|
+
throw new Error(`Attach up to ${ie} files per message.`);
|
|
982
997
|
return Promise.all(
|
|
983
998
|
e.map(async (n) => {
|
|
984
|
-
const o =
|
|
999
|
+
const o = Nn(n);
|
|
985
1000
|
if (!o)
|
|
986
1001
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
987
|
-
if (n.size >
|
|
1002
|
+
if (n.size > Vt)
|
|
988
1003
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
989
1004
|
if (o === "image/gif") {
|
|
990
|
-
const a = new Uint8Array(await
|
|
991
|
-
if (
|
|
1005
|
+
const a = new Uint8Array(await Mn(n));
|
|
1006
|
+
if (Tn(a))
|
|
992
1007
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
993
1008
|
}
|
|
994
1009
|
return {
|
|
995
|
-
name: n.name ||
|
|
1010
|
+
name: n.name || Pn(o),
|
|
996
1011
|
mimeType: o,
|
|
997
1012
|
sizeBytes: n.size,
|
|
998
|
-
dataUrl:
|
|
1013
|
+
dataUrl: Dn(await Rn(n), o)
|
|
999
1014
|
};
|
|
1000
1015
|
})
|
|
1001
1016
|
);
|
|
1002
1017
|
}
|
|
1003
|
-
function
|
|
1004
|
-
if (
|
|
1018
|
+
function Nn(t) {
|
|
1019
|
+
if (jt.has(t.type))
|
|
1005
1020
|
return t.type;
|
|
1006
1021
|
const e = t.name.toLowerCase();
|
|
1007
1022
|
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
1008
1023
|
}
|
|
1009
|
-
function
|
|
1024
|
+
function Dn(t, e) {
|
|
1010
1025
|
const n = `data:${e};base64,`;
|
|
1011
1026
|
return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
|
|
1012
1027
|
}
|
|
1013
|
-
function
|
|
1014
|
-
if (t.length < 14 || !
|
|
1028
|
+
function Tn(t) {
|
|
1029
|
+
if (t.length < 14 || !In(t))
|
|
1015
1030
|
return !1;
|
|
1016
1031
|
const e = t[10];
|
|
1017
1032
|
let n = 13;
|
|
@@ -1022,7 +1037,7 @@ function Pn(t) {
|
|
|
1022
1037
|
if (n += 1, a === 59)
|
|
1023
1038
|
return !1;
|
|
1024
1039
|
if (a === 33) {
|
|
1025
|
-
n += 1, n =
|
|
1040
|
+
n += 1, n = je(t, n);
|
|
1026
1041
|
continue;
|
|
1027
1042
|
}
|
|
1028
1043
|
if (a !== 44)
|
|
@@ -1031,17 +1046,17 @@ function Pn(t) {
|
|
|
1031
1046
|
return !0;
|
|
1032
1047
|
if (n + 9 >= t.length)
|
|
1033
1048
|
return !1;
|
|
1034
|
-
const
|
|
1035
|
-
if (n += 9,
|
|
1049
|
+
const r = t[n + 8];
|
|
1050
|
+
if (n += 9, r & 128 && (n += 3 * 2 ** ((r & 7) + 1)), n >= t.length)
|
|
1036
1051
|
return !1;
|
|
1037
|
-
n += 1, n =
|
|
1052
|
+
n += 1, n = je(t, n);
|
|
1038
1053
|
}
|
|
1039
1054
|
return !1;
|
|
1040
1055
|
}
|
|
1041
|
-
function
|
|
1056
|
+
function In(t) {
|
|
1042
1057
|
return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
|
|
1043
1058
|
}
|
|
1044
|
-
function
|
|
1059
|
+
function je(t, e) {
|
|
1045
1060
|
for (; e < t.length; ) {
|
|
1046
1061
|
const n = t[e];
|
|
1047
1062
|
if (e += 1, n === 0)
|
|
@@ -1050,10 +1065,10 @@ function He(t, e) {
|
|
|
1050
1065
|
}
|
|
1051
1066
|
return e;
|
|
1052
1067
|
}
|
|
1053
|
-
function
|
|
1068
|
+
function oe(t) {
|
|
1054
1069
|
return !!(t && Array.from(t.types).includes("Files"));
|
|
1055
1070
|
}
|
|
1056
|
-
function
|
|
1071
|
+
function Mn(t) {
|
|
1057
1072
|
return new Promise((e, n) => {
|
|
1058
1073
|
const o = new FileReader();
|
|
1059
1074
|
o.addEventListener("load", () => {
|
|
@@ -1067,7 +1082,7 @@ function Nn(t) {
|
|
|
1067
1082
|
}), o.readAsArrayBuffer(t);
|
|
1068
1083
|
});
|
|
1069
1084
|
}
|
|
1070
|
-
function
|
|
1085
|
+
function Rn(t) {
|
|
1071
1086
|
return new Promise((e, n) => {
|
|
1072
1087
|
const o = new FileReader();
|
|
1073
1088
|
o.addEventListener("load", () => {
|
|
@@ -1081,226 +1096,280 @@ function Tn(t) {
|
|
|
1081
1096
|
}), o.readAsDataURL(t);
|
|
1082
1097
|
});
|
|
1083
1098
|
}
|
|
1084
|
-
function
|
|
1085
|
-
const
|
|
1086
|
-
t.replaceChildren(),
|
|
1087
|
-
const
|
|
1088
|
-
if (n.hidden = !
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1099
|
+
function On(t, e, n, o, a, r, l, p, s) {
|
|
1100
|
+
const g = [...o.messages], c = g.filter((m) => !Vn(m));
|
|
1101
|
+
t.replaceChildren(), gt(e, o.isThinking);
|
|
1102
|
+
const b = c.length > 0 || !!o.assistantDraft || o.isThinking;
|
|
1103
|
+
if (n.hidden = !b, c.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
|
|
1104
|
+
const m = document.createElement("div");
|
|
1105
|
+
m.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1091
1106
|
const f = document.createElement("img");
|
|
1092
|
-
f.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", f.src = l(), f.alt = "", f.setAttribute("aria-hidden", "true"),
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
for (const
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
p(
|
|
1099
|
-
}),
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1107
|
+
f.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", f.src = l(), f.alt = "", f.setAttribute("aria-hidden", "true"), m.appendChild(f), m.appendChild(lt());
|
|
1108
|
+
const v = document.createElement("div");
|
|
1109
|
+
v.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && v.setAttribute("aria-hidden", "true");
|
|
1110
|
+
for (const k of o.starterPrompts) {
|
|
1111
|
+
const E = document.createElement("button");
|
|
1112
|
+
E.type = "button", E.className = "pluno-pa-widget__starter-prompt", E.textContent = `"${k}"`, E.addEventListener("click", () => {
|
|
1113
|
+
p(k);
|
|
1114
|
+
}), v.appendChild(E);
|
|
1115
|
+
}
|
|
1116
|
+
m.appendChild(v), t.appendChild(m);
|
|
1102
1117
|
return;
|
|
1103
1118
|
}
|
|
1104
|
-
let
|
|
1105
|
-
const
|
|
1106
|
-
if (
|
|
1119
|
+
let _ = null, x = null, y = [];
|
|
1120
|
+
const h = () => {
|
|
1121
|
+
if (y.length === 0)
|
|
1107
1122
|
return !1;
|
|
1108
|
-
const
|
|
1109
|
-
return t.appendChild(
|
|
1123
|
+
const m = jn(y, a, r, l());
|
|
1124
|
+
return t.appendChild(m), _ = null, x = m, y = [], !0;
|
|
1110
1125
|
};
|
|
1111
|
-
for (let
|
|
1112
|
-
const f =
|
|
1126
|
+
for (let m = 0; m < c.length; m += 1) {
|
|
1127
|
+
const f = c[m];
|
|
1113
1128
|
if (f.role === "tool") {
|
|
1114
|
-
|
|
1129
|
+
y.push(f);
|
|
1115
1130
|
continue;
|
|
1116
1131
|
}
|
|
1117
1132
|
if (f.role === "system")
|
|
1118
1133
|
continue;
|
|
1119
|
-
const
|
|
1120
|
-
if (f.role === "assistant" && !
|
|
1121
|
-
const
|
|
1122
|
-
t.appendChild(
|
|
1123
|
-
}
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1134
|
+
const v = h(), k = Ke(f.content);
|
|
1135
|
+
if (f.role === "assistant" && !v) {
|
|
1136
|
+
const C = ve(l());
|
|
1137
|
+
t.appendChild(C), _ = null, x = C;
|
|
1138
|
+
}
|
|
1139
|
+
const E = document.createElement("div");
|
|
1140
|
+
E.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Ye(E, k) : E.textContent = k, f.role === "user" && f.attachments?.length && E.appendChild(Bn(f.attachments));
|
|
1141
|
+
const q = document.createElement("div");
|
|
1142
|
+
q.className = "pluno-pa-widget__message-actions", q.appendChild(qe(k)), E.appendChild(q), t.appendChild(E), _ = E, x = null;
|
|
1128
1143
|
}
|
|
1129
|
-
const
|
|
1144
|
+
const d = h();
|
|
1130
1145
|
if (o.assistantDraft) {
|
|
1131
|
-
if (!
|
|
1132
|
-
const
|
|
1133
|
-
t.appendChild(
|
|
1134
|
-
}
|
|
1135
|
-
const
|
|
1136
|
-
f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ye(f,
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1146
|
+
if (!d) {
|
|
1147
|
+
const k = ve(l());
|
|
1148
|
+
t.appendChild(k), _ = null, x = k;
|
|
1149
|
+
}
|
|
1150
|
+
const m = Ke(o.assistantDraft), f = document.createElement("div");
|
|
1151
|
+
f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ye(f, m);
|
|
1152
|
+
const v = document.createElement("div");
|
|
1153
|
+
v.className = "pluno-pa-widget__message-actions", v.appendChild(qe(m)), f.appendChild(v), t.appendChild(f), _ = f, x = null;
|
|
1139
1154
|
}
|
|
1140
1155
|
if (o.isThinking && !o.assistantDraft)
|
|
1141
|
-
if (
|
|
1142
|
-
const
|
|
1143
|
-
t.appendChild(
|
|
1156
|
+
if (d) {
|
|
1157
|
+
const m = ut();
|
|
1158
|
+
t.appendChild(m), _ = null, x = m;
|
|
1144
1159
|
} else {
|
|
1145
|
-
const
|
|
1146
|
-
t.appendChild(
|
|
1160
|
+
const m = qn(l());
|
|
1161
|
+
t.appendChild(m), _ = null, x = m;
|
|
1147
1162
|
}
|
|
1148
1163
|
if (o.lastError) {
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1164
|
+
const m = document.createElement("div");
|
|
1165
|
+
m.className = "pluno-pa-widget__error", m.textContent = o.lastError, t.appendChild(m), _ = m, x = null;
|
|
1151
1166
|
}
|
|
1152
|
-
const
|
|
1153
|
-
if (s &&
|
|
1154
|
-
const
|
|
1155
|
-
isDrafting: s.draftingCandidateId ===
|
|
1167
|
+
const w = s && !o.isThinking ? Mt(g) : null;
|
|
1168
|
+
if (s && w && !s.dismissedCandidateIds.has(w.id)) {
|
|
1169
|
+
const m = zn(w, {
|
|
1170
|
+
isDrafting: s.draftingCandidateId === w.id,
|
|
1156
1171
|
error: s.error,
|
|
1157
1172
|
onDraft: s.onDraft,
|
|
1158
|
-
onDismiss: s.onDismiss
|
|
1173
|
+
onDismiss: s.onDismiss,
|
|
1174
|
+
onDisable: s.onDisable
|
|
1159
1175
|
});
|
|
1160
|
-
t.appendChild(
|
|
1176
|
+
t.appendChild(m), s.onSeen(w), _ = null, x = m;
|
|
1161
1177
|
}
|
|
1162
|
-
|
|
1178
|
+
_?.classList.add("pluno-pa-widget__message--bottom-reserve"), x?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
|
|
1163
1179
|
}
|
|
1164
|
-
function
|
|
1165
|
-
t.replaceChildren(),
|
|
1180
|
+
function Fn(t, e, n, o, a, r) {
|
|
1181
|
+
t.replaceChildren(), gt(e, !1), e.disabled = !0, n.hidden = !0;
|
|
1166
1182
|
const l = document.createElement("div");
|
|
1167
1183
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1168
1184
|
const p = document.createElement("img");
|
|
1169
1185
|
p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = o(), p.alt = "", p.setAttribute("aria-hidden", "true"), l.appendChild(p);
|
|
1170
1186
|
const s = document.createElement("div");
|
|
1171
1187
|
s.className = "pluno-pa-widget__empty", s.textContent = "Log in to use Pluno on this page.", l.appendChild(s);
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1188
|
+
const g = document.createElement("button");
|
|
1189
|
+
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => r?.()), l.appendChild(g), t.appendChild(l);
|
|
1174
1190
|
}
|
|
1175
|
-
function
|
|
1191
|
+
function Bn(t) {
|
|
1176
1192
|
const e = document.createElement("div");
|
|
1177
1193
|
e.className = "pluno-pa-widget__message-attachments";
|
|
1178
1194
|
for (const n of t)
|
|
1179
|
-
e.appendChild(
|
|
1195
|
+
e.appendChild(Ln(n));
|
|
1180
1196
|
return e;
|
|
1181
1197
|
}
|
|
1182
|
-
function
|
|
1198
|
+
function qe(t) {
|
|
1183
1199
|
const e = document.createElement("button");
|
|
1184
|
-
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(
|
|
1200
|
+
return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(En()), e.addEventListener("click", (n) => {
|
|
1185
1201
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
|
|
1186
1202
|
}), e;
|
|
1187
1203
|
}
|
|
1188
|
-
function
|
|
1204
|
+
function zn(t, e) {
|
|
1189
1205
|
const n = document.createElement("article");
|
|
1190
1206
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1191
1207
|
const o = document.createElement("div");
|
|
1192
1208
|
o.className = "pluno-pa-widget__share-prompt-body";
|
|
1193
1209
|
const a = document.createElement("div");
|
|
1194
1210
|
a.className = "pluno-pa-widget__share-prompt-copy";
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1211
|
+
const r = document.createElement("strong");
|
|
1212
|
+
r.textContent = "Share this win?", a.appendChild(r);
|
|
1197
1213
|
const l = document.createElement("span");
|
|
1198
|
-
if (l.textContent = e.isDrafting ? "Drafting
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1214
|
+
if (l.textContent = e.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), e.error) {
|
|
1215
|
+
const c = document.createElement("span");
|
|
1216
|
+
c.className = "pluno-pa-widget__share-prompt-error", c.textContent = e.error, a.appendChild(c);
|
|
1201
1217
|
}
|
|
1202
1218
|
o.appendChild(a);
|
|
1203
1219
|
const p = document.createElement("div");
|
|
1204
1220
|
p.className = "pluno-pa-widget__share-prompt-actions";
|
|
1205
|
-
const s = document.createElement("
|
|
1206
|
-
|
|
1221
|
+
const s = document.createElement("div");
|
|
1222
|
+
s.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
1223
|
+
const g = document.createElement("button");
|
|
1224
|
+
if (g.type = "button", g.disabled = e.isDrafting, g.addEventListener("click", () => {
|
|
1207
1225
|
e.onDraft(t);
|
|
1208
|
-
}), e.isDrafting ? (
|
|
1209
|
-
|
|
1210
|
-
|
|
1226
|
+
}), e.isDrafting ? (g.appendChild(ye()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), e.isDrafting)
|
|
1227
|
+
p.appendChild(s);
|
|
1228
|
+
else {
|
|
1229
|
+
const c = document.createElement("button");
|
|
1230
|
+
c.type = "button", c.className = "pluno-pa-widget__share-prompt-dismiss", c.setAttribute("aria-label", "Dismiss share prompt"), c.title = "Dismiss", c.textContent = "Dismiss", c.addEventListener("click", () => {
|
|
1211
1231
|
e.onDismiss(t);
|
|
1212
|
-
}), p.appendChild(
|
|
1232
|
+
}), s.appendChild(c), p.appendChild(s);
|
|
1233
|
+
const b = document.createElement("button");
|
|
1234
|
+
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1235
|
+
e.onDisable(t);
|
|
1236
|
+
}), p.appendChild(b);
|
|
1213
1237
|
}
|
|
1214
1238
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1215
1239
|
}
|
|
1216
|
-
function
|
|
1240
|
+
function Gn(t, e) {
|
|
1217
1241
|
const n = document.createElement("div");
|
|
1218
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1219
|
-
|
|
1242
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (h) => {
|
|
1243
|
+
h.target === n && e.onClose();
|
|
1220
1244
|
});
|
|
1221
1245
|
const o = document.createElement("section");
|
|
1222
|
-
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft social post");
|
|
1223
|
-
const a = document.createElement("header"),
|
|
1224
|
-
|
|
1246
|
+
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
1247
|
+
const a = document.createElement("header"), r = document.createElement("strong");
|
|
1248
|
+
r.textContent = "Share this win", a.appendChild(r);
|
|
1225
1249
|
const l = document.createElement("button");
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1250
|
+
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", e.onClose), a.appendChild(l), o.appendChild(a);
|
|
1251
|
+
const p = document.createElement("p");
|
|
1252
|
+
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
1253
|
+
const s = document.createElement("div");
|
|
1254
|
+
s.className = "pluno-pa-widget__share-dialog-step";
|
|
1255
|
+
const g = document.createElement("div");
|
|
1256
|
+
g.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1257
|
+
const c = document.createElement("strong");
|
|
1258
|
+
c.textContent = "1) Copy Screenshot", g.appendChild(c);
|
|
1259
|
+
const b = $n("Copy Screenshot", async () => {
|
|
1260
|
+
try {
|
|
1261
|
+
return await Rt(t.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1262
|
+
} catch {
|
|
1263
|
+
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
if (g.appendChild(b), s.appendChild(g), t.screenshotDataUrl) {
|
|
1267
|
+
const h = document.createElement("div");
|
|
1268
|
+
h.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1269
|
+
const d = document.createElement("img");
|
|
1270
|
+
d.src = t.screenshotDataUrl, d.alt = "Product page with Pluno open", h.appendChild(d), s.appendChild(h);
|
|
1229
1271
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1272
|
+
o.appendChild(s), o.appendChild(p);
|
|
1273
|
+
const _ = document.createElement("div");
|
|
1274
|
+
_.className = "pluno-pa-widget__share-dialog-step";
|
|
1275
|
+
const x = document.createElement("strong");
|
|
1276
|
+
x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", _.appendChild(x);
|
|
1277
|
+
const y = document.createElement("footer");
|
|
1278
|
+
y.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1279
|
+
for (const h of Un(t)) {
|
|
1280
|
+
const d = document.createElement("a");
|
|
1281
|
+
d.href = h.href, d.target = "_blank", d.rel = "noopener noreferrer", d.title = h.label, d.setAttribute("aria-label", `Open ${h.label}`), d.appendChild(Wn(h.id)), y.appendChild(d);
|
|
1282
|
+
}
|
|
1283
|
+
if (_.appendChild(y), o.appendChild(_), e.socialPostRewardsUrl) {
|
|
1284
|
+
const h = document.createElement("div");
|
|
1285
|
+
h.className = "pluno-pa-widget__share-dialog-step";
|
|
1286
|
+
const d = document.createElement("strong");
|
|
1287
|
+
d.className = "pluno-pa-widget__share-dialog-step-title", d.textContent = "3) Submit post to get 2000 free credits!", h.appendChild(d);
|
|
1288
|
+
const w = document.createElement("a");
|
|
1289
|
+
w.className = "pluno-pa-widget__share-dialog-reward-link", w.href = e.socialPostRewardsUrl, w.target = "_blank", w.rel = "noopener noreferrer", w.appendChild(document.createTextNode("Submit post URL")), w.appendChild(Hn()), h.appendChild(w), o.appendChild(h);
|
|
1290
|
+
}
|
|
1291
|
+
return n.appendChild(o), n;
|
|
1292
|
+
}
|
|
1293
|
+
function $n(t, e) {
|
|
1294
|
+
const n = document.createElement("button");
|
|
1295
|
+
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = t, n.addEventListener("click", async (o) => {
|
|
1296
|
+
o.preventDefault(), o.stopPropagation(), await e() && (n.textContent = "Copied ✓");
|
|
1297
|
+
}), n;
|
|
1298
|
+
}
|
|
1299
|
+
function Un(t) {
|
|
1300
|
+
const e = t.linkedinPost.trim(), n = t.xPost.trim();
|
|
1301
|
+
return [
|
|
1302
|
+
{
|
|
1303
|
+
id: "linkedin",
|
|
1304
|
+
label: "LinkedIn",
|
|
1305
|
+
href: `https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(e)}`
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
id: "x",
|
|
1309
|
+
label: "X",
|
|
1310
|
+
href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(n)}`
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
id: "instagram",
|
|
1314
|
+
label: "Instagram Story",
|
|
1315
|
+
href: "https://www.instagram.com/create/story/"
|
|
1316
|
+
}
|
|
1317
|
+
];
|
|
1318
|
+
}
|
|
1319
|
+
function Wn(t) {
|
|
1320
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1321
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), e.setAttribute("viewBox", "0 0 32 32"), e.setAttribute("aria-hidden", "true"), t === "linkedin" ? (P(e, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), P(e, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), P(e, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), P(e, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), P(e, "M20 18c.1 2.2.1 4.7 0 7.2"), e) : t === "x" ? (P(e, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), P(e, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), P(e, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), e) : (P(e, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), P(e, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), P(e, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), P(e, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), e);
|
|
1322
|
+
}
|
|
1323
|
+
function P(t, e, n) {
|
|
1324
|
+
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1325
|
+
o.setAttribute("d", e), n && o.setAttribute("opacity", n), t.appendChild(o);
|
|
1261
1326
|
}
|
|
1262
|
-
function
|
|
1263
|
-
|
|
1327
|
+
function Hn() {
|
|
1328
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1329
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), t.setAttribute("viewBox", "0 0 24 24"), t.setAttribute("aria-hidden", "true"), P(t, "M14 5h5v5"), P(t, "M19 5l-8 8"), P(t, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), t;
|
|
1330
|
+
}
|
|
1331
|
+
function Vn(t) {
|
|
1332
|
+
return t.role === "tool" && t.toolName === nt;
|
|
1264
1333
|
}
|
|
1265
1334
|
function Ke(t) {
|
|
1266
1335
|
return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1267
1336
|
}
|
|
1268
|
-
function
|
|
1337
|
+
function jn(t, e, n, o) {
|
|
1269
1338
|
const a = document.createElement("article");
|
|
1270
1339
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1273
|
-
const l = document.createElement("details"), p =
|
|
1340
|
+
const r = document.createElement("img");
|
|
1341
|
+
r.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", r.src = o, r.alt = "", r.setAttribute("aria-hidden", "true"), a.appendChild(r);
|
|
1342
|
+
const l = document.createElement("details"), p = Kn(t);
|
|
1274
1343
|
l.open = e.has(p), l.addEventListener("toggle", () => {
|
|
1275
1344
|
l.open ? e.add(p) : e.delete(p), n();
|
|
1276
1345
|
});
|
|
1277
1346
|
const s = document.createElement("summary");
|
|
1278
|
-
s.className = "pluno-pa-widget__tool-summary", t.some((
|
|
1279
|
-
const
|
|
1280
|
-
if (
|
|
1281
|
-
const
|
|
1282
|
-
|
|
1283
|
-
for (const
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
}
|
|
1289
|
-
l.appendChild(
|
|
1347
|
+
s.className = "pluno-pa-widget__tool-summary", t.some((b) => b.loading) && s.appendChild(ye());
|
|
1348
|
+
const c = document.createElement("span");
|
|
1349
|
+
if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = t[t.length - 1].content || "Run tool", s.appendChild(c), l.appendChild(s), t.length > 0) {
|
|
1350
|
+
const b = document.createElement("div");
|
|
1351
|
+
b.className = "pluno-pa-widget__tool-lines";
|
|
1352
|
+
for (const _ of t) {
|
|
1353
|
+
const x = document.createElement("div");
|
|
1354
|
+
x.className = "pluno-pa-widget__tool-line", _.loading && x.appendChild(ye());
|
|
1355
|
+
const y = document.createElement("span");
|
|
1356
|
+
y.textContent = _.content || "Run tool", x.appendChild(y), b.appendChild(x);
|
|
1357
|
+
}
|
|
1358
|
+
l.appendChild(b);
|
|
1290
1359
|
}
|
|
1291
1360
|
return a.appendChild(l), a;
|
|
1292
1361
|
}
|
|
1293
|
-
function
|
|
1362
|
+
function ve(t) {
|
|
1294
1363
|
const e = document.createElement("article");
|
|
1295
1364
|
e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
|
|
1296
1365
|
const n = document.createElement("img");
|
|
1297
1366
|
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e;
|
|
1298
1367
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const e =
|
|
1301
|
-
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(
|
|
1368
|
+
function qn(t) {
|
|
1369
|
+
const e = ve(t);
|
|
1370
|
+
return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(ut()), e;
|
|
1302
1371
|
}
|
|
1303
|
-
function
|
|
1372
|
+
function ut() {
|
|
1304
1373
|
const t = document.createElement("div");
|
|
1305
1374
|
t.className = "pluno-pa-widget__status";
|
|
1306
1375
|
const e = document.createElement("span");
|
|
@@ -1308,15 +1377,15 @@ function dt() {
|
|
|
1308
1377
|
const n = document.createElement("span");
|
|
1309
1378
|
return n.textContent = "Thinking...", t.appendChild(n), t;
|
|
1310
1379
|
}
|
|
1311
|
-
function
|
|
1380
|
+
function Kn(t) {
|
|
1312
1381
|
return `tools:${t.map((e) => e.id).join("|")}`;
|
|
1313
1382
|
}
|
|
1314
|
-
function
|
|
1383
|
+
function ye() {
|
|
1315
1384
|
const t = document.createElement("span");
|
|
1316
1385
|
return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
|
|
1317
1386
|
}
|
|
1318
|
-
function
|
|
1319
|
-
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ?
|
|
1387
|
+
function gt(t, e) {
|
|
1388
|
+
t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? yn() : dt());
|
|
1320
1389
|
}
|
|
1321
1390
|
function Ye(t, e) {
|
|
1322
1391
|
const n = e.replace(/\r\n/g, `
|
|
@@ -1330,54 +1399,54 @@ function Ye(t, e) {
|
|
|
1330
1399
|
continue;
|
|
1331
1400
|
}
|
|
1332
1401
|
if (a.match(/^```(\w+)?\s*$/)) {
|
|
1333
|
-
const
|
|
1402
|
+
const g = [];
|
|
1334
1403
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1335
|
-
|
|
1404
|
+
g.push(n[o]), o += 1;
|
|
1336
1405
|
o += o < n.length ? 1 : 0;
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
`),
|
|
1406
|
+
const c = document.createElement("pre"), b = document.createElement("code");
|
|
1407
|
+
b.textContent = g.join(`
|
|
1408
|
+
`), c.appendChild(b), t.appendChild(c);
|
|
1340
1409
|
continue;
|
|
1341
1410
|
}
|
|
1342
1411
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1343
1412
|
if (l) {
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1413
|
+
const g = document.createElement(`h${l[1].length + 2}`);
|
|
1414
|
+
ae(g, l[2]), t.appendChild(g), o += 1;
|
|
1346
1415
|
continue;
|
|
1347
1416
|
}
|
|
1348
1417
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1349
|
-
const
|
|
1418
|
+
const g = document.createElement("ul");
|
|
1350
1419
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1351
|
-
const
|
|
1352
|
-
|
|
1420
|
+
const c = document.createElement("li");
|
|
1421
|
+
ae(c, n[o].replace(/^\s*[-*+]\s+/, "")), g.appendChild(c), o += 1;
|
|
1353
1422
|
}
|
|
1354
|
-
t.appendChild(
|
|
1423
|
+
t.appendChild(g);
|
|
1355
1424
|
continue;
|
|
1356
1425
|
}
|
|
1357
1426
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
1358
|
-
const
|
|
1427
|
+
const g = document.createElement("ol");
|
|
1359
1428
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1429
|
+
const c = document.createElement("li");
|
|
1430
|
+
ae(c, n[o].replace(/^\s*\d+\.\s+/, "")), g.appendChild(c), o += 1;
|
|
1362
1431
|
}
|
|
1363
|
-
t.appendChild(
|
|
1432
|
+
t.appendChild(g);
|
|
1364
1433
|
continue;
|
|
1365
1434
|
}
|
|
1366
1435
|
const p = [a];
|
|
1367
1436
|
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]); )
|
|
1368
1437
|
p.push(n[o]), o += 1;
|
|
1369
1438
|
const s = document.createElement("p");
|
|
1370
|
-
p.forEach((
|
|
1371
|
-
|
|
1439
|
+
p.forEach((g, c) => {
|
|
1440
|
+
c > 0 && s.appendChild(document.createElement("br")), ae(s, g);
|
|
1372
1441
|
}), t.appendChild(s);
|
|
1373
1442
|
}
|
|
1374
1443
|
}
|
|
1375
|
-
function
|
|
1444
|
+
function ae(t, e) {
|
|
1376
1445
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
1377
1446
|
let o = 0;
|
|
1378
1447
|
for (const a of e.matchAll(n)) {
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1448
|
+
const r = a.index ?? 0;
|
|
1449
|
+
r > o && t.appendChild(document.createTextNode(e.slice(o, r)));
|
|
1381
1450
|
const l = a[0];
|
|
1382
1451
|
if (l.startsWith("`")) {
|
|
1383
1452
|
const p = document.createElement("code");
|
|
@@ -1390,17 +1459,17 @@ function ne(t, e) {
|
|
|
1390
1459
|
p.textContent = l.slice(1, -1), t.appendChild(p);
|
|
1391
1460
|
} else {
|
|
1392
1461
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1393
|
-
if (p &&
|
|
1462
|
+
if (p && Yn(p[2])) {
|
|
1394
1463
|
const s = document.createElement("a");
|
|
1395
1464
|
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], t.appendChild(s);
|
|
1396
1465
|
} else
|
|
1397
1466
|
t.appendChild(document.createTextNode(l));
|
|
1398
1467
|
}
|
|
1399
|
-
o =
|
|
1468
|
+
o = r + l.length;
|
|
1400
1469
|
}
|
|
1401
1470
|
o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
|
|
1402
1471
|
}
|
|
1403
|
-
function
|
|
1472
|
+
function Yn(t) {
|
|
1404
1473
|
if (t.startsWith("/") || t.startsWith("#"))
|
|
1405
1474
|
return !0;
|
|
1406
1475
|
try {
|
|
@@ -1465,7 +1534,7 @@ function Xe(t, e) {
|
|
|
1465
1534
|
--pluno-pa-accent-contrast: #fafafa;
|
|
1466
1535
|
position: fixed;
|
|
1467
1536
|
z-index: 2147483645;
|
|
1468
|
-
font-family: ${
|
|
1537
|
+
font-family: ${M.fontFamily};
|
|
1469
1538
|
font-size: 14px;
|
|
1470
1539
|
color: var(--pluno-pa-text);
|
|
1471
1540
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -2104,7 +2173,13 @@ function Xe(t, e) {
|
|
|
2104
2173
|
.pluno-pa-widget__share-prompt-actions {
|
|
2105
2174
|
display: flex;
|
|
2106
2175
|
align-items: center;
|
|
2107
|
-
justify-content:
|
|
2176
|
+
justify-content: space-between;
|
|
2177
|
+
gap: 6px;
|
|
2178
|
+
}
|
|
2179
|
+
.pluno-pa-widget__share-prompt-primary-actions {
|
|
2180
|
+
min-width: 0;
|
|
2181
|
+
display: flex;
|
|
2182
|
+
align-items: center;
|
|
2108
2183
|
gap: 6px;
|
|
2109
2184
|
}
|
|
2110
2185
|
.pluno-pa-widget__share-prompt-actions button {
|
|
@@ -2137,6 +2212,22 @@ function Xe(t, e) {
|
|
|
2137
2212
|
background: var(--pluno-pa-surface);
|
|
2138
2213
|
color: var(--pluno-pa-muted);
|
|
2139
2214
|
}
|
|
2215
|
+
.pluno-pa-widget__share-prompt-disable {
|
|
2216
|
+
border: 0;
|
|
2217
|
+
background: transparent;
|
|
2218
|
+
color: color-mix(in srgb, var(--pluno-pa-muted) 72%, transparent);
|
|
2219
|
+
padding: 0;
|
|
2220
|
+
font: inherit;
|
|
2221
|
+
font-size: 10px;
|
|
2222
|
+
font-weight: 500;
|
|
2223
|
+
line-height: 1.2;
|
|
2224
|
+
cursor: pointer;
|
|
2225
|
+
}
|
|
2226
|
+
.pluno-pa-widget__share-prompt-disable:hover,
|
|
2227
|
+
.pluno-pa-widget__share-prompt-disable:focus-visible {
|
|
2228
|
+
color: var(--pluno-pa-muted);
|
|
2229
|
+
text-decoration: underline;
|
|
2230
|
+
}
|
|
2140
2231
|
.pluno-pa-widget__share-dialog-backdrop {
|
|
2141
2232
|
position: fixed;
|
|
2142
2233
|
inset: 0;
|
|
@@ -2145,21 +2236,52 @@ function Xe(t, e) {
|
|
|
2145
2236
|
place-items: center;
|
|
2146
2237
|
padding: 18px;
|
|
2147
2238
|
background: rgba(24, 24, 27, 0.28);
|
|
2148
|
-
font-family: var(--pluno-pa-font, ${
|
|
2239
|
+
font-family: var(--pluno-pa-font, ${M.fontFamily});
|
|
2149
2240
|
color: var(--pluno-pa-text);
|
|
2150
2241
|
}
|
|
2151
2242
|
.pluno-pa-widget__share-dialog {
|
|
2243
|
+
--pluno-pa-share-paper: #fff9df;
|
|
2244
|
+
--pluno-pa-share-ink: #2c2a1e;
|
|
2245
|
+
--pluno-pa-share-muted: rgba(44, 42, 30, 0.66);
|
|
2246
|
+
--pluno-pa-share-rule: rgba(44, 42, 30, 0.24);
|
|
2247
|
+
--pluno-pa-share-highlight: color-mix(in srgb, var(--pluno-pa-accent) 22%, #fff9df);
|
|
2248
|
+
position: relative;
|
|
2249
|
+
isolation: isolate;
|
|
2152
2250
|
width: min(390px, calc(100vw - 36px));
|
|
2153
2251
|
max-height: min(650px, calc(100vh - 36px));
|
|
2154
2252
|
display: flex;
|
|
2155
2253
|
flex-direction: column;
|
|
2156
2254
|
gap: 12px;
|
|
2157
|
-
border:
|
|
2158
|
-
border-radius:
|
|
2159
|
-
background:
|
|
2160
|
-
|
|
2255
|
+
border: 2px solid transparent;
|
|
2256
|
+
border-radius: 31px 25px 29px 23px / 23px 33px 22px 31px;
|
|
2257
|
+
background:
|
|
2258
|
+
linear-gradient(rgba(44, 42, 30, 0.045) 1px, transparent 1px),
|
|
2259
|
+
linear-gradient(90deg, rgba(44, 42, 30, 0.035) 1px, transparent 1px),
|
|
2260
|
+
var(--pluno-pa-share-paper);
|
|
2261
|
+
background-size: 26px 26px, 26px 26px, auto;
|
|
2262
|
+
color: var(--pluno-pa-share-ink);
|
|
2263
|
+
font-family: "Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Segoe Print", cursive;
|
|
2264
|
+
transform: rotate(-0.25deg);
|
|
2265
|
+
box-shadow: 0 24px 58px rgba(44, 42, 30, 0.22);
|
|
2161
2266
|
padding: 14px;
|
|
2162
2267
|
}
|
|
2268
|
+
.pluno-pa-widget__share-dialog::before,
|
|
2269
|
+
.pluno-pa-widget__share-dialog::after {
|
|
2270
|
+
content: "";
|
|
2271
|
+
position: absolute;
|
|
2272
|
+
inset: -3px;
|
|
2273
|
+
z-index: -1;
|
|
2274
|
+
border: 2px solid var(--pluno-pa-share-ink);
|
|
2275
|
+
border-radius: inherit;
|
|
2276
|
+
filter: url(#pluno-pa-scribble-wobble);
|
|
2277
|
+
pointer-events: none;
|
|
2278
|
+
}
|
|
2279
|
+
.pluno-pa-widget__share-dialog::after {
|
|
2280
|
+
inset: -7px -5px -4px -6px;
|
|
2281
|
+
opacity: 0.42;
|
|
2282
|
+
transform: rotate(1.6deg);
|
|
2283
|
+
filter: url(#pluno-pa-scribble-wobble-2);
|
|
2284
|
+
}
|
|
2163
2285
|
.pluno-pa-widget__share-dialog header,
|
|
2164
2286
|
.pluno-pa-widget__share-dialog footer {
|
|
2165
2287
|
display: flex;
|
|
@@ -2168,84 +2290,156 @@ function Xe(t, e) {
|
|
|
2168
2290
|
gap: 10px;
|
|
2169
2291
|
}
|
|
2170
2292
|
.pluno-pa-widget__share-dialog header strong {
|
|
2171
|
-
color: var(--pluno-pa-
|
|
2172
|
-
font-size:
|
|
2173
|
-
line-height: 1.
|
|
2293
|
+
color: var(--pluno-pa-share-ink);
|
|
2294
|
+
font-size: 18px;
|
|
2295
|
+
line-height: 1.1;
|
|
2174
2296
|
}
|
|
2175
2297
|
.pluno-pa-widget__share-dialog header button {
|
|
2176
2298
|
width: 30px;
|
|
2177
2299
|
height: 30px;
|
|
2178
|
-
border:
|
|
2179
|
-
border-radius:
|
|
2180
|
-
background: var(--pluno-pa-
|
|
2181
|
-
color: var(--pluno-pa-
|
|
2300
|
+
border: 2px solid var(--pluno-pa-share-ink);
|
|
2301
|
+
border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
|
|
2302
|
+
background: var(--pluno-pa-share-paper);
|
|
2303
|
+
color: var(--pluno-pa-share-ink);
|
|
2182
2304
|
cursor: pointer;
|
|
2183
2305
|
}
|
|
2184
2306
|
.pluno-pa-widget__share-dialog-screenshot {
|
|
2307
|
+
position: relative;
|
|
2308
|
+
overflow: hidden;
|
|
2185
2309
|
width: 100%;
|
|
2310
|
+
aspect-ratio: 16 / 10;
|
|
2186
2311
|
max-height: 180px;
|
|
2187
|
-
|
|
2188
|
-
border:
|
|
2189
|
-
border-radius: 8px;
|
|
2312
|
+
border: 2px solid var(--pluno-pa-share-rule);
|
|
2313
|
+
border-radius: 18px 15px 17px 13px / 14px 18px 13px 17px;
|
|
2190
2314
|
background: var(--pluno-pa-surface);
|
|
2191
2315
|
}
|
|
2192
|
-
.pluno-pa-widget__share-dialog-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
display: grid;
|
|
2200
|
-
gap: 6px;
|
|
2201
|
-
min-width: 0;
|
|
2316
|
+
.pluno-pa-widget__share-dialog-screenshot img {
|
|
2317
|
+
width: 100%;
|
|
2318
|
+
height: 100%;
|
|
2319
|
+
display: block;
|
|
2320
|
+
object-fit: contain;
|
|
2321
|
+
filter: saturate(0.94) contrast(1.02);
|
|
2322
|
+
background: #0f0f10;
|
|
2202
2323
|
}
|
|
2203
|
-
.pluno-pa-widget__share-dialog-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
line-height: 1.2;
|
|
2324
|
+
.pluno-pa-widget__share-dialog-step {
|
|
2325
|
+
display: flex;
|
|
2326
|
+
flex-direction: column;
|
|
2327
|
+
gap: 8px;
|
|
2208
2328
|
}
|
|
2209
|
-
.pluno-pa-widget__share-dialog-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
border: 1px solid var(--pluno-pa-divider);
|
|
2215
|
-
border-radius: 8px;
|
|
2216
|
-
background: var(--pluno-pa-surface);
|
|
2217
|
-
color: var(--pluno-pa-text);
|
|
2218
|
-
padding: 9px 10px;
|
|
2219
|
-
font-size: 13px;
|
|
2220
|
-
line-height: 1.45;
|
|
2221
|
-
outline: none;
|
|
2329
|
+
.pluno-pa-widget__share-dialog-step-header {
|
|
2330
|
+
display: flex;
|
|
2331
|
+
align-items: center;
|
|
2332
|
+
justify-content: space-between;
|
|
2333
|
+
gap: 10px;
|
|
2222
2334
|
}
|
|
2223
|
-
.pluno-pa-widget__share-dialog-
|
|
2224
|
-
|
|
2335
|
+
.pluno-pa-widget__share-dialog-step-header strong,
|
|
2336
|
+
.pluno-pa-widget__share-dialog-step-title {
|
|
2337
|
+
color: var(--pluno-pa-share-ink);
|
|
2338
|
+
font-size: 15px;
|
|
2339
|
+
font-weight: 750;
|
|
2340
|
+
line-height: 1.2;
|
|
2225
2341
|
}
|
|
2226
2342
|
.pluno-pa-widget__share-dialog-status {
|
|
2227
2343
|
min-height: 16px;
|
|
2228
2344
|
margin: -2px 0 0;
|
|
2229
|
-
color: var(--pluno-pa-muted);
|
|
2345
|
+
color: var(--pluno-pa-share-muted);
|
|
2230
2346
|
font-size: 12px;
|
|
2231
2347
|
line-height: 1.3;
|
|
2232
2348
|
}
|
|
2233
2349
|
.pluno-pa-widget__share-dialog-status[hidden] {
|
|
2234
2350
|
display: none;
|
|
2235
2351
|
}
|
|
2236
|
-
.pluno-pa-widget__share-dialog
|
|
2237
|
-
|
|
2352
|
+
.pluno-pa-widget__share-dialog-copy {
|
|
2353
|
+
display: inline-flex;
|
|
2354
|
+
align-items: center;
|
|
2355
|
+
justify-content: center;
|
|
2356
|
+
min-height: 31px;
|
|
2357
|
+
border: 2px solid var(--pluno-pa-share-ink);
|
|
2358
|
+
border-radius: 41% 59% 44% 56% / 57% 43% 58% 42%;
|
|
2359
|
+
background: var(--pluno-pa-share-paper);
|
|
2360
|
+
color: var(--pluno-pa-share-ink);
|
|
2361
|
+
padding: 5px 10px;
|
|
2362
|
+
font-size: 13px;
|
|
2363
|
+
font-weight: 700;
|
|
2364
|
+
line-height: 1;
|
|
2365
|
+
transform: rotate(1deg);
|
|
2366
|
+
transition: opacity 120ms ease, transform 120ms ease;
|
|
2367
|
+
cursor: pointer;
|
|
2368
|
+
}
|
|
2369
|
+
.pluno-pa-widget__share-dialog-copy:hover {
|
|
2370
|
+
transform: translateY(0) rotate(-1deg);
|
|
2238
2371
|
}
|
|
2239
|
-
.pluno-pa-widget__share-dialog
|
|
2372
|
+
.pluno-pa-widget__share-dialog-platforms {
|
|
2373
|
+
display: grid;
|
|
2374
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
2375
|
+
gap: 10px;
|
|
2376
|
+
padding-inline: 10px;
|
|
2377
|
+
}
|
|
2378
|
+
.pluno-pa-widget__share-dialog-platforms a {
|
|
2379
|
+
display: inline-flex;
|
|
2380
|
+
align-items: center;
|
|
2381
|
+
justify-content: center;
|
|
2382
|
+
width: 100%;
|
|
2383
|
+
min-height: 44px;
|
|
2384
|
+
border: 2px solid var(--pluno-pa-share-ink);
|
|
2385
|
+
border-radius: 47% 53% 45% 55% / 55% 45% 54% 46%;
|
|
2386
|
+
background: var(--pluno-pa-share-highlight);
|
|
2387
|
+
color: var(--pluno-pa-share-ink);
|
|
2388
|
+
font-size: 16px;
|
|
2389
|
+
font-weight: 800;
|
|
2390
|
+
text-decoration: none;
|
|
2391
|
+
transform: rotate(-1.5deg);
|
|
2392
|
+
}
|
|
2393
|
+
.pluno-pa-widget__share-dialog-platform-logo {
|
|
2394
|
+
width: 24px;
|
|
2395
|
+
height: 24px;
|
|
2396
|
+
display: block;
|
|
2397
|
+
overflow: visible;
|
|
2398
|
+
fill: none;
|
|
2399
|
+
stroke: currentColor;
|
|
2400
|
+
stroke-linecap: round;
|
|
2401
|
+
stroke-linejoin: round;
|
|
2402
|
+
stroke-width: 2.2;
|
|
2403
|
+
}
|
|
2404
|
+
.pluno-pa-widget__share-dialog-platforms a:nth-child(even) {
|
|
2405
|
+
transform: rotate(1.5deg);
|
|
2406
|
+
}
|
|
2407
|
+
.pluno-pa-widget__share-dialog-platforms a:hover {
|
|
2408
|
+
background: var(--pluno-pa-share-paper);
|
|
2409
|
+
color: var(--pluno-pa-accent);
|
|
2410
|
+
}
|
|
2411
|
+
.pluno-pa-widget__share-dialog-reward-link {
|
|
2412
|
+
display: inline-flex;
|
|
2413
|
+
align-self: flex-start;
|
|
2414
|
+
align-items: center;
|
|
2415
|
+
justify-content: center;
|
|
2416
|
+
gap: 5px;
|
|
2240
2417
|
min-height: 34px;
|
|
2241
|
-
border:
|
|
2242
|
-
border-radius:
|
|
2243
|
-
background: var(--pluno-pa-
|
|
2244
|
-
color: var(--pluno-pa-
|
|
2245
|
-
padding:
|
|
2246
|
-
font-size:
|
|
2247
|
-
font-weight:
|
|
2248
|
-
|
|
2418
|
+
border: 2px solid var(--pluno-pa-share-ink);
|
|
2419
|
+
border-radius: 43% 57% 45% 55% / 56% 44% 57% 43%;
|
|
2420
|
+
background: var(--pluno-pa-share-highlight);
|
|
2421
|
+
color: var(--pluno-pa-share-ink);
|
|
2422
|
+
padding: 6px 12px;
|
|
2423
|
+
font-size: 13px;
|
|
2424
|
+
font-weight: 800;
|
|
2425
|
+
line-height: 1;
|
|
2426
|
+
text-decoration: none;
|
|
2427
|
+
transform: rotate(0.8deg);
|
|
2428
|
+
}
|
|
2429
|
+
.pluno-pa-widget__share-dialog-external-icon {
|
|
2430
|
+
width: 13px;
|
|
2431
|
+
height: 13px;
|
|
2432
|
+
display: block;
|
|
2433
|
+
fill: none;
|
|
2434
|
+
stroke: currentColor;
|
|
2435
|
+
stroke-linecap: round;
|
|
2436
|
+
stroke-linejoin: round;
|
|
2437
|
+
stroke-width: 2.25;
|
|
2438
|
+
}
|
|
2439
|
+
.pluno-pa-widget__share-dialog-reward-link:hover {
|
|
2440
|
+
background: var(--pluno-pa-share-paper);
|
|
2441
|
+
color: var(--pluno-pa-accent);
|
|
2442
|
+
transform: rotate(-0.8deg);
|
|
2249
2443
|
}
|
|
2250
2444
|
.pluno-pa-widget__composer {
|
|
2251
2445
|
flex: 0 0 auto;
|
|
@@ -2411,6 +2605,7 @@ function Xe(t, e) {
|
|
|
2411
2605
|
display: flex;
|
|
2412
2606
|
align-items: center;
|
|
2413
2607
|
justify-content: center;
|
|
2608
|
+
column-gap: 0.35em;
|
|
2414
2609
|
margin-top: 8px;
|
|
2415
2610
|
color: var(--pluno-pa-faint);
|
|
2416
2611
|
font: inherit;
|
|
@@ -2427,10 +2622,6 @@ function Xe(t, e) {
|
|
|
2427
2622
|
.pluno-pa-widget__powered-by:hover {
|
|
2428
2623
|
color: var(--pluno-pa-muted);
|
|
2429
2624
|
}
|
|
2430
|
-
.pluno-pa-widget__composer-separator {
|
|
2431
|
-
margin: 0 5px;
|
|
2432
|
-
color: inherit;
|
|
2433
|
-
}
|
|
2434
2625
|
.pluno-pa-widget__ai-disclaimer {
|
|
2435
2626
|
color: inherit;
|
|
2436
2627
|
}
|
|
@@ -2616,7 +2807,7 @@ function Xe(t, e) {
|
|
|
2616
2807
|
right: 16px;
|
|
2617
2808
|
height: 36px;
|
|
2618
2809
|
z-index: 3;
|
|
2619
|
-
background-image: url('${
|
|
2810
|
+
background-image: url('${Oe}');
|
|
2620
2811
|
background-repeat: repeat-x;
|
|
2621
2812
|
background-size: 104px 36px;
|
|
2622
2813
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -2717,7 +2908,7 @@ function Xe(t, e) {
|
|
|
2717
2908
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
|
|
2718
2909
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::before,
|
|
2719
2910
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body::before,
|
|
2720
|
-
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button::before {
|
|
2911
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
|
|
2721
2912
|
content: "";
|
|
2722
2913
|
position: absolute;
|
|
2723
2914
|
inset: -2px;
|
|
@@ -2741,7 +2932,7 @@ function Xe(t, e) {
|
|
|
2741
2932
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
|
|
2742
2933
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
|
|
2743
2934
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::before,
|
|
2744
|
-
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button::before {
|
|
2935
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
|
|
2745
2936
|
background: var(--pluno-pa-bg);
|
|
2746
2937
|
}
|
|
2747
2938
|
.pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within {
|
|
@@ -2754,14 +2945,14 @@ function Xe(t, e) {
|
|
|
2754
2945
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
|
|
2755
2946
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
|
|
2756
2947
|
.pluno-pa-widget--scribble .pluno-pa-widget__close,
|
|
2757
|
-
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
|
|
2948
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable) {
|
|
2758
2949
|
border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
|
|
2759
2950
|
}
|
|
2760
2951
|
.pluno-pa-widget--scribble .pluno-pa-widget__send::after,
|
|
2761
2952
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
|
|
2762
2953
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
|
|
2763
2954
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::after,
|
|
2764
|
-
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button::after {
|
|
2955
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::after {
|
|
2765
2956
|
content: "";
|
|
2766
2957
|
position: absolute;
|
|
2767
2958
|
inset: -3px;
|
|
@@ -2771,7 +2962,7 @@ function Xe(t, e) {
|
|
|
2771
2962
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
2772
2963
|
pointer-events: none;
|
|
2773
2964
|
opacity: 0.6;
|
|
2774
|
-
transform: rotate(
|
|
2965
|
+
transform: rotate(5deg);
|
|
2775
2966
|
}
|
|
2776
2967
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
|
|
2777
2968
|
transform: rotate(-10deg);
|
|
@@ -2838,7 +3029,7 @@ function Xe(t, e) {
|
|
|
2838
3029
|
right: 12px;
|
|
2839
3030
|
height: 22px;
|
|
2840
3031
|
z-index: 1;
|
|
2841
|
-
background-image: url('${
|
|
3032
|
+
background-image: url('${Oe}');
|
|
2842
3033
|
background-repeat: repeat-x;
|
|
2843
3034
|
background-size: 62px 21.5px;
|
|
2844
3035
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -2852,7 +3043,7 @@ function Xe(t, e) {
|
|
|
2852
3043
|
}
|
|
2853
3044
|
`, t.appendChild(n);
|
|
2854
3045
|
}
|
|
2855
|
-
async function
|
|
3046
|
+
async function Xn() {
|
|
2856
3047
|
return document.body ? document.body : await new Promise((t) => {
|
|
2857
3048
|
const e = new MutationObserver(() => {
|
|
2858
3049
|
document.body && (e.disconnect(), t(document.body));
|
|
@@ -2860,61 +3051,93 @@ async function Un() {
|
|
|
2860
3051
|
e.observe(document.documentElement, { childList: !0 });
|
|
2861
3052
|
});
|
|
2862
3053
|
}
|
|
2863
|
-
function
|
|
3054
|
+
function ht(t) {
|
|
2864
3055
|
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
2865
3056
|
}
|
|
2866
|
-
function
|
|
3057
|
+
function Zn(t) {
|
|
2867
3058
|
try {
|
|
2868
|
-
const e = window.localStorage.getItem(
|
|
3059
|
+
const e = window.localStorage.getItem(ht(t));
|
|
2869
3060
|
if (!e)
|
|
2870
|
-
return
|
|
3061
|
+
return Ze();
|
|
2871
3062
|
const n = JSON.parse(e);
|
|
2872
3063
|
return {
|
|
2873
3064
|
isOpen: n.isOpen === !0,
|
|
2874
3065
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
2875
3066
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
2876
|
-
launcherPosition:
|
|
2877
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
3067
|
+
launcherPosition: to(n.launcherPosition) ? n.launcherPosition : null,
|
|
3068
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-ot) : [],
|
|
3069
|
+
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
2878
3070
|
};
|
|
2879
3071
|
} catch {
|
|
2880
|
-
return
|
|
3072
|
+
return Ze();
|
|
2881
3073
|
}
|
|
2882
3074
|
}
|
|
2883
|
-
function
|
|
3075
|
+
async function Jn(t) {
|
|
3076
|
+
if (t.loadSharePromptsDisabled)
|
|
3077
|
+
return t.loadSharePromptsDisabled();
|
|
2884
3078
|
try {
|
|
2885
|
-
window.localStorage.
|
|
3079
|
+
return window.localStorage.getItem(at) === "true";
|
|
3080
|
+
} catch {
|
|
3081
|
+
return !1;
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
function Qn(t, e) {
|
|
3085
|
+
if (t.persistSharePromptsDisabled) {
|
|
3086
|
+
Promise.resolve(t.persistSharePromptsDisabled(e)).catch(() => {
|
|
3087
|
+
});
|
|
3088
|
+
return;
|
|
3089
|
+
}
|
|
3090
|
+
try {
|
|
3091
|
+
e && window.localStorage.setItem(at, "true");
|
|
2886
3092
|
} catch {
|
|
2887
3093
|
return;
|
|
2888
3094
|
}
|
|
2889
3095
|
}
|
|
2890
|
-
function
|
|
3096
|
+
function Ze() {
|
|
3097
|
+
return {
|
|
3098
|
+
isOpen: !1,
|
|
3099
|
+
composerValue: "",
|
|
3100
|
+
openToolGroupKeys: [],
|
|
3101
|
+
launcherPosition: null,
|
|
3102
|
+
seenShareCandidateIds: [],
|
|
3103
|
+
sharePromptsDisabled: !1
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
function eo(t, e) {
|
|
3107
|
+
try {
|
|
3108
|
+
window.localStorage.setItem(ht(t), JSON.stringify(e));
|
|
3109
|
+
} catch {
|
|
3110
|
+
return;
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
function to(t) {
|
|
2891
3114
|
if (!t || typeof t != "object")
|
|
2892
3115
|
return !1;
|
|
2893
3116
|
const e = t;
|
|
2894
3117
|
return Number.isFinite(e.x) && Number.isFinite(e.y);
|
|
2895
3118
|
}
|
|
2896
|
-
const
|
|
2897
|
-
function
|
|
3119
|
+
const Je = /* @__PURE__ */ new WeakSet();
|
|
3120
|
+
function no(t) {
|
|
2898
3121
|
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
2899
3122
|
}
|
|
2900
|
-
function
|
|
3123
|
+
function Qe(t) {
|
|
2901
3124
|
const e = t.pathname.split("/");
|
|
2902
3125
|
return e[e.length - 1] ?? "";
|
|
2903
3126
|
}
|
|
2904
|
-
function
|
|
3127
|
+
function oo(t, e) {
|
|
2905
3128
|
const n = new URL(t.src, document.baseURI);
|
|
2906
|
-
return n.href === e.href || n.pathname === e.pathname ? !0 :
|
|
3129
|
+
return n.href === e.href || n.pathname === e.pathname ? !0 : Qe(n) === Qe(e);
|
|
2907
3130
|
}
|
|
2908
3131
|
class R extends EventTarget {
|
|
2909
3132
|
constructor(e, n) {
|
|
2910
|
-
super(), this.channelId = n, this.url = e, this.addPreviewListener(
|
|
3133
|
+
super(), this.channelId = n, this.url = e, this.addPreviewListener(Gt, () => {
|
|
2911
3134
|
this.readyState = R.OPEN, this.dispatchEvent(new Event("open"));
|
|
2912
|
-
}), this.addPreviewListener(
|
|
3135
|
+
}), this.addPreviewListener($t, (o) => {
|
|
2913
3136
|
const a = o;
|
|
2914
3137
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
2915
|
-
}), this.addPreviewListener(
|
|
3138
|
+
}), this.addPreviewListener(Ut, () => {
|
|
2916
3139
|
this.readyState = R.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
2917
|
-
}), this.addPreviewListener(
|
|
3140
|
+
}), this.addPreviewListener(Wt, (o) => {
|
|
2918
3141
|
const a = o;
|
|
2919
3142
|
this.readyState = R.CLOSED, this.dispatchEvent(
|
|
2920
3143
|
new CloseEvent("close", {
|
|
@@ -2924,7 +3147,7 @@ class R extends EventTarget {
|
|
|
2924
3147
|
})
|
|
2925
3148
|
), this.cleanup();
|
|
2926
3149
|
}), window.dispatchEvent(
|
|
2927
|
-
new CustomEvent(
|
|
3150
|
+
new CustomEvent(re(Ft, this.channelId), {
|
|
2928
3151
|
detail: { socketId: this.socketId, url: e }
|
|
2929
3152
|
})
|
|
2930
3153
|
);
|
|
@@ -2940,27 +3163,27 @@ class R extends EventTarget {
|
|
|
2940
3163
|
binaryType = "blob";
|
|
2941
3164
|
bufferedAmount = 0;
|
|
2942
3165
|
readyState = R.CONNECTING;
|
|
2943
|
-
socketId =
|
|
3166
|
+
socketId = ao();
|
|
2944
3167
|
listeners = /* @__PURE__ */ new Map();
|
|
2945
3168
|
send(e) {
|
|
2946
3169
|
if (this.readyState !== R.OPEN)
|
|
2947
3170
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
2948
3171
|
window.dispatchEvent(
|
|
2949
|
-
new CustomEvent(
|
|
3172
|
+
new CustomEvent(re(Bt, this.channelId), {
|
|
2950
3173
|
detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
|
|
2951
3174
|
})
|
|
2952
3175
|
);
|
|
2953
3176
|
}
|
|
2954
3177
|
close(e, n) {
|
|
2955
3178
|
this.readyState !== R.CLOSED && (this.readyState = R.CLOSING, window.dispatchEvent(
|
|
2956
|
-
new CustomEvent(
|
|
3179
|
+
new CustomEvent(re(zt, this.channelId), {
|
|
2957
3180
|
detail: { socketId: this.socketId, code: e, reason: n }
|
|
2958
3181
|
})
|
|
2959
3182
|
), this.cleanup());
|
|
2960
3183
|
}
|
|
2961
3184
|
addPreviewListener(e, n) {
|
|
2962
|
-
const o =
|
|
2963
|
-
|
|
3185
|
+
const o = re(e, this.channelId), a = (r) => {
|
|
3186
|
+
r.detail?.socketId === this.socketId && n(r);
|
|
2964
3187
|
};
|
|
2965
3188
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
2966
3189
|
}
|
|
@@ -2970,36 +3193,36 @@ class R extends EventTarget {
|
|
|
2970
3193
|
this.listeners.clear();
|
|
2971
3194
|
}
|
|
2972
3195
|
}
|
|
2973
|
-
function
|
|
2974
|
-
const t = window.sessionStorage.getItem(
|
|
3196
|
+
function ao() {
|
|
3197
|
+
const t = window.sessionStorage.getItem(Re);
|
|
2975
3198
|
if (t)
|
|
2976
3199
|
return t;
|
|
2977
3200
|
const e = crypto.randomUUID();
|
|
2978
|
-
return window.sessionStorage.setItem(
|
|
3201
|
+
return window.sessionStorage.setItem(Re, e), e;
|
|
2979
3202
|
}
|
|
2980
|
-
function
|
|
3203
|
+
function re(t, e) {
|
|
2981
3204
|
return `${t}:${e}`;
|
|
2982
3205
|
}
|
|
2983
|
-
function
|
|
3206
|
+
function ro(t) {
|
|
2984
3207
|
const e = document.currentScript;
|
|
2985
3208
|
if (e instanceof HTMLScriptElement)
|
|
2986
3209
|
return [e];
|
|
2987
3210
|
const n = new URL(t, document.baseURI).href, o = new URL(n);
|
|
2988
3211
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
2989
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3212
|
+
(a) => a instanceof HTMLScriptElement && no(a) && oo(a, o)
|
|
2990
3213
|
);
|
|
2991
3214
|
}
|
|
2992
|
-
function
|
|
2993
|
-
for (const e of
|
|
2994
|
-
if (
|
|
3215
|
+
function io(t) {
|
|
3216
|
+
for (const e of ro(t)) {
|
|
3217
|
+
if (Je.has(e) || e.dataset.plunoAutoMount === "false")
|
|
2995
3218
|
continue;
|
|
2996
|
-
|
|
3219
|
+
Je.add(e);
|
|
2997
3220
|
const n = e.dataset.plunoPreviewChannel;
|
|
2998
|
-
|
|
3221
|
+
rn({
|
|
2999
3222
|
token: e.dataset.plunoToken,
|
|
3000
3223
|
tokenEndpoint: e.dataset.plunoTokenEndpoint,
|
|
3001
3224
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
3002
|
-
webSocketFactory: n ?
|
|
3225
|
+
webSocketFactory: n ? an(n) : void 0,
|
|
3003
3226
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
3004
3227
|
accentColor: e.dataset.plunoAccentColor,
|
|
3005
3228
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3011,8 +3234,8 @@ function Xn(t) {
|
|
|
3011
3234
|
});
|
|
3012
3235
|
}
|
|
3013
3236
|
}
|
|
3014
|
-
|
|
3237
|
+
io(import.meta.url);
|
|
3015
3238
|
export {
|
|
3016
|
-
|
|
3017
|
-
|
|
3239
|
+
an as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3240
|
+
rn as mountPlunoProductAgentWidget
|
|
3018
3241
|
};
|