@pluno/product-agent-web 0.1.84 → 0.1.86
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/README.md +4 -0
- package/dist/product-agent-widget.js +1170 -1126
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as pi, getProductAgentOriginAccessErrorMessage as si } from "./product-agent-sdk.js";
|
|
2
|
+
const di = "#7c3aed", ft = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", wt = "#2c2a1e", An = [253, 250, 241], Nn = 3.5;
|
|
3
|
+
function mo(e) {
|
|
4
|
+
const t = fo(e);
|
|
5
|
+
if (Rn(ot(t), An) >= Nn)
|
|
6
6
|
return t;
|
|
7
|
-
let o =
|
|
8
|
-
const i =
|
|
7
|
+
let o = ot(t);
|
|
8
|
+
const i = ot(wt);
|
|
9
9
|
for (let r = 0; r < 6; r += 1)
|
|
10
|
-
if (o =
|
|
10
|
+
if (o = gi(o, i, 0.22), Rn(o, An) >= Nn)
|
|
11
11
|
return Jt(o);
|
|
12
12
|
return Jt(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ci() {
|
|
15
15
|
let n = "M 280 120", o = !1, i = 0;
|
|
16
16
|
for (let r = 150; r <= 1170; r += 62) {
|
|
17
17
|
const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -19,8 +19,8 @@ function pi() {
|
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function ui(e) {
|
|
23
|
+
const t = fo(e), n = Qt(ot(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -44,23 +44,23 @@ function si(e) {
|
|
|
44
44
|
inner: "#4b4b4b",
|
|
45
45
|
shadow: "#000000"
|
|
46
46
|
} : {
|
|
47
|
-
top:
|
|
48
|
-
middle:
|
|
49
|
-
bottom:
|
|
50
|
-
edgeStart:
|
|
51
|
-
edgeMiddle:
|
|
52
|
-
edgeEnd:
|
|
53
|
-
glow:
|
|
54
|
-
highlight:
|
|
55
|
-
inner:
|
|
56
|
-
shadow:
|
|
47
|
+
top: le(t, 0.28, -0.03),
|
|
48
|
+
middle: le(t, 0.08, 0.04),
|
|
49
|
+
bottom: le(t, -0.1, 0.02),
|
|
50
|
+
edgeStart: le(t, 0.08, 0.08),
|
|
51
|
+
edgeMiddle: le(t, -0.08, 0.08),
|
|
52
|
+
edgeEnd: le(t, -0.18, 0.05),
|
|
53
|
+
glow: le(t, 0.32, -0.12),
|
|
54
|
+
highlight: le(t, 0.38, -0.18),
|
|
55
|
+
inner: le(t, 0.24, -0.1),
|
|
56
|
+
shadow: le(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function fo(e) {
|
|
60
60
|
const t = e.trim();
|
|
61
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
61
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : di;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ot(e) {
|
|
64
64
|
return [
|
|
65
65
|
Number.parseInt(e.slice(1, 3), 16),
|
|
66
66
|
Number.parseInt(e.slice(3, 5), 16),
|
|
@@ -78,11 +78,11 @@ function Qt([e, t, n]) {
|
|
|
78
78
|
};
|
|
79
79
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Rn(e, t) {
|
|
82
82
|
const n = Qt(e), o = Qt(t), [i, r] = n > o ? [n, o] : [o, n];
|
|
83
83
|
return (i + 0.05) / (r + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function gi(e, t, n) {
|
|
86
86
|
const o = en(n);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * o,
|
|
@@ -90,44 +90,44 @@ function di(e, t, n) {
|
|
|
90
90
|
e[2] + (t[2] - e[2]) * o
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const [o, i, r] =
|
|
95
|
-
return Jt(
|
|
93
|
+
function le(e, t, n) {
|
|
94
|
+
const [o, i, r] = hi(ot(e));
|
|
95
|
+
return Jt(mi(o, en(i + n), en(r + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function hi([e, t, n]) {
|
|
98
98
|
const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), s = (l + p) / 2;
|
|
99
99
|
if (l === p)
|
|
100
100
|
return [0, 0, s];
|
|
101
|
-
const
|
|
102
|
-
return [(l === o ? (i - r) /
|
|
101
|
+
const g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
|
|
102
|
+
return [(l === o ? (i - r) / g + (i < r ? 6 : 0) : l === i ? (r - o) / g + 2 : (o - i) / g + 4) / 6, c, s];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function mi(e, t, n) {
|
|
105
105
|
if (t === 0)
|
|
106
106
|
return [n * 255, n * 255, n * 255];
|
|
107
107
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
|
|
108
108
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
Wt(i, o, e + 1 / 3) * 255,
|
|
110
|
+
Wt(i, o, e) * 255,
|
|
111
|
+
Wt(i, o, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Wt(e, t, n) {
|
|
115
115
|
let o = n;
|
|
116
116
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
117
117
|
}
|
|
118
118
|
function en(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const wo = "suggest_share_on_socials";
|
|
122
|
+
function fi(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
124
|
const n = e[t];
|
|
125
|
-
if (n.role !== "tool" || n.toolName !==
|
|
125
|
+
if (n.role !== "tool" || n.toolName !== wo)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = Dn(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = Dn(e, o.index, "user");
|
|
131
131
|
return i ? {
|
|
132
132
|
id: `share:${n.callId ?? n.id}`,
|
|
133
133
|
userPrompt: i.content,
|
|
@@ -136,13 +136,13 @@ function gi(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function wi(e) {
|
|
140
|
+
const t = await bi(e);
|
|
141
141
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
142
142
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
143
143
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Dn(e, t, n) {
|
|
146
146
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
147
147
|
const i = e[o];
|
|
148
148
|
if (i.role === n && i.content.trim())
|
|
@@ -150,74 +150,74 @@ function Rn(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function bi(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
156
|
+
const _i = "https://app.pluno.ai", xi = "/api/product-agent/embed/active-users", yi = 1800, vi = 15e3, Ci = 250, Si = 1e3, Ei = 3e4;
|
|
157
|
+
function ki(e, t = {}) {
|
|
158
158
|
let n = !1, o = null, i = null, r = null;
|
|
159
159
|
const l = () => {
|
|
160
160
|
r !== null && (window.clearInterval(r), r = null);
|
|
161
161
|
}, p = (c) => {
|
|
162
162
|
n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
|
|
163
|
-
|
|
164
|
-
},
|
|
163
|
+
g();
|
|
164
|
+
}, Pi(c)));
|
|
165
165
|
}, s = (c) => {
|
|
166
166
|
if (l(), o === null) {
|
|
167
167
|
o = c, e(c);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
const h = o,
|
|
170
|
+
const h = o, C = performance.now();
|
|
171
171
|
r = window.setInterval(() => {
|
|
172
172
|
if (n) {
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
o = Math.round(h + (c - h) *
|
|
178
|
-
},
|
|
179
|
-
},
|
|
176
|
+
const P = Math.min(1, (performance.now() - C) / yi);
|
|
177
|
+
o = Math.round(h + (c - h) * Ii(P)), e(o), P >= 1 && (o = c, e(c), l());
|
|
178
|
+
}, Ci);
|
|
179
|
+
}, g = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const c = await
|
|
181
|
+
const c = await Li(t);
|
|
182
182
|
if (n)
|
|
183
183
|
return;
|
|
184
184
|
s(c.count), p(c.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(vi);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
return
|
|
189
|
+
return g(), () => {
|
|
190
190
|
n = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function Li(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
196
|
+
const n = await (e.fetcher ?? fetch)(new URL(xi, Ti(e.backendUrl ?? _i)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
200
200
|
if (!n.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const o = await n.json(), i =
|
|
202
|
+
const o = await n.json(), i = zn(o.count), r = zn(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
203
203
|
if (i === null || r === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: i, refreshAfterMs: r };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function zn(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Ti(e) {
|
|
211
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return Math.min(
|
|
213
|
+
function Pi(e) {
|
|
214
|
+
return Math.min(Ei, Math.max(Si, e));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Ii(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
function
|
|
219
|
+
const Ai = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
|
|
220
|
+
function Ni(e) {
|
|
221
221
|
let t = "", n = "", o = null;
|
|
222
222
|
for (const i of e.split(new RegExp("(?<=\\n)"))) {
|
|
223
223
|
if (o) {
|
|
@@ -228,7 +228,7 @@ function Pi(e) {
|
|
|
228
228
|
}
|
|
229
229
|
const r = i.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
|
|
230
230
|
if (r) {
|
|
231
|
-
t +=
|
|
231
|
+
t += Mn(n) + i, n = "", o = {
|
|
232
232
|
marker: r[1][0],
|
|
233
233
|
length: r[1].length
|
|
234
234
|
};
|
|
@@ -236,31 +236,31 @@ function Pi(e) {
|
|
|
236
236
|
}
|
|
237
237
|
n += i;
|
|
238
238
|
}
|
|
239
|
-
return t +
|
|
239
|
+
return t + Mn(n);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Mn(e) {
|
|
242
242
|
let t = "", n = 0;
|
|
243
|
-
for (const o of e.matchAll(
|
|
243
|
+
for (const o of e.matchAll(Ai)) {
|
|
244
244
|
const i = o.index ?? 0;
|
|
245
|
-
t +=
|
|
245
|
+
t += On(
|
|
246
246
|
e.slice(n, i)
|
|
247
247
|
), t += o[0], n = i + o[0].length;
|
|
248
248
|
}
|
|
249
|
-
return t +
|
|
249
|
+
return t + On(e.slice(n));
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function On(e) {
|
|
252
252
|
return e.replace(
|
|
253
253
|
/\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
|
|
254
|
-
(t, n, o, i, r) => r[i - 1] === "!" ||
|
|
254
|
+
(t, n, o, i, r) => r[i - 1] === "!" || Ri(r, i) || Di(r, i, n) ? t : `[${n}](${o})`
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ri(e, t) {
|
|
258
258
|
let n = 0;
|
|
259
259
|
for (let o = t - 1; e[o] === "\\"; o -= 1)
|
|
260
260
|
n += 1;
|
|
261
261
|
return n % 2 === 1;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Di(e, t, n) {
|
|
264
264
|
if (n !== "x" && n !== "X")
|
|
265
265
|
return !1;
|
|
266
266
|
const o = e.lastIndexOf(`
|
|
@@ -269,7 +269,7 @@ function Ai(e, t, n) {
|
|
|
269
269
|
e.slice(o, t)
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const bo = 100, zi = 1e4, Mi = 5e3, Oi = "product-agent:sdk-preview-socket-connect", Ui = "product-agent:sdk-preview-socket-send", Bi = "product-agent:sdk-preview-socket-close", Fi = "product-agent:sdk-preview-socket-open", Wi = "product-agent:sdk-preview-socket-message", Hi = "product-agent:sdk-preview-socket-error", $i = "product-agent:sdk-preview-socket-closed", Un = "product-agent:sdk-preview-socket-id", Gi = "data-pluno-sdk-preview-channel", _o = "data-pluno-auto-mounted", me = "__plunoProductAgentAutoMountOwner", qi = 1e4, ji = "Failed to load Pluno widget token", Bn = "Timed out loading Pluno widget token", Vi = "pluno.productAgent.widgetClientId.", Ht = /* @__PURE__ */ new Set(), Ki = "product-agent:preview-diagnostic", xo = "pluno.productAgent.sharePromptsDisabled", Yi = 3, Fn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Xi = 400, Zi = 5e3, Ji = 500, Wn = "Close the page's popup to chat", Qi = "No recent chats for this page yet.", pe = {
|
|
273
273
|
launcherLabel: "Ask for anything...",
|
|
274
274
|
accentColor: "#7c3aed",
|
|
275
275
|
colorScheme: "light",
|
|
@@ -277,7 +277,7 @@ const fo = 100, Ni = 1e4, Ri = 5e3, Di = "product-agent:sdk-preview-socket-conne
|
|
|
277
277
|
scribbleStyle: !0,
|
|
278
278
|
position: "bottom-right",
|
|
279
279
|
movableLauncher: !0
|
|
280
|
-
},
|
|
280
|
+
}, ea = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Hn = "pluno-pa-scribble-font", yo = 190, vo = 41, $n = 22, ta = 1, na = 48, cn = 420, oa = 520, ia = 0.24, un = 680, aa = 800, ra = 0.76, N = 8, Ne = 50, Co = "http://www.w3.org/2000/svg", tn = 26, nn = 8, la = 36, on = 16, pa = 4, Gn = [
|
|
281
281
|
{
|
|
282
282
|
ellipseCx: "17.5",
|
|
283
283
|
ellipseCy: "24.5",
|
|
@@ -314,22 +314,22 @@ const fo = 100, Ni = 1e4, Ri = 5e3, Di = "product-agent:sdk-preview-socket-conne
|
|
|
314
314
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
315
315
|
pathStrokeWidth: "2.45"
|
|
316
316
|
}
|
|
317
|
-
],
|
|
318
|
-
let
|
|
319
|
-
function
|
|
320
|
-
return (t) => new
|
|
317
|
+
], sa = 11, da = 13, an = 4, So = 10, Eo = 40, ca = "movable-launcher-position-v2", ko = "pluno-pa-widget-styles", Lo = "data-pluno-pa-widget-styles";
|
|
318
|
+
let qn = 0;
|
|
319
|
+
function ua(e) {
|
|
320
|
+
return (t) => new fe(t, e);
|
|
321
321
|
}
|
|
322
|
-
async function
|
|
322
|
+
async function ga(e = {}) {
|
|
323
323
|
const t = {
|
|
324
324
|
layout: e.layout ?? "floating",
|
|
325
325
|
mountTarget: e.mountTarget,
|
|
326
|
-
launcherLabel: e.launcherLabel ??
|
|
327
|
-
accentColor: e.accentColor ??
|
|
328
|
-
colorScheme: e.colorScheme ??
|
|
329
|
-
fontFamily: e.fontFamily ??
|
|
330
|
-
scribbleStyle: e.scribbleStyle ??
|
|
331
|
-
position: e.position ??
|
|
332
|
-
movableLauncher: e.movableLauncher ??
|
|
326
|
+
launcherLabel: e.launcherLabel ?? pe.launcherLabel,
|
|
327
|
+
accentColor: e.accentColor ?? pe.accentColor,
|
|
328
|
+
colorScheme: e.colorScheme ?? pe.colorScheme,
|
|
329
|
+
fontFamily: e.fontFamily ?? pe.fontFamily,
|
|
330
|
+
scribbleStyle: e.scribbleStyle ?? pe.scribbleStyle,
|
|
331
|
+
position: e.position ?? pe.position,
|
|
332
|
+
movableLauncher: e.movableLauncher ?? pe.movableLauncher,
|
|
333
333
|
token: e.token,
|
|
334
334
|
tokenProvider: e.tokenProvider,
|
|
335
335
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -362,13 +362,15 @@ async function ua(e = {}) {
|
|
|
362
362
|
initialDisplayState: e.initialDisplayState,
|
|
363
363
|
onDisplayStateChange: e.onDisplayStateChange,
|
|
364
364
|
onPanelOpenChange: e.onPanelOpenChange,
|
|
365
|
-
|
|
365
|
+
// Customer-embedded floating widgets should offer the same compact launcher state as the
|
|
366
|
+
// extension preview, while programmatic integrations can still opt out explicitly.
|
|
367
|
+
showLauncherMinimizeButton: e.showLauncherMinimizeButton !== !1,
|
|
366
368
|
morningReport: e.morningReport ?? null,
|
|
367
369
|
onMorningReportSnooze: e.onMorningReportSnooze,
|
|
368
370
|
onMorningReportTaskStart: e.onMorningReportTaskStart,
|
|
369
371
|
taskNotifications: e.taskNotifications
|
|
370
372
|
};
|
|
371
|
-
|
|
373
|
+
K(
|
|
372
374
|
"web-sdk.widget",
|
|
373
375
|
"Mounting widget with merged options",
|
|
374
376
|
{
|
|
@@ -385,121 +387,122 @@ async function ua(e = {}) {
|
|
|
385
387
|
);
|
|
386
388
|
const n = document.createElement("div");
|
|
387
389
|
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), n.setAttribute("data-pluno-product-agent-layout", t.layout), t.sdkPreviewChannelId && n.setAttribute(
|
|
388
|
-
|
|
390
|
+
Gi,
|
|
389
391
|
t.sdkPreviewChannelId
|
|
390
392
|
);
|
|
391
393
|
const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
392
394
|
i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.classList.add(`pluno-pa-widget--layout-${t.layout}`), i.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
393
|
-
let r =
|
|
395
|
+
let r = jn(
|
|
394
396
|
t.accentColor,
|
|
395
397
|
t.scribbleStyle
|
|
396
398
|
);
|
|
397
|
-
|
|
399
|
+
Ma(
|
|
398
400
|
i,
|
|
399
401
|
t.launcherLabel,
|
|
400
402
|
r,
|
|
401
403
|
t.movableLauncher,
|
|
402
404
|
t.showLauncherMinimizeButton
|
|
403
405
|
), o.appendChild(i);
|
|
404
|
-
const l = Ar(t);
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
const l = Rr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Ar(t) : "shown";
|
|
407
|
+
co(t, p);
|
|
408
|
+
let s = t.movableLauncher ? l.launcherPosition : null, g = s !== null, c = l.panelSize, h = null;
|
|
409
|
+
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), Ae(
|
|
407
410
|
i,
|
|
408
411
|
Gt(
|
|
409
412
|
i,
|
|
410
|
-
|
|
413
|
+
s,
|
|
411
414
|
t.position
|
|
412
415
|
)
|
|
413
|
-
)),
|
|
416
|
+
)), so(o, t.accentColor), Vn(i, r, {
|
|
414
417
|
accentColor: t.accentColor,
|
|
415
418
|
colorScheme: t.colorScheme,
|
|
416
419
|
fontFamily: t.fontFamily,
|
|
417
420
|
scribbleStyle: t.scribbleStyle
|
|
418
421
|
});
|
|
419
|
-
const
|
|
422
|
+
const C = t.mountTarget ?? await Ir(), P = C.ownerDocument, I = i.querySelector(
|
|
420
423
|
".pluno-pa-widget__launcher"
|
|
421
|
-
),
|
|
424
|
+
), D = i.querySelector(
|
|
422
425
|
".pluno-pa-widget__launcher-drag-handle"
|
|
423
|
-
),
|
|
426
|
+
), u = i.querySelector(
|
|
424
427
|
".pluno-pa-widget__launcher-input"
|
|
425
|
-
),
|
|
428
|
+
), v = i.querySelector(
|
|
426
429
|
".pluno-pa-widget__launcher-minimize"
|
|
427
|
-
),
|
|
430
|
+
), m = i.querySelector(".pluno-pa-widget__panel"), S = i.querySelector(
|
|
428
431
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
429
|
-
),
|
|
432
|
+
), z = Array.from(
|
|
430
433
|
i.querySelectorAll(".pluno-pa-widget__resize-handle")
|
|
431
|
-
),
|
|
434
|
+
), L = i.querySelector(
|
|
432
435
|
".pluno-pa-widget__close"
|
|
433
|
-
),
|
|
436
|
+
), oe = i.querySelector(
|
|
434
437
|
".pluno-pa-widget__composer"
|
|
435
|
-
),
|
|
438
|
+
), J = i.querySelector(
|
|
436
439
|
".pluno-pa-widget__attachment-error"
|
|
437
|
-
),
|
|
440
|
+
), Re = i.querySelector(
|
|
438
441
|
".pluno-pa-widget__billing-status"
|
|
439
|
-
),
|
|
442
|
+
), U = i.querySelector(
|
|
440
443
|
".pluno-pa-widget__attachments"
|
|
441
|
-
),
|
|
444
|
+
), we = i.querySelector(
|
|
442
445
|
".pluno-pa-widget__attachment-input"
|
|
443
|
-
),
|
|
446
|
+
), B = i.querySelector(
|
|
444
447
|
".pluno-pa-widget__attach"
|
|
445
448
|
), f = i.querySelector(
|
|
446
449
|
".pluno-pa-widget__input"
|
|
447
|
-
),
|
|
450
|
+
), Q = i.querySelector(
|
|
448
451
|
".pluno-pa-widget__send"
|
|
449
|
-
),
|
|
452
|
+
), De = i.querySelector(
|
|
450
453
|
".pluno-pa-widget__top-actions"
|
|
451
|
-
),
|
|
454
|
+
), Ce = i.querySelector(
|
|
452
455
|
".pluno-pa-widget__history"
|
|
453
|
-
),
|
|
456
|
+
), Se = i.querySelector(
|
|
454
457
|
".pluno-pa-widget__history-panel"
|
|
455
|
-
),
|
|
458
|
+
), j = i.querySelector(
|
|
456
459
|
".pluno-pa-widget__history-list"
|
|
457
460
|
), it = i.querySelector(
|
|
458
461
|
".pluno-pa-widget__history-close"
|
|
459
|
-
),
|
|
462
|
+
), ie = i.querySelector(
|
|
460
463
|
".pluno-pa-widget__history-status"
|
|
461
|
-
), oe = i.querySelector(
|
|
462
|
-
".pluno-pa-widget__timeline-jump"
|
|
463
464
|
), x = i.querySelector(
|
|
465
|
+
".pluno-pa-widget__timeline-jump"
|
|
466
|
+
), R = i.querySelector(
|
|
464
467
|
".pluno-pa-widget__active-users-counter"
|
|
465
|
-
),
|
|
468
|
+
), T = i.querySelector(
|
|
466
469
|
".pluno-pa-widget__timeline"
|
|
467
|
-
),
|
|
470
|
+
), ae = i.querySelector(
|
|
468
471
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
469
|
-
),
|
|
472
|
+
), H = i.querySelector(
|
|
470
473
|
".pluno-pa-widget__notify-suggestion"
|
|
471
|
-
),
|
|
474
|
+
), y = i.querySelector(
|
|
472
475
|
".pluno-pa-widget__notify-suggestion-enable"
|
|
473
|
-
),
|
|
476
|
+
), A = i.querySelector(
|
|
474
477
|
".pluno-pa-widget__notify-suggestion-later"
|
|
475
|
-
),
|
|
478
|
+
), qo = i.querySelector(
|
|
476
479
|
".pluno-pa-widget__notify-suggestion-never"
|
|
477
480
|
);
|
|
478
|
-
if (!
|
|
481
|
+
if (!I || !u || !m || !L || !oe || !J || !Re || !U || !we || !B || !f || !Q || !De || !Ce || !Se || !j || !it || !ie || !x || !R || !T || !ae)
|
|
479
482
|
throw new Error("Failed to mount Pluno widget");
|
|
480
|
-
if (t.movableLauncher && !
|
|
483
|
+
if (t.movableLauncher && !D)
|
|
481
484
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
482
|
-
|
|
483
|
-
let q = [],
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
B.hidden = !t.attachmentsEnabled, we.disabled = !t.attachmentsEnabled, eo(u), eo(f);
|
|
486
|
+
let q = [], ue = null;
|
|
487
|
+
const ze = () => {
|
|
488
|
+
tr(
|
|
489
|
+
U,
|
|
487
490
|
q,
|
|
488
491
|
(a) => {
|
|
489
492
|
q = q.filter(
|
|
490
493
|
(d, _) => _ !== a
|
|
491
|
-
),
|
|
494
|
+
), ze(), W(b.getState()), $();
|
|
492
495
|
}
|
|
493
496
|
);
|
|
494
|
-
},
|
|
495
|
-
if (!t.loginRequired && !t.signupRequired && !t.token && !
|
|
497
|
+
}, fn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => $o(t.tokenEndpoint) : void 0);
|
|
498
|
+
if (!t.loginRequired && !t.signupRequired && !t.token && !fn && !t.webSocketFactory)
|
|
496
499
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
497
|
-
const
|
|
500
|
+
const jo = window.fetch.bind(window), vt = Nr(t.clientId);
|
|
498
501
|
let b;
|
|
499
502
|
try {
|
|
500
503
|
const a = {
|
|
501
504
|
token: t.token,
|
|
502
|
-
tokenProvider:
|
|
505
|
+
tokenProvider: fn,
|
|
503
506
|
backendUrl: t.backendUrl,
|
|
504
507
|
metadata: () => ({
|
|
505
508
|
...t.metadata ?? {},
|
|
@@ -517,11 +520,11 @@ async function ua(e = {}) {
|
|
|
517
520
|
autoConnect: !1,
|
|
518
521
|
disableNetworkCapture: !!t.sdkPreviewChannelId
|
|
519
522
|
};
|
|
520
|
-
b = await
|
|
523
|
+
b = await pi.init(a);
|
|
521
524
|
} catch (a) {
|
|
522
525
|
throw vt.release(), n.remove(), a;
|
|
523
526
|
}
|
|
524
|
-
|
|
527
|
+
C.appendChild(n), K(
|
|
525
528
|
"web-sdk.widget",
|
|
526
529
|
"Applied initial widget appearance",
|
|
527
530
|
{
|
|
@@ -531,120 +534,120 @@ async function ua(e = {}) {
|
|
|
531
534
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
532
535
|
}
|
|
533
536
|
);
|
|
534
|
-
const Ct = new Set(l.openToolGroupKeys),
|
|
537
|
+
const Ct = new Set(l.openToolGroupKeys), Me = new Set(
|
|
535
538
|
l.seenShareCandidateIds
|
|
536
|
-
), at = new Set(
|
|
537
|
-
let St = l.sharePromptsDisabled || await
|
|
539
|
+
), at = new Set(Me);
|
|
540
|
+
let St = l.sharePromptsDisabled || await Dr(t), ee = null, re = !1, rt = !(t.loginRequired || t.signupRequired), be = !1, Ee = {
|
|
538
541
|
enabled: !0
|
|
539
|
-
},
|
|
542
|
+
}, ke = 0, wn = "", _e = !1, ge = !1, xe = [], Et = null, $e = null;
|
|
540
543
|
const te = (a, d) => {
|
|
541
|
-
|
|
544
|
+
Ee = { enabled: a, reason: d };
|
|
542
545
|
}, ne = () => {
|
|
543
|
-
|
|
544
|
-
},
|
|
545
|
-
|
|
546
|
-
},
|
|
547
|
-
te(!0, a), ne(),
|
|
548
|
-
},
|
|
549
|
-
if (
|
|
546
|
+
x.hidden = !0;
|
|
547
|
+
}, Vo = () => {
|
|
548
|
+
x.hidden = !1;
|
|
549
|
+
}, Ko = (a = "jump") => {
|
|
550
|
+
te(!0, a), ne(), nt(T, () => Ee.enabled), ke = T.scrollTop;
|
|
551
|
+
}, Le = () => {
|
|
552
|
+
if (Ce.hidden = t.layout === "page" || t.loginRequired, Se.hidden = !_e, Ce.setAttribute("aria-expanded", String(_e)), j.classList.toggle(
|
|
550
553
|
"pluno-pa-widget__history-list--center",
|
|
551
|
-
|
|
552
|
-
),
|
|
554
|
+
ge && xe.length === 0
|
|
555
|
+
), j.replaceChildren(), ge && xe.length === 0) {
|
|
553
556
|
const a = document.createElement("p");
|
|
554
|
-
a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...",
|
|
557
|
+
a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", j.appendChild(a);
|
|
555
558
|
}
|
|
556
|
-
for (const a of
|
|
559
|
+
for (const a of xe) {
|
|
557
560
|
const d = document.createElement("button");
|
|
558
|
-
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled =
|
|
561
|
+
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ge;
|
|
559
562
|
const _ = document.createElement("span");
|
|
560
|
-
_.className = "pluno-pa-widget__history-item-title", _.textContent =
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
+
_.className = "pluno-pa-widget__history-item-title", _.textContent = Ra(a);
|
|
564
|
+
const k = document.createElement("time");
|
|
565
|
+
k.className = "pluno-pa-widget__history-time", k.dateTime = a.lastActiveAt, k.textContent = za(
|
|
563
566
|
a.lastActiveAt,
|
|
564
567
|
Date.now()
|
|
565
568
|
);
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}),
|
|
569
|
+
const M = document.createElement("small");
|
|
570
|
+
M.className = "pluno-pa-widget__history-path", M.textContent = Da(a), d.append(_, k, M), d.addEventListener("click", () => {
|
|
571
|
+
_e = !1, $e = null, Le(), te(!0, "newSession"), ne(), b.loadSession(a.id), W(b.getState());
|
|
572
|
+
}), j.appendChild(d);
|
|
570
573
|
}
|
|
571
|
-
if (
|
|
574
|
+
if (ge && xe.length > 0) {
|
|
572
575
|
const a = document.createElement("p");
|
|
573
|
-
a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...",
|
|
576
|
+
a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", j.appendChild(a);
|
|
574
577
|
}
|
|
575
|
-
|
|
576
|
-
},
|
|
577
|
-
if (!
|
|
578
|
-
|
|
578
|
+
ie.textContent = $e ?? (!ge && xe.length === 0 ? "No recent chats for this page yet." : ""), ie.hidden = ie.textContent.length === 0;
|
|
579
|
+
}, bn = async (a) => {
|
|
580
|
+
if (!ge) {
|
|
581
|
+
ge = !0, $e = null, Le();
|
|
579
582
|
try {
|
|
580
583
|
const d = await b.listSessions({ cursor: a, limit: 20 });
|
|
581
|
-
|
|
584
|
+
xe = a ? [...xe, ...d.sessions] : d.sessions, Et = d.nextCursor;
|
|
582
585
|
} catch (d) {
|
|
583
|
-
|
|
586
|
+
K(
|
|
584
587
|
"web-sdk.widget",
|
|
585
588
|
"Failed to load session history",
|
|
586
589
|
{
|
|
587
590
|
message: d instanceof Error ? d.message : String(d)
|
|
588
591
|
}
|
|
589
|
-
),
|
|
592
|
+
), $e = Qi;
|
|
590
593
|
} finally {
|
|
591
|
-
|
|
594
|
+
ge = !1, Le();
|
|
592
595
|
}
|
|
593
596
|
}
|
|
594
|
-
},
|
|
595
|
-
!Et ||
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
},
|
|
599
|
-
|
|
597
|
+
}, Yo = () => {
|
|
598
|
+
!Et || ge || j.scrollHeight - j.scrollTop - j.clientHeight <= 24 && bn(Et);
|
|
599
|
+
}, _n = () => {
|
|
600
|
+
re || typeof document > "u" || (so(o, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
|
|
601
|
+
}, xn = new MutationObserver(_n);
|
|
602
|
+
xn.observe(P.documentElement, {
|
|
600
603
|
childList: !0,
|
|
601
604
|
subtree: !0
|
|
602
|
-
}),
|
|
603
|
-
const
|
|
605
|
+
}), _n();
|
|
606
|
+
const Ge = (a = !0) => {
|
|
604
607
|
const d = bt(i, a);
|
|
605
608
|
return rn(
|
|
606
609
|
i,
|
|
607
|
-
|
|
610
|
+
s ? To(s, d) : ya(
|
|
608
611
|
i,
|
|
609
612
|
t.position,
|
|
610
613
|
d
|
|
611
614
|
),
|
|
612
615
|
d
|
|
613
616
|
);
|
|
614
|
-
},
|
|
615
|
-
const a =
|
|
616
|
-
|
|
617
|
+
}, F = () => {
|
|
618
|
+
const a = Ta(o, u, f);
|
|
619
|
+
Mr(t, {
|
|
617
620
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
618
621
|
composerValue: f.value,
|
|
619
622
|
focusedInput: a,
|
|
620
623
|
focusedInputAt: a ? Date.now() : null,
|
|
621
624
|
openToolGroupKeys: [...Ct],
|
|
622
|
-
launcherPosition:
|
|
623
|
-
panelSize:
|
|
624
|
-
seenShareCandidateIds: [...
|
|
625
|
-
-
|
|
625
|
+
launcherPosition: g ? s : null,
|
|
626
|
+
panelSize: c,
|
|
627
|
+
seenShareCandidateIds: [...Me].slice(
|
|
628
|
+
-bo
|
|
626
629
|
),
|
|
627
630
|
sharePromptsDisabled: St
|
|
628
631
|
});
|
|
629
632
|
}, lt = (a) => {
|
|
630
633
|
t.onDisplayStateChange?.(a);
|
|
631
|
-
},
|
|
632
|
-
if (a === "shown") {
|
|
633
|
-
i.classList.remove("pluno-pa-widget--minimized"),
|
|
634
|
+
}, qe = (a, d = !0) => {
|
|
635
|
+
if (co(t, a), a === "shown") {
|
|
636
|
+
i.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && je(!1), d && lt("shown");
|
|
634
637
|
return;
|
|
635
638
|
}
|
|
636
|
-
ee !== null && (window.clearTimeout(ee), ee = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"),
|
|
639
|
+
ee !== null && (window.clearTimeout(ee), ee = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), I.hidden = !1, m.hidden = !0, L.hidden = !0, I.tabIndex = 0, f.value = "", Ae(
|
|
637
640
|
i,
|
|
638
641
|
Gt(
|
|
639
642
|
i,
|
|
640
|
-
|
|
643
|
+
s,
|
|
641
644
|
t.position
|
|
642
645
|
)
|
|
643
|
-
),
|
|
644
|
-
},
|
|
645
|
-
|
|
646
|
-
debugVersion:
|
|
647
|
-
launcherPosition:
|
|
646
|
+
), Zn(i), F(), d && lt("minimized");
|
|
647
|
+
}, Te = (a, d = {}) => {
|
|
648
|
+
La(a, {
|
|
649
|
+
debugVersion: ca,
|
|
650
|
+
launcherPosition: s,
|
|
648
651
|
rootClasses: i.className,
|
|
649
652
|
rootStyle: {
|
|
650
653
|
left: i.style.left,
|
|
@@ -653,145 +656,145 @@ async function ua(e = {}) {
|
|
|
653
656
|
bottom: i.style.bottom
|
|
654
657
|
},
|
|
655
658
|
rootRect: jt(i),
|
|
656
|
-
launcherRect: jt(
|
|
657
|
-
panelRect: jt(
|
|
658
|
-
viewport:
|
|
659
|
-
panelHidden:
|
|
660
|
-
closeHidden:
|
|
659
|
+
launcherRect: jt(I),
|
|
660
|
+
panelRect: jt(m),
|
|
661
|
+
viewport: Z(),
|
|
662
|
+
panelHidden: m.hidden,
|
|
663
|
+
closeHidden: L.hidden,
|
|
661
664
|
...d
|
|
662
665
|
});
|
|
663
|
-
},
|
|
664
|
-
if (!
|
|
665
|
-
return
|
|
666
|
-
const d =
|
|
667
|
-
return
|
|
666
|
+
}, je = (a = !0) => {
|
|
667
|
+
if (!s)
|
|
668
|
+
return Ae(i, null), Ge(a);
|
|
669
|
+
const d = Ge(a);
|
|
670
|
+
return Ae(i, d), Te("Applied stored closed launcher position", {
|
|
668
671
|
visibleLauncherPosition: d
|
|
669
672
|
}), d;
|
|
670
673
|
}, kt = (a, d) => {
|
|
671
674
|
if (!a || !d) {
|
|
672
|
-
|
|
675
|
+
Zn(i);
|
|
673
676
|
return;
|
|
674
677
|
}
|
|
675
|
-
|
|
678
|
+
ka(i, {
|
|
676
679
|
x: a.x - d.x,
|
|
677
680
|
y: a.y - d.y
|
|
678
681
|
});
|
|
679
682
|
}, Lt = () => {
|
|
680
|
-
const a =
|
|
681
|
-
return t.layout === "page" &&
|
|
682
|
-
},
|
|
683
|
+
const a = tt(c).width;
|
|
684
|
+
return t.layout === "page" && m.getBoundingClientRect().width || a;
|
|
685
|
+
}, yn = () => {
|
|
683
686
|
if (i.classList.contains("pluno-pa-widget--minimized")) {
|
|
684
|
-
|
|
687
|
+
Ae(
|
|
685
688
|
i,
|
|
686
689
|
Gt(
|
|
687
690
|
i,
|
|
688
|
-
|
|
691
|
+
s,
|
|
689
692
|
t.position
|
|
690
693
|
)
|
|
691
694
|
);
|
|
692
695
|
return;
|
|
693
696
|
}
|
|
694
|
-
const a =
|
|
697
|
+
const a = je();
|
|
695
698
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
696
|
-
$t(i,
|
|
697
|
-
const d =
|
|
699
|
+
$t(i, c);
|
|
700
|
+
const d = tt(c);
|
|
698
701
|
Kt(
|
|
699
|
-
|
|
702
|
+
S,
|
|
700
703
|
Lt()
|
|
701
704
|
);
|
|
702
705
|
const _ = mt(
|
|
703
|
-
|
|
706
|
+
h ?? qt(
|
|
704
707
|
i,
|
|
705
708
|
a,
|
|
706
709
|
t.position,
|
|
707
|
-
|
|
710
|
+
c
|
|
708
711
|
),
|
|
709
712
|
d
|
|
710
713
|
);
|
|
711
|
-
|
|
714
|
+
h && (h = _), kt(_, a), Te(
|
|
712
715
|
"Applied open panel position after viewport resize",
|
|
713
716
|
{ openPanelPosition: _ }
|
|
714
717
|
);
|
|
715
|
-
} else
|
|
718
|
+
} else s && Te(
|
|
716
719
|
"Applied visible launcher position after viewport resize",
|
|
717
720
|
{ visibleLauncherPosition: a }
|
|
718
721
|
);
|
|
719
722
|
};
|
|
720
|
-
let
|
|
723
|
+
let vn = () => {
|
|
721
724
|
};
|
|
722
|
-
window.addEventListener("resize",
|
|
725
|
+
window.addEventListener("resize", yn), t.movableLauncher && D ? (je(), vn = ba({
|
|
723
726
|
root: i,
|
|
724
|
-
launcher:
|
|
725
|
-
launcherDragHandle:
|
|
726
|
-
getPosition: () =>
|
|
727
|
+
launcher: I,
|
|
728
|
+
launcherDragHandle: D,
|
|
729
|
+
getPosition: () => Ge(),
|
|
727
730
|
setPosition: (a) => {
|
|
728
|
-
const d = a, _ = bt(i),
|
|
731
|
+
const d = a, _ = bt(i), k = rn(
|
|
729
732
|
i,
|
|
730
733
|
a,
|
|
731
734
|
_
|
|
732
735
|
);
|
|
733
|
-
|
|
734
|
-
|
|
736
|
+
s = Ca(
|
|
737
|
+
k,
|
|
735
738
|
_
|
|
736
|
-
),
|
|
739
|
+
), Ae(i, k), Te("Dragging closed launcher", {
|
|
737
740
|
requestedPosition: d
|
|
738
741
|
});
|
|
739
742
|
},
|
|
740
743
|
persist: () => {
|
|
741
|
-
|
|
744
|
+
g = !0, F(), Te("Persisted closed launcher drag position");
|
|
742
745
|
}
|
|
743
|
-
})) :
|
|
744
|
-
const
|
|
745
|
-
const a =
|
|
746
|
+
})) : Ae(i, null), $t(i, c);
|
|
747
|
+
const Xo = () => {
|
|
748
|
+
const a = tt(c), d = Ge();
|
|
746
749
|
return {
|
|
747
750
|
position: mt(
|
|
748
|
-
|
|
751
|
+
h ?? qt(
|
|
749
752
|
i,
|
|
750
753
|
d,
|
|
751
754
|
t.position,
|
|
752
|
-
|
|
755
|
+
c
|
|
753
756
|
),
|
|
754
757
|
a
|
|
755
758
|
),
|
|
756
759
|
size: a
|
|
757
760
|
};
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
|
|
761
|
+
}, Zo = (a) => {
|
|
762
|
+
c = xt(a.size), $t(i, c), Kt(
|
|
763
|
+
S,
|
|
761
764
|
Lt()
|
|
762
|
-
),
|
|
765
|
+
), h = mt(
|
|
763
766
|
a.position,
|
|
764
|
-
|
|
767
|
+
tt(c)
|
|
765
768
|
);
|
|
766
|
-
const d =
|
|
767
|
-
kt(
|
|
768
|
-
},
|
|
769
|
+
const d = Ge();
|
|
770
|
+
kt(h, d);
|
|
771
|
+
}, Jo = z.length > 0 ? _a({
|
|
769
772
|
root: i,
|
|
770
|
-
handles:
|
|
771
|
-
getBounds:
|
|
772
|
-
setBounds:
|
|
773
|
-
persist:
|
|
773
|
+
handles: z,
|
|
774
|
+
getBounds: Xo,
|
|
775
|
+
setBounds: Zo,
|
|
776
|
+
persist: F
|
|
774
777
|
}) : () => {
|
|
775
778
|
};
|
|
776
779
|
let Tt = !1;
|
|
777
|
-
const
|
|
780
|
+
const Cn = async () => {
|
|
778
781
|
if (!(!t.billingStatusLoader || Tt)) {
|
|
779
782
|
Tt = !0;
|
|
780
783
|
try {
|
|
781
784
|
const a = await t.billingStatusLoader();
|
|
782
|
-
if (
|
|
785
|
+
if (re)
|
|
783
786
|
return;
|
|
784
|
-
|
|
787
|
+
no(
|
|
785
788
|
t.billingStatus,
|
|
786
789
|
a,
|
|
787
790
|
b.getState().lastErrorCode
|
|
788
791
|
) && (t.billingStatus = a, Xt(
|
|
789
|
-
|
|
792
|
+
Re,
|
|
790
793
|
t.billingStatus,
|
|
791
794
|
b.getState().lastErrorCode
|
|
792
|
-
),
|
|
795
|
+
), $());
|
|
793
796
|
} catch (a) {
|
|
794
|
-
|
|
797
|
+
K(
|
|
795
798
|
"web-sdk.widget",
|
|
796
799
|
"Failed to refresh billing status",
|
|
797
800
|
{ message: a instanceof Error ? a.message : String(a) }
|
|
@@ -800,63 +803,63 @@ async function ua(e = {}) {
|
|
|
800
803
|
Tt = !1;
|
|
801
804
|
}
|
|
802
805
|
}
|
|
803
|
-
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
+
}, he = (a = "", d = !0) => {
|
|
807
|
+
Cn(), Ye && (Ye = !1, At()), i.classList.contains("pluno-pa-widget--open") || (h = null), ee !== null && (window.clearTimeout(ee), ee = null), qe("shown", !1), m.hidden = !1, L.hidden = !1, Kt(
|
|
808
|
+
S,
|
|
806
809
|
Lt()
|
|
807
810
|
), i.classList.remove("pluno-pa-widget--closing");
|
|
808
|
-
const _ =
|
|
811
|
+
const _ = je(), k = qt(
|
|
809
812
|
i,
|
|
810
813
|
_,
|
|
811
814
|
t.position,
|
|
812
|
-
|
|
815
|
+
c
|
|
813
816
|
);
|
|
814
|
-
if (kt(
|
|
815
|
-
openPanelPosition:
|
|
817
|
+
if (kt(k, _), Te("Opening launcher at clamped open panel position", {
|
|
818
|
+
openPanelPosition: k,
|
|
816
819
|
visibleLauncherPosition: _
|
|
817
820
|
}), te(!0, "open"), ne(), !d) {
|
|
818
|
-
i.classList.add("pluno-pa-widget--open"),
|
|
821
|
+
i.classList.add("pluno-pa-widget--open"), I.hidden = !0, a && (f.value = a, et(f)), nt(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), lt("shown"), t.onPanelOpenChange?.(!0);
|
|
819
822
|
return;
|
|
820
823
|
}
|
|
821
824
|
window.requestAnimationFrame(() => {
|
|
822
|
-
i.classList.add("pluno-pa-widget--open"), a && (f.value = a,
|
|
823
|
-
|
|
825
|
+
i.classList.add("pluno-pa-widget--open"), a && (f.value = a, et(f)), nt(T, () => Ee.enabled), ke = T.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), F(), lt("shown"), t.onPanelOpenChange?.(!0), ee = window.setTimeout(() => {
|
|
826
|
+
I.hidden = !0, nt(T, () => Ee.enabled), ke = T.scrollTop;
|
|
824
827
|
}, 220);
|
|
825
828
|
});
|
|
826
829
|
}, Pt = () => {
|
|
827
|
-
ee !== null && (window.clearTimeout(ee), ee = null),
|
|
828
|
-
|
|
830
|
+
ee !== null && (window.clearTimeout(ee), ee = null), I.hidden = !1, s && (je(!1), Te("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), ee = window.setTimeout(() => {
|
|
831
|
+
m.hidden = !0, L.hidden = !0, h = null, i.classList.remove("pluno-pa-widget--closing");
|
|
829
832
|
}, 220);
|
|
830
833
|
};
|
|
831
|
-
|
|
832
|
-
a.preventDefault(),
|
|
833
|
-
}),
|
|
834
|
+
I.addEventListener("submit", (a) => {
|
|
835
|
+
a.preventDefault(), he(u.value), u.value = "";
|
|
836
|
+
}), D?.addEventListener("click", (a) => {
|
|
834
837
|
a.preventDefault(), a.stopPropagation();
|
|
835
|
-
}),
|
|
836
|
-
a.target ===
|
|
837
|
-
}),
|
|
838
|
-
|
|
839
|
-
}),
|
|
840
|
-
if (!
|
|
838
|
+
}), I.addEventListener("click", (a) => {
|
|
839
|
+
a.target === u && !D || (he(u.value), u.value = "");
|
|
840
|
+
}), u.addEventListener("focus", () => {
|
|
841
|
+
he(u.value), u.value = "";
|
|
842
|
+
}), u.addEventListener("input", () => {
|
|
843
|
+
if (!u.value)
|
|
841
844
|
return;
|
|
842
|
-
const a =
|
|
843
|
-
|
|
845
|
+
const a = u.value;
|
|
846
|
+
he(a), u.value = "";
|
|
844
847
|
});
|
|
845
|
-
let It = null, pt = null,
|
|
846
|
-
const
|
|
848
|
+
let It = null, pt = null, Pe = null;
|
|
849
|
+
const Sn = (a) => a === u || a === f, Qo = (a) => {
|
|
847
850
|
if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
|
|
848
851
|
return null;
|
|
849
852
|
let d = a;
|
|
850
853
|
for (; d; ) {
|
|
851
|
-
const _ = d.closest(
|
|
854
|
+
const _ = d.closest(Fn);
|
|
852
855
|
if (_)
|
|
853
856
|
return _;
|
|
854
|
-
const
|
|
855
|
-
d =
|
|
857
|
+
const k = d.getRootNode();
|
|
858
|
+
d = k instanceof ShadowRoot ? k.host : null;
|
|
856
859
|
}
|
|
857
860
|
return null;
|
|
858
|
-
},
|
|
859
|
-
if (!a.isConnected || !a.matches(
|
|
861
|
+
}, ei = (a) => {
|
|
862
|
+
if (!a.isConnected || !a.matches(Fn))
|
|
860
863
|
return !1;
|
|
861
864
|
if (!(a instanceof HTMLElement))
|
|
862
865
|
return !0;
|
|
@@ -866,73 +869,73 @@ async function ua(e = {}) {
|
|
|
866
869
|
return a.checkVisibility();
|
|
867
870
|
const d = window.getComputedStyle(a);
|
|
868
871
|
return d.display !== "none" && d.visibility !== "hidden";
|
|
869
|
-
},
|
|
870
|
-
|
|
871
|
-
const d =
|
|
872
|
-
(!d || !
|
|
873
|
-
},
|
|
874
|
-
},
|
|
875
|
-
|
|
872
|
+
}, En = (a) => {
|
|
873
|
+
Ke !== a && (Ke = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ie(), a !== null ? Pe = window.setInterval(() => {
|
|
874
|
+
const d = Ke;
|
|
875
|
+
(!d || !ei(d)) && En(null);
|
|
876
|
+
}, Ji) : Pe !== null && (window.clearInterval(Pe), Pe = null, pt = null));
|
|
877
|
+
}, ti = () => {
|
|
878
|
+
Pe !== null && (window.clearInterval(Pe), Pe = null);
|
|
876
879
|
};
|
|
877
880
|
i.addEventListener("focusin", (a) => {
|
|
878
|
-
|
|
881
|
+
Sn(a.target) && (It = Date.now(), F());
|
|
879
882
|
}), i.addEventListener("focusout", (a) => {
|
|
880
|
-
if (!
|
|
883
|
+
if (!Sn(a.target) || Ke !== null)
|
|
881
884
|
return;
|
|
882
885
|
const d = It;
|
|
883
|
-
if (It = null, d === null || Date.now() - d >
|
|
886
|
+
if (It = null, d === null || Date.now() - d > Xi)
|
|
884
887
|
return;
|
|
885
|
-
const _ =
|
|
888
|
+
const _ = Qo(a.relatedTarget);
|
|
886
889
|
if (!_)
|
|
887
890
|
return;
|
|
888
|
-
const
|
|
889
|
-
if (pt !== null &&
|
|
890
|
-
|
|
891
|
+
const k = Date.now();
|
|
892
|
+
if (pt !== null && k - pt <= Zi) {
|
|
893
|
+
En(_);
|
|
891
894
|
return;
|
|
892
895
|
}
|
|
893
|
-
pt =
|
|
894
|
-
}),
|
|
895
|
-
!i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(),
|
|
896
|
-
}),
|
|
896
|
+
pt = k;
|
|
897
|
+
}), I.addEventListener("keydown", (a) => {
|
|
898
|
+
!i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), he());
|
|
899
|
+
}), v?.addEventListener("pointerdown", (a) => {
|
|
897
900
|
a.stopPropagation();
|
|
898
|
-
}),
|
|
899
|
-
a.preventDefault(), a.stopPropagation(),
|
|
900
|
-
}),
|
|
901
|
-
|
|
902
|
-
}),
|
|
903
|
-
|
|
901
|
+
}), v?.addEventListener("click", (a) => {
|
|
902
|
+
a.preventDefault(), a.stopPropagation(), qe("minimized");
|
|
903
|
+
}), L.addEventListener("click", Pt), T.addEventListener("scroll", () => {
|
|
904
|
+
T.scrollTop < ke - 1 && te(!1, "userScroll"), ke = T.scrollTop;
|
|
905
|
+
}), x.addEventListener("click", () => {
|
|
906
|
+
Ko();
|
|
904
907
|
});
|
|
905
|
-
const
|
|
908
|
+
const kn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
906
909
|
([a]) => {
|
|
907
910
|
a?.isIntersecting && (te(!0, "bottom"), ne());
|
|
908
911
|
},
|
|
909
|
-
{ root:
|
|
912
|
+
{ root: T, threshold: 0 }
|
|
910
913
|
);
|
|
911
|
-
|
|
912
|
-
const
|
|
913
|
-
let
|
|
914
|
-
const
|
|
915
|
-
const a =
|
|
916
|
-
|
|
917
|
-
},
|
|
918
|
-
|
|
914
|
+
kn?.observe(ae);
|
|
915
|
+
const Ve = () => t.loginRequired || t.signupRequired;
|
|
916
|
+
let Ke = null, Ye = !1;
|
|
917
|
+
const V = () => rt || b.getState().status !== "connected", Ie = () => {
|
|
918
|
+
const a = Ve(), d = Ke !== null, _ = !a && V();
|
|
919
|
+
u.readOnly = a || d || _, f.readOnly = d || _, u.placeholder = d ? Wn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ye ? "New update" : t.launcherLabel, f.placeholder = d ? Wn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : pe.launcherLabel, oe.hidden = a;
|
|
920
|
+
}, $ = () => {
|
|
921
|
+
Q.disabled = V() || de(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && q.length === 0, B.disabled = Ve() || V() || de(t.billingStatus);
|
|
919
922
|
};
|
|
920
|
-
|
|
923
|
+
Ie();
|
|
921
924
|
const At = () => {
|
|
922
925
|
const a = b.getState().isThinking;
|
|
923
926
|
i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
|
|
924
927
|
"pluno-pa-widget--unread",
|
|
925
|
-
!a &&
|
|
926
|
-
),
|
|
928
|
+
!a && Ye
|
|
929
|
+
), Ie();
|
|
927
930
|
};
|
|
928
931
|
At();
|
|
929
932
|
const Nt = () => {
|
|
930
|
-
|
|
933
|
+
Ve() || re || (rt = !0, Ie(), $(), b.connect().then(
|
|
931
934
|
() => {
|
|
932
|
-
|
|
935
|
+
re || (rt = !1, Ie(), $());
|
|
933
936
|
},
|
|
934
937
|
(a) => {
|
|
935
|
-
|
|
938
|
+
re || (rt = !1, Ie(), $(), K(
|
|
936
939
|
"web-sdk.widget",
|
|
937
940
|
"Failed to connect Product Agent widget",
|
|
938
941
|
{
|
|
@@ -942,7 +945,7 @@ async function ua(e = {}) {
|
|
|
942
945
|
}
|
|
943
946
|
));
|
|
944
947
|
};
|
|
945
|
-
|
|
948
|
+
oe.addEventListener("submit", (a) => {
|
|
946
949
|
if (a.preventDefault(), t.loginRequired) {
|
|
947
950
|
t.onLoginClick?.();
|
|
948
951
|
return;
|
|
@@ -951,65 +954,65 @@ async function ua(e = {}) {
|
|
|
951
954
|
t.onSignupClick?.();
|
|
952
955
|
return;
|
|
953
956
|
}
|
|
954
|
-
|
|
957
|
+
V() || de(t.billingStatus) || (be = !0, te(!0, "send"), ne(), q = Vt(
|
|
955
958
|
b,
|
|
956
959
|
f,
|
|
957
960
|
q
|
|
958
|
-
),
|
|
961
|
+
), ze(), $());
|
|
959
962
|
});
|
|
960
|
-
let
|
|
961
|
-
const
|
|
962
|
-
|
|
963
|
+
let Xe = 0;
|
|
964
|
+
const ni = () => {
|
|
965
|
+
Xe = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
963
966
|
}, Rt = (a) => {
|
|
964
|
-
|
|
965
|
-
|
|
967
|
+
ue !== null && window.clearTimeout(ue), J.textContent = a, J.hidden = !1, ue = window.setTimeout(() => {
|
|
968
|
+
J.textContent = "", J.hidden = !0, ue = null;
|
|
966
969
|
}, 3e3);
|
|
967
|
-
},
|
|
968
|
-
|
|
970
|
+
}, oi = () => {
|
|
971
|
+
ue !== null && (window.clearTimeout(ue), ue = null), J.textContent = "", J.hidden = !0;
|
|
969
972
|
}, Dt = async (a) => {
|
|
970
973
|
if (!t.attachmentsEnabled || a.length === 0)
|
|
971
974
|
return;
|
|
972
|
-
const d =
|
|
973
|
-
q = [...q, ...d],
|
|
975
|
+
const d = ir(b, a);
|
|
976
|
+
q = [...q, ...d], ze(), oi(), $(), W(b.getState()), i.classList.contains("pluno-pa-widget--open") || he();
|
|
974
977
|
};
|
|
975
|
-
|
|
976
|
-
t.loginRequired ||
|
|
977
|
-
}),
|
|
978
|
-
const a = Array.from(
|
|
979
|
-
|
|
978
|
+
B.addEventListener("click", () => {
|
|
979
|
+
t.loginRequired || V() || de(t.billingStatus) || we.click();
|
|
980
|
+
}), we.addEventListener("change", () => {
|
|
981
|
+
const a = Array.from(we.files ?? []);
|
|
982
|
+
we.value = "", Dt(a).catch((d) => {
|
|
980
983
|
Rt(
|
|
981
984
|
d instanceof Error ? d.message : "Failed to attach file"
|
|
982
|
-
),
|
|
985
|
+
), K("web-sdk.widget", "Attachment failed", {
|
|
983
986
|
message: d instanceof Error ? d.message : String(d)
|
|
984
987
|
});
|
|
985
988
|
});
|
|
986
989
|
}), i.addEventListener("dragenter", (a) => {
|
|
987
|
-
!t.attachmentsEnabled || !ut(a.dataTransfer) || t.loginRequired ||
|
|
990
|
+
!t.attachmentsEnabled || !ut(a.dataTransfer) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), Xe += 1, i.classList.add("pluno-pa-widget--drag-over"));
|
|
988
991
|
}), i.addEventListener("dragover", (a) => {
|
|
989
992
|
const d = a.dataTransfer;
|
|
990
|
-
!t.attachmentsEnabled || !ut(d) || t.loginRequired ||
|
|
993
|
+
!t.attachmentsEnabled || !ut(d) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
|
|
991
994
|
}), i.addEventListener("dragleave", (a) => {
|
|
992
|
-
ut(a.dataTransfer) && (a.stopPropagation(),
|
|
995
|
+
ut(a.dataTransfer) && (a.stopPropagation(), Xe = Math.max(0, Xe - 1), Xe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
993
996
|
}), i.addEventListener("drop", (a) => {
|
|
994
997
|
const d = a.dataTransfer;
|
|
995
|
-
!t.attachmentsEnabled || !ut(d) || t.loginRequired ||
|
|
998
|
+
!t.attachmentsEnabled || !ut(d) || t.loginRequired || V() || (a.preventDefault(), a.stopPropagation(), ni(), Dt(d.files).catch((_) => {
|
|
996
999
|
Rt(
|
|
997
1000
|
_ instanceof Error ? _.message : "Failed to attach file"
|
|
998
|
-
),
|
|
1001
|
+
), K("web-sdk.widget", "Attachment failed", {
|
|
999
1002
|
message: _ instanceof Error ? _.message : String(_)
|
|
1000
1003
|
});
|
|
1001
1004
|
}));
|
|
1002
1005
|
}), i.addEventListener("paste", (a) => {
|
|
1003
1006
|
a.stopPropagation();
|
|
1004
1007
|
const d = a.clipboardData, _ = Array.from(d?.files ?? []);
|
|
1005
|
-
!t.attachmentsEnabled || _.length === 0 || t.loginRequired ||
|
|
1008
|
+
!t.attachmentsEnabled || _.length === 0 || t.loginRequired || V() || (a.preventDefault(), Dt(_).catch((k) => {
|
|
1006
1009
|
Rt(
|
|
1007
|
-
|
|
1008
|
-
),
|
|
1009
|
-
message:
|
|
1010
|
+
k instanceof Error ? k.message : "Failed to attach file"
|
|
1011
|
+
), K("web-sdk.widget", "Attachment failed", {
|
|
1012
|
+
message: k instanceof Error ? k.message : String(k)
|
|
1010
1013
|
});
|
|
1011
1014
|
}));
|
|
1012
|
-
}),
|
|
1015
|
+
}), Q.addEventListener("click", () => {
|
|
1013
1016
|
if (t.loginRequired) {
|
|
1014
1017
|
t.onLoginClick?.();
|
|
1015
1018
|
return;
|
|
@@ -1018,89 +1021,89 @@ async function ua(e = {}) {
|
|
|
1018
1021
|
b.stop();
|
|
1019
1022
|
return;
|
|
1020
1023
|
}
|
|
1021
|
-
|
|
1024
|
+
V() || (be = !0, te(!0, "send"), ne(), q = Vt(
|
|
1022
1025
|
b,
|
|
1023
1026
|
f,
|
|
1024
1027
|
q
|
|
1025
|
-
),
|
|
1026
|
-
}),
|
|
1027
|
-
|
|
1028
|
+
), ze(), $(), W(b.getState()));
|
|
1029
|
+
}), Ce.addEventListener("click", () => {
|
|
1030
|
+
_e = !_e, $e = null, Le(), _e && xe.length === 0 && bn(null);
|
|
1028
1031
|
}), it.addEventListener("click", () => {
|
|
1029
|
-
|
|
1030
|
-
}),
|
|
1031
|
-
|
|
1032
|
+
_e = !1, Le();
|
|
1033
|
+
}), j.addEventListener("scroll", Yo), f.addEventListener("input", () => {
|
|
1034
|
+
et(f), F(), $(), ri();
|
|
1032
1035
|
}), f.addEventListener("keydown", (a) => {
|
|
1033
1036
|
if (!(a.key !== "Enter" || a.shiftKey)) {
|
|
1034
1037
|
if (a.preventDefault(), t.loginRequired) {
|
|
1035
1038
|
t.onLoginClick?.();
|
|
1036
1039
|
return;
|
|
1037
1040
|
}
|
|
1038
|
-
|
|
1041
|
+
V() || (be = !0, te(!0, "send"), ne(), q = Vt(
|
|
1039
1042
|
b,
|
|
1040
1043
|
f,
|
|
1041
1044
|
q
|
|
1042
|
-
),
|
|
1045
|
+
), ze(), $(), W(b.getState()));
|
|
1043
1046
|
}
|
|
1044
1047
|
}), i.addEventListener("click", (a) => {
|
|
1045
|
-
(a.target instanceof Element ? a.target : null)?.closest("a[href]") &&
|
|
1046
|
-
}), l.composerValue && (f.value = l.composerValue,
|
|
1048
|
+
(a.target instanceof Element ? a.target : null)?.closest("a[href]") && F();
|
|
1049
|
+
}), l.composerValue && (f.value = l.composerValue, et(f)), t.layout === "page" ? he(f.value, !1) : p === "minimized" ? qe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(f.value, !1), Pa(l, i, u, f);
|
|
1047
1050
|
const st = () => r;
|
|
1048
|
-
let zt = b.getState().appearance !== null, dt = null,
|
|
1049
|
-
const
|
|
1050
|
-
let
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1051
|
+
let zt = b.getState().appearance !== null, dt = null, Ze = null, Oe = null, Ln = b.getState().isThinking, Ue = null;
|
|
1052
|
+
const Je = t.taskNotifications;
|
|
1053
|
+
let Be = null, Fe = !1;
|
|
1054
|
+
const Tn = () => {
|
|
1055
|
+
Be !== null && (window.clearTimeout(Be), Be = null);
|
|
1053
1056
|
}, ct = () => {
|
|
1054
|
-
|
|
1055
|
-
},
|
|
1056
|
-
if (!
|
|
1057
|
+
H && (H.hidden = !0);
|
|
1058
|
+
}, Pn = () => b.getState().assistantDraft.trim().length > 0, ii = async () => {
|
|
1059
|
+
if (!Je || !H || Fe || re || !b.getState().isThinking || Pn())
|
|
1057
1060
|
return;
|
|
1058
1061
|
let a;
|
|
1059
1062
|
try {
|
|
1060
|
-
a = await
|
|
1063
|
+
a = await Je.getState();
|
|
1061
1064
|
} catch {
|
|
1062
1065
|
return;
|
|
1063
1066
|
}
|
|
1064
|
-
a.enabled || a.neverSuggest || !b.getState().isThinking ||
|
|
1067
|
+
a.enabled || a.neverSuggest || !b.getState().isThinking || Pn() || Fe || re || (H.hidden = !1);
|
|
1065
1068
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1069
|
+
y?.addEventListener("click", () => {
|
|
1070
|
+
Fe = !0, ct(), Je?.enable().catch(() => {
|
|
1068
1071
|
});
|
|
1069
|
-
}),
|
|
1070
|
-
|
|
1071
|
-
}),
|
|
1072
|
-
|
|
1072
|
+
}), A?.addEventListener("click", () => {
|
|
1073
|
+
Fe = !0, ct();
|
|
1074
|
+
}), qo?.addEventListener("click", () => {
|
|
1075
|
+
Fe = !0, ct(), Je?.dismissForever().catch(() => {
|
|
1073
1076
|
});
|
|
1074
1077
|
});
|
|
1075
|
-
let
|
|
1078
|
+
let We = null, In = () => {
|
|
1076
1079
|
};
|
|
1077
|
-
const
|
|
1078
|
-
const a =
|
|
1079
|
-
|
|
1080
|
+
const ai = !!t.socialPostDraftHandler, Mt = /* @__PURE__ */ new Map(), Ot = () => f.value.trim().length > 0 || q.length > 0, ri = () => {
|
|
1081
|
+
const a = We !== null && Zt(b.getState(), Ot());
|
|
1082
|
+
R.hidden = !a, a && We !== null && Io(R, We);
|
|
1080
1083
|
};
|
|
1081
|
-
let
|
|
1084
|
+
let He = null;
|
|
1082
1085
|
const Ut = (a = {}) => {
|
|
1083
|
-
|
|
1086
|
+
be = !0, te(!0, "newSession"), ne(), _e = !1, Le(), b.startNewSession(a), Ct.clear(), f.value = "", q = [], ze(), et(f), F(), $(), f.focus(), W(b.getState());
|
|
1084
1087
|
}, Bt = (a) => {
|
|
1085
1088
|
if (!a || t.layout === "page") {
|
|
1086
|
-
|
|
1089
|
+
He?.remove(), He = null;
|
|
1087
1090
|
return;
|
|
1088
1091
|
}
|
|
1089
|
-
|
|
1092
|
+
He || (He = yt(
|
|
1090
1093
|
"pluno-pa-widget__new-chat",
|
|
1091
1094
|
"New chat",
|
|
1092
|
-
|
|
1095
|
+
Va(),
|
|
1093
1096
|
!1
|
|
1094
|
-
),
|
|
1095
|
-
},
|
|
1096
|
-
if (
|
|
1097
|
-
|
|
1097
|
+
), He.addEventListener("click", () => Ut()), De.insertBefore(He, Ce));
|
|
1098
|
+
}, W = (a) => {
|
|
1099
|
+
if (Le(), hn(a.lastErrorCode) ? Ue = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null), Xt(
|
|
1100
|
+
Re,
|
|
1098
1101
|
t.billingStatus,
|
|
1099
|
-
|
|
1102
|
+
Ue
|
|
1100
1103
|
), t.loginRequired) {
|
|
1101
|
-
Mt.clear(),
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
+
Mt.clear(), ro(
|
|
1105
|
+
T,
|
|
1106
|
+
Q,
|
|
1104
1107
|
Bt,
|
|
1105
1108
|
st,
|
|
1106
1109
|
"Log in to use Pluno on this page.",
|
|
@@ -1111,9 +1114,9 @@ async function ua(e = {}) {
|
|
|
1111
1114
|
return;
|
|
1112
1115
|
}
|
|
1113
1116
|
if (t.signupRequired) {
|
|
1114
|
-
Mt.clear(),
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
+
Mt.clear(), ro(
|
|
1118
|
+
T,
|
|
1119
|
+
Q,
|
|
1117
1120
|
Bt,
|
|
1118
1121
|
st,
|
|
1119
1122
|
"Complete signup to unlock your free trial credits.",
|
|
@@ -1123,78 +1126,78 @@ async function ua(e = {}) {
|
|
|
1123
1126
|
);
|
|
1124
1127
|
return;
|
|
1125
1128
|
}
|
|
1126
|
-
const d =
|
|
1127
|
-
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1129
|
+
const d = Aa(a), _ = d !== wn;
|
|
1130
|
+
wn = d;
|
|
1131
|
+
const k = be || Ee.enabled;
|
|
1132
|
+
be = !1, cr(
|
|
1133
|
+
T,
|
|
1134
|
+
ae,
|
|
1135
|
+
Q,
|
|
1133
1136
|
Bt,
|
|
1134
|
-
|
|
1137
|
+
R,
|
|
1135
1138
|
a,
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
() =>
|
|
1139
|
+
We,
|
|
1140
|
+
We !== null && Zt(a, Ot()),
|
|
1141
|
+
k,
|
|
1142
|
+
() => Ee.enabled,
|
|
1140
1143
|
Ct,
|
|
1141
1144
|
Mt,
|
|
1142
|
-
|
|
1145
|
+
F,
|
|
1143
1146
|
st,
|
|
1144
|
-
(
|
|
1145
|
-
if (
|
|
1147
|
+
(M) => {
|
|
1148
|
+
if (V())
|
|
1146
1149
|
return;
|
|
1147
|
-
const
|
|
1148
|
-
t.morningReport = null,
|
|
1150
|
+
const Qe = t.morningReport !== null;
|
|
1151
|
+
t.morningReport = null, Qe && (t.onMorningReportTaskStart?.(), Ut()), be = !0, te(!0, "send"), ne(), b.sendMessage(M);
|
|
1149
1152
|
},
|
|
1150
1153
|
() => {
|
|
1151
|
-
|
|
1154
|
+
be = !0, te(!0, "send"), ne(), b.retryLastMessage();
|
|
1152
1155
|
},
|
|
1153
1156
|
t.morningReport,
|
|
1154
1157
|
() => {
|
|
1155
|
-
t.morningReport = null, t.onMorningReportSnooze?.(), Pt(),
|
|
1158
|
+
t.morningReport = null, t.onMorningReportSnooze?.(), Pt(), W(b.getState());
|
|
1156
1159
|
},
|
|
1157
1160
|
Nt,
|
|
1158
|
-
|
|
1161
|
+
ai && !St ? {
|
|
1159
1162
|
dismissedCandidateIds: at,
|
|
1160
1163
|
draftingCandidateId: dt,
|
|
1161
|
-
error:
|
|
1164
|
+
error: Ze,
|
|
1162
1165
|
characterIconOptions: st(),
|
|
1163
|
-
onSeen: (
|
|
1164
|
-
|
|
1166
|
+
onSeen: (M) => {
|
|
1167
|
+
Me.add(M.id), F();
|
|
1165
1168
|
},
|
|
1166
|
-
onDraft: (
|
|
1167
|
-
|
|
1169
|
+
onDraft: (M) => {
|
|
1170
|
+
li(M);
|
|
1168
1171
|
},
|
|
1169
|
-
onDismiss: (
|
|
1170
|
-
|
|
1172
|
+
onDismiss: (M) => {
|
|
1173
|
+
Me.add(M.id), at.add(M.id), F(), Ze = null, W(b.getState());
|
|
1171
1174
|
},
|
|
1172
|
-
onDisable: (
|
|
1173
|
-
St = !0,
|
|
1175
|
+
onDisable: (M) => {
|
|
1176
|
+
St = !0, Me.add(M.id), at.add(M.id), F(), zr(t, !0), Ze = null, W(b.getState());
|
|
1174
1177
|
}
|
|
1175
1178
|
} : void 0
|
|
1176
|
-
),
|
|
1179
|
+
), k ? (ke = T.scrollTop, ne()) : _ && Na(a) && Vo();
|
|
1177
1180
|
};
|
|
1178
|
-
return
|
|
1181
|
+
return In = ki(
|
|
1179
1182
|
(a) => {
|
|
1180
|
-
|
|
1183
|
+
We = a, !re && Zt(b.getState(), Ot()) && W(b.getState());
|
|
1181
1184
|
},
|
|
1182
1185
|
{
|
|
1183
1186
|
backendUrl: t.backendUrl,
|
|
1184
|
-
fetcher:
|
|
1187
|
+
fetcher: jo,
|
|
1185
1188
|
loader: t.activeUsersLoader
|
|
1186
1189
|
}
|
|
1187
1190
|
), b.on("state", (a) => {
|
|
1188
|
-
const d =
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
},
|
|
1191
|
+
const d = Ln && !a.isThinking;
|
|
1192
|
+
Ln = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Je && !Fe && Be === null && H?.hidden !== !1 && (Be = window.setTimeout(() => {
|
|
1193
|
+
Be = null, ii();
|
|
1194
|
+
}, zi)), (!a.isThinking || a.assistantDraft.trim()) && (Tn(), ct()), d && !i.classList.contains("pluno-pa-widget--open") && (Ye = !0), At(), a.appearance ? (zt = !0, K(
|
|
1192
1195
|
"web-sdk.widget",
|
|
1193
1196
|
"Agent state supplied appearance",
|
|
1194
1197
|
{
|
|
1195
1198
|
appearance: a.appearance
|
|
1196
1199
|
}
|
|
1197
|
-
), Ft(a.appearance, "agent.state.appearance")) : zt && (zt = !1,
|
|
1200
|
+
), Ft(a.appearance, "agent.state.appearance")) : zt && (zt = !1, K(
|
|
1198
1201
|
"web-sdk.widget",
|
|
1199
1202
|
"Agent state cleared appearance; reverting to configured widget options",
|
|
1200
1203
|
{
|
|
@@ -1202,8 +1205,8 @@ async function ua(e = {}) {
|
|
|
1202
1205
|
fallbackColorScheme: t.colorScheme,
|
|
1203
1206
|
fallbackFontFamily: t.fontFamily
|
|
1204
1207
|
}
|
|
1205
|
-
), Ft({}, "agent.state.appearance-cleared")),
|
|
1206
|
-
}),
|
|
1208
|
+
), Ft({}, "agent.state.appearance-cleared")), W(a), $(), d && Cn();
|
|
1209
|
+
}), W(b.getState()), $(), Nt(), {
|
|
1207
1210
|
agent: b,
|
|
1208
1211
|
startNewChat: Ut,
|
|
1209
1212
|
host: n,
|
|
@@ -1212,89 +1215,89 @@ async function ua(e = {}) {
|
|
|
1212
1215
|
},
|
|
1213
1216
|
updateBillingStatus: (a) => {
|
|
1214
1217
|
const d = a ?? null;
|
|
1215
|
-
|
|
1218
|
+
no(
|
|
1216
1219
|
t.billingStatus,
|
|
1217
1220
|
d,
|
|
1218
|
-
|
|
1219
|
-
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !
|
|
1221
|
+
Ue
|
|
1222
|
+
) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !de(t.billingStatus) && (Ue = null), Xt(
|
|
1220
1223
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
1221
1224
|
t.billingStatus,
|
|
1222
|
-
|
|
1223
|
-
),
|
|
1225
|
+
Ue
|
|
1226
|
+
), $());
|
|
1224
1227
|
},
|
|
1225
1228
|
updateAuthGate: (a) => {
|
|
1226
|
-
const d =
|
|
1227
|
-
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl),
|
|
1229
|
+
const d = Ve();
|
|
1230
|
+
t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ie(), W(b.getState()), $(), d && !Ve() && Nt();
|
|
1228
1231
|
},
|
|
1229
1232
|
openPanel: () => {
|
|
1230
|
-
|
|
1233
|
+
he(f.value, !1);
|
|
1231
1234
|
},
|
|
1232
1235
|
closePanel: Pt,
|
|
1233
1236
|
updateDisplayState: (a) => {
|
|
1234
1237
|
if (a === "shown") {
|
|
1235
|
-
|
|
1238
|
+
qe("shown", !1);
|
|
1236
1239
|
return;
|
|
1237
1240
|
}
|
|
1238
|
-
|
|
1241
|
+
qe("minimized", !1);
|
|
1239
1242
|
},
|
|
1240
1243
|
updateMorningReport: (a) => {
|
|
1241
|
-
t.morningReport = a ?? null,
|
|
1244
|
+
t.morningReport = a ?? null, W(b.getState());
|
|
1242
1245
|
},
|
|
1243
1246
|
destroy: () => {
|
|
1244
|
-
|
|
1247
|
+
re || (F(), re = !0, xn.disconnect(), kn?.disconnect(), ti(), window.removeEventListener("resize", yn), vn(), Jo(), ue !== null && window.clearTimeout(ue), Tn(), In(), Oe?.remove(), b.destroy(), vt.release(), n.remove());
|
|
1245
1248
|
}
|
|
1246
1249
|
};
|
|
1247
|
-
async function
|
|
1250
|
+
async function li(a) {
|
|
1248
1251
|
if (!dt) {
|
|
1249
|
-
dt = a.id,
|
|
1252
|
+
dt = a.id, Ze = null, W(b.getState());
|
|
1250
1253
|
try {
|
|
1251
1254
|
if (!t.socialPostDraftHandler)
|
|
1252
1255
|
throw new Error("Social post drafting is not available here.");
|
|
1253
1256
|
const d = await t.socialPostDraftHandler(a);
|
|
1254
1257
|
if (!d.linkedinPost || !d.xPost)
|
|
1255
1258
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1256
|
-
|
|
1259
|
+
Me.add(a.id), at.add(a.id), F(), Oe?.remove(), Oe = _r(d, {
|
|
1257
1260
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1258
1261
|
onClose: () => {
|
|
1259
|
-
|
|
1262
|
+
Oe?.remove(), Oe = null;
|
|
1260
1263
|
}
|
|
1261
|
-
}), i.appendChild(
|
|
1264
|
+
}), i.appendChild(Oe);
|
|
1262
1265
|
} catch (d) {
|
|
1263
|
-
|
|
1266
|
+
Ze = d instanceof Error ? d.message : "Could not draft social post.";
|
|
1264
1267
|
} finally {
|
|
1265
|
-
dt = null,
|
|
1268
|
+
dt = null, W(b.getState());
|
|
1266
1269
|
}
|
|
1267
1270
|
}
|
|
1268
1271
|
}
|
|
1269
1272
|
function Ft(a, d) {
|
|
1270
|
-
const _ = a.accentColor ?? t.accentColor,
|
|
1271
|
-
r =
|
|
1273
|
+
const _ = a.accentColor ?? t.accentColor, k = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, Qe = a.scribbleStyle ?? t.scribbleStyle;
|
|
1274
|
+
r = jn(
|
|
1272
1275
|
_,
|
|
1273
|
-
|
|
1274
|
-
),
|
|
1276
|
+
Qe
|
|
1277
|
+
), Vn(i, r, {
|
|
1275
1278
|
accentColor: _,
|
|
1276
|
-
colorScheme:
|
|
1277
|
-
fontFamily:
|
|
1278
|
-
scribbleStyle:
|
|
1279
|
-
}),
|
|
1279
|
+
colorScheme: k,
|
|
1280
|
+
fontFamily: M,
|
|
1281
|
+
scribbleStyle: Qe
|
|
1282
|
+
}), K("web-sdk.widget", "Updated widget appearance", {
|
|
1280
1283
|
source: d,
|
|
1281
1284
|
inputAppearance: a,
|
|
1282
1285
|
appliedAccentColor: _,
|
|
1283
|
-
appliedColorScheme:
|
|
1284
|
-
appliedFontFamily:
|
|
1285
|
-
appliedScribbleStyle:
|
|
1286
|
+
appliedColorScheme: k,
|
|
1287
|
+
appliedFontFamily: M,
|
|
1288
|
+
appliedScribbleStyle: Qe,
|
|
1286
1289
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
1287
1290
|
});
|
|
1288
1291
|
}
|
|
1289
1292
|
}
|
|
1290
|
-
function
|
|
1293
|
+
function jn(e, t) {
|
|
1291
1294
|
return { accentColor: e, scribbleStyle: t };
|
|
1292
1295
|
}
|
|
1293
|
-
function ga(e) {
|
|
1294
|
-
const t = ha(e);
|
|
1295
|
-
return t === null ? "#fafafa" : ma(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1296
|
-
}
|
|
1297
1296
|
function ha(e) {
|
|
1297
|
+
const t = ma(e);
|
|
1298
|
+
return t === null ? "#fafafa" : fa(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1299
|
+
}
|
|
1300
|
+
function ma(e) {
|
|
1298
1301
|
const t = e.trim();
|
|
1299
1302
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1300
1303
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1306,14 +1309,14 @@ function ha(e) {
|
|
|
1306
1309
|
Number.parseInt(t[3] + t[3], 16)
|
|
1307
1310
|
] : null;
|
|
1308
1311
|
}
|
|
1309
|
-
function
|
|
1312
|
+
function fa([e, t, n]) {
|
|
1310
1313
|
const o = (i) => {
|
|
1311
1314
|
const r = i / 255;
|
|
1312
1315
|
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
1313
1316
|
};
|
|
1314
1317
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
1315
1318
|
}
|
|
1316
|
-
function
|
|
1319
|
+
function Vn(e, t, n) {
|
|
1317
1320
|
e.classList.toggle(
|
|
1318
1321
|
"pluno-pa-widget--dark",
|
|
1319
1322
|
n.colorScheme === "dark"
|
|
@@ -1321,23 +1324,23 @@ function jn(e, t, n) {
|
|
|
1321
1324
|
"pluno-pa-widget--light",
|
|
1322
1325
|
n.colorScheme !== "dark"
|
|
1323
1326
|
), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
1324
|
-
const o = n.scribbleStyle ?
|
|
1327
|
+
const o = n.scribbleStyle ? mo(n.accentColor) : n.accentColor;
|
|
1325
1328
|
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
|
|
1326
1329
|
"--pluno-pa-accent-contrast",
|
|
1327
|
-
|
|
1328
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ?
|
|
1330
|
+
ha(o)
|
|
1331
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ea : n.fontFamily, n.scribbleStyle && wa(e.ownerDocument);
|
|
1329
1332
|
const i = Array.from(
|
|
1330
1333
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1331
1334
|
);
|
|
1332
1335
|
for (const r of i)
|
|
1333
1336
|
r.replaceWith(
|
|
1334
|
-
|
|
1337
|
+
ve(
|
|
1335
1338
|
Array.from(r.classList).join(" "),
|
|
1336
1339
|
t
|
|
1337
1340
|
)
|
|
1338
1341
|
);
|
|
1339
1342
|
}
|
|
1340
|
-
function
|
|
1343
|
+
function wa(e) {
|
|
1341
1344
|
if (e.getElementById(Hn))
|
|
1342
1345
|
return;
|
|
1343
1346
|
const t = e.createElement("style");
|
|
@@ -1349,7 +1352,7 @@ function fa(e) {
|
|
|
1349
1352
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1350
1353
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1351
1354
|
}
|
|
1352
|
-
function
|
|
1355
|
+
function ba({
|
|
1353
1356
|
root: e,
|
|
1354
1357
|
launcher: t,
|
|
1355
1358
|
launcherDragHandle: n,
|
|
@@ -1357,104 +1360,104 @@ function wa({
|
|
|
1357
1360
|
setPosition: i,
|
|
1358
1361
|
persist: r
|
|
1359
1362
|
}) {
|
|
1360
|
-
let l = null, p = null, s = null,
|
|
1363
|
+
let l = null, p = null, s = null, g = !1, c = null;
|
|
1361
1364
|
const h = () => {
|
|
1362
|
-
l = null, p = null, s = null,
|
|
1363
|
-
},
|
|
1364
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), l = m.pointerId, p = { x: m.clientX, y: m.clientY }, s = o(),
|
|
1365
|
-
},
|
|
1365
|
+
l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1366
|
+
}, C = (m) => {
|
|
1367
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), l = m.pointerId, p = { x: m.clientX, y: m.clientY }, s = o(), g = !1, t.setPointerCapture?.(m.pointerId));
|
|
1368
|
+
}, P = (m) => {
|
|
1366
1369
|
if (l !== m.pointerId || !p || !s)
|
|
1367
1370
|
return;
|
|
1368
1371
|
m.preventDefault();
|
|
1369
|
-
const
|
|
1370
|
-
!
|
|
1371
|
-
},
|
|
1372
|
-
l === m.pointerId && (m.preventDefault(), m.stopPropagation(),
|
|
1373
|
-
},
|
|
1372
|
+
const S = m.clientX - p.x, z = m.clientY - p.y;
|
|
1373
|
+
!g && Math.hypot(S, z) < an || (g = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: s.x + S, y: s.y + z }));
|
|
1374
|
+
}, I = (m) => {
|
|
1375
|
+
l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
|
|
1376
|
+
}, D = (m) => {
|
|
1374
1377
|
l === m.pointerId && (m.preventDefault(), h());
|
|
1375
|
-
},
|
|
1378
|
+
}, u = (m) => {
|
|
1376
1379
|
if (!c)
|
|
1377
1380
|
return;
|
|
1378
|
-
const
|
|
1381
|
+
const S = Math.hypot(
|
|
1379
1382
|
m.clientX - c.x,
|
|
1380
1383
|
m.clientY - c.y
|
|
1381
1384
|
) <= an;
|
|
1382
|
-
c = null,
|
|
1383
|
-
},
|
|
1385
|
+
c = null, S && (m.preventDefault(), m.stopPropagation());
|
|
1386
|
+
}, v = (m) => {
|
|
1384
1387
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1385
1388
|
return;
|
|
1386
|
-
const
|
|
1387
|
-
let
|
|
1388
|
-
m.key === "ArrowUp" ?
|
|
1389
|
+
const S = m.shiftKey ? Eo : So, z = o();
|
|
1390
|
+
let L = null;
|
|
1391
|
+
m.key === "ArrowUp" ? L = { x: z.x, y: z.y - S } : m.key === "ArrowDown" ? L = { x: z.x, y: z.y + S } : m.key === "ArrowLeft" ? L = { x: z.x - S, y: z.y } : m.key === "ArrowRight" && (L = { x: z.x + S, y: z.y }), L && (m.preventDefault(), m.stopPropagation(), i(L), r());
|
|
1389
1392
|
};
|
|
1390
|
-
return t.addEventListener("pointerdown",
|
|
1391
|
-
t.removeEventListener("pointerdown",
|
|
1393
|
+
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", P), t.addEventListener("pointerup", I), t.addEventListener("pointercancel", D), t.addEventListener("click", u, !0), n.addEventListener("keydown", v), () => {
|
|
1394
|
+
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", I), t.removeEventListener("pointercancel", D), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", v);
|
|
1392
1395
|
};
|
|
1393
1396
|
}
|
|
1394
|
-
function
|
|
1397
|
+
function _a({
|
|
1395
1398
|
root: e,
|
|
1396
1399
|
handles: t,
|
|
1397
1400
|
getBounds: n,
|
|
1398
1401
|
setBounds: o,
|
|
1399
1402
|
persist: i
|
|
1400
1403
|
}) {
|
|
1401
|
-
let r = null, l = null, p = null, s = null,
|
|
1404
|
+
let r = null, l = null, p = null, s = null, g = !1;
|
|
1402
1405
|
const c = () => {
|
|
1403
|
-
r = null, l = null, p = null, s = null,
|
|
1404
|
-
}, h = (
|
|
1405
|
-
const
|
|
1406
|
-
!e.classList.contains("pluno-pa-widget--open") || !
|
|
1407
|
-
},
|
|
1408
|
-
if (r !==
|
|
1406
|
+
r = null, l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
|
|
1407
|
+
}, h = (u) => {
|
|
1408
|
+
const v = u.currentTarget, m = v.dataset.resizeDirection;
|
|
1409
|
+
!e.classList.contains("pluno-pa-widget--open") || !Kn(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, p = { x: u.clientX, y: u.clientY }, s = n(), g = !1, v.setPointerCapture?.(u.pointerId));
|
|
1410
|
+
}, C = (u) => {
|
|
1411
|
+
if (r !== u.pointerId || !l || !p || !s)
|
|
1409
1412
|
return;
|
|
1410
|
-
|
|
1411
|
-
const
|
|
1412
|
-
!
|
|
1413
|
-
|
|
1413
|
+
u.preventDefault(), u.stopPropagation();
|
|
1414
|
+
const v = u.clientX - p.x, m = u.clientY - p.y;
|
|
1415
|
+
!g && Math.hypot(v, m) < an || (g = !0, e.classList.add("pluno-pa-widget--resizing"), o(
|
|
1416
|
+
Yn(s, l, v, m)
|
|
1414
1417
|
));
|
|
1415
|
-
},
|
|
1416
|
-
r ===
|
|
1417
|
-
},
|
|
1418
|
-
r ===
|
|
1419
|
-
},
|
|
1420
|
-
const m =
|
|
1421
|
-
let
|
|
1422
|
-
|
|
1418
|
+
}, P = (u) => {
|
|
1419
|
+
r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && i(), c());
|
|
1420
|
+
}, I = (u) => {
|
|
1421
|
+
r === u.pointerId && (u.preventDefault(), c());
|
|
1422
|
+
}, D = (u) => {
|
|
1423
|
+
const m = u.currentTarget.dataset.resizeDirection, S = u.shiftKey ? Eo : So, z = n();
|
|
1424
|
+
let L = 0, oe = 0;
|
|
1425
|
+
Kn(m) && (u.key === "ArrowLeft" ? L = -S : u.key === "ArrowRight" ? L = S : u.key === "ArrowUp" ? oe = -S : u.key === "ArrowDown" && (oe = S), !(L === 0 && oe === 0) && (u.preventDefault(), u.stopPropagation(), o(Yn(z, m, L, oe)), i()));
|
|
1423
1426
|
};
|
|
1424
|
-
for (const
|
|
1425
|
-
|
|
1427
|
+
for (const u of t)
|
|
1428
|
+
u.addEventListener("pointerdown", h), u.addEventListener("pointermove", C), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", I), u.addEventListener("keydown", D);
|
|
1426
1429
|
return () => {
|
|
1427
|
-
for (const
|
|
1428
|
-
|
|
1430
|
+
for (const u of t)
|
|
1431
|
+
u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", C), u.removeEventListener("pointerup", P), u.removeEventListener("pointercancel", I), u.removeEventListener("keydown", D);
|
|
1429
1432
|
};
|
|
1430
1433
|
}
|
|
1431
|
-
function
|
|
1434
|
+
function Kn(e) {
|
|
1432
1435
|
return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
|
|
1433
1436
|
}
|
|
1434
|
-
function
|
|
1435
|
-
const i =
|
|
1437
|
+
function Yn(e, t, n, o) {
|
|
1438
|
+
const i = Z(), r = Xn({
|
|
1436
1439
|
leading: e.position.x,
|
|
1437
1440
|
length: e.size.width,
|
|
1438
1441
|
delta: n,
|
|
1439
1442
|
resizeLeading: t.endsWith("left") || t === "left",
|
|
1440
1443
|
resizeTrailing: t.endsWith("right") || t === "right",
|
|
1441
|
-
minLeading:
|
|
1442
|
-
maxTrailing: i.width -
|
|
1444
|
+
minLeading: N,
|
|
1445
|
+
maxTrailing: i.width - N,
|
|
1443
1446
|
minLength: Math.min(
|
|
1444
1447
|
cn,
|
|
1445
|
-
i.width -
|
|
1448
|
+
i.width - N * 2
|
|
1446
1449
|
)
|
|
1447
|
-
}), l =
|
|
1450
|
+
}), l = Xn({
|
|
1448
1451
|
leading: e.position.y,
|
|
1449
1452
|
length: e.size.height,
|
|
1450
1453
|
delta: o,
|
|
1451
1454
|
resizeLeading: t.startsWith("top") || t === "top",
|
|
1452
1455
|
resizeTrailing: t.startsWith("bottom") || t === "bottom",
|
|
1453
|
-
minLeading:
|
|
1454
|
-
maxTrailing: i.height -
|
|
1456
|
+
minLeading: Ne,
|
|
1457
|
+
maxTrailing: i.height - N,
|
|
1455
1458
|
minLength: Math.min(
|
|
1456
1459
|
un,
|
|
1457
|
-
i.height -
|
|
1460
|
+
i.height - Ne - N
|
|
1458
1461
|
)
|
|
1459
1462
|
});
|
|
1460
1463
|
return {
|
|
@@ -1462,7 +1465,7 @@ function Kn(e, t, n, o) {
|
|
|
1462
1465
|
size: { width: r.length, height: l.length }
|
|
1463
1466
|
};
|
|
1464
1467
|
}
|
|
1465
|
-
function
|
|
1468
|
+
function Xn({
|
|
1466
1469
|
leading: e,
|
|
1467
1470
|
length: t,
|
|
1468
1471
|
delta: n,
|
|
@@ -1474,30 +1477,30 @@ function Yn({
|
|
|
1474
1477
|
}) {
|
|
1475
1478
|
const s = e + t;
|
|
1476
1479
|
if (o) {
|
|
1477
|
-
const
|
|
1478
|
-
if (
|
|
1479
|
-
const h =
|
|
1480
|
+
const g = e + n;
|
|
1481
|
+
if (g >= r) {
|
|
1482
|
+
const h = X(g, r, s - p);
|
|
1480
1483
|
return { leading: h, length: s - h };
|
|
1481
1484
|
}
|
|
1482
|
-
const c =
|
|
1483
|
-
s + r -
|
|
1485
|
+
const c = X(
|
|
1486
|
+
s + r - g,
|
|
1484
1487
|
s,
|
|
1485
1488
|
l
|
|
1486
1489
|
);
|
|
1487
1490
|
return { leading: r, length: c - r };
|
|
1488
1491
|
}
|
|
1489
1492
|
if (i) {
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1492
|
-
const h =
|
|
1493
|
-
|
|
1493
|
+
const g = s + n;
|
|
1494
|
+
if (g <= l) {
|
|
1495
|
+
const h = X(
|
|
1496
|
+
g,
|
|
1494
1497
|
e + p,
|
|
1495
1498
|
l
|
|
1496
1499
|
);
|
|
1497
1500
|
return { leading: e, length: h - e };
|
|
1498
1501
|
}
|
|
1499
|
-
const c =
|
|
1500
|
-
e - (
|
|
1502
|
+
const c = X(
|
|
1503
|
+
e - (g - l),
|
|
1501
1504
|
r,
|
|
1502
1505
|
e
|
|
1503
1506
|
);
|
|
@@ -1506,65 +1509,62 @@ function Yn({
|
|
|
1506
1509
|
return { leading: e, length: t };
|
|
1507
1510
|
}
|
|
1508
1511
|
function bt(e, t = !0) {
|
|
1509
|
-
const n =
|
|
1512
|
+
const n = Z();
|
|
1510
1513
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1511
|
-
return
|
|
1512
|
-
width: Ji,
|
|
1513
|
-
height: Qi
|
|
1514
|
-
} : { width: Wn, height: Wn };
|
|
1514
|
+
return { width: $n, height: $n };
|
|
1515
1515
|
const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1516
1516
|
return {
|
|
1517
|
-
width: t && i && o.width > 0 ? o.width : Math.min(
|
|
1518
|
-
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1517
|
+
width: t && i && o.width > 0 ? o.width : Math.min(yo, n.width - 36),
|
|
1518
|
+
height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? na : vo
|
|
1519
1519
|
};
|
|
1520
1520
|
}
|
|
1521
|
-
function
|
|
1522
|
-
const e =
|
|
1521
|
+
function xa() {
|
|
1522
|
+
const e = Z();
|
|
1523
1523
|
return {
|
|
1524
1524
|
width: Math.min(
|
|
1525
|
-
|
|
1526
|
-
e.width *
|
|
1525
|
+
X(
|
|
1526
|
+
e.width * ia,
|
|
1527
1527
|
cn,
|
|
1528
|
-
|
|
1528
|
+
oa
|
|
1529
1529
|
),
|
|
1530
|
-
e.width -
|
|
1530
|
+
e.width - N * 2
|
|
1531
1531
|
),
|
|
1532
1532
|
height: Math.min(
|
|
1533
|
-
|
|
1534
|
-
e.height *
|
|
1533
|
+
X(
|
|
1534
|
+
e.height * ra,
|
|
1535
1535
|
un,
|
|
1536
|
-
|
|
1536
|
+
aa
|
|
1537
1537
|
),
|
|
1538
|
-
e.height -
|
|
1538
|
+
e.height - Ne - N
|
|
1539
1539
|
)
|
|
1540
1540
|
};
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1543
|
-
return e ? xt(e) :
|
|
1542
|
+
function tt(e = null) {
|
|
1543
|
+
return e ? xt(e) : xa();
|
|
1544
1544
|
}
|
|
1545
1545
|
function xt(e) {
|
|
1546
|
-
const t =
|
|
1546
|
+
const t = Z();
|
|
1547
1547
|
return {
|
|
1548
|
-
width:
|
|
1548
|
+
width: X(
|
|
1549
1549
|
e.width,
|
|
1550
1550
|
Math.min(
|
|
1551
1551
|
cn,
|
|
1552
|
-
t.width -
|
|
1552
|
+
t.width - N * 2
|
|
1553
1553
|
),
|
|
1554
1554
|
Math.max(
|
|
1555
|
-
|
|
1556
|
-
t.width -
|
|
1555
|
+
N,
|
|
1556
|
+
t.width - N * 2
|
|
1557
1557
|
)
|
|
1558
1558
|
),
|
|
1559
|
-
height:
|
|
1559
|
+
height: X(
|
|
1560
1560
|
e.height,
|
|
1561
1561
|
Math.min(
|
|
1562
1562
|
un,
|
|
1563
|
-
t.height -
|
|
1563
|
+
t.height - Ne - N
|
|
1564
1564
|
),
|
|
1565
1565
|
Math.max(
|
|
1566
|
-
|
|
1567
|
-
t.height -
|
|
1566
|
+
N,
|
|
1567
|
+
t.height - Ne - N
|
|
1568
1568
|
)
|
|
1569
1569
|
)
|
|
1570
1570
|
};
|
|
@@ -1577,14 +1577,14 @@ function $t(e, t) {
|
|
|
1577
1577
|
const n = xt(t);
|
|
1578
1578
|
e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1580
|
+
function ya(e, t, n) {
|
|
1581
1581
|
const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1582
1582
|
if (Number.isFinite(o) && Number.isFinite(i))
|
|
1583
1583
|
return { x: o, y: i };
|
|
1584
1584
|
const r = e.getBoundingClientRect();
|
|
1585
1585
|
if (r.width > 0 || r.height > 0)
|
|
1586
1586
|
return { x: r.left, y: r.top };
|
|
1587
|
-
const l =
|
|
1587
|
+
const l = Z();
|
|
1588
1588
|
return {
|
|
1589
1589
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
1590
1590
|
y: l.height - 24 - n.height
|
|
@@ -1594,105 +1594,105 @@ function Gt(e, t, n) {
|
|
|
1594
1594
|
const o = bt(e, !1);
|
|
1595
1595
|
return t ? rn(
|
|
1596
1596
|
e,
|
|
1597
|
-
|
|
1597
|
+
To(t, o),
|
|
1598
1598
|
o
|
|
1599
|
-
) :
|
|
1599
|
+
) : va(n === "bottom-left" ? "bottom-left" : "bottom-right", o, ta);
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1602
|
-
const o =
|
|
1601
|
+
function va(e, t, n) {
|
|
1602
|
+
const o = Z();
|
|
1603
1603
|
return {
|
|
1604
1604
|
x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
|
|
1605
1605
|
y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
|
|
1606
1606
|
};
|
|
1607
1607
|
}
|
|
1608
1608
|
function rn(e, t, n) {
|
|
1609
|
-
const o =
|
|
1609
|
+
const o = Z(), i = N + Ea(e);
|
|
1610
1610
|
return {
|
|
1611
|
-
x:
|
|
1611
|
+
x: X(
|
|
1612
1612
|
t.x,
|
|
1613
|
-
|
|
1613
|
+
N,
|
|
1614
1614
|
Math.max(
|
|
1615
|
-
|
|
1616
|
-
o.width - n.width -
|
|
1615
|
+
N,
|
|
1616
|
+
o.width - n.width - N
|
|
1617
1617
|
)
|
|
1618
1618
|
),
|
|
1619
|
-
y:
|
|
1619
|
+
y: X(
|
|
1620
1620
|
t.y,
|
|
1621
1621
|
i,
|
|
1622
1622
|
Math.max(
|
|
1623
1623
|
i,
|
|
1624
|
-
o.height - n.height -
|
|
1624
|
+
o.height - n.height - N
|
|
1625
1625
|
)
|
|
1626
1626
|
)
|
|
1627
1627
|
};
|
|
1628
1628
|
}
|
|
1629
|
-
function
|
|
1630
|
-
const n =
|
|
1629
|
+
function To(e, t) {
|
|
1630
|
+
const n = Z();
|
|
1631
1631
|
return {
|
|
1632
1632
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
1633
1633
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
1634
1634
|
};
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1637
|
-
const n =
|
|
1636
|
+
function Ca(e, t) {
|
|
1637
|
+
const n = Sa(e, t), o = Z();
|
|
1638
1638
|
return {
|
|
1639
1639
|
anchor: n,
|
|
1640
1640
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
1641
1641
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
1642
1642
|
};
|
|
1643
1643
|
}
|
|
1644
|
-
function
|
|
1645
|
-
const n =
|
|
1644
|
+
function Sa(e, t) {
|
|
1645
|
+
const n = Z(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
1646
1646
|
return `${r}-${l}`;
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1649
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1648
|
+
function Ea(e) {
|
|
1649
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? da : sa;
|
|
1650
1650
|
}
|
|
1651
1651
|
function qt(e, t, n, o = null) {
|
|
1652
|
-
const i = bt(e), r =
|
|
1652
|
+
const i = bt(e), r = tt(o), l = {
|
|
1653
1653
|
x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
|
|
1654
1654
|
y: t.y + i.height - r.height
|
|
1655
1655
|
};
|
|
1656
1656
|
return mt(l, r);
|
|
1657
1657
|
}
|
|
1658
1658
|
function mt(e, t) {
|
|
1659
|
-
const n =
|
|
1659
|
+
const n = Z();
|
|
1660
1660
|
return {
|
|
1661
|
-
x:
|
|
1661
|
+
x: X(
|
|
1662
1662
|
e.x,
|
|
1663
|
-
|
|
1663
|
+
N,
|
|
1664
1664
|
Math.max(
|
|
1665
|
-
|
|
1666
|
-
n.width - t.width -
|
|
1665
|
+
N,
|
|
1666
|
+
n.width - t.width - N
|
|
1667
1667
|
)
|
|
1668
1668
|
),
|
|
1669
|
-
y:
|
|
1669
|
+
y: X(
|
|
1670
1670
|
e.y,
|
|
1671
|
-
|
|
1671
|
+
Ne,
|
|
1672
1672
|
Math.max(
|
|
1673
|
-
|
|
1674
|
-
n.height - t.height -
|
|
1673
|
+
Ne,
|
|
1674
|
+
n.height - t.height - N
|
|
1675
1675
|
)
|
|
1676
1676
|
)
|
|
1677
1677
|
};
|
|
1678
1678
|
}
|
|
1679
|
-
function
|
|
1679
|
+
function Ae(e, t) {
|
|
1680
1680
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1681
1681
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1682
1682
|
return;
|
|
1683
1683
|
}
|
|
1684
1684
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1685
1685
|
}
|
|
1686
|
-
function
|
|
1686
|
+
function ka(e, t) {
|
|
1687
1687
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1688
1688
|
}
|
|
1689
|
-
function
|
|
1689
|
+
function Zn(e) {
|
|
1690
1690
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1692
|
+
function Z() {
|
|
1693
1693
|
return {
|
|
1694
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1695
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1694
|
+
width: window.innerWidth || document.documentElement.clientWidth || yo + N * 2,
|
|
1695
|
+
height: window.innerHeight || document.documentElement.clientHeight || vo + N * 2
|
|
1696
1696
|
};
|
|
1697
1697
|
}
|
|
1698
1698
|
function jt(e) {
|
|
@@ -1704,10 +1704,10 @@ function jt(e) {
|
|
|
1704
1704
|
height: Math.round(t.height)
|
|
1705
1705
|
};
|
|
1706
1706
|
}
|
|
1707
|
-
function
|
|
1707
|
+
function X(e, t, n) {
|
|
1708
1708
|
return Math.min(Math.max(e, t), n);
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function K(e, t, n) {
|
|
1711
1711
|
if (typeof window > "u")
|
|
1712
1712
|
return;
|
|
1713
1713
|
const o = window, i = {
|
|
@@ -1717,44 +1717,44 @@ function Y(e, t, n) {
|
|
|
1717
1717
|
details: n
|
|
1718
1718
|
}, r = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
1719
1719
|
r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
|
|
1720
|
-
new CustomEvent(
|
|
1720
|
+
new CustomEvent(Ki, { detail: i })
|
|
1721
1721
|
);
|
|
1722
1722
|
}
|
|
1723
|
-
function
|
|
1724
|
-
|
|
1723
|
+
function La(e, t) {
|
|
1724
|
+
K("web-sdk.widget.position", e, t);
|
|
1725
1725
|
}
|
|
1726
1726
|
function Vt(e, t, n) {
|
|
1727
1727
|
const o = t.value.trim();
|
|
1728
1728
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
|
|
1729
|
-
attachments: n.length > 0 ? n.map(
|
|
1729
|
+
attachments: n.length > 0 ? n.map(Ia) : void 0
|
|
1730
1730
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1731
1731
|
}
|
|
1732
|
-
function
|
|
1732
|
+
function Ta(e, t, n) {
|
|
1733
1733
|
const o = e.activeElement;
|
|
1734
1734
|
return o === n ? "composer" : o === t ? "launcher" : null;
|
|
1735
1735
|
}
|
|
1736
|
-
function
|
|
1737
|
-
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt >
|
|
1736
|
+
function Pa(e, t, n, o) {
|
|
1737
|
+
if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Mi)
|
|
1738
1738
|
return;
|
|
1739
1739
|
const i = e.focusedInput === "composer" ? o : n;
|
|
1740
1740
|
i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
|
|
1741
1741
|
!i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
|
|
1742
1742
|
});
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1744
|
+
function Ia(e) {
|
|
1745
1745
|
return e;
|
|
1746
1746
|
}
|
|
1747
|
-
function
|
|
1747
|
+
function et(e) {
|
|
1748
1748
|
e.style.height = "0px";
|
|
1749
1749
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1750
1750
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1752
|
+
function nt(e, t = () => !0) {
|
|
1753
1753
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1754
1754
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1755
1755
|
});
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function Aa(e) {
|
|
1758
1758
|
const t = e.messages[e.messages.length - 1];
|
|
1759
1759
|
return [
|
|
1760
1760
|
e.messages.length,
|
|
@@ -1765,13 +1765,13 @@ function Ia(e) {
|
|
|
1765
1765
|
e.lastError ?? ""
|
|
1766
1766
|
].join(":");
|
|
1767
1767
|
}
|
|
1768
|
-
function
|
|
1768
|
+
function Na(e) {
|
|
1769
1769
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function Ra(e) {
|
|
1772
1772
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1773
1773
|
}
|
|
1774
|
-
function
|
|
1774
|
+
function Da(e) {
|
|
1775
1775
|
const t = e.currentPage;
|
|
1776
1776
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1777
1777
|
try {
|
|
@@ -1782,7 +1782,7 @@ function Ra(e) {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1784
1784
|
}
|
|
1785
|
-
function
|
|
1785
|
+
function za(e, t) {
|
|
1786
1786
|
const n = new Date(e).getTime();
|
|
1787
1787
|
if (!Number.isFinite(n))
|
|
1788
1788
|
return "now";
|
|
@@ -1798,9 +1798,9 @@ function Da(e, t) {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
return "now";
|
|
1800
1800
|
}
|
|
1801
|
-
function
|
|
1802
|
-
e.appendChild(
|
|
1803
|
-
|
|
1801
|
+
function Ma(e, t, n, o, i) {
|
|
1802
|
+
e.appendChild(qa()), e.appendChild(
|
|
1803
|
+
Oa(
|
|
1804
1804
|
t,
|
|
1805
1805
|
n,
|
|
1806
1806
|
o,
|
|
@@ -1810,24 +1810,24 @@ function za(e, t, n, o, i) {
|
|
|
1810
1810
|
yt(
|
|
1811
1811
|
"pluno-pa-widget__close",
|
|
1812
1812
|
"Close",
|
|
1813
|
-
|
|
1813
|
+
ja(16),
|
|
1814
1814
|
!0
|
|
1815
1815
|
)
|
|
1816
|
-
), e.appendChild(
|
|
1816
|
+
), e.appendChild(Ua(n));
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1818
|
+
function Oa(e, t, n, o) {
|
|
1819
1819
|
const i = document.createElement("form");
|
|
1820
1820
|
if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
|
|
1821
1821
|
const s = document.createElement("button");
|
|
1822
1822
|
s.type = "button", s.className = "pluno-pa-widget__launcher-drag-handle", s.setAttribute("aria-label", "Move Pluno launcher"), s.title = "Move Pluno launcher", i.appendChild(s);
|
|
1823
1823
|
}
|
|
1824
1824
|
i.appendChild(
|
|
1825
|
-
|
|
1825
|
+
No(
|
|
1826
1826
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1827
1827
|
10
|
|
1828
1828
|
)
|
|
1829
1829
|
), i.appendChild(
|
|
1830
|
-
|
|
1830
|
+
ve(
|
|
1831
1831
|
"pluno-pa-widget__character--launcher",
|
|
1832
1832
|
t
|
|
1833
1833
|
)
|
|
@@ -1843,10 +1843,10 @@ function Ma(e, t, n, o) {
|
|
|
1843
1843
|
}
|
|
1844
1844
|
return i;
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1846
|
+
function Ua(e) {
|
|
1847
1847
|
const t = document.createElement("section");
|
|
1848
1848
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1849
|
-
|
|
1849
|
+
No("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1850
1850
|
);
|
|
1851
1851
|
const n = document.createElement("div");
|
|
1852
1852
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
@@ -1863,31 +1863,31 @@ function Oa(e) {
|
|
|
1863
1863
|
yt(
|
|
1864
1864
|
"pluno-pa-widget__history",
|
|
1865
1865
|
ln(),
|
|
1866
|
-
|
|
1866
|
+
Ka(),
|
|
1867
1867
|
!0
|
|
1868
1868
|
)
|
|
1869
|
-
), n.appendChild(p), n.appendChild(
|
|
1870
|
-
|
|
1871
|
-
), t.appendChild(
|
|
1872
|
-
|
|
1869
|
+
), n.appendChild(p), n.appendChild(Wa()), t.appendChild(n), t.appendChild(Ba()), t.appendChild(Fa()), t.appendChild(ye("left", "Resize Pluno from left")), t.appendChild(
|
|
1870
|
+
ye("right", "Resize Pluno from right")
|
|
1871
|
+
), t.appendChild(ye("top", "Resize Pluno from top")), t.appendChild(
|
|
1872
|
+
ye("bottom", "Resize Pluno from bottom")
|
|
1873
1873
|
), t.appendChild(
|
|
1874
|
-
|
|
1874
|
+
ye("top-left", "Resize Pluno from top left")
|
|
1875
1875
|
), t.appendChild(
|
|
1876
|
-
|
|
1876
|
+
ye("top-right", "Resize Pluno from top right")
|
|
1877
1877
|
), t.appendChild(
|
|
1878
|
-
|
|
1878
|
+
ye("bottom-left", "Resize Pluno from bottom left")
|
|
1879
1879
|
), t.appendChild(
|
|
1880
|
-
|
|
1880
|
+
ye("bottom-right", "Resize Pluno from bottom right")
|
|
1881
1881
|
), t;
|
|
1882
1882
|
}
|
|
1883
|
-
function
|
|
1883
|
+
function ye(e, t) {
|
|
1884
1884
|
const n = document.createElement("button");
|
|
1885
1885
|
return n.type = "button", n.className = [
|
|
1886
1886
|
"pluno-pa-widget__resize-handle",
|
|
1887
1887
|
`pluno-pa-widget__resize-handle--${e}`
|
|
1888
1888
|
].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Ba() {
|
|
1891
1891
|
const e = document.createElement("div");
|
|
1892
1892
|
e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
|
|
1893
1893
|
const t = document.createElement("span");
|
|
@@ -1901,7 +1901,7 @@ function Ua() {
|
|
|
1901
1901
|
const r = document.createElement("button");
|
|
1902
1902
|
return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(o, i, r), e.append(t, n), e;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Fa() {
|
|
1905
1905
|
const e = document.createElement("form");
|
|
1906
1906
|
e.className = "pluno-pa-widget__composer";
|
|
1907
1907
|
const t = document.createElement("div");
|
|
@@ -1915,22 +1915,22 @@ function Ba() {
|
|
|
1915
1915
|
const r = document.createElement("input");
|
|
1916
1916
|
r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
|
|
1917
1917
|
const l = document.createElement("button");
|
|
1918
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1918
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Xa()), l.appendChild(Za()), i.appendChild(l);
|
|
1919
1919
|
const p = document.createElement("textarea");
|
|
1920
1920
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1921
1921
|
const s = document.createElement("button");
|
|
1922
|
-
s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(
|
|
1923
|
-
const
|
|
1924
|
-
|
|
1922
|
+
s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(Do()), i.appendChild(s), e.appendChild(i);
|
|
1923
|
+
const g = document.createElement("div");
|
|
1924
|
+
g.className = "pluno-pa-widget__composer-meta";
|
|
1925
1925
|
const c = document.createElement("a");
|
|
1926
|
-
c.className = "pluno-pa-widget__powered-by", c.href = "https://pluno.ai", c.target = "_blank", c.rel = "noopener noreferrer", c.textContent = "Powered by Pluno.ai.",
|
|
1926
|
+
c.className = "pluno-pa-widget__powered-by", c.href = "https://pluno.ai", c.target = "_blank", c.rel = "noopener noreferrer", c.textContent = "Powered by Pluno.ai.", g.appendChild(c);
|
|
1927
1927
|
const h = document.createElement("span");
|
|
1928
|
-
return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.",
|
|
1928
|
+
return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", g.appendChild(h), e.appendChild(g), e;
|
|
1929
1929
|
}
|
|
1930
1930
|
function ln() {
|
|
1931
1931
|
return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
|
|
1932
1932
|
}
|
|
1933
|
-
function
|
|
1933
|
+
function Wa() {
|
|
1934
1934
|
const e = document.createElement("section");
|
|
1935
1935
|
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", ln());
|
|
1936
1936
|
const t = document.createElement("div");
|
|
@@ -1940,7 +1940,7 @@ function Fa() {
|
|
|
1940
1940
|
const o = yt(
|
|
1941
1941
|
"pluno-pa-widget__history-close",
|
|
1942
1942
|
"Close recent chats",
|
|
1943
|
-
|
|
1943
|
+
Ya(),
|
|
1944
1944
|
!1
|
|
1945
1945
|
);
|
|
1946
1946
|
t.append(n, o);
|
|
@@ -1952,17 +1952,17 @@ function Fa() {
|
|
|
1952
1952
|
function Ha(e) {
|
|
1953
1953
|
const t = document.createElement("div");
|
|
1954
1954
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1955
|
-
|
|
1955
|
+
ve(
|
|
1956
1956
|
"pluno-pa-widget__character--empty",
|
|
1957
1957
|
e
|
|
1958
1958
|
)
|
|
1959
|
-
), t.appendChild(
|
|
1959
|
+
), t.appendChild(Po()), t;
|
|
1960
1960
|
}
|
|
1961
|
-
function
|
|
1961
|
+
function Po() {
|
|
1962
1962
|
const e = document.createElement("div");
|
|
1963
1963
|
return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
|
|
1964
1964
|
}
|
|
1965
|
-
function
|
|
1965
|
+
function Io(e, t) {
|
|
1966
1966
|
e.replaceChildren(), e.setAttribute(
|
|
1967
1967
|
"aria-label",
|
|
1968
1968
|
`${t.toLocaleString("en-US")} users currently active`
|
|
@@ -1974,17 +1974,17 @@ function To(e, t) {
|
|
|
1974
1974
|
)
|
|
1975
1975
|
);
|
|
1976
1976
|
}
|
|
1977
|
-
function
|
|
1978
|
-
const n = `pluno-pa-character-${
|
|
1979
|
-
|
|
1980
|
-
const o = t.scribbleStyle ?
|
|
1977
|
+
function ve(e, t) {
|
|
1978
|
+
const n = `pluno-pa-character-${qn}`;
|
|
1979
|
+
qn += 1;
|
|
1980
|
+
const o = t.scribbleStyle ? Ga(t.accentColor, n) : $a(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
|
|
1981
1981
|
return o.setAttribute(
|
|
1982
1982
|
"class",
|
|
1983
1983
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1984
1984
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1985
1985
|
}
|
|
1986
|
-
function
|
|
1987
|
-
const n =
|
|
1986
|
+
function $a(e, t) {
|
|
1987
|
+
const n = ui(e), o = {
|
|
1988
1988
|
boltFill: `${t}-boltFill`,
|
|
1989
1989
|
boltEdge: `${t}-boltEdge`,
|
|
1990
1990
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1995,7 +1995,7 @@ function Wa(e, t) {
|
|
|
1995
1995
|
eyeShadow: `${t}-eyeShadow`,
|
|
1996
1996
|
pupilGloss: `${t}-pupilGloss`,
|
|
1997
1997
|
boltClip: `${t}-boltClip`
|
|
1998
|
-
}, i =
|
|
1998
|
+
}, i = Ao(), r = w(i, "defs"), l = w(r, "linearGradient", {
|
|
1999
1999
|
id: o.boltFill,
|
|
2000
2000
|
x1: "420",
|
|
2001
2001
|
y1: "180",
|
|
@@ -2003,7 +2003,7 @@ function Wa(e, t) {
|
|
|
2003
2003
|
y2: "1040",
|
|
2004
2004
|
gradientUnits: "userSpaceOnUse"
|
|
2005
2005
|
});
|
|
2006
|
-
|
|
2006
|
+
O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
|
|
2007
2007
|
const p = w(r, "linearGradient", {
|
|
2008
2008
|
id: o.boltEdge,
|
|
2009
2009
|
x1: "470",
|
|
@@ -2012,28 +2012,28 @@ function Wa(e, t) {
|
|
|
2012
2012
|
y2: "980",
|
|
2013
2013
|
gradientUnits: "userSpaceOnUse"
|
|
2014
2014
|
});
|
|
2015
|
-
|
|
2015
|
+
O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
|
|
2016
2016
|
const s = w(r, "radialGradient", {
|
|
2017
2017
|
id: o.boltGlow,
|
|
2018
2018
|
cx: "50%",
|
|
2019
2019
|
cy: "22%",
|
|
2020
2020
|
r: "82%"
|
|
2021
2021
|
});
|
|
2022
|
-
|
|
2023
|
-
const
|
|
2022
|
+
O(s, "0", n.glow, "0.72"), O(s, "0.5", n.middle, "0.44"), O(s, "1", n.bottom, "0");
|
|
2023
|
+
const g = w(r, "radialGradient", {
|
|
2024
2024
|
id: o.eyeWhite,
|
|
2025
2025
|
cx: "35%",
|
|
2026
2026
|
cy: "25%",
|
|
2027
2027
|
r: "70%"
|
|
2028
2028
|
});
|
|
2029
|
-
|
|
2029
|
+
O(g, "0", "#ffffff"), O(g, "0.72", "#ffffff"), O(g, "1", "#e5e5e5");
|
|
2030
2030
|
const c = w(r, "radialGradient", {
|
|
2031
2031
|
id: o.pupil,
|
|
2032
2032
|
cx: "42%",
|
|
2033
2033
|
cy: "38%",
|
|
2034
2034
|
r: "65%"
|
|
2035
2035
|
});
|
|
2036
|
-
|
|
2036
|
+
O(c, "0", "#2a1f10"), O(c, "0.52", "#080604"), O(c, "1", "#000000");
|
|
2037
2037
|
const h = w(r, "filter", {
|
|
2038
2038
|
id: o.softDropShadow,
|
|
2039
2039
|
x: "-18%",
|
|
@@ -2049,7 +2049,7 @@ function Wa(e, t) {
|
|
|
2049
2049
|
"flood-color": n.shadow,
|
|
2050
2050
|
"flood-opacity": "0.24"
|
|
2051
2051
|
});
|
|
2052
|
-
const
|
|
2052
|
+
const C = w(r, "filter", {
|
|
2053
2053
|
id: o.innerDepth,
|
|
2054
2054
|
x: "-8%",
|
|
2055
2055
|
y: "-8%",
|
|
@@ -2057,32 +2057,32 @@ function Wa(e, t) {
|
|
|
2057
2057
|
height: "116%",
|
|
2058
2058
|
"color-interpolation-filters": "sRGB"
|
|
2059
2059
|
});
|
|
2060
|
-
w(
|
|
2060
|
+
w(C, "feGaussianBlur", {
|
|
2061
2061
|
in: "SourceAlpha",
|
|
2062
2062
|
stdDeviation: "8",
|
|
2063
2063
|
result: "blur"
|
|
2064
|
-
}), w(
|
|
2064
|
+
}), w(C, "feOffset", {
|
|
2065
2065
|
dx: "-7",
|
|
2066
2066
|
dy: "-9",
|
|
2067
2067
|
result: "topLeft"
|
|
2068
|
-
}), w(
|
|
2068
|
+
}), w(C, "feComposite", {
|
|
2069
2069
|
in: "topLeft",
|
|
2070
2070
|
in2: "SourceAlpha",
|
|
2071
2071
|
operator: "arithmetic",
|
|
2072
2072
|
k2: "-1",
|
|
2073
2073
|
k3: "1",
|
|
2074
2074
|
result: "innerShadow"
|
|
2075
|
-
}), w(
|
|
2075
|
+
}), w(C, "feColorMatrix", {
|
|
2076
2076
|
in: "innerShadow",
|
|
2077
2077
|
type: "matrix",
|
|
2078
2078
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
2079
2079
|
result: "innerLight"
|
|
2080
|
-
}), w(
|
|
2080
|
+
}), w(C, "feBlend", {
|
|
2081
2081
|
in: "SourceGraphic",
|
|
2082
2082
|
in2: "innerLight",
|
|
2083
2083
|
mode: "screen"
|
|
2084
2084
|
});
|
|
2085
|
-
const
|
|
2085
|
+
const P = w(r, "filter", {
|
|
2086
2086
|
id: o.eyeShadow,
|
|
2087
2087
|
x: "-24%",
|
|
2088
2088
|
y: "-20%",
|
|
@@ -2090,14 +2090,14 @@ function Wa(e, t) {
|
|
|
2090
2090
|
height: "148%",
|
|
2091
2091
|
"color-interpolation-filters": "sRGB"
|
|
2092
2092
|
});
|
|
2093
|
-
w(
|
|
2093
|
+
w(P, "feDropShadow", {
|
|
2094
2094
|
dx: "0",
|
|
2095
2095
|
dy: "8",
|
|
2096
2096
|
stdDeviation: "5",
|
|
2097
2097
|
"flood-color": n.shadow,
|
|
2098
2098
|
"flood-opacity": "0.3"
|
|
2099
2099
|
});
|
|
2100
|
-
const
|
|
2100
|
+
const I = w(r, "filter", {
|
|
2101
2101
|
id: o.pupilGloss,
|
|
2102
2102
|
x: "-15%",
|
|
2103
2103
|
y: "-15%",
|
|
@@ -2105,34 +2105,34 @@ function Wa(e, t) {
|
|
|
2105
2105
|
height: "130%",
|
|
2106
2106
|
"color-interpolation-filters": "sRGB"
|
|
2107
2107
|
});
|
|
2108
|
-
w(
|
|
2108
|
+
w(I, "feDropShadow", {
|
|
2109
2109
|
dx: "0",
|
|
2110
2110
|
dy: "3",
|
|
2111
2111
|
stdDeviation: "3",
|
|
2112
2112
|
"flood-color": "#000000",
|
|
2113
2113
|
"flood-opacity": "0.22"
|
|
2114
2114
|
});
|
|
2115
|
-
const
|
|
2116
|
-
w(
|
|
2117
|
-
const
|
|
2118
|
-
filter:
|
|
2115
|
+
const D = w(r, "clipPath", { id: o.boltClip });
|
|
2116
|
+
w(D, "path", { d: ft });
|
|
2117
|
+
const u = w(i, "g", {
|
|
2118
|
+
filter: Y(o.softDropShadow)
|
|
2119
2119
|
});
|
|
2120
|
-
w(
|
|
2120
|
+
w(u, "path", {
|
|
2121
2121
|
d: ft,
|
|
2122
|
-
fill:
|
|
2122
|
+
fill: Y(o.boltEdge)
|
|
2123
2123
|
});
|
|
2124
|
-
const
|
|
2125
|
-
w(
|
|
2126
|
-
d:
|
|
2127
|
-
fill:
|
|
2128
|
-
filter:
|
|
2129
|
-
}), w(
|
|
2130
|
-
d:
|
|
2131
|
-
fill:
|
|
2124
|
+
const v = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
|
|
2125
|
+
w(u, "path", {
|
|
2126
|
+
d: v,
|
|
2127
|
+
fill: Y(o.boltFill),
|
|
2128
|
+
filter: Y(o.innerDepth)
|
|
2129
|
+
}), w(u, "path", {
|
|
2130
|
+
d: v,
|
|
2131
|
+
fill: Y(o.boltGlow),
|
|
2132
2132
|
opacity: "0.74"
|
|
2133
2133
|
});
|
|
2134
|
-
const m = w(
|
|
2135
|
-
"clip-path":
|
|
2134
|
+
const m = w(u, "g", {
|
|
2135
|
+
"clip-path": Y(o.boltClip),
|
|
2136
2136
|
opacity: "0.42"
|
|
2137
2137
|
});
|
|
2138
2138
|
w(m, "path", {
|
|
@@ -2157,9 +2157,9 @@ function Wa(e, t) {
|
|
|
2157
2157
|
"stroke-linecap": "round",
|
|
2158
2158
|
opacity: "0.48"
|
|
2159
2159
|
});
|
|
2160
|
-
const
|
|
2161
|
-
return
|
|
2162
|
-
|
|
2160
|
+
const S = w(i, "g", { filter: Y(o.eyeShadow) });
|
|
2161
|
+
return Jn(
|
|
2162
|
+
S,
|
|
2163
2163
|
"rotate(-2 528 463)",
|
|
2164
2164
|
"528",
|
|
2165
2165
|
"463",
|
|
@@ -2168,8 +2168,8 @@ function Wa(e, t) {
|
|
|
2168
2168
|
"557",
|
|
2169
2169
|
"447",
|
|
2170
2170
|
o
|
|
2171
|
-
),
|
|
2172
|
-
|
|
2171
|
+
), Jn(
|
|
2172
|
+
S,
|
|
2173
2173
|
"rotate(2 717 462)",
|
|
2174
2174
|
"717",
|
|
2175
2175
|
"462",
|
|
@@ -2180,11 +2180,11 @@ function Wa(e, t) {
|
|
|
2180
2180
|
o
|
|
2181
2181
|
), i;
|
|
2182
2182
|
}
|
|
2183
|
-
function
|
|
2184
|
-
const n =
|
|
2183
|
+
function Ga(e, t) {
|
|
2184
|
+
const n = mo(e), o = {
|
|
2185
2185
|
clip: `${t}-scribbleBoltClip`,
|
|
2186
2186
|
wobble: `${t}-scribbleBoltWobble`
|
|
2187
|
-
}, i =
|
|
2187
|
+
}, i = Ao(), r = w(i, "defs"), l = w(r, "clipPath", { id: o.clip });
|
|
2188
2188
|
w(l, "path", { d: ft });
|
|
2189
2189
|
const p = w(r, "filter", {
|
|
2190
2190
|
id: o.wobble,
|
|
@@ -2207,11 +2207,11 @@ function $a(e, t) {
|
|
|
2207
2207
|
xChannelSelector: "R",
|
|
2208
2208
|
yChannelSelector: "G"
|
|
2209
2209
|
});
|
|
2210
|
-
const s = w(i, "g", { filter:
|
|
2211
|
-
"clip-path":
|
|
2210
|
+
const s = w(i, "g", { filter: Y(o.wobble) }), g = w(s, "g", {
|
|
2211
|
+
"clip-path": Y(o.clip)
|
|
2212
2212
|
});
|
|
2213
|
-
return w(
|
|
2214
|
-
d:
|
|
2213
|
+
return w(g, "path", {
|
|
2214
|
+
d: ci(),
|
|
2215
2215
|
fill: "none",
|
|
2216
2216
|
stroke: n,
|
|
2217
2217
|
"stroke-width": "56",
|
|
@@ -2225,7 +2225,7 @@ function $a(e, t) {
|
|
|
2225
2225
|
stroke: wt,
|
|
2226
2226
|
"stroke-width": "18",
|
|
2227
2227
|
"stroke-linejoin": "round"
|
|
2228
|
-
}),
|
|
2228
|
+
}), Qn(
|
|
2229
2229
|
s,
|
|
2230
2230
|
"rotate(-2 528 463)",
|
|
2231
2231
|
"528",
|
|
@@ -2234,7 +2234,7 @@ function $a(e, t) {
|
|
|
2234
2234
|
"473",
|
|
2235
2235
|
"557",
|
|
2236
2236
|
"447"
|
|
2237
|
-
),
|
|
2237
|
+
), Qn(
|
|
2238
2238
|
s,
|
|
2239
2239
|
"rotate(2 717 462)",
|
|
2240
2240
|
"717",
|
|
@@ -2245,35 +2245,35 @@ function $a(e, t) {
|
|
|
2245
2245
|
"447"
|
|
2246
2246
|
), i;
|
|
2247
2247
|
}
|
|
2248
|
-
function
|
|
2249
|
-
return
|
|
2250
|
-
xmlns:
|
|
2248
|
+
function Ao() {
|
|
2249
|
+
return E("svg", {
|
|
2250
|
+
xmlns: Co,
|
|
2251
2251
|
viewBox: "0 0 1254 1254"
|
|
2252
2252
|
});
|
|
2253
2253
|
}
|
|
2254
|
-
function
|
|
2255
|
-
const
|
|
2256
|
-
w(
|
|
2254
|
+
function Jn(e, t, n, o, i, r, l, p, s) {
|
|
2255
|
+
const g = w(e, "g", { transform: t });
|
|
2256
|
+
w(g, "ellipse", {
|
|
2257
2257
|
cx: n,
|
|
2258
2258
|
cy: o,
|
|
2259
2259
|
rx: "73",
|
|
2260
2260
|
ry: "80",
|
|
2261
|
-
fill:
|
|
2262
|
-
}), w(
|
|
2261
|
+
fill: Y(s.eyeWhite)
|
|
2262
|
+
}), w(g, "ellipse", {
|
|
2263
2263
|
cx: i,
|
|
2264
2264
|
cy: r,
|
|
2265
2265
|
rx: "49",
|
|
2266
2266
|
ry: "57",
|
|
2267
|
-
fill:
|
|
2268
|
-
filter:
|
|
2269
|
-
}), w(
|
|
2267
|
+
fill: Y(s.pupil),
|
|
2268
|
+
filter: Y(s.pupilGloss)
|
|
2269
|
+
}), w(g, "circle", {
|
|
2270
2270
|
cx: l,
|
|
2271
2271
|
cy: p,
|
|
2272
2272
|
r: "18",
|
|
2273
2273
|
fill: "#ffffff"
|
|
2274
2274
|
});
|
|
2275
2275
|
}
|
|
2276
|
-
function
|
|
2276
|
+
function Qn(e, t, n, o, i, r, l, p) {
|
|
2277
2277
|
const s = w(e, "g", { transform: t });
|
|
2278
2278
|
w(s, "ellipse", {
|
|
2279
2279
|
cx: n,
|
|
@@ -2297,42 +2297,42 @@ function Jn(e, t, n, o, i, r, l, p) {
|
|
|
2297
2297
|
});
|
|
2298
2298
|
}
|
|
2299
2299
|
function w(e, t, n = {}) {
|
|
2300
|
-
const o =
|
|
2300
|
+
const o = E(t, n);
|
|
2301
2301
|
return e.appendChild(o), o;
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2303
|
+
function O(e, t, n, o) {
|
|
2304
2304
|
const i = { offset: t, "stop-color": n };
|
|
2305
2305
|
o !== void 0 && (i["stop-opacity"] = o), w(e, "stop", i);
|
|
2306
2306
|
}
|
|
2307
|
-
function
|
|
2307
|
+
function Y(e) {
|
|
2308
2308
|
return `url(#${e})`;
|
|
2309
2309
|
}
|
|
2310
2310
|
function yt(e, t, n, o) {
|
|
2311
2311
|
const i = document.createElement("button");
|
|
2312
2312
|
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
|
|
2313
2313
|
}
|
|
2314
|
-
function
|
|
2315
|
-
const e =
|
|
2314
|
+
function qa() {
|
|
2315
|
+
const e = E("svg", {
|
|
2316
2316
|
class: "pluno-pa-widget__scribble-defs",
|
|
2317
2317
|
"aria-hidden": "true",
|
|
2318
2318
|
focusable: "false",
|
|
2319
2319
|
width: "0",
|
|
2320
2320
|
height: "0"
|
|
2321
|
-
}), t =
|
|
2321
|
+
}), t = E("defs");
|
|
2322
2322
|
return t.appendChild(Yt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
2323
2323
|
Yt("pluno-pa-scribble-wobble-2", "5", "15")
|
|
2324
2324
|
), t.appendChild(
|
|
2325
2325
|
Yt("pluno-pa-scribble-wobble-3", "9", "19")
|
|
2326
2326
|
), e.appendChild(t), e;
|
|
2327
2327
|
}
|
|
2328
|
-
function
|
|
2329
|
-
const n =
|
|
2328
|
+
function No(e, t) {
|
|
2329
|
+
const n = E("svg", {
|
|
2330
2330
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
2331
2331
|
preserveAspectRatio: "xMidYMid meet",
|
|
2332
2332
|
"aria-hidden": "true",
|
|
2333
2333
|
focusable: "false"
|
|
2334
2334
|
});
|
|
2335
|
-
return
|
|
2335
|
+
return Ro(n, t), n;
|
|
2336
2336
|
}
|
|
2337
2337
|
function Kt(e, t) {
|
|
2338
2338
|
if (!e)
|
|
@@ -2341,27 +2341,27 @@ function Kt(e, t) {
|
|
|
2341
2341
|
0,
|
|
2342
2342
|
t - on * 2
|
|
2343
2343
|
), o = Math.max(
|
|
2344
|
-
|
|
2344
|
+
pa,
|
|
2345
2345
|
Math.floor(
|
|
2346
2346
|
(n - nn * 2) / tn
|
|
2347
2347
|
)
|
|
2348
2348
|
);
|
|
2349
|
-
|
|
2349
|
+
Ro(e, o);
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function Ro(e, t) {
|
|
2352
2352
|
if (e.dataset.spiralCount === `${t}`)
|
|
2353
2353
|
return;
|
|
2354
2354
|
const n = t * tn + nn * 2;
|
|
2355
2355
|
e.dataset.spiralCount = `${t}`, e.setAttribute(
|
|
2356
2356
|
"viewBox",
|
|
2357
|
-
`0 0 ${n} ${
|
|
2357
|
+
`0 0 ${n} ${la}`
|
|
2358
2358
|
), e.replaceChildren();
|
|
2359
2359
|
for (let o = 0; o < t; o += 1) {
|
|
2360
|
-
const i =
|
|
2360
|
+
const i = Gn[o % Gn.length], r = E("g", {
|
|
2361
2361
|
transform: `translate(${nn + o * tn} 0)`
|
|
2362
2362
|
});
|
|
2363
2363
|
r.appendChild(
|
|
2364
|
-
|
|
2364
|
+
E("ellipse", {
|
|
2365
2365
|
cx: i.ellipseCx,
|
|
2366
2366
|
cy: i.ellipseCy,
|
|
2367
2367
|
rx: i.ellipseRx,
|
|
@@ -2372,7 +2372,7 @@ function Ao(e, t) {
|
|
|
2372
2372
|
opacity: "0.8"
|
|
2373
2373
|
})
|
|
2374
2374
|
), r.appendChild(
|
|
2375
|
-
|
|
2375
|
+
E("path", {
|
|
2376
2376
|
d: i.path,
|
|
2377
2377
|
fill: "none",
|
|
2378
2378
|
stroke: "#2c2a1e",
|
|
@@ -2383,7 +2383,7 @@ function Ao(e, t) {
|
|
|
2383
2383
|
}
|
|
2384
2384
|
}
|
|
2385
2385
|
function Yt(e, t, n) {
|
|
2386
|
-
const o =
|
|
2386
|
+
const o = E("filter", {
|
|
2387
2387
|
id: e,
|
|
2388
2388
|
x: "-8%",
|
|
2389
2389
|
y: "-8%",
|
|
@@ -2391,7 +2391,7 @@ function Yt(e, t, n) {
|
|
|
2391
2391
|
height: "116%"
|
|
2392
2392
|
});
|
|
2393
2393
|
return o.appendChild(
|
|
2394
|
-
|
|
2394
|
+
E("feTurbulence", {
|
|
2395
2395
|
type: "fractalNoise",
|
|
2396
2396
|
baseFrequency: "0.012 0.028",
|
|
2397
2397
|
numOctaves: "3",
|
|
@@ -2399,7 +2399,7 @@ function Yt(e, t, n) {
|
|
|
2399
2399
|
result: "stroke-noise"
|
|
2400
2400
|
})
|
|
2401
2401
|
), o.appendChild(
|
|
2402
|
-
|
|
2402
|
+
E("feDisplacementMap", {
|
|
2403
2403
|
in: "SourceGraphic",
|
|
2404
2404
|
in2: "stroke-noise",
|
|
2405
2405
|
scale: "3.5",
|
|
@@ -2408,7 +2408,7 @@ function Yt(e, t, n) {
|
|
|
2408
2408
|
result: "warped"
|
|
2409
2409
|
})
|
|
2410
2410
|
), o.appendChild(
|
|
2411
|
-
|
|
2411
|
+
E("feTurbulence", {
|
|
2412
2412
|
type: "fractalNoise",
|
|
2413
2413
|
baseFrequency: "0.7",
|
|
2414
2414
|
numOctaves: "1",
|
|
@@ -2416,7 +2416,7 @@ function Yt(e, t, n) {
|
|
|
2416
2416
|
result: "ink-noise"
|
|
2417
2417
|
})
|
|
2418
2418
|
), o.appendChild(
|
|
2419
|
-
|
|
2419
|
+
E("feDisplacementMap", {
|
|
2420
2420
|
in: "warped",
|
|
2421
2421
|
in2: "ink-noise",
|
|
2422
2422
|
scale: "0.9",
|
|
@@ -2425,8 +2425,8 @@ function Yt(e, t, n) {
|
|
|
2425
2425
|
})
|
|
2426
2426
|
), o;
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2429
|
-
const t =
|
|
2428
|
+
function ja(e) {
|
|
2429
|
+
const t = ce(
|
|
2430
2430
|
"0 0 24 24",
|
|
2431
2431
|
e,
|
|
2432
2432
|
e,
|
|
@@ -2434,10 +2434,10 @@ function qa(e) {
|
|
|
2434
2434
|
"currentColor",
|
|
2435
2435
|
"2.25"
|
|
2436
2436
|
);
|
|
2437
|
-
return t.appendChild(
|
|
2437
|
+
return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2440
|
-
const e =
|
|
2439
|
+
function Va() {
|
|
2440
|
+
const e = ce(
|
|
2441
2441
|
"0 0 24 24",
|
|
2442
2442
|
17,
|
|
2443
2443
|
17,
|
|
@@ -2446,17 +2446,17 @@ function ja() {
|
|
|
2446
2446
|
"2.25"
|
|
2447
2447
|
);
|
|
2448
2448
|
return e.appendChild(
|
|
2449
|
-
|
|
2449
|
+
E("path", {
|
|
2450
2450
|
d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
|
2451
2451
|
})
|
|
2452
2452
|
), e.appendChild(
|
|
2453
|
-
|
|
2453
|
+
E("path", {
|
|
2454
2454
|
d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
|
|
2455
2455
|
})
|
|
2456
2456
|
), e;
|
|
2457
2457
|
}
|
|
2458
|
-
function
|
|
2459
|
-
const e =
|
|
2458
|
+
function Ka() {
|
|
2459
|
+
const e = ce(
|
|
2460
2460
|
"0 0 24 24",
|
|
2461
2461
|
17,
|
|
2462
2462
|
17,
|
|
@@ -2464,10 +2464,10 @@ function Va() {
|
|
|
2464
2464
|
"currentColor",
|
|
2465
2465
|
"2.25"
|
|
2466
2466
|
);
|
|
2467
|
-
return e.appendChild(
|
|
2467
|
+
return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
|
|
2468
2468
|
}
|
|
2469
|
-
function
|
|
2470
|
-
const e =
|
|
2469
|
+
function Ya() {
|
|
2470
|
+
const e = ce(
|
|
2471
2471
|
"0 0 24 24",
|
|
2472
2472
|
15,
|
|
2473
2473
|
15,
|
|
@@ -2475,10 +2475,10 @@ function Ka() {
|
|
|
2475
2475
|
"currentColor",
|
|
2476
2476
|
"2.4"
|
|
2477
2477
|
);
|
|
2478
|
-
return e.appendChild(
|
|
2478
|
+
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
2479
2479
|
}
|
|
2480
|
-
function
|
|
2481
|
-
const e =
|
|
2480
|
+
function Do() {
|
|
2481
|
+
const e = ce(
|
|
2482
2482
|
"0 0 24 24",
|
|
2483
2483
|
14,
|
|
2484
2484
|
14,
|
|
@@ -2487,11 +2487,11 @@ function No() {
|
|
|
2487
2487
|
"2.75"
|
|
2488
2488
|
);
|
|
2489
2489
|
return e.appendChild(
|
|
2490
|
-
|
|
2491
|
-
), e.appendChild(
|
|
2490
|
+
E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2491
|
+
), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2494
|
-
const e =
|
|
2493
|
+
function Xa() {
|
|
2494
|
+
const e = ce(
|
|
2495
2495
|
"0 0 24 24",
|
|
2496
2496
|
16,
|
|
2497
2497
|
16,
|
|
@@ -2503,18 +2503,18 @@ function Ya() {
|
|
|
2503
2503
|
"class",
|
|
2504
2504
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
|
|
2505
2505
|
), e.appendChild(
|
|
2506
|
-
|
|
2506
|
+
E("path", {
|
|
2507
2507
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
2508
2508
|
})
|
|
2509
2509
|
), e;
|
|
2510
2510
|
}
|
|
2511
|
-
function
|
|
2512
|
-
const e =
|
|
2511
|
+
function Za() {
|
|
2512
|
+
const e = ce("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2513
2513
|
return e.setAttribute(
|
|
2514
2514
|
"class",
|
|
2515
2515
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
|
|
2516
2516
|
), e.appendChild(
|
|
2517
|
-
|
|
2517
|
+
E("path", {
|
|
2518
2518
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
2519
2519
|
stroke: "currentColor",
|
|
2520
2520
|
"stroke-width": "2",
|
|
@@ -2523,10 +2523,10 @@ function Xa() {
|
|
|
2523
2523
|
})
|
|
2524
2524
|
), e;
|
|
2525
2525
|
}
|
|
2526
|
-
function
|
|
2527
|
-
const e =
|
|
2526
|
+
function Ja() {
|
|
2527
|
+
const e = ce("0 0 24 24", 18, 18, "currentColor");
|
|
2528
2528
|
return e.appendChild(
|
|
2529
|
-
|
|
2529
|
+
E("rect", {
|
|
2530
2530
|
x: "6",
|
|
2531
2531
|
y: "6",
|
|
2532
2532
|
width: "12",
|
|
@@ -2535,8 +2535,8 @@ function Za() {
|
|
|
2535
2535
|
})
|
|
2536
2536
|
), e;
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2539
|
-
const e =
|
|
2538
|
+
function Qa() {
|
|
2539
|
+
const e = ce(
|
|
2540
2540
|
"0 0 24 24",
|
|
2541
2541
|
12,
|
|
2542
2542
|
12,
|
|
@@ -2544,10 +2544,10 @@ function Ja() {
|
|
|
2544
2544
|
"currentColor",
|
|
2545
2545
|
"2.4"
|
|
2546
2546
|
);
|
|
2547
|
-
return e.appendChild(
|
|
2547
|
+
return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
|
|
2548
2548
|
}
|
|
2549
|
-
function
|
|
2550
|
-
const e =
|
|
2549
|
+
function er() {
|
|
2550
|
+
const e = ce(
|
|
2551
2551
|
"0 0 24 24",
|
|
2552
2552
|
13,
|
|
2553
2553
|
13,
|
|
@@ -2556,7 +2556,7 @@ function Qa() {
|
|
|
2556
2556
|
"2.25"
|
|
2557
2557
|
);
|
|
2558
2558
|
return e.appendChild(
|
|
2559
|
-
|
|
2559
|
+
E("rect", {
|
|
2560
2560
|
width: "14",
|
|
2561
2561
|
height: "14",
|
|
2562
2562
|
x: "8",
|
|
@@ -2565,12 +2565,12 @@ function Qa() {
|
|
|
2565
2565
|
ry: "2"
|
|
2566
2566
|
})
|
|
2567
2567
|
), e.appendChild(
|
|
2568
|
-
|
|
2568
|
+
E("path", {
|
|
2569
2569
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
2570
2570
|
})
|
|
2571
2571
|
), e;
|
|
2572
2572
|
}
|
|
2573
|
-
function
|
|
2573
|
+
function ce(e, t, n, o, i, r) {
|
|
2574
2574
|
const l = {
|
|
2575
2575
|
viewBox: e,
|
|
2576
2576
|
width: String(t),
|
|
@@ -2578,88 +2578,88 @@ function se(e, t, n, o, i, r) {
|
|
|
2578
2578
|
fill: o,
|
|
2579
2579
|
"aria-hidden": "true"
|
|
2580
2580
|
};
|
|
2581
|
-
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r),
|
|
2581
|
+
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
|
|
2582
2582
|
}
|
|
2583
|
-
function
|
|
2584
|
-
const n = document.createElementNS(
|
|
2583
|
+
function E(e, t = {}) {
|
|
2584
|
+
const n = document.createElementNS(Co, e);
|
|
2585
2585
|
for (const [o, i] of Object.entries(t))
|
|
2586
2586
|
n.setAttribute(o, i);
|
|
2587
2587
|
return n;
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function eo(e) {
|
|
2590
2590
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2591
2591
|
e.addEventListener(t, (n) => {
|
|
2592
2592
|
n.stopPropagation();
|
|
2593
2593
|
});
|
|
2594
2594
|
}
|
|
2595
|
-
function
|
|
2595
|
+
function tr(e, t, n) {
|
|
2596
2596
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2597
2597
|
for (const [o, i] of t.entries()) {
|
|
2598
2598
|
const r = document.createElement("div");
|
|
2599
|
-
r.className = "pluno-pa-widget__attachment", r.appendChild(
|
|
2599
|
+
r.className = "pluno-pa-widget__attachment", r.appendChild(nr(i));
|
|
2600
2600
|
const l = document.createElement("span");
|
|
2601
2601
|
l.textContent = i.name, r.appendChild(l);
|
|
2602
2602
|
const p = document.createElement("button");
|
|
2603
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2603
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Qa()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
|
|
2604
2604
|
}
|
|
2605
2605
|
}
|
|
2606
|
-
function
|
|
2607
|
-
const t = gn(e), n =
|
|
2606
|
+
function nr(e) {
|
|
2607
|
+
const t = gn(e), n = zo(e);
|
|
2608
2608
|
if (t === "image" && n) {
|
|
2609
2609
|
const o = document.createElement("img");
|
|
2610
|
-
return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(
|
|
2610
|
+
return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(se(e))), o;
|
|
2611
2611
|
}
|
|
2612
2612
|
if (t === "video" && n) {
|
|
2613
2613
|
const o = document.createElement("video");
|
|
2614
|
-
return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(
|
|
2614
|
+
return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(se(e))), o.addEventListener("stalled", () => o.replaceWith(se(e))), o;
|
|
2615
2615
|
}
|
|
2616
|
-
return
|
|
2616
|
+
return se(e);
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2619
|
-
const t = gn(e), n =
|
|
2618
|
+
function or(e) {
|
|
2619
|
+
const t = gn(e), n = zo(e);
|
|
2620
2620
|
if (t === "image" && n) {
|
|
2621
2621
|
const o = document.createElement("img");
|
|
2622
|
-
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(
|
|
2622
|
+
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(se(e, "message"))), o;
|
|
2623
2623
|
}
|
|
2624
2624
|
if (t === "pdf" && n) {
|
|
2625
2625
|
const o = document.createElement("object");
|
|
2626
|
-
return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(
|
|
2626
|
+
return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(se(e, "message"))), o.appendChild(se(e, "message")), o;
|
|
2627
2627
|
}
|
|
2628
2628
|
if (t === "video" && n) {
|
|
2629
2629
|
const o = document.createElement("video");
|
|
2630
|
-
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(
|
|
2630
|
+
return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(se(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(se(e, "message"))), o;
|
|
2631
2631
|
}
|
|
2632
|
-
return
|
|
2632
|
+
return se(e, "message");
|
|
2633
2633
|
}
|
|
2634
|
-
function
|
|
2634
|
+
function se(e, t = "composer") {
|
|
2635
2635
|
if (t === "composer") {
|
|
2636
2636
|
const r = document.createElement("span");
|
|
2637
|
-
return r.className = "pluno-pa-widget__attachment-file", r.textContent =
|
|
2637
|
+
return r.className = "pluno-pa-widget__attachment-file", r.textContent = to(e), r;
|
|
2638
2638
|
}
|
|
2639
2639
|
const n = document.createElement("div");
|
|
2640
2640
|
n.className = "pluno-pa-widget__message-attachment-file";
|
|
2641
2641
|
const o = document.createElement("span");
|
|
2642
|
-
o.textContent =
|
|
2642
|
+
o.textContent = to(e);
|
|
2643
2643
|
const i = document.createElement("strong");
|
|
2644
2644
|
return i.textContent = e.name, n.append(o, i), n;
|
|
2645
2645
|
}
|
|
2646
2646
|
function gn(e) {
|
|
2647
2647
|
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2648
2648
|
}
|
|
2649
|
-
function
|
|
2649
|
+
function zo(e) {
|
|
2650
2650
|
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2651
2651
|
}
|
|
2652
|
-
function
|
|
2652
|
+
function to(e) {
|
|
2653
2653
|
const t = gn(e);
|
|
2654
2654
|
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2655
2655
|
}
|
|
2656
|
-
function
|
|
2656
|
+
function ir(e, t) {
|
|
2657
2657
|
return t ? Array.from(t).map((o) => ({
|
|
2658
2658
|
...e.createLocalAttachment(o),
|
|
2659
|
-
previewUrl:
|
|
2659
|
+
previewUrl: ar(o)
|
|
2660
2660
|
})) : [];
|
|
2661
2661
|
}
|
|
2662
|
-
function
|
|
2662
|
+
function ar(e) {
|
|
2663
2663
|
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2664
2664
|
}
|
|
2665
2665
|
function ut(e) {
|
|
@@ -2670,32 +2670,32 @@ function Xt(e, t, n = null) {
|
|
|
2670
2670
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2671
2671
|
return;
|
|
2672
2672
|
}
|
|
2673
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
2674
|
-
|
|
2675
|
-
) :
|
|
2673
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", de(t) || hn(n) ? e.appendChild(
|
|
2674
|
+
rr(t, n)
|
|
2675
|
+
) : Mo(t) && e.appendChild(lr(t));
|
|
2676
2676
|
}
|
|
2677
|
-
function
|
|
2677
|
+
function rr(e, t) {
|
|
2678
2678
|
const n = document.createElement("div");
|
|
2679
2679
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
2680
2680
|
const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2681
2681
|
i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
|
|
2682
2682
|
const r = document.createElement("span");
|
|
2683
2683
|
return r.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
|
|
2684
|
-
|
|
2684
|
+
Oo(
|
|
2685
2685
|
e,
|
|
2686
2686
|
"Upgrade plan",
|
|
2687
2687
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2688
2688
|
)
|
|
2689
2689
|
), n;
|
|
2690
2690
|
}
|
|
2691
|
-
function
|
|
2691
|
+
function lr(e) {
|
|
2692
2692
|
const t = document.createElement("div");
|
|
2693
2693
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2694
2694
|
const n = document.createElement("strong");
|
|
2695
2695
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
2696
2696
|
const o = document.createElement("span");
|
|
2697
|
-
return o.textContent =
|
|
2698
|
-
|
|
2697
|
+
return o.textContent = sr(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
|
|
2698
|
+
Oo(
|
|
2699
2699
|
e,
|
|
2700
2700
|
"Upgrade",
|
|
2701
2701
|
"pluno-pa-widget__billing-action-card-actions"
|
|
@@ -2703,40 +2703,40 @@ function rr(e) {
|
|
|
2703
2703
|
), t;
|
|
2704
2704
|
}
|
|
2705
2705
|
function pn(e, t) {
|
|
2706
|
-
return e !== null && (
|
|
2706
|
+
return e !== null && (de(e) || Mo(e) || hn(t));
|
|
2707
2707
|
}
|
|
2708
|
-
function
|
|
2709
|
-
return pn(t, n) ||
|
|
2708
|
+
function no(e, t, n) {
|
|
2709
|
+
return pn(t, n) || pr(t) ? !0 : !pn(e, n);
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2712
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
2711
|
+
function pr(e) {
|
|
2712
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || de(e));
|
|
2713
2713
|
}
|
|
2714
|
-
function
|
|
2714
|
+
function de(e) {
|
|
2715
2715
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2716
2716
|
}
|
|
2717
2717
|
function hn(e) {
|
|
2718
2718
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2719
2719
|
}
|
|
2720
|
-
function
|
|
2721
|
-
return !
|
|
2722
|
-
}
|
|
2723
|
-
function pr(e) {
|
|
2724
|
-
return e.creditsRemaining === null ? null : `${sr(e.creditsRemaining)} credits left`;
|
|
2720
|
+
function Mo(e) {
|
|
2721
|
+
return !de(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2725
2722
|
}
|
|
2726
2723
|
function sr(e) {
|
|
2724
|
+
return e.creditsRemaining === null ? null : `${dr(e.creditsRemaining)} credits left`;
|
|
2725
|
+
}
|
|
2726
|
+
function dr(e) {
|
|
2727
2727
|
return new Intl.NumberFormat("en-US", {
|
|
2728
2728
|
maximumFractionDigits: 0
|
|
2729
2729
|
}).format(Math.ceil(e));
|
|
2730
2730
|
}
|
|
2731
|
-
function
|
|
2731
|
+
function Oo(e, t, n) {
|
|
2732
2732
|
const o = document.createElement("div");
|
|
2733
2733
|
return o.className = n, o.appendChild(
|
|
2734
|
-
|
|
2734
|
+
oo(t, e.pricingUrl)
|
|
2735
2735
|
), o.appendChild(
|
|
2736
|
-
|
|
2736
|
+
oo("Earn credits", e.earnCreditsUrl)
|
|
2737
2737
|
), o;
|
|
2738
2738
|
}
|
|
2739
|
-
function
|
|
2739
|
+
function oo(e, t) {
|
|
2740
2740
|
const n = document.createElement("button");
|
|
2741
2741
|
if (n.type = "button", e === "Earn credits") {
|
|
2742
2742
|
const o = document.createElement("span");
|
|
@@ -2749,146 +2749,146 @@ function no(e, t) {
|
|
|
2749
2749
|
}
|
|
2750
2750
|
function Zt(e, t) {
|
|
2751
2751
|
return e.messages.filter(
|
|
2752
|
-
(o) => !
|
|
2752
|
+
(o) => !Uo(o)
|
|
2753
2753
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2754
2754
|
}
|
|
2755
|
-
function
|
|
2756
|
-
const
|
|
2757
|
-
(x) => !
|
|
2758
|
-
),
|
|
2759
|
-
|
|
2755
|
+
function cr(e, t, n, o, i, r, l, p, s, g, c, h, C, P, I, D, u, v, m, S) {
|
|
2756
|
+
const z = mr(r), L = z.filter(
|
|
2757
|
+
(x) => !Uo(x)
|
|
2758
|
+
), oe = e.scrollTop, J = [], Re = /* @__PURE__ */ new Set(), U = (x) => {
|
|
2759
|
+
J.push(x);
|
|
2760
2760
|
};
|
|
2761
|
-
|
|
2762
|
-
const
|
|
2763
|
-
if (o(
|
|
2761
|
+
Fo(n, r.isThinking), i.hidden = !p, p && l !== null && Io(i, l);
|
|
2762
|
+
const we = L.length > 0 || !!r.assistantDraft || r.isThinking;
|
|
2763
|
+
if (o(we), u || L.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
|
|
2764
2764
|
const x = document.createElement("div");
|
|
2765
|
-
x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (
|
|
2766
|
-
const
|
|
2767
|
-
|
|
2768
|
-
const
|
|
2765
|
+
x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
|
|
2766
|
+
const R = document.createElement("div");
|
|
2767
|
+
R.className = "pluno-pa-widget__empty-hero";
|
|
2768
|
+
const T = ve(
|
|
2769
2769
|
"pluno-pa-widget__character--empty",
|
|
2770
|
-
|
|
2770
|
+
P()
|
|
2771
2771
|
);
|
|
2772
|
-
if (
|
|
2773
|
-
const
|
|
2774
|
-
|
|
2772
|
+
if (R.appendChild(T), x.appendChild(R), u) {
|
|
2773
|
+
const y = document.createElement("h2");
|
|
2774
|
+
y.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", y.textContent = u.opening, x.appendChild(y);
|
|
2775
2775
|
} else
|
|
2776
|
-
x.appendChild(
|
|
2777
|
-
const
|
|
2778
|
-
if (
|
|
2779
|
-
for (const
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
}),
|
|
2776
|
+
x.appendChild(Po());
|
|
2777
|
+
const ae = u?.prompts ?? r.starterPrompts, H = document.createElement("div");
|
|
2778
|
+
if (H.className = ae.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", ae.length === 0 && !r.starterPromptsLoading && H.setAttribute("aria-hidden", "true"), ae.length > 0)
|
|
2779
|
+
for (const y of ae) {
|
|
2780
|
+
const A = document.createElement("button");
|
|
2781
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${y}"`, A.addEventListener("click", () => {
|
|
2782
|
+
I(y);
|
|
2783
|
+
}), H.appendChild(A);
|
|
2784
2784
|
}
|
|
2785
2785
|
else if (r.starterPromptsLoading) {
|
|
2786
|
-
const
|
|
2787
|
-
|
|
2786
|
+
const y = document.createElement("button");
|
|
2787
|
+
y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", y.disabled = !0, y.tabIndex = -1, y.textContent = "Generating example tasks...", H.appendChild(y);
|
|
2788
2788
|
} else
|
|
2789
|
-
for (let
|
|
2790
|
-
const
|
|
2791
|
-
|
|
2789
|
+
for (let y = 0; y < Yi; y += 1) {
|
|
2790
|
+
const A = document.createElement("button");
|
|
2791
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", H.appendChild(A);
|
|
2792
2792
|
}
|
|
2793
|
-
if (x.appendChild(
|
|
2794
|
-
const
|
|
2795
|
-
|
|
2793
|
+
if (x.appendChild(H), u) {
|
|
2794
|
+
const y = document.createElement("button");
|
|
2795
|
+
y.type = "button", y.className = "pluno-pa-widget__morning-report-snooze", y.textContent = "Snooze morning report", y.addEventListener("click", v), x.appendChild(y);
|
|
2796
2796
|
}
|
|
2797
|
-
h.clear(),
|
|
2797
|
+
h.clear(), U(x), U(t), io(e, J);
|
|
2798
2798
|
return;
|
|
2799
2799
|
}
|
|
2800
|
-
let
|
|
2801
|
-
const
|
|
2802
|
-
if (
|
|
2800
|
+
let B = null, f = null, Q = [];
|
|
2801
|
+
const De = L.length - 1, Ce = De >= 0 && sn(L[De]), Se = () => {
|
|
2802
|
+
if (Q.length === 0)
|
|
2803
2803
|
return !1;
|
|
2804
|
-
const x =
|
|
2805
|
-
|
|
2804
|
+
const x = Sr(
|
|
2805
|
+
Q,
|
|
2806
2806
|
c,
|
|
2807
|
-
|
|
2808
|
-
|
|
2807
|
+
C,
|
|
2808
|
+
P()
|
|
2809
2809
|
);
|
|
2810
|
-
return
|
|
2810
|
+
return U(x), B = null, f = x, Q = [], !0;
|
|
2811
2811
|
};
|
|
2812
|
-
for (let x = 0; x <
|
|
2813
|
-
const
|
|
2814
|
-
if (
|
|
2815
|
-
|
|
2812
|
+
for (let x = 0; x < L.length; x += 1) {
|
|
2813
|
+
const R = L[x];
|
|
2814
|
+
if (R.role === "tool") {
|
|
2815
|
+
Q.push(R);
|
|
2816
2816
|
continue;
|
|
2817
2817
|
}
|
|
2818
|
-
if (sn(
|
|
2819
|
-
if (x !==
|
|
2818
|
+
if (sn(R)) {
|
|
2819
|
+
if (x !== De)
|
|
2820
2820
|
continue;
|
|
2821
|
-
if (
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2821
|
+
if (Se()) {
|
|
2822
|
+
const A = _t();
|
|
2823
|
+
U(A), B = null, f = A;
|
|
2824
2824
|
} else {
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2825
|
+
const A = po(P());
|
|
2826
|
+
U(A), B = null, f = A;
|
|
2827
2827
|
}
|
|
2828
2828
|
continue;
|
|
2829
2829
|
}
|
|
2830
|
-
if (
|
|
2831
|
-
if (
|
|
2832
|
-
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2830
|
+
if (R.role === "system") {
|
|
2831
|
+
if (R.dataType === "run_error" || R.dataType === "run_status") {
|
|
2832
|
+
Se();
|
|
2833
|
+
const y = document.createElement("div"), A = R.dataType === "run_error";
|
|
2834
|
+
y.className = A ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent = lo(R.content), U(y), B = A ? y : null, f = A ? null : y;
|
|
2835
2835
|
}
|
|
2836
2836
|
continue;
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2839
|
-
if (
|
|
2840
|
-
const
|
|
2841
|
-
|
|
2838
|
+
const T = Se(), ae = lo(R.content);
|
|
2839
|
+
if (R.role === "assistant" && !T) {
|
|
2840
|
+
const y = Bo(P());
|
|
2841
|
+
U(y), B = null, f = y;
|
|
2842
2842
|
}
|
|
2843
|
-
const
|
|
2844
|
-
|
|
2843
|
+
const H = ur(R, ae, h, Re);
|
|
2844
|
+
U(H), B = H, f = null;
|
|
2845
2845
|
}
|
|
2846
|
-
const
|
|
2847
|
-
if (r.isThinking && !
|
|
2848
|
-
if (
|
|
2846
|
+
const j = Se(), it = L[L.length - 1]?.id === "assistant-draft";
|
|
2847
|
+
if (r.isThinking && !it && !Ce)
|
|
2848
|
+
if (j) {
|
|
2849
2849
|
const x = _t();
|
|
2850
|
-
|
|
2850
|
+
U(x), B = null, f = x;
|
|
2851
2851
|
} else {
|
|
2852
|
-
const x =
|
|
2853
|
-
|
|
2852
|
+
const x = po(P());
|
|
2853
|
+
U(x), B = null, f = x;
|
|
2854
2854
|
}
|
|
2855
2855
|
if (r.lastError) {
|
|
2856
2856
|
const x = document.createElement("div");
|
|
2857
2857
|
x.className = "pluno-pa-widget__error";
|
|
2858
|
-
const
|
|
2859
|
-
if (
|
|
2860
|
-
const
|
|
2861
|
-
|
|
2858
|
+
const R = document.createElement("span");
|
|
2859
|
+
if (R.textContent = r.lastError, x.appendChild(R), r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
|
|
2860
|
+
const T = document.createElement("button");
|
|
2861
|
+
T.type = "button", T.className = "pluno-pa-widget__error-retry", T.textContent = "Try again", T.addEventListener(
|
|
2862
2862
|
"click",
|
|
2863
|
-
r.lastErrorCode === "connection_failed" ? m :
|
|
2864
|
-
), x.appendChild(
|
|
2863
|
+
r.lastErrorCode === "connection_failed" ? m : D
|
|
2864
|
+
), x.appendChild(T);
|
|
2865
2865
|
}
|
|
2866
|
-
|
|
2866
|
+
U(x), B = x, f = null;
|
|
2867
2867
|
}
|
|
2868
|
-
const
|
|
2869
|
-
if (
|
|
2870
|
-
const x =
|
|
2871
|
-
isDrafting:
|
|
2872
|
-
error:
|
|
2873
|
-
characterIconOptions:
|
|
2874
|
-
onDraft:
|
|
2875
|
-
onDismiss:
|
|
2876
|
-
onDisable:
|
|
2868
|
+
const ie = S && !r.isThinking ? fi(z) : null;
|
|
2869
|
+
if (S && ie && !S.dismissedCandidateIds.has(ie.id)) {
|
|
2870
|
+
const x = br(ie, {
|
|
2871
|
+
isDrafting: S.draftingCandidateId === ie.id,
|
|
2872
|
+
error: S.error,
|
|
2873
|
+
characterIconOptions: S.characterIconOptions,
|
|
2874
|
+
onDraft: S.onDraft,
|
|
2875
|
+
onDismiss: S.onDismiss,
|
|
2876
|
+
onDisable: S.onDisable
|
|
2877
2877
|
});
|
|
2878
|
-
|
|
2878
|
+
U(x), S.onSeen(ie), B = null, f = x;
|
|
2879
2879
|
}
|
|
2880
|
-
|
|
2880
|
+
B?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), hr(h, Re), io(e, J), s ? nt(e, g) : e.scrollTop = oe;
|
|
2881
2881
|
}
|
|
2882
|
-
function
|
|
2883
|
-
const i =
|
|
2882
|
+
function ur(e, t, n, o) {
|
|
2883
|
+
const i = gr(e, t), r = i ? n.get(i) : void 0;
|
|
2884
2884
|
if (i && r)
|
|
2885
2885
|
return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
|
|
2886
2886
|
const l = document.createElement("div");
|
|
2887
|
-
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ?
|
|
2887
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? kr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(fr(e.attachments));
|
|
2888
2888
|
const p = document.createElement("div");
|
|
2889
|
-
return p.className = "pluno-pa-widget__message-actions", p.appendChild(
|
|
2889
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(wr(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
|
|
2890
2890
|
}
|
|
2891
|
-
function
|
|
2891
|
+
function gr(e, t) {
|
|
2892
2892
|
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2893
2893
|
id: e.id,
|
|
2894
2894
|
content: t,
|
|
@@ -2906,11 +2906,11 @@ function ur(e, t) {
|
|
|
2906
2906
|
})
|
|
2907
2907
|
});
|
|
2908
2908
|
}
|
|
2909
|
-
function
|
|
2909
|
+
function hr(e, t) {
|
|
2910
2910
|
for (const n of e.keys())
|
|
2911
2911
|
t.has(n) || e.delete(n);
|
|
2912
2912
|
}
|
|
2913
|
-
function
|
|
2913
|
+
function io(e, t) {
|
|
2914
2914
|
let n = e.firstChild;
|
|
2915
2915
|
for (const o of t) {
|
|
2916
2916
|
if (o === n) {
|
|
@@ -2924,7 +2924,7 @@ function oo(e, t) {
|
|
|
2924
2924
|
n = n.nextSibling, e.removeChild(o);
|
|
2925
2925
|
}
|
|
2926
2926
|
}
|
|
2927
|
-
function
|
|
2927
|
+
function mr(e) {
|
|
2928
2928
|
if (!e.assistantDraft)
|
|
2929
2929
|
return [...e.messages];
|
|
2930
2930
|
const t = {
|
|
@@ -2944,7 +2944,7 @@ function hr(e) {
|
|
|
2944
2944
|
if (n === -1)
|
|
2945
2945
|
return [...e.messages, t];
|
|
2946
2946
|
const o = e.messages.findIndex(
|
|
2947
|
-
(r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2947
|
+
(r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && ao(r, t) && sn(r)
|
|
2948
2948
|
);
|
|
2949
2949
|
if (o !== -1)
|
|
2950
2950
|
return [
|
|
@@ -2953,7 +2953,7 @@ function hr(e) {
|
|
|
2953
2953
|
...e.messages.slice(o + 1)
|
|
2954
2954
|
];
|
|
2955
2955
|
let i = n + 1;
|
|
2956
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2956
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && ao(e.messages[i], t); )
|
|
2957
2957
|
i += 1;
|
|
2958
2958
|
return [
|
|
2959
2959
|
...e.messages.slice(0, i),
|
|
@@ -2964,18 +2964,18 @@ function hr(e) {
|
|
|
2964
2964
|
function sn(e) {
|
|
2965
2965
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2966
2966
|
}
|
|
2967
|
-
function
|
|
2967
|
+
function ao(e, t) {
|
|
2968
2968
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2969
2969
|
}
|
|
2970
|
-
function
|
|
2971
|
-
e.replaceChildren(),
|
|
2970
|
+
function ro(e, t, n, o, i, r, l, p) {
|
|
2971
|
+
e.replaceChildren(), Fo(t, !1), t.disabled = !0, n(!1);
|
|
2972
2972
|
const s = document.createElement("div");
|
|
2973
2973
|
s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2974
|
-
const
|
|
2974
|
+
const g = ve(
|
|
2975
2975
|
"pluno-pa-widget__character--empty",
|
|
2976
2976
|
o()
|
|
2977
2977
|
);
|
|
2978
|
-
s.appendChild(
|
|
2978
|
+
s.appendChild(g);
|
|
2979
2979
|
const c = document.createElement("div");
|
|
2980
2980
|
if (c.className = "pluno-pa-widget__empty", c.textContent = i, s.appendChild(c), l) {
|
|
2981
2981
|
const h = document.createElement("a");
|
|
@@ -2986,25 +2986,25 @@ function ao(e, t, n, o, i, r, l, p) {
|
|
|
2986
2986
|
}
|
|
2987
2987
|
e.appendChild(s);
|
|
2988
2988
|
}
|
|
2989
|
-
function
|
|
2989
|
+
function fr(e) {
|
|
2990
2990
|
const t = document.createElement("div");
|
|
2991
2991
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2992
2992
|
for (const n of e)
|
|
2993
|
-
t.appendChild(
|
|
2993
|
+
t.appendChild(or(n));
|
|
2994
2994
|
return t;
|
|
2995
2995
|
}
|
|
2996
|
-
function
|
|
2996
|
+
function wr(e) {
|
|
2997
2997
|
const t = document.createElement("button");
|
|
2998
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
2998
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(er()), t.addEventListener("click", (n) => {
|
|
2999
2999
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
3000
3000
|
}), t;
|
|
3001
3001
|
}
|
|
3002
|
-
function
|
|
3002
|
+
function br(e, t) {
|
|
3003
3003
|
const n = document.createElement("article");
|
|
3004
3004
|
n.className = "pluno-pa-widget__share-prompt";
|
|
3005
3005
|
const o = document.createElement("div");
|
|
3006
3006
|
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
|
|
3007
|
-
|
|
3007
|
+
ve(
|
|
3008
3008
|
"pluno-pa-widget__share-prompt-icon",
|
|
3009
3009
|
t.characterIconOptions
|
|
3010
3010
|
)
|
|
@@ -3023,10 +3023,10 @@ function wr(e, t) {
|
|
|
3023
3023
|
p.className = "pluno-pa-widget__share-prompt-actions";
|
|
3024
3024
|
const s = document.createElement("div");
|
|
3025
3025
|
s.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
3026
|
-
const
|
|
3027
|
-
if (
|
|
3026
|
+
const g = document.createElement("button");
|
|
3027
|
+
if (g.type = "button", g.disabled = t.isDrafting, g.addEventListener("click", () => {
|
|
3028
3028
|
t.onDraft(e);
|
|
3029
|
-
}), t.isDrafting ? (
|
|
3029
|
+
}), t.isDrafting ? (g.appendChild(dn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
|
|
3030
3030
|
p.appendChild(s);
|
|
3031
3031
|
else {
|
|
3032
3032
|
const c = document.createElement("button");
|
|
@@ -3040,10 +3040,10 @@ function wr(e, t) {
|
|
|
3040
3040
|
}
|
|
3041
3041
|
return o.appendChild(p), n.appendChild(o), n;
|
|
3042
3042
|
}
|
|
3043
|
-
function
|
|
3043
|
+
function _r(e, t) {
|
|
3044
3044
|
const n = document.createElement("div");
|
|
3045
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
3046
|
-
|
|
3045
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (u) => {
|
|
3046
|
+
u.target === n && t.onClose();
|
|
3047
3047
|
});
|
|
3048
3048
|
const o = document.createElement("section");
|
|
3049
3049
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
@@ -3055,56 +3055,56 @@ function br(e, t) {
|
|
|
3055
3055
|
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
3056
3056
|
const s = document.createElement("div");
|
|
3057
3057
|
s.className = "pluno-pa-widget__share-dialog-step";
|
|
3058
|
-
const
|
|
3059
|
-
|
|
3058
|
+
const g = document.createElement("div");
|
|
3059
|
+
g.className = "pluno-pa-widget__share-dialog-step-header";
|
|
3060
3060
|
const c = document.createElement("strong");
|
|
3061
|
-
c.textContent = "1) Copy Screenshot",
|
|
3062
|
-
const h =
|
|
3061
|
+
c.textContent = "1) Copy Screenshot", g.appendChild(c);
|
|
3062
|
+
const h = xr(
|
|
3063
3063
|
"Copy Screenshot",
|
|
3064
3064
|
async () => {
|
|
3065
3065
|
try {
|
|
3066
|
-
return await
|
|
3066
|
+
return await wi(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
3067
3067
|
} catch {
|
|
3068
3068
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
3069
3069
|
}
|
|
3070
3070
|
}
|
|
3071
3071
|
);
|
|
3072
|
-
if (
|
|
3073
|
-
const
|
|
3074
|
-
|
|
3075
|
-
const
|
|
3076
|
-
|
|
3072
|
+
if (g.appendChild(h), s.appendChild(g), e.screenshotDataUrl) {
|
|
3073
|
+
const u = document.createElement("div");
|
|
3074
|
+
u.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
3075
|
+
const v = document.createElement("img");
|
|
3076
|
+
v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", u.appendChild(v), s.appendChild(u);
|
|
3077
3077
|
}
|
|
3078
3078
|
o.appendChild(s), o.appendChild(p);
|
|
3079
|
-
const
|
|
3080
|
-
|
|
3081
|
-
const
|
|
3082
|
-
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3085
|
-
const
|
|
3086
|
-
|
|
3087
|
-
for (const
|
|
3088
|
-
const
|
|
3089
|
-
|
|
3079
|
+
const C = document.createElement("div");
|
|
3080
|
+
C.className = "pluno-pa-widget__share-dialog-step";
|
|
3081
|
+
const P = document.createElement("strong");
|
|
3082
|
+
P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", C.appendChild(P);
|
|
3083
|
+
const I = document.createElement("p");
|
|
3084
|
+
I.className = "pluno-pa-widget__share-dialog-hint", I.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(I);
|
|
3085
|
+
const D = document.createElement("footer");
|
|
3086
|
+
D.className = "pluno-pa-widget__share-dialog-platforms";
|
|
3087
|
+
for (const u of yr(e)) {
|
|
3088
|
+
const v = document.createElement("a");
|
|
3089
|
+
v.href = u.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = u.label, v.setAttribute("aria-label", `Open ${u.label}`), v.appendChild(vr(u.id)), D.appendChild(v);
|
|
3090
3090
|
}
|
|
3091
|
-
if (
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3094
|
-
const
|
|
3095
|
-
|
|
3091
|
+
if (C.appendChild(D), o.appendChild(C), t.socialPostRewardsUrl) {
|
|
3092
|
+
const u = document.createElement("div");
|
|
3093
|
+
u.className = "pluno-pa-widget__share-dialog-step";
|
|
3094
|
+
const v = document.createElement("strong");
|
|
3095
|
+
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", u.appendChild(v);
|
|
3096
3096
|
const m = document.createElement("a");
|
|
3097
|
-
m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(
|
|
3097
|
+
m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Cr()), u.appendChild(m), o.appendChild(u);
|
|
3098
3098
|
}
|
|
3099
3099
|
return n.appendChild(o), n;
|
|
3100
3100
|
}
|
|
3101
|
-
function
|
|
3101
|
+
function xr(e, t) {
|
|
3102
3102
|
const n = document.createElement("button");
|
|
3103
3103
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
3104
3104
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
3105
3105
|
}), n;
|
|
3106
3106
|
}
|
|
3107
|
-
function
|
|
3107
|
+
function yr(e) {
|
|
3108
3108
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
3109
3109
|
return [
|
|
3110
3110
|
{
|
|
@@ -3124,87 +3124,87 @@ function xr(e) {
|
|
|
3124
3124
|
}
|
|
3125
3125
|
];
|
|
3126
3126
|
}
|
|
3127
|
-
function
|
|
3127
|
+
function vr(e) {
|
|
3128
3128
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3129
|
-
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (
|
|
3129
|
+
return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (G(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), G(
|
|
3130
3130
|
t,
|
|
3131
3131
|
"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"
|
|
3132
|
-
),
|
|
3132
|
+
), G(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), G(
|
|
3133
3133
|
t,
|
|
3134
3134
|
"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"
|
|
3135
|
-
),
|
|
3135
|
+
), G(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (G(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), G(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), G(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (G(
|
|
3136
3136
|
t,
|
|
3137
3137
|
"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"
|
|
3138
|
-
),
|
|
3138
|
+
), G(
|
|
3139
3139
|
t,
|
|
3140
3140
|
"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",
|
|
3141
3141
|
"0.48"
|
|
3142
|
-
),
|
|
3142
|
+
), G(
|
|
3143
3143
|
t,
|
|
3144
3144
|
"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"
|
|
3145
|
-
),
|
|
3145
|
+
), G(
|
|
3146
3146
|
t,
|
|
3147
3147
|
"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"
|
|
3148
3148
|
), t);
|
|
3149
3149
|
}
|
|
3150
|
-
function
|
|
3150
|
+
function G(e, t, n) {
|
|
3151
3151
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3152
3152
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
3153
3153
|
}
|
|
3154
|
-
function
|
|
3154
|
+
function Cr() {
|
|
3155
3155
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3156
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
3156
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), G(e, "M14 5h5v5"), G(e, "M19 5l-8 8"), G(
|
|
3157
3157
|
e,
|
|
3158
3158
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
3159
3159
|
), e;
|
|
3160
3160
|
}
|
|
3161
|
-
function
|
|
3162
|
-
return e.role === "tool" && e.toolName ===
|
|
3161
|
+
function Uo(e) {
|
|
3162
|
+
return e.role === "tool" && e.toolName === wo;
|
|
3163
3163
|
}
|
|
3164
|
-
function
|
|
3164
|
+
function lo(e) {
|
|
3165
3165
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
3166
3166
|
}
|
|
3167
|
-
function
|
|
3167
|
+
function Sr(e, t, n, o) {
|
|
3168
3168
|
const i = document.createElement("article");
|
|
3169
3169
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
3170
3170
|
e[e.length - 1].createdAt
|
|
3171
3171
|
).toLocaleString(), i.appendChild(
|
|
3172
|
-
|
|
3172
|
+
ve(
|
|
3173
3173
|
"pluno-pa-widget__character--tool-group",
|
|
3174
3174
|
o
|
|
3175
3175
|
)
|
|
3176
3176
|
);
|
|
3177
|
-
const r = document.createElement("details"), l =
|
|
3177
|
+
const r = document.createElement("details"), l = Er(e);
|
|
3178
3178
|
r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
|
|
3179
3179
|
i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
|
|
3180
3180
|
});
|
|
3181
3181
|
const p = document.createElement("summary");
|
|
3182
3182
|
p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(dn());
|
|
3183
|
-
const
|
|
3184
|
-
if (
|
|
3183
|
+
const g = document.createElement("span");
|
|
3184
|
+
if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = e[e.length - 1].content || "Run tool", p.appendChild(g), r.appendChild(p), e.length > 0) {
|
|
3185
3185
|
const c = document.createElement("div");
|
|
3186
3186
|
c.className = "pluno-pa-widget__tool-lines";
|
|
3187
3187
|
for (const h of e) {
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
const
|
|
3191
|
-
|
|
3188
|
+
const C = document.createElement("div");
|
|
3189
|
+
C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(dn());
|
|
3190
|
+
const P = document.createElement("span");
|
|
3191
|
+
P.textContent = h.content || "Run tool", C.appendChild(P), c.appendChild(C);
|
|
3192
3192
|
}
|
|
3193
3193
|
r.appendChild(c);
|
|
3194
3194
|
}
|
|
3195
3195
|
return i.appendChild(r), i;
|
|
3196
3196
|
}
|
|
3197
|
-
function
|
|
3197
|
+
function Bo(e) {
|
|
3198
3198
|
const t = document.createElement("article");
|
|
3199
3199
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
3200
|
-
|
|
3200
|
+
ve(
|
|
3201
3201
|
"pluno-pa-widget__character--tool-group",
|
|
3202
3202
|
e
|
|
3203
3203
|
)
|
|
3204
3204
|
), t;
|
|
3205
3205
|
}
|
|
3206
|
-
function
|
|
3207
|
-
const t =
|
|
3206
|
+
function po(e) {
|
|
3207
|
+
const t = Bo(e);
|
|
3208
3208
|
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(_t()), t;
|
|
3209
3209
|
}
|
|
3210
3210
|
function _t(e = "Thinking...") {
|
|
@@ -3215,18 +3215,18 @@ function _t(e = "Thinking...") {
|
|
|
3215
3215
|
const o = document.createElement("span");
|
|
3216
3216
|
return o.textContent = e, t.appendChild(o), t;
|
|
3217
3217
|
}
|
|
3218
|
-
function
|
|
3218
|
+
function Er(e) {
|
|
3219
3219
|
return `tools:${e[0]?.id ?? ""}`;
|
|
3220
3220
|
}
|
|
3221
3221
|
function dn() {
|
|
3222
3222
|
const e = document.createElement("span");
|
|
3223
3223
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
3224
3224
|
}
|
|
3225
|
-
function
|
|
3226
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
3225
|
+
function Fo(e, t) {
|
|
3226
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ja() : Do());
|
|
3227
3227
|
}
|
|
3228
|
-
function
|
|
3229
|
-
const n =
|
|
3228
|
+
function kr(e, t) {
|
|
3229
|
+
const n = Ni(t).replace(/\r\n/g, `
|
|
3230
3230
|
`).split(`
|
|
3231
3231
|
`);
|
|
3232
3232
|
let o = 0;
|
|
@@ -3241,9 +3241,9 @@ function Er(e, t) {
|
|
|
3241
3241
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
3242
3242
|
c.push(n[o]), o += 1;
|
|
3243
3243
|
o += o < n.length ? 1 : 0;
|
|
3244
|
-
const h = document.createElement("pre"),
|
|
3245
|
-
|
|
3246
|
-
`), h.appendChild(
|
|
3244
|
+
const h = document.createElement("pre"), C = document.createElement("code");
|
|
3245
|
+
C.textContent = c.join(`
|
|
3246
|
+
`), h.appendChild(C), e.appendChild(h);
|
|
3247
3247
|
continue;
|
|
3248
3248
|
}
|
|
3249
3249
|
const l = i.match(/^(#{1,3})\s+(.+)$/);
|
|
@@ -3274,10 +3274,10 @@ function Er(e, t) {
|
|
|
3274
3274
|
const s = [i];
|
|
3275
3275
|
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]); )
|
|
3276
3276
|
s.push(n[o]), o += 1;
|
|
3277
|
-
const
|
|
3277
|
+
const g = document.createElement("p");
|
|
3278
3278
|
s.forEach((c, h) => {
|
|
3279
|
-
h > 0 &&
|
|
3280
|
-
}), e.appendChild(
|
|
3279
|
+
h > 0 && g.appendChild(document.createElement("br")), gt(g, c);
|
|
3280
|
+
}), e.appendChild(g);
|
|
3281
3281
|
}
|
|
3282
3282
|
}
|
|
3283
3283
|
function gt(e, t) {
|
|
@@ -3300,7 +3300,7 @@ function gt(e, t) {
|
|
|
3300
3300
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
3301
3301
|
} else {
|
|
3302
3302
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
3303
|
-
if (p &&
|
|
3303
|
+
if (p && Lr(p[2])) {
|
|
3304
3304
|
const s = document.createElement("a");
|
|
3305
3305
|
s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
|
|
3306
3306
|
} else
|
|
@@ -3310,7 +3310,7 @@ function gt(e, t) {
|
|
|
3310
3310
|
}
|
|
3311
3311
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
3312
3312
|
}
|
|
3313
|
-
function
|
|
3313
|
+
function Lr(e) {
|
|
3314
3314
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
3315
3315
|
return !0;
|
|
3316
3316
|
try {
|
|
@@ -3320,8 +3320,8 @@ function kr(e) {
|
|
|
3320
3320
|
return !1;
|
|
3321
3321
|
}
|
|
3322
3322
|
}
|
|
3323
|
-
function
|
|
3324
|
-
if (
|
|
3323
|
+
function so(e, t) {
|
|
3324
|
+
if (Tr(e))
|
|
3325
3325
|
return;
|
|
3326
3326
|
const n = `
|
|
3327
3327
|
:host {
|
|
@@ -3380,7 +3380,7 @@ function po(e, t) {
|
|
|
3380
3380
|
--pluno-pa-accent-contrast: #fafafa;
|
|
3381
3381
|
position: fixed;
|
|
3382
3382
|
z-index: 2147483645;
|
|
3383
|
-
font-family: ${
|
|
3383
|
+
font-family: ${pe.fontFamily};
|
|
3384
3384
|
font-size: 14px;
|
|
3385
3385
|
color: var(--pluno-pa-text);
|
|
3386
3386
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -3635,6 +3635,22 @@ function po(e, t) {
|
|
|
3635
3635
|
padding: 0;
|
|
3636
3636
|
overflow: visible;
|
|
3637
3637
|
pointer-events: auto;
|
|
3638
|
+
isolation: isolate;
|
|
3639
|
+
}
|
|
3640
|
+
.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before {
|
|
3641
|
+
content: "";
|
|
3642
|
+
position: absolute;
|
|
3643
|
+
inset: 0;
|
|
3644
|
+
z-index: -1;
|
|
3645
|
+
border: 1px solid rgba(40, 36, 20, 0.45);
|
|
3646
|
+
border-radius: 999px;
|
|
3647
|
+
background-color: #fdfaf1;
|
|
3648
|
+
background-image:
|
|
3649
|
+
linear-gradient(rgba(96, 138, 188, 0.22) 1px, transparent 1px),
|
|
3650
|
+
linear-gradient(90deg, rgba(96, 138, 188, 0.22) 1px, transparent 1px);
|
|
3651
|
+
background-size: 22px 22px;
|
|
3652
|
+
filter: url(#pluno-pa-scribble-wobble-3);
|
|
3653
|
+
pointer-events: none;
|
|
3638
3654
|
}
|
|
3639
3655
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-input,
|
|
3640
3656
|
.pluno-pa-widget--minimized .pluno-pa-widget__launcher-drag-handle,
|
|
@@ -4486,7 +4502,7 @@ function po(e, t) {
|
|
|
4486
4502
|
place-items: center;
|
|
4487
4503
|
padding: 18px;
|
|
4488
4504
|
background: rgba(24, 24, 27, 0.28);
|
|
4489
|
-
font-family: var(--pluno-pa-font, ${
|
|
4505
|
+
font-family: var(--pluno-pa-font, ${pe.fontFamily});
|
|
4490
4506
|
color: var(--pluno-pa-text);
|
|
4491
4507
|
}
|
|
4492
4508
|
.pluno-pa-widget__share-dialog {
|
|
@@ -5410,18 +5426,10 @@ function po(e, t) {
|
|
|
5410
5426
|
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
|
|
5411
5427
|
border-radius: var(--pluno-pa-scribble-wobble);
|
|
5412
5428
|
}
|
|
5413
|
-
.pluno-pa-widget--scribble.pluno-pa-widget--minimized {
|
|
5414
|
-
--pluno-pa-launcher-width: 16px;
|
|
5415
|
-
--pluno-pa-launcher-height: 24px;
|
|
5416
|
-
}
|
|
5417
|
-
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
|
|
5418
|
-
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
|
|
5419
|
-
content: none;
|
|
5420
|
-
}
|
|
5421
5429
|
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
|
|
5422
|
-
left:
|
|
5423
|
-
width:
|
|
5424
|
-
height:
|
|
5430
|
+
left: 1px;
|
|
5431
|
+
width: 20px;
|
|
5432
|
+
height: 20px;
|
|
5425
5433
|
margin-top: 0;
|
|
5426
5434
|
}
|
|
5427
5435
|
.pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize {
|
|
@@ -5561,13 +5569,24 @@ function po(e, t) {
|
|
|
5561
5569
|
}
|
|
5562
5570
|
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
|
|
5563
5571
|
border: 0;
|
|
5572
|
+
border-radius: 999px;
|
|
5564
5573
|
width: var(--pluno-pa-launcher-width);
|
|
5565
5574
|
min-width: 0;
|
|
5566
5575
|
height: var(--pluno-pa-launcher-height);
|
|
5567
5576
|
min-height: 0;
|
|
5568
5577
|
padding: 0;
|
|
5569
5578
|
}
|
|
5570
|
-
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before
|
|
5579
|
+
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before {
|
|
5580
|
+
inset: 0;
|
|
5581
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
5582
|
+
border-radius: 999px;
|
|
5583
|
+
background-color: var(--pluno-pa-bg);
|
|
5584
|
+
background-image:
|
|
5585
|
+
linear-gradient(var(--pluno-pa-scribble-grid-line) 1px, transparent 1px),
|
|
5586
|
+
linear-gradient(90deg, var(--pluno-pa-scribble-grid-line) 1px, transparent 1px);
|
|
5587
|
+
background-size: 22px 22px;
|
|
5588
|
+
filter: url(#pluno-pa-scribble-wobble-3);
|
|
5589
|
+
}
|
|
5571
5590
|
.pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
|
|
5572
5591
|
content: none;
|
|
5573
5592
|
}
|
|
@@ -5668,28 +5687,28 @@ function po(e, t) {
|
|
|
5668
5687
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
5669
5688
|
}
|
|
5670
5689
|
`;
|
|
5671
|
-
if (
|
|
5690
|
+
if (Pr(e, n))
|
|
5672
5691
|
return;
|
|
5673
5692
|
const o = e.ownerDocument.createElement("style");
|
|
5674
|
-
o.id =
|
|
5693
|
+
o.id = ko, o.textContent = n, e.appendChild(o), Wo(e);
|
|
5675
5694
|
}
|
|
5676
|
-
function
|
|
5677
|
-
return e.getElementById(
|
|
5695
|
+
function Tr(e) {
|
|
5696
|
+
return e.getElementById(ko) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Lo) === "true";
|
|
5678
5697
|
}
|
|
5679
|
-
function
|
|
5680
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
5698
|
+
function Wo(e) {
|
|
5699
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Lo, "true");
|
|
5681
5700
|
}
|
|
5682
|
-
function
|
|
5701
|
+
function Pr(e, t) {
|
|
5683
5702
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
5684
5703
|
return !1;
|
|
5685
5704
|
try {
|
|
5686
5705
|
const n = new CSSStyleSheet();
|
|
5687
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
5706
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Wo(e), !0;
|
|
5688
5707
|
} catch {
|
|
5689
5708
|
return !1;
|
|
5690
5709
|
}
|
|
5691
5710
|
}
|
|
5692
|
-
async function
|
|
5711
|
+
async function Ir() {
|
|
5693
5712
|
return document.body ? document.body : await new Promise((e) => {
|
|
5694
5713
|
const t = new MutationObserver(() => {
|
|
5695
5714
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -5697,18 +5716,43 @@ async function Pr() {
|
|
|
5697
5716
|
t.observe(document.documentElement, { childList: !0 });
|
|
5698
5717
|
});
|
|
5699
5718
|
}
|
|
5700
|
-
function
|
|
5719
|
+
function mn(e) {
|
|
5701
5720
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5702
5721
|
}
|
|
5703
|
-
function
|
|
5722
|
+
function Ho(e) {
|
|
5723
|
+
return `${mn(e)}.displayState`;
|
|
5724
|
+
}
|
|
5725
|
+
function Ar(e) {
|
|
5726
|
+
try {
|
|
5727
|
+
return window.sessionStorage.getItem(
|
|
5728
|
+
Ho(e)
|
|
5729
|
+
) === "minimized" ? "minimized" : "shown";
|
|
5730
|
+
} catch {
|
|
5731
|
+
return "shown";
|
|
5732
|
+
}
|
|
5733
|
+
}
|
|
5734
|
+
function co(e, t) {
|
|
5735
|
+
if (e.layout === "floating")
|
|
5736
|
+
try {
|
|
5737
|
+
const n = Ho(e);
|
|
5738
|
+
if (t === "minimized") {
|
|
5739
|
+
window.sessionStorage.setItem(n, t);
|
|
5740
|
+
return;
|
|
5741
|
+
}
|
|
5742
|
+
window.sessionStorage.removeItem(n);
|
|
5743
|
+
} catch {
|
|
5744
|
+
return;
|
|
5745
|
+
}
|
|
5746
|
+
}
|
|
5747
|
+
function Nr(e) {
|
|
5704
5748
|
if (e)
|
|
5705
5749
|
return { clientId: e, release: () => {
|
|
5706
5750
|
} };
|
|
5707
5751
|
let t = 0;
|
|
5708
|
-
for (;
|
|
5752
|
+
for (; Ht.has(t); )
|
|
5709
5753
|
t += 1;
|
|
5710
|
-
|
|
5711
|
-
const n = `${
|
|
5754
|
+
Ht.add(t);
|
|
5755
|
+
const n = `${Vi}${t}`;
|
|
5712
5756
|
let o = crypto.randomUUID();
|
|
5713
5757
|
try {
|
|
5714
5758
|
o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
|
|
@@ -5718,15 +5762,15 @@ function Ir(e) {
|
|
|
5718
5762
|
return {
|
|
5719
5763
|
clientId: o,
|
|
5720
5764
|
release: () => {
|
|
5721
|
-
i || (i = !0,
|
|
5765
|
+
i || (i = !0, Ht.delete(t));
|
|
5722
5766
|
}
|
|
5723
5767
|
};
|
|
5724
5768
|
}
|
|
5725
|
-
function
|
|
5769
|
+
function Rr(e) {
|
|
5726
5770
|
try {
|
|
5727
|
-
const t = window.localStorage.getItem(
|
|
5771
|
+
const t = window.localStorage.getItem(mn(e));
|
|
5728
5772
|
if (!t)
|
|
5729
|
-
return
|
|
5773
|
+
return uo();
|
|
5730
5774
|
const n = JSON.parse(t);
|
|
5731
5775
|
return {
|
|
5732
5776
|
isOpen: n.isOpen === !0,
|
|
@@ -5736,25 +5780,25 @@ function Ar(e) {
|
|
|
5736
5780
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
|
|
5737
5781
|
(o) => typeof o == "string"
|
|
5738
5782
|
) : [],
|
|
5739
|
-
launcherPosition:
|
|
5740
|
-
panelSize:
|
|
5741
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
5783
|
+
launcherPosition: Or(n.launcherPosition) ? n.launcherPosition : null,
|
|
5784
|
+
panelSize: Ur(n.panelSize) ? xt(n.panelSize) : null,
|
|
5785
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-bo) : [],
|
|
5742
5786
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
5743
5787
|
};
|
|
5744
5788
|
} catch {
|
|
5745
|
-
return
|
|
5789
|
+
return uo();
|
|
5746
5790
|
}
|
|
5747
5791
|
}
|
|
5748
|
-
async function
|
|
5792
|
+
async function Dr(e) {
|
|
5749
5793
|
if (e.loadSharePromptsDisabled)
|
|
5750
5794
|
return e.loadSharePromptsDisabled();
|
|
5751
5795
|
try {
|
|
5752
|
-
return window.localStorage.getItem(
|
|
5796
|
+
return window.localStorage.getItem(xo) === "true";
|
|
5753
5797
|
} catch {
|
|
5754
5798
|
return !1;
|
|
5755
5799
|
}
|
|
5756
5800
|
}
|
|
5757
|
-
function
|
|
5801
|
+
function zr(e, t) {
|
|
5758
5802
|
if (e.persistSharePromptsDisabled) {
|
|
5759
5803
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
|
|
5760
5804
|
() => {
|
|
@@ -5763,12 +5807,12 @@ function Rr(e, t) {
|
|
|
5763
5807
|
return;
|
|
5764
5808
|
}
|
|
5765
5809
|
try {
|
|
5766
|
-
t && window.localStorage.setItem(
|
|
5810
|
+
t && window.localStorage.setItem(xo, "true");
|
|
5767
5811
|
} catch {
|
|
5768
5812
|
return;
|
|
5769
5813
|
}
|
|
5770
5814
|
}
|
|
5771
|
-
function
|
|
5815
|
+
function uo() {
|
|
5772
5816
|
return {
|
|
5773
5817
|
isOpen: !1,
|
|
5774
5818
|
composerValue: "",
|
|
@@ -5781,29 +5825,29 @@ function so() {
|
|
|
5781
5825
|
sharePromptsDisabled: !1
|
|
5782
5826
|
};
|
|
5783
5827
|
}
|
|
5784
|
-
function
|
|
5828
|
+
function Mr(e, t) {
|
|
5785
5829
|
try {
|
|
5786
5830
|
window.localStorage.setItem(
|
|
5787
|
-
|
|
5831
|
+
mn(e),
|
|
5788
5832
|
JSON.stringify(t)
|
|
5789
5833
|
);
|
|
5790
5834
|
} catch {
|
|
5791
5835
|
return;
|
|
5792
5836
|
}
|
|
5793
5837
|
}
|
|
5794
|
-
function
|
|
5838
|
+
function Or(e) {
|
|
5795
5839
|
if (!e || typeof e != "object")
|
|
5796
5840
|
return !1;
|
|
5797
5841
|
const t = e;
|
|
5798
5842
|
return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
|
|
5799
5843
|
}
|
|
5800
|
-
function
|
|
5844
|
+
function Ur(e) {
|
|
5801
5845
|
if (!e || typeof e != "object")
|
|
5802
5846
|
return !1;
|
|
5803
5847
|
const t = e;
|
|
5804
5848
|
return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
|
|
5805
5849
|
}
|
|
5806
|
-
async function
|
|
5850
|
+
async function $o(e, t) {
|
|
5807
5851
|
const n = await fetch(e, {
|
|
5808
5852
|
method: "POST",
|
|
5809
5853
|
credentials: "include",
|
|
@@ -5815,7 +5859,7 @@ async function Ho(e, t) {
|
|
|
5815
5859
|
...t ? { signal: t } : {}
|
|
5816
5860
|
});
|
|
5817
5861
|
if (!n.ok) {
|
|
5818
|
-
const i = await n.text(), r =
|
|
5862
|
+
const i = await n.text(), r = si(i);
|
|
5819
5863
|
throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
|
|
5820
5864
|
}
|
|
5821
5865
|
const o = await n.json();
|
|
@@ -5823,29 +5867,29 @@ async function Ho(e, t) {
|
|
|
5823
5867
|
throw new Error("Pluno token endpoint did not return a token");
|
|
5824
5868
|
return o.token;
|
|
5825
5869
|
}
|
|
5826
|
-
function
|
|
5870
|
+
function Br(e) {
|
|
5827
5871
|
let t = !1, n = !1;
|
|
5828
5872
|
const o = async () => {
|
|
5829
5873
|
const i = new AbortController();
|
|
5830
5874
|
let r = !1;
|
|
5831
5875
|
const l = new Promise((p, s) => {
|
|
5832
|
-
const
|
|
5833
|
-
r = !0, i.abort(), s(new Error(
|
|
5834
|
-
},
|
|
5876
|
+
const g = window.setTimeout(() => {
|
|
5877
|
+
r = !0, i.abort(), s(new Error(Bn));
|
|
5878
|
+
}, qi);
|
|
5835
5879
|
i.signal.addEventListener(
|
|
5836
5880
|
"abort",
|
|
5837
|
-
() => window.clearTimeout(
|
|
5881
|
+
() => window.clearTimeout(g),
|
|
5838
5882
|
{ once: !0 }
|
|
5839
5883
|
);
|
|
5840
5884
|
});
|
|
5841
5885
|
try {
|
|
5842
5886
|
const p = await Promise.race([
|
|
5843
|
-
|
|
5887
|
+
$o(e, i.signal),
|
|
5844
5888
|
l
|
|
5845
5889
|
]);
|
|
5846
5890
|
return i.abort(), p;
|
|
5847
5891
|
} catch (p) {
|
|
5848
|
-
throw i.abort(), r ? new Error(
|
|
5892
|
+
throw i.abort(), r ? new Error(Bn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(ji);
|
|
5849
5893
|
}
|
|
5850
5894
|
};
|
|
5851
5895
|
return {
|
|
@@ -5868,32 +5912,32 @@ function Or(e) {
|
|
|
5868
5912
|
}
|
|
5869
5913
|
};
|
|
5870
5914
|
}
|
|
5871
|
-
const
|
|
5872
|
-
function
|
|
5915
|
+
const go = /* @__PURE__ */ new WeakSet();
|
|
5916
|
+
function Fr(e) {
|
|
5873
5917
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5874
5918
|
}
|
|
5875
|
-
function
|
|
5919
|
+
function ho(e) {
|
|
5876
5920
|
const t = e.pathname.split("/");
|
|
5877
5921
|
return t[t.length - 1] ?? "";
|
|
5878
5922
|
}
|
|
5879
|
-
function
|
|
5923
|
+
function Wr(e, t) {
|
|
5880
5924
|
const n = new URL(e.src, document.baseURI);
|
|
5881
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
5925
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : ho(n) === ho(t);
|
|
5882
5926
|
}
|
|
5883
|
-
class
|
|
5927
|
+
class fe extends EventTarget {
|
|
5884
5928
|
constructor(t, n) {
|
|
5885
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
5886
|
-
this.readyState =
|
|
5887
|
-
}), this.addPreviewListener(
|
|
5929
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(Fi, () => {
|
|
5930
|
+
this.readyState = fe.OPEN, this.dispatchEvent(new Event("open"));
|
|
5931
|
+
}), this.addPreviewListener(Wi, (o) => {
|
|
5888
5932
|
const i = o;
|
|
5889
5933
|
this.dispatchEvent(
|
|
5890
5934
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5891
5935
|
);
|
|
5892
|
-
}), this.addPreviewListener(
|
|
5893
|
-
this.readyState =
|
|
5894
|
-
}), this.addPreviewListener(
|
|
5936
|
+
}), this.addPreviewListener(Hi, () => {
|
|
5937
|
+
this.readyState = fe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5938
|
+
}), this.addPreviewListener($i, (o) => {
|
|
5895
5939
|
const i = o;
|
|
5896
|
-
this.readyState =
|
|
5940
|
+
this.readyState = fe.CLOSED, this.dispatchEvent(
|
|
5897
5941
|
new CloseEvent("close", {
|
|
5898
5942
|
code: i.detail?.code ?? 1e3,
|
|
5899
5943
|
reason: i.detail?.reason ?? "",
|
|
@@ -5903,7 +5947,7 @@ class me extends EventTarget {
|
|
|
5903
5947
|
}), window.dispatchEvent(
|
|
5904
5948
|
new CustomEvent(
|
|
5905
5949
|
ht(
|
|
5906
|
-
|
|
5950
|
+
Oi,
|
|
5907
5951
|
this.channelId
|
|
5908
5952
|
),
|
|
5909
5953
|
{
|
|
@@ -5922,18 +5966,18 @@ class me extends EventTarget {
|
|
|
5922
5966
|
extensions = "";
|
|
5923
5967
|
binaryType = "blob";
|
|
5924
5968
|
bufferedAmount = 0;
|
|
5925
|
-
readyState =
|
|
5926
|
-
socketId =
|
|
5969
|
+
readyState = fe.CONNECTING;
|
|
5970
|
+
socketId = Hr();
|
|
5927
5971
|
listeners = /* @__PURE__ */ new Map();
|
|
5928
5972
|
send(t) {
|
|
5929
|
-
if (this.readyState !==
|
|
5973
|
+
if (this.readyState !== fe.OPEN)
|
|
5930
5974
|
throw new DOMException(
|
|
5931
5975
|
"Pluno preview websocket is not open",
|
|
5932
5976
|
"InvalidStateError"
|
|
5933
5977
|
);
|
|
5934
5978
|
window.dispatchEvent(
|
|
5935
5979
|
new CustomEvent(
|
|
5936
|
-
ht(
|
|
5980
|
+
ht(Ui, this.channelId),
|
|
5937
5981
|
{
|
|
5938
5982
|
detail: {
|
|
5939
5983
|
socketId: this.socketId,
|
|
@@ -5944,9 +5988,9 @@ class me extends EventTarget {
|
|
|
5944
5988
|
);
|
|
5945
5989
|
}
|
|
5946
5990
|
close(t, n) {
|
|
5947
|
-
this.readyState !==
|
|
5991
|
+
this.readyState !== fe.CLOSED && (this.readyState = fe.CLOSING, window.dispatchEvent(
|
|
5948
5992
|
new CustomEvent(
|
|
5949
|
-
ht(
|
|
5993
|
+
ht(Bi, this.channelId),
|
|
5950
5994
|
{
|
|
5951
5995
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
5952
5996
|
}
|
|
@@ -5968,19 +6012,19 @@ class me extends EventTarget {
|
|
|
5968
6012
|
this.listeners.clear();
|
|
5969
6013
|
}
|
|
5970
6014
|
}
|
|
5971
|
-
function
|
|
6015
|
+
function Hr() {
|
|
5972
6016
|
const e = window.sessionStorage.getItem(
|
|
5973
|
-
|
|
6017
|
+
Un
|
|
5974
6018
|
);
|
|
5975
6019
|
if (e)
|
|
5976
6020
|
return e;
|
|
5977
6021
|
const t = crypto.randomUUID();
|
|
5978
|
-
return window.sessionStorage.setItem(
|
|
6022
|
+
return window.sessionStorage.setItem(Un, t), t;
|
|
5979
6023
|
}
|
|
5980
6024
|
function ht(e, t) {
|
|
5981
6025
|
return `${e}:${t}`;
|
|
5982
6026
|
}
|
|
5983
|
-
function
|
|
6027
|
+
function $r(e) {
|
|
5984
6028
|
const t = document.currentScript;
|
|
5985
6029
|
if (t instanceof HTMLScriptElement)
|
|
5986
6030
|
return [t];
|
|
@@ -5988,35 +6032,35 @@ function Hr(e) {
|
|
|
5988
6032
|
return Array.from(
|
|
5989
6033
|
document.querySelectorAll("script[type='module'][src]")
|
|
5990
6034
|
).filter(
|
|
5991
|
-
(i) => i instanceof HTMLScriptElement &&
|
|
6035
|
+
(i) => i instanceof HTMLScriptElement && Fr(i) && Wr(i, o)
|
|
5992
6036
|
);
|
|
5993
6037
|
}
|
|
5994
|
-
function
|
|
5995
|
-
for (const t of
|
|
5996
|
-
|
|
6038
|
+
function Gr(e) {
|
|
6039
|
+
for (const t of $r(e))
|
|
6040
|
+
go.has(t) || t.dataset.plunoAutoMount === "false" || (go.add(t), Go(t).catch((n) => {
|
|
5997
6041
|
console.error("Failed to mount Pluno widget", n);
|
|
5998
6042
|
}));
|
|
5999
6043
|
}
|
|
6000
|
-
function
|
|
6001
|
-
const t = window, n = t[
|
|
6044
|
+
function Go(e) {
|
|
6045
|
+
const t = window, n = t[me];
|
|
6002
6046
|
if (n) {
|
|
6003
6047
|
if (n.host === null)
|
|
6004
6048
|
return n.mountPromise.catch(() => {
|
|
6005
|
-
const s = t[
|
|
6006
|
-
return s ? s.mountPromise :
|
|
6049
|
+
const s = t[me];
|
|
6050
|
+
return s ? s.mountPromise : Go(e);
|
|
6007
6051
|
});
|
|
6008
|
-
if (
|
|
6052
|
+
if (qr(n.host))
|
|
6009
6053
|
return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
|
|
6010
|
-
n.destroy?.(), delete t[
|
|
6054
|
+
n.destroy?.(), delete t[me];
|
|
6011
6055
|
}
|
|
6012
|
-
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ?
|
|
6056
|
+
const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !o && i ? Br(i) : null;
|
|
6013
6057
|
let l;
|
|
6014
|
-
const p =
|
|
6058
|
+
const p = ga({
|
|
6015
6059
|
token: e.dataset.plunoToken,
|
|
6016
6060
|
tokenProvider: r?.loadToken,
|
|
6017
6061
|
tokenEndpoint: i,
|
|
6018
6062
|
backendUrl: e.dataset.plunoBackendUrl,
|
|
6019
|
-
webSocketFactory: o ?
|
|
6063
|
+
webSocketFactory: o ? ua(o) : void 0,
|
|
6020
6064
|
launcherLabel: e.dataset.plunoLauncherLabel,
|
|
6021
6065
|
accentColor: e.dataset.plunoAccentColor,
|
|
6022
6066
|
colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -6024,29 +6068,29 @@ function Wo(e) {
|
|
|
6024
6068
|
scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
|
|
6025
6069
|
position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
6026
6070
|
}).then((s) => {
|
|
6027
|
-
if (t[
|
|
6071
|
+
if (t[me] !== l) {
|
|
6028
6072
|
s.destroy();
|
|
6029
6073
|
return;
|
|
6030
6074
|
}
|
|
6031
|
-
const
|
|
6032
|
-
|
|
6033
|
-
t[
|
|
6075
|
+
const g = s.host;
|
|
6076
|
+
g.setAttribute(_o, "true"), l.host = g, l.destroy = () => {
|
|
6077
|
+
t[me] === l && delete t[me], l.host = null, l.destroy = null, s.destroy();
|
|
6034
6078
|
};
|
|
6035
6079
|
}).catch((s) => {
|
|
6036
|
-
throw t[
|
|
6080
|
+
throw t[me] === l && delete t[me], s;
|
|
6037
6081
|
});
|
|
6038
6082
|
return l = {
|
|
6039
6083
|
mountPromise: p,
|
|
6040
6084
|
host: null,
|
|
6041
6085
|
destroy: null,
|
|
6042
6086
|
retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
|
|
6043
|
-
}, t[
|
|
6087
|
+
}, t[me] = l, p;
|
|
6044
6088
|
}
|
|
6045
|
-
function
|
|
6046
|
-
return e.isConnected && e.getAttribute(
|
|
6089
|
+
function qr(e) {
|
|
6090
|
+
return e.isConnected && e.getAttribute(_o) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|
|
6047
6091
|
}
|
|
6048
|
-
|
|
6092
|
+
Gr(import.meta.url);
|
|
6049
6093
|
export {
|
|
6050
|
-
|
|
6051
|
-
|
|
6094
|
+
ua as createProductAgentPreviewBridgeWebSocketFactory,
|
|
6095
|
+
ga as mountPlunoProductAgentWidget
|
|
6052
6096
|
};
|