@pluno/product-agent-web 0.1.53 → 0.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attachmentStorage.d.ts +18 -0
- package/dist/index.d.ts +39 -3
- package/dist/product-agent-sdk.js +838 -391
- package/dist/product-agent-widget.js +1254 -1298
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as Jn } from "./product-agent-sdk.js";
|
|
2
|
+
const Qn = "#7c3aed", $e = "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", qe = "#2c2a1e", zt = [253, 250, 241], Bt = 3.5;
|
|
3
|
+
function hn(e) {
|
|
4
|
+
const t = mn(e);
|
|
5
|
+
if (Ut(De(t), zt) >= Bt)
|
|
6
6
|
return t;
|
|
7
|
-
let
|
|
8
|
-
const i =
|
|
7
|
+
let n = De(t);
|
|
8
|
+
const i = De(qe);
|
|
9
9
|
for (let a = 0; a < 6; a += 1)
|
|
10
|
-
if (
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (n = no(n, i, 0.22), Ut(n, zt) >= Bt)
|
|
11
|
+
return ut(n);
|
|
12
|
+
return ut(n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
let
|
|
14
|
+
function eo() {
|
|
15
|
+
let o = "M 280 120", n = !1, i = 0;
|
|
16
16
|
for (let a = 150; a <= 1170; a += 62) {
|
|
17
|
-
const l = (i % 3 - 1) * 18, p =
|
|
18
|
-
|
|
17
|
+
const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
|
|
18
|
+
o += ` L ${p} ${a}`, n = !n, i += 1;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return o;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
24
|
-
return
|
|
22
|
+
function to(e) {
|
|
23
|
+
const t = mn(e), o = gt(De(t));
|
|
24
|
+
return o > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
27
27
|
bottom: "#e7e7e7",
|
|
@@ -32,7 +32,7 @@ function Xn(e) {
|
|
|
32
32
|
highlight: "#ffffff",
|
|
33
33
|
inner: "#f4f4f4",
|
|
34
34
|
shadow: "#9d9d9d"
|
|
35
|
-
} :
|
|
35
|
+
} : o < 0.05 ? {
|
|
36
36
|
top: "#3d3d3d",
|
|
37
37
|
middle: "#171717",
|
|
38
38
|
bottom: "#030303",
|
|
@@ -44,187 +44,179 @@ function Xn(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: Z(t, 0.28, -0.03),
|
|
48
|
+
middle: Z(t, 0.08, 0.04),
|
|
49
|
+
bottom: Z(t, -0.1, 0.02),
|
|
50
|
+
edgeStart: Z(t, 0.08, 0.08),
|
|
51
|
+
edgeMiddle: Z(t, -0.08, 0.08),
|
|
52
|
+
edgeEnd: Z(t, -0.18, 0.05),
|
|
53
|
+
glow: Z(t, 0.32, -0.12),
|
|
54
|
+
highlight: Z(t, 0.38, -0.18),
|
|
55
|
+
inner: Z(t, 0.24, -0.1),
|
|
56
|
+
shadow: Z(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function mn(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((
|
|
61
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : Qn;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function De(e) {
|
|
64
64
|
return [
|
|
65
65
|
Number.parseInt(e.slice(1, 3), 16),
|
|
66
66
|
Number.parseInt(e.slice(3, 5), 16),
|
|
67
67
|
Number.parseInt(e.slice(5, 7), 16)
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
72
|
-
return `#${
|
|
70
|
+
function ut([e, t, o]) {
|
|
71
|
+
const n = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
|
|
72
|
+
return `#${n(e)}${n(t)}${n(o)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const
|
|
74
|
+
function gt([e, t, o]) {
|
|
75
|
+
const n = (i) => {
|
|
76
76
|
const a = i / 255;
|
|
77
77
|
return a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
|
-
return 0.2126 *
|
|
79
|
+
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const
|
|
81
|
+
function Ut(e, t) {
|
|
82
|
+
const o = gt(e), n = gt(t), [i, a] = o > n ? [o, n] : [n, o];
|
|
83
83
|
return (i + 0.05) / (a + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
85
|
+
function no(e, t, o) {
|
|
86
|
+
const n = ht(o);
|
|
87
87
|
return [
|
|
88
|
-
e[0] + (t[0] - e[0]) *
|
|
89
|
-
e[1] + (t[1] - e[1]) *
|
|
90
|
-
e[2] + (t[2] - e[2]) *
|
|
88
|
+
e[0] + (t[0] - e[0]) * n,
|
|
89
|
+
e[1] + (t[1] - e[1]) * n,
|
|
90
|
+
e[2] + (t[2] - e[2]) * n
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const [
|
|
95
|
-
return
|
|
93
|
+
function Z(e, t, o) {
|
|
94
|
+
const [n, i, a] = oo(De(e));
|
|
95
|
+
return ut(io(n, ht(i + o), ht(a + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const
|
|
97
|
+
function oo([e, t, o]) {
|
|
98
|
+
const n = e / 255, i = t / 255, a = o / 255, l = Math.max(n, i, a), p = Math.min(n, i, a), c = (l + p) / 2;
|
|
99
99
|
if (l === p)
|
|
100
100
|
return [0, 0, c];
|
|
101
101
|
const u = l - p, d = c > 0.5 ? u / (2 - l - p) : u / (l + p);
|
|
102
|
-
return [(l ===
|
|
102
|
+
return [(l === n ? (i - a) / u + (i < a ? 6 : 0) : l === i ? (a - n) / u + 2 : (n - i) / u + 4) / 6, d, c];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function io(e, t, o) {
|
|
105
105
|
if (t === 0)
|
|
106
|
-
return [
|
|
107
|
-
const
|
|
106
|
+
return [o * 255, o * 255, o * 255];
|
|
107
|
+
const n = o < 0.5 ? o * (1 + t) : o + t - o * t, i = 2 * o - n;
|
|
108
108
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
at(i, n, e + 1 / 3) * 255,
|
|
110
|
+
at(i, n, e) * 255,
|
|
111
|
+
at(i, n, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
let
|
|
116
|
-
return
|
|
114
|
+
function at(e, t, o) {
|
|
115
|
+
let n = o;
|
|
116
|
+
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function ht(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const bn = "suggest_share_on_socials";
|
|
122
|
+
function ao(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
124
|
+
const o = e[t];
|
|
125
|
+
if (o.role !== "tool" || o.toolName !== bn)
|
|
126
126
|
continue;
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
127
|
+
const n = Ot(e, t, "assistant");
|
|
128
|
+
if (!n)
|
|
129
129
|
return null;
|
|
130
|
-
const i =
|
|
130
|
+
const i = Ot(e, n.index, "user");
|
|
131
131
|
return i ? {
|
|
132
|
-
id: `share:${
|
|
132
|
+
id: `share:${o.callId ?? o.id}`,
|
|
133
133
|
userPrompt: i.content,
|
|
134
|
-
assistantAnswer:
|
|
134
|
+
assistantAnswer: n.content
|
|
135
135
|
} : null;
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function ro(e) {
|
|
140
|
+
const t = await lo(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
|
|
146
|
-
for (let
|
|
147
|
-
const i = e[
|
|
148
|
-
if (i.role ===
|
|
149
|
-
return { index:
|
|
145
|
+
function Ot(e, t, o) {
|
|
146
|
+
for (let n = t - 1; n >= 0; n -= 1) {
|
|
147
|
+
const i = e[n];
|
|
148
|
+
if (i.role === o && i.content.trim())
|
|
149
|
+
return { index: n, content: i.content.trim() };
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function lo(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
let
|
|
156
|
+
const po = "https://app.pluno.ai", so = "/api/product-agent/embed/active-users", co = 1800, uo = 15e3, go = 250, ho = 1e3, mo = 3e4;
|
|
157
|
+
function bo(e, t = {}) {
|
|
158
|
+
let o = !1, n = null, i = null, a = null;
|
|
159
159
|
const l = () => {
|
|
160
160
|
a !== null && (window.clearInterval(a), a = null);
|
|
161
161
|
}, p = (d) => {
|
|
162
|
-
|
|
162
|
+
o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
|
|
163
163
|
u();
|
|
164
|
-
},
|
|
164
|
+
}, _o(d)));
|
|
165
165
|
}, c = (d) => {
|
|
166
|
-
if (l(),
|
|
167
|
-
|
|
166
|
+
if (l(), n === null) {
|
|
167
|
+
n = d, e(d);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
const
|
|
170
|
+
const g = n, S = performance.now();
|
|
171
171
|
a = window.setInterval(() => {
|
|
172
|
-
if (
|
|
172
|
+
if (o) {
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
},
|
|
176
|
+
const f = Math.min(1, (performance.now() - S) / co);
|
|
177
|
+
n = Math.round(g + (d - g) * xo(f)), e(n), f >= 1 && (n = d, e(d), l());
|
|
178
|
+
}, go);
|
|
179
179
|
}, u = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const d = await
|
|
182
|
-
if (
|
|
181
|
+
const d = await fo(t);
|
|
182
|
+
if (o)
|
|
183
183
|
return;
|
|
184
184
|
c(d.count), p(d.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(uo);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return u(), () => {
|
|
190
|
-
|
|
190
|
+
o = !0, i !== null && window.clearTimeout(i), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function fo(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const
|
|
196
|
+
const o = await (e.fetcher ?? fetch)(new URL(so, wo(e.backendUrl ?? po)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
200
|
-
if (!
|
|
200
|
+
if (!o.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const
|
|
202
|
+
const n = await o.json(), i = Ft(n.count), a = Ft(n.refreshAfterMs ?? n.refresh_after_ms);
|
|
203
203
|
if (i === null || a === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: i, refreshAfterMs: a };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Ft(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function wo(e) {
|
|
211
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return Math.min(
|
|
213
|
+
function _o(e) {
|
|
214
|
+
return Math.min(mo, Math.max(ho, e));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function xo(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
"image/png",
|
|
221
|
-
"image/jpeg",
|
|
222
|
-
"image/webp",
|
|
223
|
-
"image/gif",
|
|
224
|
-
"application/pdf"
|
|
225
|
-
]), ko = Array.from(
|
|
226
|
-
mn
|
|
227
|
-
).join(","), Lo = 3, Po = "No recent chats for this page yet.", Z = {
|
|
219
|
+
const fn = 100, vo = "product-agent:sdk-preview-socket-connect", yo = "product-agent:sdk-preview-socket-send", Co = "product-agent:sdk-preview-socket-close", So = "product-agent:sdk-preview-socket-open", Eo = "product-agent:sdk-preview-socket-message", ko = "product-agent:sdk-preview-socket-error", Lo = "product-agent:sdk-preview-socket-closed", Ht = "product-agent:sdk-preview-socket-id", Io = "data-pluno-sdk-preview-channel", Po = "product-agent:preview-diagnostic", wn = "pluno.productAgent.sharePromptsDisabled", Ao = 3, No = "No recent chats for this page yet.", Q = {
|
|
228
220
|
launcherLabel: "Ask for anything...",
|
|
229
221
|
accentColor: "#7c3aed",
|
|
230
222
|
colorScheme: "light",
|
|
@@ -232,7 +224,7 @@ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-a
|
|
|
232
224
|
scribbleStyle: !1,
|
|
233
225
|
position: "bottom-right",
|
|
234
226
|
movableLauncher: !1
|
|
235
|
-
},
|
|
227
|
+
}, To = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Wt = "pluno-pa-scribble-font", _n = 190, xn = 41, Gt = 22, Do = 16, Ro = 24, Mo = 1, zo = 48, Bo = 420, Uo = 520, Oo = 0.24, Fo = 680, Ho = 800, Wo = 0.76, H = 8, mt = 50, vn = "http://www.w3.org/2000/svg", $t = 26, qt = 8, Go = 36, jt = [
|
|
236
228
|
{
|
|
237
229
|
ellipseCx: "17.5",
|
|
238
230
|
ellipseCy: "24.5",
|
|
@@ -269,20 +261,20 @@ const gn = 100, bo = "product-agent:sdk-preview-socket-connect", fo = "product-a
|
|
|
269
261
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
270
262
|
pathStrokeWidth: "2.45"
|
|
271
263
|
}
|
|
272
|
-
],
|
|
273
|
-
let
|
|
274
|
-
function
|
|
275
|
-
return (t) => new
|
|
264
|
+
], $o = 11, qo = 13, Vt = 4, jo = 10, Vo = 40, Ko = "movable-launcher-position-v2", yn = "pluno-pa-widget-styles", Cn = "data-pluno-pa-widget-styles";
|
|
265
|
+
let Kt = 0;
|
|
266
|
+
function Yo(e) {
|
|
267
|
+
return (t) => new ae(t, e);
|
|
276
268
|
}
|
|
277
|
-
async function
|
|
269
|
+
async function Xo(e = {}) {
|
|
278
270
|
const t = {
|
|
279
|
-
launcherLabel: e.launcherLabel ??
|
|
280
|
-
accentColor: e.accentColor ??
|
|
281
|
-
colorScheme: e.colorScheme ??
|
|
282
|
-
fontFamily: e.fontFamily ??
|
|
283
|
-
scribbleStyle: e.scribbleStyle ??
|
|
284
|
-
position: e.position ??
|
|
285
|
-
movableLauncher: e.movableLauncher ??
|
|
271
|
+
launcherLabel: e.launcherLabel ?? Q.launcherLabel,
|
|
272
|
+
accentColor: e.accentColor ?? Q.accentColor,
|
|
273
|
+
colorScheme: e.colorScheme ?? Q.colorScheme,
|
|
274
|
+
fontFamily: e.fontFamily ?? Q.fontFamily,
|
|
275
|
+
scribbleStyle: e.scribbleStyle ?? Q.scribbleStyle,
|
|
276
|
+
position: e.position ?? Q.position,
|
|
277
|
+
movableLauncher: e.movableLauncher ?? Q.movableLauncher,
|
|
286
278
|
token: e.token,
|
|
287
279
|
tokenProvider: e.tokenProvider,
|
|
288
280
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -293,6 +285,7 @@ async function Vo(e = {}) {
|
|
|
293
285
|
restorePersistedState: e.restorePersistedState,
|
|
294
286
|
expectedPersistedSessionId: e.expectedPersistedSessionId,
|
|
295
287
|
webSocketFactory: e.webSocketFactory,
|
|
288
|
+
prepareAttachmentUpload: e.prepareAttachmentUpload,
|
|
296
289
|
loginRequired: e.loginRequired === !0,
|
|
297
290
|
loginButtonLabel: e.loginButtonLabel ?? "Log in to Pluno",
|
|
298
291
|
loginUrl: e.loginUrl,
|
|
@@ -314,7 +307,7 @@ async function Vo(e = {}) {
|
|
|
314
307
|
onPanelOpenChange: e.onPanelOpenChange,
|
|
315
308
|
showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0
|
|
316
309
|
};
|
|
317
|
-
|
|
310
|
+
J(
|
|
318
311
|
"web-sdk.widget",
|
|
319
312
|
"Mounting widget with merged options",
|
|
320
313
|
{
|
|
@@ -329,41 +322,41 @@ async function Vo(e = {}) {
|
|
|
329
322
|
initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
|
|
330
323
|
}
|
|
331
324
|
);
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
325
|
+
const o = document.createElement("div");
|
|
326
|
+
o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
|
|
327
|
+
Io,
|
|
335
328
|
t.sdkPreviewChannelId
|
|
336
329
|
);
|
|
337
|
-
const
|
|
330
|
+
const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
338
331
|
i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
339
|
-
let a =
|
|
332
|
+
let a = Yt(
|
|
340
333
|
t.accentColor,
|
|
341
334
|
t.scribbleStyle
|
|
342
335
|
);
|
|
343
|
-
|
|
336
|
+
bi(
|
|
344
337
|
i,
|
|
345
338
|
t.launcherLabel,
|
|
346
339
|
a,
|
|
347
340
|
t.movableLauncher,
|
|
348
341
|
t.showLauncherMinimizeButton
|
|
349
|
-
),
|
|
342
|
+
), n.appendChild(i);
|
|
350
343
|
const l = ca(t);
|
|
351
344
|
let p = t.movableLauncher ? l.launcherPosition : null, c = p !== null;
|
|
352
|
-
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"),
|
|
345
|
+
i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), fe(
|
|
353
346
|
i,
|
|
354
|
-
|
|
347
|
+
rt(
|
|
355
348
|
i,
|
|
356
349
|
p,
|
|
357
350
|
t.position
|
|
358
351
|
)
|
|
359
|
-
)),
|
|
352
|
+
)), dn(n, t.accentColor), Xt(i, a, {
|
|
360
353
|
accentColor: t.accentColor,
|
|
361
354
|
colorScheme: t.colorScheme,
|
|
362
355
|
fontFamily: t.fontFamily,
|
|
363
356
|
scribbleStyle: t.scribbleStyle
|
|
364
357
|
});
|
|
365
358
|
const u = await da(), d = u.ownerDocument;
|
|
366
|
-
u.appendChild(
|
|
359
|
+
u.appendChild(o), J(
|
|
367
360
|
"web-sdk.widget",
|
|
368
361
|
"Applied initial widget appearance",
|
|
369
362
|
{
|
|
@@ -373,70 +366,70 @@ async function Vo(e = {}) {
|
|
|
373
366
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
374
367
|
}
|
|
375
368
|
);
|
|
376
|
-
const
|
|
369
|
+
const g = i.querySelector(
|
|
377
370
|
".pluno-pa-widget__launcher"
|
|
378
|
-
),
|
|
371
|
+
), S = i.querySelector(
|
|
379
372
|
".pluno-pa-widget__launcher-drag-handle"
|
|
380
|
-
),
|
|
373
|
+
), f = i.querySelector(
|
|
381
374
|
".pluno-pa-widget__launcher-input"
|
|
382
|
-
),
|
|
375
|
+
), O = i.querySelector(
|
|
383
376
|
".pluno-pa-widget__launcher-minimize"
|
|
384
|
-
),
|
|
377
|
+
), k = i.querySelector(".pluno-pa-widget__panel"), x = i.querySelector(
|
|
385
378
|
".pluno-pa-widget__close"
|
|
386
|
-
),
|
|
379
|
+
), v = i.querySelector(
|
|
387
380
|
".pluno-pa-widget__composer"
|
|
388
|
-
),
|
|
381
|
+
), h = i.querySelector(
|
|
389
382
|
".pluno-pa-widget__attachment-error"
|
|
390
|
-
),
|
|
383
|
+
), A = i.querySelector(
|
|
391
384
|
".pluno-pa-widget__billing-status"
|
|
392
|
-
),
|
|
385
|
+
), T = i.querySelector(
|
|
393
386
|
".pluno-pa-widget__attachments"
|
|
394
|
-
),
|
|
387
|
+
), I = i.querySelector(
|
|
395
388
|
".pluno-pa-widget__attachment-input"
|
|
396
|
-
),
|
|
389
|
+
), Ee = i.querySelector(
|
|
397
390
|
".pluno-pa-widget__attach"
|
|
398
391
|
), b = i.querySelector(
|
|
399
392
|
".pluno-pa-widget__input"
|
|
400
|
-
),
|
|
393
|
+
), D = i.querySelector(
|
|
401
394
|
".pluno-pa-widget__send"
|
|
402
|
-
),
|
|
395
|
+
), de = i.querySelector(
|
|
403
396
|
".pluno-pa-widget__top-actions"
|
|
404
|
-
),
|
|
397
|
+
), ce = i.querySelector(
|
|
405
398
|
".pluno-pa-widget__history"
|
|
406
|
-
),
|
|
399
|
+
), we = i.querySelector(
|
|
407
400
|
".pluno-pa-widget__history-panel"
|
|
408
|
-
),
|
|
401
|
+
), W = i.querySelector(
|
|
409
402
|
".pluno-pa-widget__history-list"
|
|
410
|
-
),
|
|
403
|
+
), Re = i.querySelector(
|
|
411
404
|
".pluno-pa-widget__history-close"
|
|
412
|
-
),
|
|
405
|
+
), K = i.querySelector(
|
|
413
406
|
".pluno-pa-widget__history-status"
|
|
414
|
-
),
|
|
407
|
+
), _ = i.querySelector(
|
|
415
408
|
".pluno-pa-widget__timeline-jump"
|
|
416
|
-
),
|
|
409
|
+
), M = i.querySelector(
|
|
417
410
|
".pluno-pa-widget__active-users-counter"
|
|
418
411
|
), P = i.querySelector(
|
|
419
412
|
".pluno-pa-widget__timeline"
|
|
420
|
-
),
|
|
413
|
+
), G = i.querySelector(
|
|
421
414
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
422
415
|
);
|
|
423
|
-
if (!
|
|
416
|
+
if (!g || !f || !k || !x || !v || !h || !A || !T || !I || !Ee || !b || !D || !de || !ce || !we || !W || !Re || !K || !_ || !M || !P || !G)
|
|
424
417
|
throw new Error("Failed to mount Pluno widget");
|
|
425
|
-
if (t.movableLauncher && !
|
|
418
|
+
if (t.movableLauncher && !S)
|
|
426
419
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
427
|
-
|
|
428
|
-
let
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
420
|
+
tn(f), tn(b);
|
|
421
|
+
let C = [], L = null;
|
|
422
|
+
const $ = () => {
|
|
423
|
+
Ri(
|
|
424
|
+
T,
|
|
425
|
+
C,
|
|
433
426
|
(r) => {
|
|
434
|
-
|
|
435
|
-
(s,
|
|
436
|
-
),
|
|
427
|
+
C = C.filter(
|
|
428
|
+
(s, E) => E !== r
|
|
429
|
+
), $(), U(w.getState()), q();
|
|
437
430
|
}
|
|
438
431
|
);
|
|
439
|
-
},
|
|
432
|
+
}, On = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
440
433
|
if (!t.tokenEndpoint)
|
|
441
434
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
442
435
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -454,11 +447,11 @@ async function Vo(e = {}) {
|
|
|
454
447
|
if (!s.token)
|
|
455
448
|
throw new Error("Pluno token endpoint did not return a token");
|
|
456
449
|
return s.token;
|
|
457
|
-
}),
|
|
450
|
+
}), Fn = window.fetch.bind(window);
|
|
458
451
|
let w;
|
|
459
|
-
w = await
|
|
452
|
+
w = await Jn.init({
|
|
460
453
|
token: t.token,
|
|
461
|
-
tokenProvider:
|
|
454
|
+
tokenProvider: On,
|
|
462
455
|
backendUrl: t.backendUrl,
|
|
463
456
|
metadata: () => ({
|
|
464
457
|
...t.metadata ?? {},
|
|
@@ -469,117 +462,118 @@ async function Vo(e = {}) {
|
|
|
469
462
|
restorePersistedState: t.restorePersistedState,
|
|
470
463
|
expectedPersistedSessionId: t.expectedPersistedSessionId,
|
|
471
464
|
webSocketFactory: t.webSocketFactory,
|
|
465
|
+
prepareAttachmentUpload: t.prepareAttachmentUpload,
|
|
472
466
|
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
|
|
473
467
|
});
|
|
474
|
-
const
|
|
468
|
+
const Ke = new Set(l.openToolGroupKeys), _e = new Set(
|
|
475
469
|
l.seenShareCandidateIds
|
|
476
|
-
),
|
|
477
|
-
let Ye = l.sharePromptsDisabled || await ua(t),
|
|
470
|
+
), Me = new Set(_e);
|
|
471
|
+
let Ye = l.sharePromptsDisabled || await ua(t), V = null, ze = !1, ue = !1, ge = {
|
|
478
472
|
enabled: !0
|
|
479
|
-
},
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
},
|
|
485
|
-
|
|
486
|
-
},
|
|
487
|
-
|
|
488
|
-
},
|
|
489
|
-
if (
|
|
473
|
+
}, he = 0, Ct = "", re = !1, ie = !1, le = [], Xe = null, ke = null;
|
|
474
|
+
const Y = (r, s) => {
|
|
475
|
+
ge = { enabled: r, reason: s };
|
|
476
|
+
}, X = () => {
|
|
477
|
+
_.hidden = !0;
|
|
478
|
+
}, Hn = () => {
|
|
479
|
+
_.hidden = !1;
|
|
480
|
+
}, Wn = (r = "jump") => {
|
|
481
|
+
Y(!0, r), X(), Te(P, () => ge.enabled), he = P.scrollTop;
|
|
482
|
+
}, me = () => {
|
|
483
|
+
if (ce.hidden = t.loginRequired, we.hidden = !re, ce.setAttribute("aria-expanded", String(re)), W.classList.toggle(
|
|
490
484
|
"pluno-pa-widget__history-list--center",
|
|
491
|
-
|
|
492
|
-
),
|
|
485
|
+
ie && le.length === 0
|
|
486
|
+
), W.replaceChildren(), ie && le.length === 0) {
|
|
493
487
|
const r = document.createElement("p");
|
|
494
|
-
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...",
|
|
488
|
+
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", W.appendChild(r);
|
|
495
489
|
}
|
|
496
490
|
for (const r of le) {
|
|
497
491
|
const s = document.createElement("button");
|
|
498
|
-
s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled =
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
const
|
|
502
|
-
|
|
492
|
+
s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ie;
|
|
493
|
+
const E = document.createElement("span");
|
|
494
|
+
E.className = "pluno-pa-widget__history-item-title", E.textContent = gi(r);
|
|
495
|
+
const z = document.createElement("time");
|
|
496
|
+
z.className = "pluno-pa-widget__history-time", z.dateTime = r.lastActiveAt, z.textContent = mi(
|
|
503
497
|
r.lastActiveAt,
|
|
504
498
|
Date.now()
|
|
505
499
|
);
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
re = !1,
|
|
509
|
-
}),
|
|
500
|
+
const N = document.createElement("small");
|
|
501
|
+
N.className = "pluno-pa-widget__history-path", N.textContent = hi(r), s.append(E, z, N), s.addEventListener("click", () => {
|
|
502
|
+
re = !1, ke = null, me(), Y(!0, "newSession"), X(), w.loadSession(r.id), U(w.getState());
|
|
503
|
+
}), W.appendChild(s);
|
|
510
504
|
}
|
|
511
|
-
if (
|
|
505
|
+
if (ie && le.length > 0) {
|
|
512
506
|
const r = document.createElement("p");
|
|
513
|
-
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...",
|
|
507
|
+
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", W.appendChild(r);
|
|
514
508
|
}
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
if (!
|
|
518
|
-
|
|
509
|
+
K.textContent = ke ?? (!ie && le.length === 0 ? "No recent chats for this page yet." : ""), K.hidden = K.textContent.length === 0;
|
|
510
|
+
}, St = async (r) => {
|
|
511
|
+
if (!ie) {
|
|
512
|
+
ie = !0, ke = null, me();
|
|
519
513
|
try {
|
|
520
514
|
const s = await w.listSessions({ cursor: r, limit: 20 });
|
|
521
|
-
le = r ? [...le, ...s.sessions] : s.sessions,
|
|
515
|
+
le = r ? [...le, ...s.sessions] : s.sessions, Xe = s.nextCursor;
|
|
522
516
|
} catch (s) {
|
|
523
|
-
|
|
517
|
+
J(
|
|
524
518
|
"web-sdk.widget",
|
|
525
519
|
"Failed to load session history",
|
|
526
520
|
{
|
|
527
521
|
message: s instanceof Error ? s.message : String(s)
|
|
528
522
|
}
|
|
529
|
-
),
|
|
523
|
+
), ke = No;
|
|
530
524
|
} finally {
|
|
531
|
-
|
|
525
|
+
ie = !1, me();
|
|
532
526
|
}
|
|
533
527
|
}
|
|
534
|
-
},
|
|
535
|
-
!
|
|
536
|
-
},
|
|
537
|
-
|
|
538
|
-
},
|
|
539
|
-
|
|
528
|
+
}, Gn = () => {
|
|
529
|
+
!Xe || ie || W.scrollHeight - W.scrollTop - W.clientHeight <= 24 && St(Xe);
|
|
530
|
+
}, $n = () => {
|
|
531
|
+
ze || typeof document > "u" || (dn(n, t.accentColor), o.isConnected || d.body?.appendChild(o));
|
|
532
|
+
}, Et = new MutationObserver($n);
|
|
533
|
+
Et.observe(d.documentElement, {
|
|
540
534
|
childList: !0,
|
|
541
535
|
subtree: !0
|
|
542
536
|
});
|
|
543
|
-
const
|
|
544
|
-
const s =
|
|
545
|
-
return
|
|
537
|
+
const Ze = (r = !0) => {
|
|
538
|
+
const s = je(i, r);
|
|
539
|
+
return bt(
|
|
546
540
|
i,
|
|
547
|
-
p ?
|
|
541
|
+
p ? En(p, s) : ni(
|
|
548
542
|
i,
|
|
549
543
|
t.position,
|
|
550
544
|
s
|
|
551
545
|
),
|
|
552
546
|
s
|
|
553
547
|
);
|
|
554
|
-
},
|
|
548
|
+
}, F = () => {
|
|
555
549
|
ha(t, {
|
|
556
550
|
isOpen: i.classList.contains("pluno-pa-widget--open"),
|
|
557
551
|
composerValue: b.value,
|
|
558
|
-
openToolGroupKeys: [...
|
|
552
|
+
openToolGroupKeys: [...Ke],
|
|
559
553
|
launcherPosition: c ? p : null,
|
|
560
|
-
seenShareCandidateIds: [...
|
|
561
|
-
-
|
|
554
|
+
seenShareCandidateIds: [..._e].slice(
|
|
555
|
+
-fn
|
|
562
556
|
),
|
|
563
557
|
sharePromptsDisabled: Ye
|
|
564
558
|
});
|
|
565
|
-
},
|
|
559
|
+
}, Be = (r) => {
|
|
566
560
|
t.onDisplayStateChange?.(r);
|
|
567
|
-
},
|
|
561
|
+
}, Le = (r, s = !0) => {
|
|
568
562
|
if (r === "shown") {
|
|
569
|
-
i.classList.remove("pluno-pa-widget--minimized"),
|
|
563
|
+
i.classList.remove("pluno-pa-widget--minimized"), g.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Ie(!1), s && Be("shown");
|
|
570
564
|
return;
|
|
571
565
|
}
|
|
572
|
-
|
|
566
|
+
V !== null && (window.clearTimeout(V), V = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), g.hidden = !1, k.hidden = !0, x.hidden = !0, g.tabIndex = 0, b.value = "", fe(
|
|
573
567
|
i,
|
|
574
|
-
|
|
568
|
+
rt(
|
|
575
569
|
i,
|
|
576
570
|
p,
|
|
577
571
|
t.position
|
|
578
572
|
)
|
|
579
|
-
),
|
|
580
|
-
},
|
|
581
|
-
|
|
582
|
-
debugVersion:
|
|
573
|
+
), Jt(i), F(), s && Be("minimized");
|
|
574
|
+
}, be = (r, s = {}) => {
|
|
575
|
+
si(r, {
|
|
576
|
+
debugVersion: Ko,
|
|
583
577
|
launcherPosition: p,
|
|
584
578
|
rootClasses: i.className,
|
|
585
579
|
rootStyle: {
|
|
@@ -588,35 +582,35 @@ async function Vo(e = {}) {
|
|
|
588
582
|
right: i.style.right,
|
|
589
583
|
bottom: i.style.bottom
|
|
590
584
|
},
|
|
591
|
-
rootRect:
|
|
592
|
-
launcherRect:
|
|
593
|
-
panelRect:
|
|
594
|
-
viewport:
|
|
595
|
-
panelHidden:
|
|
596
|
-
closeHidden:
|
|
585
|
+
rootRect: lt(i),
|
|
586
|
+
launcherRect: lt(g),
|
|
587
|
+
panelRect: lt(k),
|
|
588
|
+
viewport: ne(),
|
|
589
|
+
panelHidden: k.hidden,
|
|
590
|
+
closeHidden: x.hidden,
|
|
597
591
|
...s
|
|
598
592
|
});
|
|
599
|
-
},
|
|
593
|
+
}, Ie = (r = !0) => {
|
|
600
594
|
if (!p)
|
|
601
|
-
return
|
|
602
|
-
const s =
|
|
603
|
-
return
|
|
595
|
+
return fe(i, null), Ze(r);
|
|
596
|
+
const s = Ze(r);
|
|
597
|
+
return fe(i, s), be("Applied stored closed launcher position", {
|
|
604
598
|
visibleLauncherPosition: s
|
|
605
599
|
}), s;
|
|
606
|
-
},
|
|
600
|
+
}, kt = (r, s) => {
|
|
607
601
|
if (!r || !s) {
|
|
608
|
-
|
|
602
|
+
Jt(i);
|
|
609
603
|
return;
|
|
610
604
|
}
|
|
611
|
-
|
|
605
|
+
pi(i, {
|
|
612
606
|
x: r.x - s.x,
|
|
613
607
|
y: r.y - s.y
|
|
614
608
|
});
|
|
615
|
-
},
|
|
609
|
+
}, Lt = () => {
|
|
616
610
|
if (i.classList.contains("pluno-pa-widget--minimized")) {
|
|
617
|
-
|
|
611
|
+
fe(
|
|
618
612
|
i,
|
|
619
|
-
|
|
613
|
+
rt(
|
|
620
614
|
i,
|
|
621
615
|
p,
|
|
622
616
|
t.position
|
|
@@ -624,127 +618,127 @@ async function Vo(e = {}) {
|
|
|
624
618
|
);
|
|
625
619
|
return;
|
|
626
620
|
}
|
|
627
|
-
const r =
|
|
621
|
+
const r = Ie();
|
|
628
622
|
if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
|
|
629
|
-
const s =
|
|
623
|
+
const s = Zt(
|
|
630
624
|
i,
|
|
631
625
|
r,
|
|
632
626
|
t.position
|
|
633
627
|
);
|
|
634
|
-
|
|
628
|
+
kt(s, r), be(
|
|
635
629
|
"Applied open panel position after viewport resize",
|
|
636
630
|
{ openPanelPosition: s }
|
|
637
631
|
);
|
|
638
|
-
} else p &&
|
|
632
|
+
} else p && be(
|
|
639
633
|
"Applied visible launcher position after viewport resize",
|
|
640
634
|
{ visibleLauncherPosition: r }
|
|
641
635
|
);
|
|
642
636
|
};
|
|
643
|
-
let
|
|
637
|
+
let It = () => {
|
|
644
638
|
};
|
|
645
|
-
window.addEventListener("resize",
|
|
639
|
+
window.addEventListener("resize", Lt), t.movableLauncher && S ? (Ie(), It = ti({
|
|
646
640
|
root: i,
|
|
647
|
-
launcher:
|
|
648
|
-
launcherDragHandle:
|
|
649
|
-
getPosition: () =>
|
|
641
|
+
launcher: g,
|
|
642
|
+
launcherDragHandle: S,
|
|
643
|
+
getPosition: () => Ze(),
|
|
650
644
|
setPosition: (r) => {
|
|
651
|
-
const s = r,
|
|
645
|
+
const s = r, E = je(i), z = bt(
|
|
652
646
|
i,
|
|
653
647
|
r,
|
|
654
|
-
|
|
648
|
+
E
|
|
655
649
|
);
|
|
656
|
-
p =
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
),
|
|
650
|
+
p = ii(
|
|
651
|
+
z,
|
|
652
|
+
E
|
|
653
|
+
), fe(i, z), be("Dragging closed launcher", {
|
|
660
654
|
requestedPosition: s
|
|
661
655
|
});
|
|
662
656
|
},
|
|
663
657
|
persist: () => {
|
|
664
|
-
c = !0,
|
|
658
|
+
c = !0, F(), be("Persisted closed launcher drag position");
|
|
665
659
|
}
|
|
666
|
-
})) :
|
|
667
|
-
let
|
|
668
|
-
const
|
|
669
|
-
if (!(!t.billingStatusLoader ||
|
|
670
|
-
|
|
660
|
+
})) : fe(i, null);
|
|
661
|
+
let Je = !1;
|
|
662
|
+
const Pt = async () => {
|
|
663
|
+
if (!(!t.billingStatusLoader || Je)) {
|
|
664
|
+
Je = !0;
|
|
671
665
|
try {
|
|
672
666
|
const r = await t.billingStatusLoader();
|
|
673
|
-
|
|
667
|
+
on(
|
|
674
668
|
t.billingStatus,
|
|
675
669
|
r,
|
|
676
670
|
w.getState().lastErrorCode
|
|
677
|
-
) && (t.billingStatus = r,
|
|
678
|
-
|
|
671
|
+
) && (t.billingStatus = r, dt(
|
|
672
|
+
A,
|
|
679
673
|
t.billingStatus,
|
|
680
674
|
w.getState().lastErrorCode
|
|
681
|
-
),
|
|
675
|
+
), q());
|
|
682
676
|
} finally {
|
|
683
|
-
|
|
677
|
+
Je = !1;
|
|
684
678
|
}
|
|
685
679
|
}
|
|
686
680
|
}, pe = (r = "", s = !0) => {
|
|
687
|
-
|
|
688
|
-
const
|
|
681
|
+
Pt(), V !== null && (window.clearTimeout(V), V = null), Le("shown", !1), k.hidden = !1, x.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
|
|
682
|
+
const E = Ie(), z = Zt(
|
|
689
683
|
i,
|
|
690
|
-
|
|
684
|
+
E,
|
|
691
685
|
t.position
|
|
692
686
|
);
|
|
693
|
-
if (
|
|
694
|
-
openPanelPosition:
|
|
695
|
-
visibleLauncherPosition:
|
|
696
|
-
}),
|
|
697
|
-
i.classList.add("pluno-pa-widget--open"),
|
|
687
|
+
if (kt(z, E), be("Opening launcher at clamped open panel position", {
|
|
688
|
+
openPanelPosition: z,
|
|
689
|
+
visibleLauncherPosition: E
|
|
690
|
+
}), Y(!0, "open"), X(), !s) {
|
|
691
|
+
i.classList.add("pluno-pa-widget--open"), g.hidden = !0, r && (b.value = r, Ne(b)), Te(P, () => ge.enabled), he = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), F(), Be("shown"), t.onPanelOpenChange?.(!0);
|
|
698
692
|
return;
|
|
699
693
|
}
|
|
700
694
|
window.requestAnimationFrame(() => {
|
|
701
|
-
i.classList.add("pluno-pa-widget--open"), r && (b.value = r,
|
|
702
|
-
|
|
695
|
+
i.classList.add("pluno-pa-widget--open"), r && (b.value = r, Ne(b)), Te(P, () => ge.enabled), he = P.scrollTop, b.focus(), b.setSelectionRange(b.value.length, b.value.length), F(), Be("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
|
|
696
|
+
g.hidden = !0, Te(P, () => ge.enabled), he = P.scrollTop;
|
|
703
697
|
}, 220);
|
|
704
698
|
});
|
|
705
|
-
},
|
|
706
|
-
|
|
707
|
-
|
|
699
|
+
}, qn = () => {
|
|
700
|
+
V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Ie(!1), be("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
|
|
701
|
+
k.hidden = !0, x.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
|
|
708
702
|
}, 220);
|
|
709
703
|
};
|
|
710
|
-
|
|
711
|
-
r.preventDefault(), pe(
|
|
712
|
-
}),
|
|
704
|
+
g.addEventListener("submit", (r) => {
|
|
705
|
+
r.preventDefault(), pe(f.value), f.value = "";
|
|
706
|
+
}), S?.addEventListener("click", (r) => {
|
|
713
707
|
r.preventDefault(), r.stopPropagation();
|
|
714
|
-
}),
|
|
715
|
-
r.target ===
|
|
716
|
-
}),
|
|
717
|
-
pe(
|
|
718
|
-
}),
|
|
719
|
-
if (!
|
|
708
|
+
}), g.addEventListener("click", (r) => {
|
|
709
|
+
r.target === f && !S || (pe(f.value), f.value = "");
|
|
710
|
+
}), f.addEventListener("focus", () => {
|
|
711
|
+
pe(f.value), f.value = "";
|
|
712
|
+
}), f.addEventListener("input", () => {
|
|
713
|
+
if (!f.value)
|
|
720
714
|
return;
|
|
721
|
-
const r =
|
|
722
|
-
pe(r),
|
|
723
|
-
}),
|
|
715
|
+
const r = f.value;
|
|
716
|
+
pe(r), f.value = "";
|
|
717
|
+
}), g.addEventListener("keydown", (r) => {
|
|
724
718
|
!i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), pe());
|
|
725
|
-
}),
|
|
719
|
+
}), O?.addEventListener("pointerdown", (r) => {
|
|
726
720
|
r.stopPropagation();
|
|
727
|
-
}),
|
|
728
|
-
r.preventDefault(), r.stopPropagation(),
|
|
729
|
-
}),
|
|
730
|
-
P.scrollTop <
|
|
731
|
-
}),
|
|
732
|
-
|
|
721
|
+
}), O?.addEventListener("click", (r) => {
|
|
722
|
+
r.preventDefault(), r.stopPropagation(), Le("minimized");
|
|
723
|
+
}), x.addEventListener("click", qn), P.addEventListener("scroll", () => {
|
|
724
|
+
P.scrollTop < he - 1 && Y(!1, "userScroll"), he = P.scrollTop;
|
|
725
|
+
}), _.addEventListener("click", () => {
|
|
726
|
+
Wn();
|
|
733
727
|
});
|
|
734
|
-
const
|
|
728
|
+
const At = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
735
729
|
([r]) => {
|
|
736
|
-
r?.isIntersecting && (
|
|
730
|
+
r?.isIntersecting && (Y(!0, "bottom"), X());
|
|
737
731
|
},
|
|
738
732
|
{ root: P, threshold: 0 }
|
|
739
733
|
);
|
|
740
|
-
|
|
741
|
-
const
|
|
742
|
-
const r =
|
|
743
|
-
|
|
744
|
-
},
|
|
745
|
-
|
|
734
|
+
At?.observe(G);
|
|
735
|
+
const Ue = () => t.loginRequired || t.signupRequired, Nt = () => {
|
|
736
|
+
const r = Ue();
|
|
737
|
+
f.readOnly = r, f.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, b.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = r;
|
|
738
|
+
}, q = () => {
|
|
739
|
+
D.disabled = te(t.billingStatus) || !w.getState().isThinking && b.value.trim().length === 0 && C.length === 0, Ee.disabled = Ue() || te(t.billingStatus);
|
|
746
740
|
};
|
|
747
|
-
|
|
741
|
+
Nt(), v.addEventListener("submit", (r) => {
|
|
748
742
|
if (r.preventDefault(), t.loginRequired) {
|
|
749
743
|
t.onLoginClick?.();
|
|
750
744
|
return;
|
|
@@ -753,59 +747,55 @@ async function Vo(e = {}) {
|
|
|
753
747
|
t.onSignupClick?.();
|
|
754
748
|
return;
|
|
755
749
|
}
|
|
756
|
-
|
|
750
|
+
te(t.billingStatus) || (ue = !0, Y(!0, "send"), X(), C = pt(
|
|
757
751
|
w,
|
|
758
752
|
b,
|
|
759
|
-
|
|
760
|
-
),
|
|
753
|
+
C
|
|
754
|
+
), $(), q());
|
|
761
755
|
});
|
|
762
|
-
let
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
},
|
|
766
|
-
|
|
767
|
-
|
|
756
|
+
let Pe = 0;
|
|
757
|
+
const jn = () => {
|
|
758
|
+
Pe = 0, i.classList.remove("pluno-pa-widget--drag-over");
|
|
759
|
+
}, Tt = (r) => {
|
|
760
|
+
L !== null && window.clearTimeout(L), h.textContent = r, h.hidden = !1, L = window.setTimeout(() => {
|
|
761
|
+
h.textContent = "", h.hidden = !0, L = null;
|
|
768
762
|
}, 3e3);
|
|
769
|
-
},
|
|
770
|
-
|
|
771
|
-
},
|
|
763
|
+
}, Vn = () => {
|
|
764
|
+
L !== null && (window.clearTimeout(L), L = null), h.textContent = "", h.hidden = !0;
|
|
765
|
+
}, Dt = async (r) => {
|
|
772
766
|
if (r.length === 0)
|
|
773
767
|
return;
|
|
774
|
-
const s =
|
|
775
|
-
|
|
776
|
-
throw new Error(
|
|
777
|
-
`Attach up to ${We} files per message.`
|
|
778
|
-
);
|
|
779
|
-
z = [...z, ...s], fe(), Wn(), $(), O(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
|
|
768
|
+
const s = Bi(w, r);
|
|
769
|
+
C = [...C, ...s], $(), Vn(), q(), U(w.getState()), i.classList.contains("pluno-pa-widget--open") || pe();
|
|
780
770
|
};
|
|
781
|
-
|
|
782
|
-
t.loginRequired ||
|
|
783
|
-
}),
|
|
784
|
-
const r = Array.from(
|
|
785
|
-
|
|
786
|
-
|
|
771
|
+
Ee.addEventListener("click", () => {
|
|
772
|
+
t.loginRequired || te(t.billingStatus) || I.click();
|
|
773
|
+
}), I.addEventListener("change", () => {
|
|
774
|
+
const r = Array.from(I.files ?? []);
|
|
775
|
+
I.value = "", Dt(r).catch((s) => {
|
|
776
|
+
Tt(
|
|
787
777
|
s instanceof Error ? s.message : "Failed to attach file"
|
|
788
|
-
),
|
|
778
|
+
), J("web-sdk.widget", "Attachment failed", {
|
|
789
779
|
message: s instanceof Error ? s.message : String(s)
|
|
790
780
|
});
|
|
791
781
|
});
|
|
792
782
|
}), i.addEventListener("dragenter", (r) => {
|
|
793
|
-
!
|
|
783
|
+
!He(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Pe += 1, i.classList.add("pluno-pa-widget--drag-over"));
|
|
794
784
|
}), i.addEventListener("dragover", (r) => {
|
|
795
785
|
const s = r.dataTransfer;
|
|
796
|
-
!
|
|
786
|
+
!He(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
|
|
797
787
|
}), i.addEventListener("dragleave", (r) => {
|
|
798
|
-
|
|
788
|
+
He(r.dataTransfer) && (r.stopPropagation(), Pe = Math.max(0, Pe - 1), Pe === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
|
|
799
789
|
}), i.addEventListener("drop", (r) => {
|
|
800
790
|
const s = r.dataTransfer;
|
|
801
|
-
!
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
),
|
|
805
|
-
message:
|
|
791
|
+
!He(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), jn(), Dt(s.files).catch((E) => {
|
|
792
|
+
Tt(
|
|
793
|
+
E instanceof Error ? E.message : "Failed to attach file"
|
|
794
|
+
), J("web-sdk.widget", "Attachment failed", {
|
|
795
|
+
message: E instanceof Error ? E.message : String(E)
|
|
806
796
|
});
|
|
807
797
|
}));
|
|
808
|
-
}),
|
|
798
|
+
}), D.addEventListener("click", () => {
|
|
809
799
|
if (t.loginRequired) {
|
|
810
800
|
t.onLoginClick?.();
|
|
811
801
|
return;
|
|
@@ -814,61 +804,64 @@ async function Vo(e = {}) {
|
|
|
814
804
|
w.stop();
|
|
815
805
|
return;
|
|
816
806
|
}
|
|
817
|
-
|
|
807
|
+
ue = !0, Y(!0, "send"), X(), C = pt(
|
|
818
808
|
w,
|
|
819
809
|
b,
|
|
820
|
-
|
|
821
|
-
),
|
|
822
|
-
}),
|
|
823
|
-
re = !re,
|
|
824
|
-
}),
|
|
825
|
-
re = !1,
|
|
826
|
-
}),
|
|
827
|
-
|
|
810
|
+
C
|
|
811
|
+
), $(), q(), U(w.getState());
|
|
812
|
+
}), ce.addEventListener("click", () => {
|
|
813
|
+
re = !re, ke = null, me(), re && le.length === 0 && St(null);
|
|
814
|
+
}), Re.addEventListener("click", () => {
|
|
815
|
+
re = !1, me();
|
|
816
|
+
}), W.addEventListener("scroll", Gn), b.addEventListener("input", () => {
|
|
817
|
+
Ne(b), F(), q(), Yn();
|
|
828
818
|
}), b.addEventListener("keydown", (r) => {
|
|
829
819
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
830
820
|
if (r.preventDefault(), t.loginRequired) {
|
|
831
821
|
t.onLoginClick?.();
|
|
832
822
|
return;
|
|
833
823
|
}
|
|
834
|
-
|
|
824
|
+
ue = !0, Y(!0, "send"), X(), C = pt(
|
|
835
825
|
w,
|
|
836
826
|
b,
|
|
837
|
-
|
|
838
|
-
),
|
|
827
|
+
C
|
|
828
|
+
), $(), q(), U(w.getState());
|
|
839
829
|
}
|
|
840
830
|
}), i.addEventListener("click", (r) => {
|
|
841
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
842
|
-
}), l.composerValue && (b.value = l.composerValue,
|
|
843
|
-
const
|
|
844
|
-
let
|
|
831
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
|
|
832
|
+
}), l.composerValue && (b.value = l.composerValue, Ne(b)), t.initialDisplayState === "minimized" ? Le("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && pe(b.value, !1);
|
|
833
|
+
const Oe = () => a;
|
|
834
|
+
let Qe = w.getState().appearance !== null, Fe = null, Ae = null, xe = null, Rt = w.getState().isThinking, ve = null, ye = null, Mt = () => {
|
|
835
|
+
};
|
|
836
|
+
const Kn = !!t.socialPostDraftHandler, et = /* @__PURE__ */ new Map(), tt = () => b.value.trim().length > 0 || C.length > 0, Yn = () => {
|
|
837
|
+
const r = ye !== null && ct(w.getState(), tt());
|
|
838
|
+
M.hidden = !r, r && ye !== null && Ln(M, ye);
|
|
845
839
|
};
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}, et = (r) => {
|
|
840
|
+
let Ce = null;
|
|
841
|
+
const Xn = () => {
|
|
842
|
+
ue = !0, Y(!0, "newSession"), X(), re = !1, me(), w.startNewSession(), Ke.clear(), b.value = "", C = [], $(), Ne(b), F(), q(), b.focus(), U(w.getState());
|
|
843
|
+
}, nt = (r) => {
|
|
851
844
|
if (!r) {
|
|
852
|
-
|
|
845
|
+
Ce?.remove(), Ce = null;
|
|
853
846
|
return;
|
|
854
847
|
}
|
|
855
|
-
|
|
848
|
+
Ce || (Ce = Ve(
|
|
856
849
|
"pluno-pa-widget__new-chat",
|
|
857
850
|
"New chat",
|
|
858
|
-
|
|
851
|
+
ki(),
|
|
859
852
|
!1
|
|
860
|
-
),
|
|
861
|
-
},
|
|
862
|
-
if (
|
|
863
|
-
|
|
853
|
+
), Ce.addEventListener("click", Xn), de.insertBefore(Ce, ce));
|
|
854
|
+
}, U = (r) => {
|
|
855
|
+
if (me(), yt(r.lastErrorCode) ? ve = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ve = null), dt(
|
|
856
|
+
A,
|
|
864
857
|
t.billingStatus,
|
|
865
|
-
|
|
858
|
+
ve
|
|
866
859
|
), t.loginRequired) {
|
|
867
|
-
|
|
860
|
+
et.clear(), pn(
|
|
868
861
|
P,
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
862
|
+
D,
|
|
863
|
+
nt,
|
|
864
|
+
Oe,
|
|
872
865
|
"Log in to use Pluno on this page.",
|
|
873
866
|
t.loginButtonLabel,
|
|
874
867
|
t.loginUrl,
|
|
@@ -877,11 +870,11 @@ async function Vo(e = {}) {
|
|
|
877
870
|
return;
|
|
878
871
|
}
|
|
879
872
|
if (t.signupRequired) {
|
|
880
|
-
|
|
873
|
+
et.clear(), pn(
|
|
881
874
|
P,
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
875
|
+
D,
|
|
876
|
+
nt,
|
|
877
|
+
Oe,
|
|
885
878
|
"Complete signup to unlock your free trial credits.",
|
|
886
879
|
t.signupButtonLabel,
|
|
887
880
|
t.signupUrl,
|
|
@@ -889,70 +882,65 @@ async function Vo(e = {}) {
|
|
|
889
882
|
);
|
|
890
883
|
return;
|
|
891
884
|
}
|
|
892
|
-
const s =
|
|
893
|
-
|
|
894
|
-
const
|
|
895
|
-
|
|
885
|
+
const s = ci(r), E = s !== Ct;
|
|
886
|
+
Ct = s;
|
|
887
|
+
const z = ue || ge.enabled;
|
|
888
|
+
ue = !1, $i(
|
|
896
889
|
P,
|
|
897
|
-
je,
|
|
898
|
-
ie,
|
|
899
|
-
et,
|
|
900
|
-
be,
|
|
901
|
-
r,
|
|
902
|
-
Qe,
|
|
903
|
-
Qe !== null && tn(
|
|
904
|
-
r,
|
|
905
|
-
b.value.trim().length > 0 || z.length > 0
|
|
906
|
-
),
|
|
907
|
-
B,
|
|
908
|
-
() => ce.enabled,
|
|
909
|
-
Ve,
|
|
910
890
|
G,
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
891
|
+
D,
|
|
892
|
+
nt,
|
|
893
|
+
M,
|
|
894
|
+
r,
|
|
895
|
+
ye,
|
|
896
|
+
ye !== null && ct(r, tt()),
|
|
897
|
+
z,
|
|
898
|
+
() => ge.enabled,
|
|
899
|
+
Ke,
|
|
900
|
+
et,
|
|
901
|
+
F,
|
|
902
|
+
Oe,
|
|
903
|
+
(N) => {
|
|
904
|
+
ue = !0, Y(!0, "send"), X(), w.sendMessage(N);
|
|
914
905
|
},
|
|
915
|
-
|
|
916
|
-
dismissedCandidateIds:
|
|
917
|
-
draftingCandidateId:
|
|
918
|
-
error:
|
|
919
|
-
characterIconOptions:
|
|
920
|
-
onSeen: (
|
|
921
|
-
|
|
906
|
+
Kn && !Ye ? {
|
|
907
|
+
dismissedCandidateIds: Me,
|
|
908
|
+
draftingCandidateId: Fe,
|
|
909
|
+
error: Ae,
|
|
910
|
+
characterIconOptions: Oe(),
|
|
911
|
+
onSeen: (N) => {
|
|
912
|
+
_e.add(N.id), F();
|
|
922
913
|
},
|
|
923
|
-
onDraft: (
|
|
924
|
-
|
|
914
|
+
onDraft: (N) => {
|
|
915
|
+
Zn(N);
|
|
925
916
|
},
|
|
926
|
-
onDismiss: (
|
|
927
|
-
|
|
917
|
+
onDismiss: (N) => {
|
|
918
|
+
_e.add(N.id), Me.add(N.id), F(), Ae = null, U(w.getState());
|
|
928
919
|
},
|
|
929
|
-
onDisable: (
|
|
930
|
-
Ye = !0,
|
|
920
|
+
onDisable: (N) => {
|
|
921
|
+
Ye = !0, _e.add(N.id), Me.add(N.id), F(), ga(t, !0), Ae = null, U(w.getState());
|
|
931
922
|
}
|
|
932
923
|
} : void 0
|
|
933
|
-
),
|
|
924
|
+
), z ? (he = P.scrollTop, X()) : E && ui(r) && Hn();
|
|
934
925
|
};
|
|
935
|
-
return
|
|
926
|
+
return Mt = bo(
|
|
936
927
|
(r) => {
|
|
937
|
-
|
|
938
|
-
w.getState(),
|
|
939
|
-
b.value.trim().length > 0 || z.length > 0
|
|
940
|
-
) && O(w.getState());
|
|
928
|
+
ye = r, !ze && ct(w.getState(), tt()) && U(w.getState());
|
|
941
929
|
},
|
|
942
930
|
{
|
|
943
931
|
backendUrl: t.backendUrl,
|
|
944
|
-
fetcher:
|
|
932
|
+
fetcher: Fn,
|
|
945
933
|
loader: t.activeUsersLoader
|
|
946
934
|
}
|
|
947
935
|
), w.on("state", (r) => {
|
|
948
|
-
const s =
|
|
949
|
-
|
|
936
|
+
const s = Rt && !r.isThinking;
|
|
937
|
+
Rt = r.isThinking, r.appearance ? (Qe = !0, J(
|
|
950
938
|
"web-sdk.widget",
|
|
951
939
|
"Agent state supplied appearance",
|
|
952
940
|
{
|
|
953
941
|
appearance: r.appearance
|
|
954
942
|
}
|
|
955
|
-
),
|
|
943
|
+
), ot(r.appearance, "agent.state.appearance")) : Qe && (Qe = !1, J(
|
|
956
944
|
"web-sdk.widget",
|
|
957
945
|
"Agent state cleared appearance; reverting to configured widget options",
|
|
958
946
|
{
|
|
@@ -960,32 +948,32 @@ async function Vo(e = {}) {
|
|
|
960
948
|
fallbackColorScheme: t.colorScheme,
|
|
961
949
|
fallbackFontFamily: t.fontFamily
|
|
962
950
|
}
|
|
963
|
-
),
|
|
964
|
-
}),
|
|
951
|
+
), ot({}, "agent.state.appearance-cleared")), U(r), q(), s && Pt();
|
|
952
|
+
}), U(w.getState()), q(), {
|
|
965
953
|
agent: w,
|
|
966
954
|
updateAppearance: (r) => {
|
|
967
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
955
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), ot(r, "widgetHandle.updateAppearance");
|
|
968
956
|
},
|
|
969
957
|
updateBillingStatus: (r) => {
|
|
970
958
|
const s = r ?? null;
|
|
971
|
-
|
|
959
|
+
on(
|
|
972
960
|
t.billingStatus,
|
|
973
961
|
s,
|
|
974
|
-
|
|
975
|
-
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !
|
|
962
|
+
ve
|
|
963
|
+
) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ve = null), dt(
|
|
976
964
|
i.querySelector(".pluno-pa-widget__billing-status"),
|
|
977
965
|
t.billingStatus,
|
|
978
|
-
|
|
979
|
-
),
|
|
966
|
+
ve
|
|
967
|
+
), q());
|
|
980
968
|
},
|
|
981
969
|
updateAuthGate: (r) => {
|
|
982
|
-
const s =
|
|
983
|
-
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl),
|
|
984
|
-
|
|
970
|
+
const s = Ue();
|
|
971
|
+
t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), Nt(), U(w.getState()), q(), s && !Ue() && w.connect().catch((E) => {
|
|
972
|
+
J(
|
|
985
973
|
"web-sdk.widget",
|
|
986
974
|
"Failed to connect after auth gate cleared",
|
|
987
975
|
{
|
|
988
|
-
message:
|
|
976
|
+
message: E instanceof Error ? E.message : String(E)
|
|
989
977
|
}
|
|
990
978
|
);
|
|
991
979
|
});
|
|
@@ -995,66 +983,66 @@ async function Vo(e = {}) {
|
|
|
995
983
|
},
|
|
996
984
|
updateDisplayState: (r) => {
|
|
997
985
|
if (r === "shown") {
|
|
998
|
-
|
|
986
|
+
Le("shown", !1);
|
|
999
987
|
return;
|
|
1000
988
|
}
|
|
1001
|
-
|
|
989
|
+
Le("minimized", !1);
|
|
1002
990
|
},
|
|
1003
991
|
destroy: () => {
|
|
1004
|
-
|
|
992
|
+
ze || (ze = !0, Et.disconnect(), At?.disconnect(), window.removeEventListener("resize", Lt), It(), L !== null && window.clearTimeout(L), Mt(), xe?.remove(), w.destroy(), o.remove());
|
|
1005
993
|
}
|
|
1006
994
|
};
|
|
1007
|
-
async function
|
|
1008
|
-
if (!
|
|
1009
|
-
|
|
995
|
+
async function Zn(r) {
|
|
996
|
+
if (!Fe) {
|
|
997
|
+
Fe = r.id, Ae = null, U(w.getState());
|
|
1010
998
|
try {
|
|
1011
999
|
if (!t.socialPostDraftHandler)
|
|
1012
1000
|
throw new Error("Social post drafting is not available here.");
|
|
1013
1001
|
const s = await t.socialPostDraftHandler(r);
|
|
1014
1002
|
if (!s.linkedinPost || !s.xPost)
|
|
1015
1003
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
1016
|
-
|
|
1004
|
+
_e.add(r.id), Me.add(r.id), F(), xe?.remove(), xe = Ji(s, {
|
|
1017
1005
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
1018
1006
|
onClose: () => {
|
|
1019
|
-
|
|
1007
|
+
xe?.remove(), xe = null;
|
|
1020
1008
|
}
|
|
1021
|
-
}), i.appendChild(
|
|
1009
|
+
}), i.appendChild(xe);
|
|
1022
1010
|
} catch (s) {
|
|
1023
|
-
|
|
1011
|
+
Ae = s instanceof Error ? s.message : "Could not draft social post.";
|
|
1024
1012
|
} finally {
|
|
1025
|
-
|
|
1013
|
+
Fe = null, U(w.getState());
|
|
1026
1014
|
}
|
|
1027
1015
|
}
|
|
1028
1016
|
}
|
|
1029
|
-
function
|
|
1030
|
-
const
|
|
1031
|
-
a =
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
),
|
|
1035
|
-
accentColor:
|
|
1036
|
-
colorScheme:
|
|
1037
|
-
fontFamily:
|
|
1038
|
-
scribbleStyle:
|
|
1039
|
-
}),
|
|
1017
|
+
function ot(r, s) {
|
|
1018
|
+
const E = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, it = r.scribbleStyle ?? t.scribbleStyle;
|
|
1019
|
+
a = Yt(
|
|
1020
|
+
E,
|
|
1021
|
+
it
|
|
1022
|
+
), Xt(i, a, {
|
|
1023
|
+
accentColor: E,
|
|
1024
|
+
colorScheme: z,
|
|
1025
|
+
fontFamily: N,
|
|
1026
|
+
scribbleStyle: it
|
|
1027
|
+
}), J("web-sdk.widget", "Updated widget appearance", {
|
|
1040
1028
|
source: s,
|
|
1041
1029
|
inputAppearance: r,
|
|
1042
|
-
appliedAccentColor:
|
|
1043
|
-
appliedColorScheme:
|
|
1044
|
-
appliedFontFamily:
|
|
1045
|
-
appliedScribbleStyle:
|
|
1030
|
+
appliedAccentColor: E,
|
|
1031
|
+
appliedColorScheme: z,
|
|
1032
|
+
appliedFontFamily: N,
|
|
1033
|
+
appliedScribbleStyle: it,
|
|
1046
1034
|
cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
|
|
1047
1035
|
});
|
|
1048
1036
|
}
|
|
1049
1037
|
}
|
|
1050
|
-
function
|
|
1038
|
+
function Yt(e, t) {
|
|
1051
1039
|
return { accentColor: e, scribbleStyle: t };
|
|
1052
1040
|
}
|
|
1053
|
-
function
|
|
1054
|
-
const t =
|
|
1055
|
-
return t === null ? "#fafafa" :
|
|
1041
|
+
function Zo(e) {
|
|
1042
|
+
const t = Jo(e);
|
|
1043
|
+
return t === null ? "#fafafa" : Qo(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
1056
1044
|
}
|
|
1057
|
-
function
|
|
1045
|
+
function Jo(e) {
|
|
1058
1046
|
const t = e.trim();
|
|
1059
1047
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
1060
1048
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -1066,26 +1054,26 @@ function Ko(e) {
|
|
|
1066
1054
|
Number.parseInt(t[3] + t[3], 16)
|
|
1067
1055
|
] : null;
|
|
1068
1056
|
}
|
|
1069
|
-
function
|
|
1070
|
-
const
|
|
1057
|
+
function Qo([e, t, o]) {
|
|
1058
|
+
const n = (i) => {
|
|
1071
1059
|
const a = i / 255;
|
|
1072
1060
|
return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
|
|
1073
1061
|
};
|
|
1074
|
-
return 0.2126 *
|
|
1062
|
+
return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
|
|
1075
1063
|
}
|
|
1076
|
-
function
|
|
1064
|
+
function Xt(e, t, o) {
|
|
1077
1065
|
e.classList.toggle(
|
|
1078
1066
|
"pluno-pa-widget--dark",
|
|
1079
|
-
|
|
1067
|
+
o.colorScheme === "dark"
|
|
1080
1068
|
), e.classList.toggle(
|
|
1081
1069
|
"pluno-pa-widget--light",
|
|
1082
|
-
|
|
1083
|
-
), e.classList.toggle("pluno-pa-widget--scribble",
|
|
1084
|
-
const
|
|
1085
|
-
e.style.setProperty("--pluno-pa-accent",
|
|
1070
|
+
o.colorScheme !== "dark"
|
|
1071
|
+
), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
|
|
1072
|
+
const n = o.scribbleStyle ? hn(o.accentColor) : o.accentColor;
|
|
1073
|
+
e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
|
|
1086
1074
|
"--pluno-pa-accent-contrast",
|
|
1087
|
-
|
|
1088
|
-
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily =
|
|
1075
|
+
Zo(n)
|
|
1076
|
+
) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? To : o.fontFamily, o.scribbleStyle && ei(e.ownerDocument);
|
|
1089
1077
|
const i = Array.from(
|
|
1090
1078
|
e.querySelectorAll(".pluno-pa-widget__character")
|
|
1091
1079
|
);
|
|
@@ -1097,11 +1085,11 @@ function jt(e, t, n) {
|
|
|
1097
1085
|
)
|
|
1098
1086
|
);
|
|
1099
1087
|
}
|
|
1100
|
-
function
|
|
1101
|
-
if (e.getElementById(
|
|
1088
|
+
function ei(e) {
|
|
1089
|
+
if (e.getElementById(Wt))
|
|
1102
1090
|
return;
|
|
1103
1091
|
const t = e.createElement("style");
|
|
1104
|
-
t.id =
|
|
1092
|
+
t.id = Wt, t.textContent = `@font-face {
|
|
1105
1093
|
font-family: "Architects Daughter";
|
|
1106
1094
|
font-style: normal;
|
|
1107
1095
|
font-weight: 400;
|
|
@@ -1109,201 +1097,201 @@ function Zo(e) {
|
|
|
1109
1097
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
1110
1098
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
1111
1099
|
}
|
|
1112
|
-
function
|
|
1100
|
+
function ti({
|
|
1113
1101
|
root: e,
|
|
1114
1102
|
launcher: t,
|
|
1115
|
-
launcherDragHandle:
|
|
1116
|
-
getPosition:
|
|
1103
|
+
launcherDragHandle: o,
|
|
1104
|
+
getPosition: n,
|
|
1117
1105
|
setPosition: i,
|
|
1118
1106
|
persist: a
|
|
1119
1107
|
}) {
|
|
1120
1108
|
let l = null, p = null, c = null, u = !1, d = null;
|
|
1121
|
-
const
|
|
1109
|
+
const g = () => {
|
|
1122
1110
|
l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
1123
|
-
},
|
|
1124
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (
|
|
1125
|
-
},
|
|
1126
|
-
if (l !==
|
|
1111
|
+
}, S = (h) => {
|
|
1112
|
+
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = n(), u = !1, t.setPointerCapture?.(h.pointerId));
|
|
1113
|
+
}, f = (h) => {
|
|
1114
|
+
if (l !== h.pointerId || !p || !c)
|
|
1127
1115
|
return;
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
!u && Math.hypot(
|
|
1131
|
-
},
|
|
1132
|
-
l ===
|
|
1133
|
-
},
|
|
1134
|
-
l ===
|
|
1135
|
-
},
|
|
1116
|
+
h.preventDefault();
|
|
1117
|
+
const A = h.clientX - p.x, T = h.clientY - p.y;
|
|
1118
|
+
!u && Math.hypot(A, T) < Vt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: c.x + A, y: c.y + T }));
|
|
1119
|
+
}, O = (h) => {
|
|
1120
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (d = { x: h.clientX, y: h.clientY }, a()), g());
|
|
1121
|
+
}, k = (h) => {
|
|
1122
|
+
l === h.pointerId && (h.preventDefault(), g());
|
|
1123
|
+
}, x = (h) => {
|
|
1136
1124
|
if (!d)
|
|
1137
1125
|
return;
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
) <=
|
|
1142
|
-
d = null,
|
|
1143
|
-
},
|
|
1126
|
+
const A = Math.hypot(
|
|
1127
|
+
h.clientX - d.x,
|
|
1128
|
+
h.clientY - d.y
|
|
1129
|
+
) <= Vt;
|
|
1130
|
+
d = null, A && (h.preventDefault(), h.stopPropagation());
|
|
1131
|
+
}, v = (h) => {
|
|
1144
1132
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
1145
1133
|
return;
|
|
1146
|
-
const
|
|
1147
|
-
let
|
|
1148
|
-
|
|
1134
|
+
const A = h.shiftKey ? Vo : jo, T = n();
|
|
1135
|
+
let I = null;
|
|
1136
|
+
h.key === "ArrowUp" ? I = { x: T.x, y: T.y - A } : h.key === "ArrowDown" ? I = { x: T.x, y: T.y + A } : h.key === "ArrowLeft" ? I = { x: T.x - A, y: T.y } : h.key === "ArrowRight" && (I = { x: T.x + A, y: T.y }), I && (h.preventDefault(), h.stopPropagation(), i(I), a());
|
|
1149
1137
|
};
|
|
1150
|
-
return t.addEventListener("pointerdown",
|
|
1151
|
-
t.removeEventListener("pointerdown",
|
|
1138
|
+
return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", f), t.addEventListener("pointerup", O), t.addEventListener("pointercancel", k), t.addEventListener("click", x, !0), o.addEventListener("keydown", v), () => {
|
|
1139
|
+
t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", f), t.removeEventListener("pointerup", O), t.removeEventListener("pointercancel", k), t.removeEventListener("click", x, !0), o.removeEventListener("keydown", v);
|
|
1152
1140
|
};
|
|
1153
1141
|
}
|
|
1154
|
-
function
|
|
1155
|
-
const
|
|
1142
|
+
function je(e, t = !0) {
|
|
1143
|
+
const o = ne();
|
|
1156
1144
|
if (e.classList.contains("pluno-pa-widget--minimized"))
|
|
1157
1145
|
return e.classList.contains("pluno-pa-widget--scribble") ? {
|
|
1158
|
-
width:
|
|
1159
|
-
height:
|
|
1160
|
-
} : { width:
|
|
1161
|
-
const
|
|
1146
|
+
width: Do,
|
|
1147
|
+
height: Ro
|
|
1148
|
+
} : { width: Gt, height: Gt };
|
|
1149
|
+
const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
1162
1150
|
return {
|
|
1163
|
-
width: t && i &&
|
|
1164
|
-
height: t && i &&
|
|
1151
|
+
width: t && i && n.width > 0 ? n.width : Math.min(_n, o.width - 36),
|
|
1152
|
+
height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? zo : xn
|
|
1165
1153
|
};
|
|
1166
1154
|
}
|
|
1167
|
-
function
|
|
1168
|
-
const e =
|
|
1155
|
+
function Sn() {
|
|
1156
|
+
const e = ne();
|
|
1169
1157
|
return {
|
|
1170
1158
|
width: Math.min(
|
|
1171
|
-
|
|
1172
|
-
e.width *
|
|
1173
|
-
|
|
1174
|
-
|
|
1159
|
+
Se(
|
|
1160
|
+
e.width * Oo,
|
|
1161
|
+
Bo,
|
|
1162
|
+
Uo
|
|
1175
1163
|
),
|
|
1176
|
-
e.width -
|
|
1164
|
+
e.width - H * 2
|
|
1177
1165
|
),
|
|
1178
1166
|
height: Math.min(
|
|
1179
|
-
|
|
1180
|
-
e.height *
|
|
1181
|
-
|
|
1182
|
-
|
|
1167
|
+
Se(
|
|
1168
|
+
e.height * Wo,
|
|
1169
|
+
Fo,
|
|
1170
|
+
Ho
|
|
1183
1171
|
),
|
|
1184
|
-
e.height -
|
|
1172
|
+
e.height - mt - H
|
|
1185
1173
|
)
|
|
1186
1174
|
};
|
|
1187
1175
|
}
|
|
1188
|
-
function
|
|
1189
|
-
const
|
|
1190
|
-
if (Number.isFinite(
|
|
1191
|
-
return { x:
|
|
1176
|
+
function ni(e, t, o) {
|
|
1177
|
+
const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
|
|
1178
|
+
if (Number.isFinite(n) && Number.isFinite(i))
|
|
1179
|
+
return { x: n, y: i };
|
|
1192
1180
|
const a = e.getBoundingClientRect();
|
|
1193
1181
|
if (a.width > 0 || a.height > 0)
|
|
1194
1182
|
return { x: a.left, y: a.top };
|
|
1195
|
-
const l =
|
|
1183
|
+
const l = ne();
|
|
1196
1184
|
return {
|
|
1197
|
-
x: t === "bottom-left" ? 26 : l.width - 26 -
|
|
1198
|
-
y: l.height - 24 -
|
|
1185
|
+
x: t === "bottom-left" ? 26 : l.width - 26 - o.width,
|
|
1186
|
+
y: l.height - 24 - o.height
|
|
1199
1187
|
};
|
|
1200
1188
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const
|
|
1203
|
-
return t ?
|
|
1189
|
+
function rt(e, t, o) {
|
|
1190
|
+
const n = je(e, !1);
|
|
1191
|
+
return t ? bt(
|
|
1204
1192
|
e,
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
) :
|
|
1193
|
+
En(t, n),
|
|
1194
|
+
n
|
|
1195
|
+
) : oi(o === "bottom-left" ? "bottom-left" : "bottom-right", n, Mo);
|
|
1208
1196
|
}
|
|
1209
|
-
function
|
|
1210
|
-
const
|
|
1197
|
+
function oi(e, t, o) {
|
|
1198
|
+
const n = ne();
|
|
1211
1199
|
return {
|
|
1212
|
-
x: e.endsWith("right") ? Math.max(0,
|
|
1213
|
-
y: e.startsWith("bottom") ? Math.max(0,
|
|
1200
|
+
x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
|
|
1201
|
+
y: e.startsWith("bottom") ? Math.max(0, n.height - t.height - o) : o
|
|
1214
1202
|
};
|
|
1215
1203
|
}
|
|
1216
|
-
function
|
|
1217
|
-
const
|
|
1204
|
+
function bt(e, t, o) {
|
|
1205
|
+
const n = ne(), i = H + ri(e);
|
|
1218
1206
|
return {
|
|
1219
|
-
x:
|
|
1207
|
+
x: Se(
|
|
1220
1208
|
t.x,
|
|
1221
|
-
|
|
1209
|
+
H,
|
|
1222
1210
|
Math.max(
|
|
1223
|
-
|
|
1224
|
-
|
|
1211
|
+
H,
|
|
1212
|
+
n.width - o.width - H
|
|
1225
1213
|
)
|
|
1226
1214
|
),
|
|
1227
|
-
y:
|
|
1215
|
+
y: Se(
|
|
1228
1216
|
t.y,
|
|
1229
1217
|
i,
|
|
1230
1218
|
Math.max(
|
|
1231
1219
|
i,
|
|
1232
|
-
|
|
1220
|
+
n.height - o.height - H
|
|
1233
1221
|
)
|
|
1234
1222
|
)
|
|
1235
1223
|
};
|
|
1236
1224
|
}
|
|
1237
|
-
function
|
|
1238
|
-
const
|
|
1225
|
+
function En(e, t) {
|
|
1226
|
+
const o = ne();
|
|
1239
1227
|
return {
|
|
1240
|
-
x: e.anchor.endsWith("right") ?
|
|
1241
|
-
y: e.anchor.startsWith("bottom") ?
|
|
1228
|
+
x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
|
|
1229
|
+
y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
|
|
1242
1230
|
};
|
|
1243
1231
|
}
|
|
1244
|
-
function
|
|
1245
|
-
const
|
|
1232
|
+
function ii(e, t) {
|
|
1233
|
+
const o = ai(e, t), n = ne();
|
|
1246
1234
|
return {
|
|
1247
|
-
anchor:
|
|
1248
|
-
x:
|
|
1249
|
-
y:
|
|
1235
|
+
anchor: o,
|
|
1236
|
+
x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
|
|
1237
|
+
y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
|
|
1250
1238
|
};
|
|
1251
1239
|
}
|
|
1252
|
-
function
|
|
1253
|
-
const
|
|
1240
|
+
function ai(e, t) {
|
|
1241
|
+
const o = ne(), n = e.x + t.width / 2, a = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
|
|
1254
1242
|
return `${a}-${l}`;
|
|
1255
1243
|
}
|
|
1256
|
-
function
|
|
1257
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
1244
|
+
function ri(e) {
|
|
1245
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? qo : $o;
|
|
1258
1246
|
}
|
|
1259
|
-
function
|
|
1260
|
-
const
|
|
1261
|
-
x:
|
|
1262
|
-
y: t.y +
|
|
1247
|
+
function Zt(e, t, o) {
|
|
1248
|
+
const n = je(e), i = Sn(), a = {
|
|
1249
|
+
x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
|
|
1250
|
+
y: t.y + n.height - i.height
|
|
1263
1251
|
};
|
|
1264
|
-
return
|
|
1252
|
+
return li(a);
|
|
1265
1253
|
}
|
|
1266
|
-
function
|
|
1267
|
-
const t =
|
|
1254
|
+
function li(e) {
|
|
1255
|
+
const t = ne(), o = Sn();
|
|
1268
1256
|
return {
|
|
1269
|
-
x:
|
|
1257
|
+
x: Se(
|
|
1270
1258
|
e.x,
|
|
1271
|
-
|
|
1259
|
+
H,
|
|
1272
1260
|
Math.max(
|
|
1273
|
-
|
|
1274
|
-
t.width -
|
|
1261
|
+
H,
|
|
1262
|
+
t.width - o.width - H
|
|
1275
1263
|
)
|
|
1276
1264
|
),
|
|
1277
|
-
y:
|
|
1265
|
+
y: Se(
|
|
1278
1266
|
e.y,
|
|
1279
|
-
|
|
1267
|
+
mt,
|
|
1280
1268
|
Math.max(
|
|
1281
|
-
|
|
1282
|
-
t.height -
|
|
1269
|
+
mt,
|
|
1270
|
+
t.height - o.height - H
|
|
1283
1271
|
)
|
|
1284
1272
|
)
|
|
1285
1273
|
};
|
|
1286
1274
|
}
|
|
1287
|
-
function
|
|
1275
|
+
function fe(e, t) {
|
|
1288
1276
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
1289
1277
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
1290
1278
|
return;
|
|
1291
1279
|
}
|
|
1292
1280
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
1293
1281
|
}
|
|
1294
|
-
function
|
|
1282
|
+
function pi(e, t) {
|
|
1295
1283
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
1296
1284
|
}
|
|
1297
|
-
function
|
|
1285
|
+
function Jt(e) {
|
|
1298
1286
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
1299
1287
|
}
|
|
1300
|
-
function
|
|
1288
|
+
function ne() {
|
|
1301
1289
|
return {
|
|
1302
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
1303
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
1290
|
+
width: window.innerWidth || document.documentElement.clientWidth || _n + H * 2,
|
|
1291
|
+
height: window.innerHeight || document.documentElement.clientHeight || xn + H * 2
|
|
1304
1292
|
};
|
|
1305
1293
|
}
|
|
1306
|
-
function
|
|
1294
|
+
function lt(e) {
|
|
1307
1295
|
const t = e.getBoundingClientRect();
|
|
1308
1296
|
return {
|
|
1309
1297
|
x: Math.round(t.x),
|
|
@@ -1312,42 +1300,45 @@ function at(e) {
|
|
|
1312
1300
|
height: Math.round(t.height)
|
|
1313
1301
|
};
|
|
1314
1302
|
}
|
|
1315
|
-
function
|
|
1316
|
-
return Math.min(Math.max(e, t),
|
|
1303
|
+
function Se(e, t, o) {
|
|
1304
|
+
return Math.min(Math.max(e, t), o);
|
|
1317
1305
|
}
|
|
1318
|
-
function
|
|
1306
|
+
function J(e, t, o) {
|
|
1319
1307
|
if (typeof window > "u")
|
|
1320
1308
|
return;
|
|
1321
|
-
const
|
|
1309
|
+
const n = window, i = {
|
|
1322
1310
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1323
1311
|
source: e,
|
|
1324
1312
|
message: t,
|
|
1325
|
-
details:
|
|
1326
|
-
}, a =
|
|
1327
|
-
a.push(i), a.length > 120 && a.splice(0, a.length - 120),
|
|
1328
|
-
new CustomEvent(
|
|
1313
|
+
details: o
|
|
1314
|
+
}, a = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
1315
|
+
a.push(i), a.length > 120 && a.splice(0, a.length - 120), n.__plunoProductAgentDiagnostics__ = a, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
|
|
1316
|
+
new CustomEvent(Po, { detail: i })
|
|
1329
1317
|
);
|
|
1330
1318
|
}
|
|
1331
|
-
function
|
|
1332
|
-
|
|
1319
|
+
function si(e, t) {
|
|
1320
|
+
J("web-sdk.widget.position", e, t);
|
|
1333
1321
|
}
|
|
1334
|
-
function
|
|
1335
|
-
const
|
|
1336
|
-
return !
|
|
1337
|
-
attachments:
|
|
1322
|
+
function pt(e, t, o) {
|
|
1323
|
+
const n = t.value.trim();
|
|
1324
|
+
return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
|
|
1325
|
+
attachments: o.length > 0 ? o.map(di) : void 0
|
|
1338
1326
|
}), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
1339
1327
|
}
|
|
1340
|
-
function
|
|
1328
|
+
function di(e) {
|
|
1329
|
+
return e;
|
|
1330
|
+
}
|
|
1331
|
+
function Ne(e) {
|
|
1341
1332
|
e.style.height = "0px";
|
|
1342
1333
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1343
1334
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1344
1335
|
}
|
|
1345
|
-
function
|
|
1336
|
+
function Te(e, t = () => !0) {
|
|
1346
1337
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1347
1338
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1348
1339
|
});
|
|
1349
1340
|
}
|
|
1350
|
-
function
|
|
1341
|
+
function ci(e) {
|
|
1351
1342
|
const t = e.messages[e.messages.length - 1];
|
|
1352
1343
|
return [
|
|
1353
1344
|
e.messages.length,
|
|
@@ -1358,64 +1349,64 @@ function li(e) {
|
|
|
1358
1349
|
e.lastError ?? ""
|
|
1359
1350
|
].join(":");
|
|
1360
1351
|
}
|
|
1361
|
-
function
|
|
1352
|
+
function ui(e) {
|
|
1362
1353
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1363
1354
|
}
|
|
1364
|
-
function
|
|
1355
|
+
function gi(e) {
|
|
1365
1356
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1366
1357
|
}
|
|
1367
|
-
function
|
|
1358
|
+
function hi(e) {
|
|
1368
1359
|
const t = e.currentPage;
|
|
1369
1360
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1370
1361
|
try {
|
|
1371
|
-
const
|
|
1372
|
-
return `${
|
|
1362
|
+
const o = new URL(t.url);
|
|
1363
|
+
return `${o.pathname || "/"}${o.search}`;
|
|
1373
1364
|
} catch {
|
|
1374
1365
|
return t.url;
|
|
1375
1366
|
}
|
|
1376
1367
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1377
1368
|
}
|
|
1378
|
-
function
|
|
1379
|
-
const
|
|
1380
|
-
if (!Number.isFinite(
|
|
1369
|
+
function mi(e, t) {
|
|
1370
|
+
const o = new Date(e).getTime();
|
|
1371
|
+
if (!Number.isFinite(o))
|
|
1381
1372
|
return "now";
|
|
1382
|
-
const
|
|
1373
|
+
const n = Math.max(0, t - o), i = [
|
|
1383
1374
|
["day", 864e5],
|
|
1384
1375
|
["hour", 36e5],
|
|
1385
1376
|
["min", 6e4]
|
|
1386
1377
|
];
|
|
1387
1378
|
for (const [a, l] of i)
|
|
1388
|
-
if (
|
|
1389
|
-
const p = Math.max(1, Math.floor(
|
|
1379
|
+
if (n >= l) {
|
|
1380
|
+
const p = Math.max(1, Math.floor(n / l));
|
|
1390
1381
|
return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
|
|
1391
1382
|
}
|
|
1392
1383
|
return "now";
|
|
1393
1384
|
}
|
|
1394
|
-
function
|
|
1395
|
-
e.appendChild(
|
|
1396
|
-
|
|
1385
|
+
function bi(e, t, o, n, i) {
|
|
1386
|
+
e.appendChild(Si()), e.appendChild(
|
|
1387
|
+
fi(
|
|
1397
1388
|
t,
|
|
1398
|
-
n,
|
|
1399
1389
|
o,
|
|
1390
|
+
n,
|
|
1400
1391
|
i
|
|
1401
1392
|
)
|
|
1402
1393
|
), e.appendChild(
|
|
1403
|
-
|
|
1394
|
+
Ve(
|
|
1404
1395
|
"pluno-pa-widget__close",
|
|
1405
1396
|
"Close",
|
|
1406
|
-
|
|
1397
|
+
Ei(16),
|
|
1407
1398
|
!0
|
|
1408
1399
|
)
|
|
1409
|
-
), e.appendChild(
|
|
1400
|
+
), e.appendChild(wi(o));
|
|
1410
1401
|
}
|
|
1411
|
-
function
|
|
1402
|
+
function fi(e, t, o, n) {
|
|
1412
1403
|
const i = document.createElement("form");
|
|
1413
|
-
if (i.className = "pluno-pa-widget__launcher",
|
|
1404
|
+
if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
|
|
1414
1405
|
const l = document.createElement("button");
|
|
1415
1406
|
l.type = "button", l.className = "pluno-pa-widget__launcher-drag-handle", l.setAttribute("aria-label", "Move Pluno launcher"), l.title = "Move Pluno launcher", i.appendChild(l);
|
|
1416
1407
|
}
|
|
1417
1408
|
i.appendChild(
|
|
1418
|
-
|
|
1409
|
+
Pn(
|
|
1419
1410
|
"pluno-pa-widget__scribble-spirals--launcher",
|
|
1420
1411
|
10
|
|
1421
1412
|
)
|
|
@@ -1426,118 +1417,118 @@ function gi(e, t, n, o) {
|
|
|
1426
1417
|
)
|
|
1427
1418
|
);
|
|
1428
1419
|
const a = document.createElement("input");
|
|
1429
|
-
if (a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), i.appendChild(a),
|
|
1420
|
+
if (a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), i.appendChild(a), n) {
|
|
1430
1421
|
const l = document.createElement("button");
|
|
1431
1422
|
l.type = "button", l.className = "pluno-pa-widget__launcher-minimize", l.textContent = "-", l.setAttribute("aria-label", "Minimize Pluno on this site"), l.title = "Minimize Pluno on this site", i.appendChild(l);
|
|
1432
1423
|
}
|
|
1433
1424
|
return i;
|
|
1434
1425
|
}
|
|
1435
|
-
function
|
|
1426
|
+
function wi(e) {
|
|
1436
1427
|
const t = document.createElement("section");
|
|
1437
1428
|
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1438
|
-
|
|
1429
|
+
Pn("pluno-pa-widget__scribble-spirals--panel", 16)
|
|
1439
1430
|
);
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1431
|
+
const o = document.createElement("div");
|
|
1432
|
+
o.className = "pluno-pa-widget__timeline-wrap";
|
|
1433
|
+
const n = document.createElement("main");
|
|
1434
|
+
n.className = "pluno-pa-widget__timeline", n.appendChild(vi(e));
|
|
1444
1435
|
const i = document.createElement("div");
|
|
1445
|
-
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"),
|
|
1436
|
+
i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
|
|
1446
1437
|
const a = document.createElement("div");
|
|
1447
|
-
a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0,
|
|
1438
|
+
a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, o.appendChild(a);
|
|
1448
1439
|
const l = document.createElement("button");
|
|
1449
|
-
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0,
|
|
1440
|
+
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, o.appendChild(l);
|
|
1450
1441
|
const p = document.createElement("div");
|
|
1451
1442
|
return p.className = "pluno-pa-widget__top-actions", p.appendChild(
|
|
1452
|
-
|
|
1443
|
+
Ve(
|
|
1453
1444
|
"pluno-pa-widget__history",
|
|
1454
1445
|
"Recent chats",
|
|
1455
|
-
|
|
1446
|
+
Li(),
|
|
1456
1447
|
!0
|
|
1457
1448
|
)
|
|
1458
|
-
),
|
|
1449
|
+
), o.appendChild(p), o.appendChild(xi()), t.appendChild(o), t.appendChild(_i()), t;
|
|
1459
1450
|
}
|
|
1460
|
-
function
|
|
1451
|
+
function _i() {
|
|
1461
1452
|
const e = document.createElement("form");
|
|
1462
1453
|
e.className = "pluno-pa-widget__composer";
|
|
1463
1454
|
const t = document.createElement("div");
|
|
1464
1455
|
t.className = "pluno-pa-widget__billing-status", t.hidden = !0, e.appendChild(t);
|
|
1465
|
-
const n = document.createElement("div");
|
|
1466
|
-
n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, e.appendChild(n);
|
|
1467
1456
|
const o = document.createElement("div");
|
|
1468
|
-
o.className = "pluno-pa-
|
|
1457
|
+
o.className = "pluno-pa-widget__attachment-error", o.hidden = !0, e.appendChild(o);
|
|
1458
|
+
const n = document.createElement("div");
|
|
1459
|
+
n.className = "pluno-pa-widget__attachments", n.hidden = !0, e.appendChild(n);
|
|
1469
1460
|
const i = document.createElement("div");
|
|
1470
1461
|
i.className = "pluno-pa-widget__composer-inner";
|
|
1471
1462
|
const a = document.createElement("input");
|
|
1472
|
-
a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.
|
|
1463
|
+
a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
|
|
1473
1464
|
const l = document.createElement("button");
|
|
1474
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1465
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Pi()), l.appendChild(Ai()), i.appendChild(l);
|
|
1475
1466
|
const p = document.createElement("textarea");
|
|
1476
1467
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
|
|
1477
1468
|
const c = document.createElement("button");
|
|
1478
|
-
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(
|
|
1469
|
+
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(An()), i.appendChild(c), e.appendChild(i);
|
|
1479
1470
|
const u = document.createElement("div");
|
|
1480
1471
|
u.className = "pluno-pa-widget__composer-meta";
|
|
1481
1472
|
const d = document.createElement("a");
|
|
1482
1473
|
d.className = "pluno-pa-widget__powered-by", d.href = "https://pluno.ai", d.target = "_blank", d.rel = "noopener noreferrer", d.textContent = "Powered by Pluno.ai.", u.appendChild(d);
|
|
1483
|
-
const
|
|
1484
|
-
return
|
|
1474
|
+
const g = document.createElement("span");
|
|
1475
|
+
return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(g), e.appendChild(u), e;
|
|
1485
1476
|
}
|
|
1486
|
-
function
|
|
1477
|
+
function xi() {
|
|
1487
1478
|
const e = document.createElement("section");
|
|
1488
1479
|
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
|
|
1489
1480
|
const t = document.createElement("div");
|
|
1490
1481
|
t.className = "pluno-pa-widget__history-header";
|
|
1491
|
-
const
|
|
1492
|
-
|
|
1493
|
-
const
|
|
1482
|
+
const o = document.createElement("strong");
|
|
1483
|
+
o.textContent = "Recent chats";
|
|
1484
|
+
const n = Ve(
|
|
1494
1485
|
"pluno-pa-widget__history-close",
|
|
1495
1486
|
"Close recent chats",
|
|
1496
|
-
|
|
1487
|
+
Ii(),
|
|
1497
1488
|
!1
|
|
1498
1489
|
);
|
|
1499
|
-
t.append(
|
|
1490
|
+
t.append(o, n);
|
|
1500
1491
|
const i = document.createElement("div");
|
|
1501
1492
|
i.className = "pluno-pa-widget__history-list";
|
|
1502
1493
|
const a = document.createElement("p");
|
|
1503
1494
|
return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
|
|
1504
1495
|
}
|
|
1505
|
-
function
|
|
1496
|
+
function vi(e) {
|
|
1506
1497
|
const t = document.createElement("div");
|
|
1507
1498
|
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1508
1499
|
se(
|
|
1509
1500
|
"pluno-pa-widget__character--empty",
|
|
1510
1501
|
e
|
|
1511
1502
|
)
|
|
1512
|
-
), t.appendChild(
|
|
1503
|
+
), t.appendChild(kn()), t;
|
|
1513
1504
|
}
|
|
1514
|
-
function
|
|
1505
|
+
function kn() {
|
|
1515
1506
|
const e = document.createElement("div");
|
|
1516
1507
|
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;
|
|
1517
1508
|
}
|
|
1518
|
-
function
|
|
1509
|
+
function Ln(e, t) {
|
|
1519
1510
|
e.replaceChildren(), e.setAttribute(
|
|
1520
1511
|
"aria-label",
|
|
1521
1512
|
`${t.toLocaleString("en-US")} users currently active`
|
|
1522
1513
|
);
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1514
|
+
const o = document.createElement("span");
|
|
1515
|
+
o.className = "pluno-pa-widget__active-users-counter-dot", o.setAttribute("aria-hidden", "true"), e.appendChild(o), e.appendChild(
|
|
1525
1516
|
document.createTextNode(
|
|
1526
1517
|
`${t.toLocaleString("en-US")} users currently active`
|
|
1527
1518
|
)
|
|
1528
1519
|
);
|
|
1529
1520
|
}
|
|
1530
1521
|
function se(e, t) {
|
|
1531
|
-
const
|
|
1532
|
-
|
|
1533
|
-
const
|
|
1534
|
-
return
|
|
1522
|
+
const o = `pluno-pa-character-${Kt}`;
|
|
1523
|
+
Kt += 1;
|
|
1524
|
+
const n = t.scribbleStyle ? Ci(t.accentColor, o) : yi(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
|
|
1525
|
+
return n.setAttribute(
|
|
1535
1526
|
"class",
|
|
1536
1527
|
i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1537
|
-
),
|
|
1528
|
+
), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
|
|
1538
1529
|
}
|
|
1539
|
-
function
|
|
1540
|
-
const
|
|
1530
|
+
function yi(e, t) {
|
|
1531
|
+
const o = to(e), n = {
|
|
1541
1532
|
boltFill: `${t}-boltFill`,
|
|
1542
1533
|
boltEdge: `${t}-boltEdge`,
|
|
1543
1534
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1548,171 +1539,171 @@ function _i(e, t) {
|
|
|
1548
1539
|
eyeShadow: `${t}-eyeShadow`,
|
|
1549
1540
|
pupilGloss: `${t}-pupilGloss`,
|
|
1550
1541
|
boltClip: `${t}-boltClip`
|
|
1551
|
-
}, i =
|
|
1552
|
-
id:
|
|
1542
|
+
}, i = In(), a = m(i, "defs"), l = m(a, "linearGradient", {
|
|
1543
|
+
id: n.boltFill,
|
|
1553
1544
|
x1: "420",
|
|
1554
1545
|
y1: "180",
|
|
1555
1546
|
x2: "790",
|
|
1556
1547
|
y2: "1040",
|
|
1557
1548
|
gradientUnits: "userSpaceOnUse"
|
|
1558
1549
|
});
|
|
1559
|
-
|
|
1550
|
+
R(l, "0", o.top), R(l, "0.36", o.middle), R(l, "0.72", o.bottom), R(l, "1", o.bottom);
|
|
1560
1551
|
const p = m(a, "linearGradient", {
|
|
1561
|
-
id:
|
|
1552
|
+
id: n.boltEdge,
|
|
1562
1553
|
x1: "470",
|
|
1563
1554
|
y1: "145",
|
|
1564
1555
|
x2: "900",
|
|
1565
1556
|
y2: "980",
|
|
1566
1557
|
gradientUnits: "userSpaceOnUse"
|
|
1567
1558
|
});
|
|
1568
|
-
|
|
1559
|
+
R(p, "0", o.edgeStart), R(p, "0.32", o.edgeMiddle), R(p, "0.78", o.edgeEnd), R(p, "1", o.edgeEnd);
|
|
1569
1560
|
const c = m(a, "radialGradient", {
|
|
1570
|
-
id:
|
|
1561
|
+
id: n.boltGlow,
|
|
1571
1562
|
cx: "50%",
|
|
1572
1563
|
cy: "22%",
|
|
1573
1564
|
r: "82%"
|
|
1574
1565
|
});
|
|
1575
|
-
|
|
1566
|
+
R(c, "0", o.glow, "0.72"), R(c, "0.5", o.middle, "0.44"), R(c, "1", o.bottom, "0");
|
|
1576
1567
|
const u = m(a, "radialGradient", {
|
|
1577
|
-
id:
|
|
1568
|
+
id: n.eyeWhite,
|
|
1578
1569
|
cx: "35%",
|
|
1579
1570
|
cy: "25%",
|
|
1580
1571
|
r: "70%"
|
|
1581
1572
|
});
|
|
1582
|
-
|
|
1573
|
+
R(u, "0", "#ffffff"), R(u, "0.72", "#ffffff"), R(u, "1", "#e5e5e5");
|
|
1583
1574
|
const d = m(a, "radialGradient", {
|
|
1584
|
-
id:
|
|
1575
|
+
id: n.pupil,
|
|
1585
1576
|
cx: "42%",
|
|
1586
1577
|
cy: "38%",
|
|
1587
1578
|
r: "65%"
|
|
1588
1579
|
});
|
|
1589
|
-
|
|
1590
|
-
const
|
|
1591
|
-
id:
|
|
1580
|
+
R(d, "0", "#2a1f10"), R(d, "0.52", "#080604"), R(d, "1", "#000000");
|
|
1581
|
+
const g = m(a, "filter", {
|
|
1582
|
+
id: n.softDropShadow,
|
|
1592
1583
|
x: "-18%",
|
|
1593
1584
|
y: "-12%",
|
|
1594
1585
|
width: "136%",
|
|
1595
1586
|
height: "136%",
|
|
1596
1587
|
"color-interpolation-filters": "sRGB"
|
|
1597
1588
|
});
|
|
1598
|
-
m(
|
|
1589
|
+
m(g, "feDropShadow", {
|
|
1599
1590
|
dx: "0",
|
|
1600
1591
|
dy: "12",
|
|
1601
1592
|
stdDeviation: "18",
|
|
1602
|
-
"flood-color":
|
|
1593
|
+
"flood-color": o.shadow,
|
|
1603
1594
|
"flood-opacity": "0.24"
|
|
1604
1595
|
});
|
|
1605
|
-
const
|
|
1606
|
-
id:
|
|
1596
|
+
const S = m(a, "filter", {
|
|
1597
|
+
id: n.innerDepth,
|
|
1607
1598
|
x: "-8%",
|
|
1608
1599
|
y: "-8%",
|
|
1609
1600
|
width: "116%",
|
|
1610
1601
|
height: "116%",
|
|
1611
1602
|
"color-interpolation-filters": "sRGB"
|
|
1612
1603
|
});
|
|
1613
|
-
m(
|
|
1604
|
+
m(S, "feGaussianBlur", {
|
|
1614
1605
|
in: "SourceAlpha",
|
|
1615
1606
|
stdDeviation: "8",
|
|
1616
1607
|
result: "blur"
|
|
1617
|
-
}), m(
|
|
1608
|
+
}), m(S, "feOffset", {
|
|
1618
1609
|
dx: "-7",
|
|
1619
1610
|
dy: "-9",
|
|
1620
1611
|
result: "topLeft"
|
|
1621
|
-
}), m(
|
|
1612
|
+
}), m(S, "feComposite", {
|
|
1622
1613
|
in: "topLeft",
|
|
1623
1614
|
in2: "SourceAlpha",
|
|
1624
1615
|
operator: "arithmetic",
|
|
1625
1616
|
k2: "-1",
|
|
1626
1617
|
k3: "1",
|
|
1627
1618
|
result: "innerShadow"
|
|
1628
|
-
}), m(
|
|
1619
|
+
}), m(S, "feColorMatrix", {
|
|
1629
1620
|
in: "innerShadow",
|
|
1630
1621
|
type: "matrix",
|
|
1631
1622
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1632
1623
|
result: "innerLight"
|
|
1633
|
-
}), m(
|
|
1624
|
+
}), m(S, "feBlend", {
|
|
1634
1625
|
in: "SourceGraphic",
|
|
1635
1626
|
in2: "innerLight",
|
|
1636
1627
|
mode: "screen"
|
|
1637
1628
|
});
|
|
1638
|
-
const
|
|
1639
|
-
id:
|
|
1629
|
+
const f = m(a, "filter", {
|
|
1630
|
+
id: n.eyeShadow,
|
|
1640
1631
|
x: "-24%",
|
|
1641
1632
|
y: "-20%",
|
|
1642
1633
|
width: "148%",
|
|
1643
1634
|
height: "148%",
|
|
1644
1635
|
"color-interpolation-filters": "sRGB"
|
|
1645
1636
|
});
|
|
1646
|
-
m(
|
|
1637
|
+
m(f, "feDropShadow", {
|
|
1647
1638
|
dx: "0",
|
|
1648
1639
|
dy: "8",
|
|
1649
1640
|
stdDeviation: "5",
|
|
1650
|
-
"flood-color":
|
|
1641
|
+
"flood-color": o.shadow,
|
|
1651
1642
|
"flood-opacity": "0.3"
|
|
1652
1643
|
});
|
|
1653
|
-
const
|
|
1654
|
-
id:
|
|
1644
|
+
const O = m(a, "filter", {
|
|
1645
|
+
id: n.pupilGloss,
|
|
1655
1646
|
x: "-15%",
|
|
1656
1647
|
y: "-15%",
|
|
1657
1648
|
width: "130%",
|
|
1658
1649
|
height: "130%",
|
|
1659
1650
|
"color-interpolation-filters": "sRGB"
|
|
1660
1651
|
});
|
|
1661
|
-
m(
|
|
1652
|
+
m(O, "feDropShadow", {
|
|
1662
1653
|
dx: "0",
|
|
1663
1654
|
dy: "3",
|
|
1664
1655
|
stdDeviation: "3",
|
|
1665
1656
|
"flood-color": "#000000",
|
|
1666
1657
|
"flood-opacity": "0.22"
|
|
1667
1658
|
});
|
|
1668
|
-
const
|
|
1669
|
-
m(
|
|
1670
|
-
const
|
|
1671
|
-
filter:
|
|
1659
|
+
const k = m(a, "clipPath", { id: n.boltClip });
|
|
1660
|
+
m(k, "path", { d: $e });
|
|
1661
|
+
const x = m(i, "g", {
|
|
1662
|
+
filter: j(n.softDropShadow)
|
|
1672
1663
|
});
|
|
1673
|
-
m(
|
|
1674
|
-
d:
|
|
1675
|
-
fill:
|
|
1664
|
+
m(x, "path", {
|
|
1665
|
+
d: $e,
|
|
1666
|
+
fill: j(n.boltEdge)
|
|
1676
1667
|
});
|
|
1677
|
-
const
|
|
1678
|
-
m(
|
|
1679
|
-
d:
|
|
1680
|
-
fill:
|
|
1681
|
-
filter:
|
|
1682
|
-
}), m(
|
|
1683
|
-
d:
|
|
1684
|
-
fill:
|
|
1668
|
+
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";
|
|
1669
|
+
m(x, "path", {
|
|
1670
|
+
d: v,
|
|
1671
|
+
fill: j(n.boltFill),
|
|
1672
|
+
filter: j(n.innerDepth)
|
|
1673
|
+
}), m(x, "path", {
|
|
1674
|
+
d: v,
|
|
1675
|
+
fill: j(n.boltGlow),
|
|
1685
1676
|
opacity: "0.74"
|
|
1686
1677
|
});
|
|
1687
|
-
const
|
|
1688
|
-
"clip-path":
|
|
1678
|
+
const h = m(x, "g", {
|
|
1679
|
+
"clip-path": j(n.boltClip),
|
|
1689
1680
|
opacity: "0.42"
|
|
1690
1681
|
});
|
|
1691
|
-
m(
|
|
1682
|
+
m(h, "path", {
|
|
1692
1683
|
d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
|
|
1693
1684
|
fill: "none",
|
|
1694
|
-
stroke:
|
|
1685
|
+
stroke: o.highlight,
|
|
1695
1686
|
"stroke-width": "22",
|
|
1696
1687
|
"stroke-linecap": "round",
|
|
1697
1688
|
opacity: "0.65"
|
|
1698
|
-
}), m(
|
|
1689
|
+
}), m(h, "path", {
|
|
1699
1690
|
d: "M556 685 L501 994",
|
|
1700
1691
|
fill: "none",
|
|
1701
|
-
stroke:
|
|
1692
|
+
stroke: o.highlight,
|
|
1702
1693
|
"stroke-width": "20",
|
|
1703
1694
|
"stroke-linecap": "round",
|
|
1704
1695
|
opacity: "0.55"
|
|
1705
|
-
}), m(
|
|
1696
|
+
}), m(h, "path", {
|
|
1706
1697
|
d: "M858 160 C882 166 893 181 883 204",
|
|
1707
1698
|
fill: "none",
|
|
1708
|
-
stroke:
|
|
1699
|
+
stroke: o.inner,
|
|
1709
1700
|
"stroke-width": "18",
|
|
1710
1701
|
"stroke-linecap": "round",
|
|
1711
1702
|
opacity: "0.48"
|
|
1712
1703
|
});
|
|
1713
|
-
const
|
|
1714
|
-
return
|
|
1715
|
-
|
|
1704
|
+
const A = m(i, "g", { filter: j(n.eyeShadow) });
|
|
1705
|
+
return Qt(
|
|
1706
|
+
A,
|
|
1716
1707
|
"rotate(-2 528 463)",
|
|
1717
1708
|
"528",
|
|
1718
1709
|
"463",
|
|
@@ -1720,9 +1711,9 @@ function _i(e, t) {
|
|
|
1720
1711
|
"473",
|
|
1721
1712
|
"557",
|
|
1722
1713
|
"447",
|
|
1723
|
-
|
|
1724
|
-
),
|
|
1725
|
-
|
|
1714
|
+
n
|
|
1715
|
+
), Qt(
|
|
1716
|
+
A,
|
|
1726
1717
|
"rotate(2 717 462)",
|
|
1727
1718
|
"717",
|
|
1728
1719
|
"462",
|
|
@@ -1730,17 +1721,17 @@ function _i(e, t) {
|
|
|
1730
1721
|
"473",
|
|
1731
1722
|
"728",
|
|
1732
1723
|
"447",
|
|
1733
|
-
|
|
1724
|
+
n
|
|
1734
1725
|
), i;
|
|
1735
1726
|
}
|
|
1736
|
-
function
|
|
1737
|
-
const
|
|
1727
|
+
function Ci(e, t) {
|
|
1728
|
+
const o = hn(e), n = {
|
|
1738
1729
|
clip: `${t}-scribbleBoltClip`,
|
|
1739
1730
|
wobble: `${t}-scribbleBoltWobble`
|
|
1740
|
-
}, i =
|
|
1741
|
-
m(l, "path", { d:
|
|
1731
|
+
}, i = In(), a = m(i, "defs"), l = m(a, "clipPath", { id: n.clip });
|
|
1732
|
+
m(l, "path", { d: $e });
|
|
1742
1733
|
const p = m(a, "filter", {
|
|
1743
|
-
id:
|
|
1734
|
+
id: n.wobble,
|
|
1744
1735
|
x: "-10%",
|
|
1745
1736
|
y: "-10%",
|
|
1746
1737
|
width: "120%",
|
|
@@ -1760,25 +1751,25 @@ function xi(e, t) {
|
|
|
1760
1751
|
xChannelSelector: "R",
|
|
1761
1752
|
yChannelSelector: "G"
|
|
1762
1753
|
});
|
|
1763
|
-
const c = m(i, "g", { filter:
|
|
1764
|
-
"clip-path":
|
|
1754
|
+
const c = m(i, "g", { filter: j(n.wobble) }), u = m(c, "g", {
|
|
1755
|
+
"clip-path": j(n.clip)
|
|
1765
1756
|
});
|
|
1766
1757
|
return m(u, "path", {
|
|
1767
|
-
d:
|
|
1758
|
+
d: eo(),
|
|
1768
1759
|
fill: "none",
|
|
1769
|
-
stroke:
|
|
1760
|
+
stroke: o,
|
|
1770
1761
|
"stroke-width": "56",
|
|
1771
1762
|
"stroke-linecap": "round",
|
|
1772
1763
|
"stroke-linejoin": "round",
|
|
1773
1764
|
opacity: "0.9",
|
|
1774
1765
|
transform: "rotate(-14 627 600)"
|
|
1775
1766
|
}), m(c, "path", {
|
|
1776
|
-
d:
|
|
1767
|
+
d: $e,
|
|
1777
1768
|
fill: "none",
|
|
1778
|
-
stroke:
|
|
1769
|
+
stroke: qe,
|
|
1779
1770
|
"stroke-width": "18",
|
|
1780
1771
|
"stroke-linejoin": "round"
|
|
1781
|
-
}),
|
|
1772
|
+
}), en(
|
|
1782
1773
|
c,
|
|
1783
1774
|
"rotate(-2 528 463)",
|
|
1784
1775
|
"528",
|
|
@@ -1787,7 +1778,7 @@ function xi(e, t) {
|
|
|
1787
1778
|
"473",
|
|
1788
1779
|
"557",
|
|
1789
1780
|
"447"
|
|
1790
|
-
),
|
|
1781
|
+
), en(
|
|
1791
1782
|
c,
|
|
1792
1783
|
"rotate(2 717 462)",
|
|
1793
1784
|
"717",
|
|
@@ -1798,27 +1789,27 @@ function xi(e, t) {
|
|
|
1798
1789
|
"447"
|
|
1799
1790
|
), i;
|
|
1800
1791
|
}
|
|
1801
|
-
function
|
|
1802
|
-
return
|
|
1803
|
-
xmlns:
|
|
1792
|
+
function In() {
|
|
1793
|
+
return y("svg", {
|
|
1794
|
+
xmlns: vn,
|
|
1804
1795
|
viewBox: "0 0 1254 1254"
|
|
1805
1796
|
});
|
|
1806
1797
|
}
|
|
1807
|
-
function
|
|
1798
|
+
function Qt(e, t, o, n, i, a, l, p, c) {
|
|
1808
1799
|
const u = m(e, "g", { transform: t });
|
|
1809
1800
|
m(u, "ellipse", {
|
|
1810
|
-
cx:
|
|
1811
|
-
cy:
|
|
1801
|
+
cx: o,
|
|
1802
|
+
cy: n,
|
|
1812
1803
|
rx: "73",
|
|
1813
1804
|
ry: "80",
|
|
1814
|
-
fill:
|
|
1805
|
+
fill: j(c.eyeWhite)
|
|
1815
1806
|
}), m(u, "ellipse", {
|
|
1816
1807
|
cx: i,
|
|
1817
1808
|
cy: a,
|
|
1818
1809
|
rx: "49",
|
|
1819
1810
|
ry: "57",
|
|
1820
|
-
fill:
|
|
1821
|
-
filter:
|
|
1811
|
+
fill: j(c.pupil),
|
|
1812
|
+
filter: j(c.pupilGloss)
|
|
1822
1813
|
}), m(u, "circle", {
|
|
1823
1814
|
cx: l,
|
|
1824
1815
|
cy: p,
|
|
@@ -1826,22 +1817,22 @@ function Kt(e, t, n, o, i, a, l, p, c) {
|
|
|
1826
1817
|
fill: "#ffffff"
|
|
1827
1818
|
});
|
|
1828
1819
|
}
|
|
1829
|
-
function
|
|
1820
|
+
function en(e, t, o, n, i, a, l, p) {
|
|
1830
1821
|
const c = m(e, "g", { transform: t });
|
|
1831
1822
|
m(c, "ellipse", {
|
|
1832
|
-
cx:
|
|
1833
|
-
cy:
|
|
1823
|
+
cx: o,
|
|
1824
|
+
cy: n,
|
|
1834
1825
|
rx: "73",
|
|
1835
1826
|
ry: "80",
|
|
1836
1827
|
fill: "#ffffff",
|
|
1837
|
-
stroke:
|
|
1828
|
+
stroke: qe,
|
|
1838
1829
|
"stroke-width": "13"
|
|
1839
1830
|
}), m(c, "ellipse", {
|
|
1840
1831
|
cx: i,
|
|
1841
1832
|
cy: a,
|
|
1842
1833
|
rx: "45",
|
|
1843
1834
|
ry: "53",
|
|
1844
|
-
fill:
|
|
1835
|
+
fill: qe
|
|
1845
1836
|
}), m(c, "circle", {
|
|
1846
1837
|
cx: l,
|
|
1847
1838
|
cy: p,
|
|
@@ -1849,49 +1840,49 @@ function Xt(e, t, n, o, i, a, l, p) {
|
|
|
1849
1840
|
fill: "#ffffff"
|
|
1850
1841
|
});
|
|
1851
1842
|
}
|
|
1852
|
-
function m(e, t,
|
|
1853
|
-
const
|
|
1854
|
-
return e.appendChild(
|
|
1843
|
+
function m(e, t, o = {}) {
|
|
1844
|
+
const n = y(t, o);
|
|
1845
|
+
return e.appendChild(n), n;
|
|
1855
1846
|
}
|
|
1856
|
-
function
|
|
1857
|
-
const i = { offset: t, "stop-color":
|
|
1858
|
-
|
|
1847
|
+
function R(e, t, o, n) {
|
|
1848
|
+
const i = { offset: t, "stop-color": o };
|
|
1849
|
+
n !== void 0 && (i["stop-opacity"] = n), m(e, "stop", i);
|
|
1859
1850
|
}
|
|
1860
|
-
function
|
|
1851
|
+
function j(e) {
|
|
1861
1852
|
return `url(#${e})`;
|
|
1862
1853
|
}
|
|
1863
|
-
function
|
|
1854
|
+
function Ve(e, t, o, n) {
|
|
1864
1855
|
const i = document.createElement("button");
|
|
1865
|
-
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden =
|
|
1856
|
+
return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
|
|
1866
1857
|
}
|
|
1867
|
-
function
|
|
1868
|
-
const e =
|
|
1858
|
+
function Si() {
|
|
1859
|
+
const e = y("svg", {
|
|
1869
1860
|
class: "pluno-pa-widget__scribble-defs",
|
|
1870
1861
|
"aria-hidden": "true",
|
|
1871
1862
|
focusable: "false",
|
|
1872
1863
|
width: "0",
|
|
1873
1864
|
height: "0"
|
|
1874
|
-
}), t =
|
|
1875
|
-
return t.appendChild(
|
|
1876
|
-
|
|
1865
|
+
}), t = y("defs");
|
|
1866
|
+
return t.appendChild(st("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
|
|
1867
|
+
st("pluno-pa-scribble-wobble-2", "5", "15")
|
|
1877
1868
|
), t.appendChild(
|
|
1878
|
-
|
|
1869
|
+
st("pluno-pa-scribble-wobble-3", "9", "19")
|
|
1879
1870
|
), e.appendChild(t), e;
|
|
1880
1871
|
}
|
|
1881
|
-
function
|
|
1882
|
-
const
|
|
1872
|
+
function Pn(e, t) {
|
|
1873
|
+
const o = t * $t + qt * 2, n = y("svg", {
|
|
1883
1874
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1884
|
-
viewBox: `0 0 ${
|
|
1875
|
+
viewBox: `0 0 ${o} ${Go}`,
|
|
1885
1876
|
preserveAspectRatio: "xMidYMid meet",
|
|
1886
1877
|
"aria-hidden": "true",
|
|
1887
1878
|
focusable: "false"
|
|
1888
1879
|
});
|
|
1889
1880
|
for (let i = 0; i < t; i += 1) {
|
|
1890
|
-
const a =
|
|
1891
|
-
transform: `translate(${
|
|
1881
|
+
const a = jt[i % jt.length], l = y("g", {
|
|
1882
|
+
transform: `translate(${qt + i * $t} 0)`
|
|
1892
1883
|
});
|
|
1893
1884
|
l.appendChild(
|
|
1894
|
-
|
|
1885
|
+
y("ellipse", {
|
|
1895
1886
|
cx: a.ellipseCx,
|
|
1896
1887
|
cy: a.ellipseCy,
|
|
1897
1888
|
rx: a.ellipseRx,
|
|
@@ -1902,35 +1893,35 @@ function Sn(e, t) {
|
|
|
1902
1893
|
opacity: "0.8"
|
|
1903
1894
|
})
|
|
1904
1895
|
), l.appendChild(
|
|
1905
|
-
|
|
1896
|
+
y("path", {
|
|
1906
1897
|
d: a.path,
|
|
1907
1898
|
fill: "none",
|
|
1908
1899
|
stroke: "#2c2a1e",
|
|
1909
1900
|
"stroke-width": a.pathStrokeWidth,
|
|
1910
1901
|
"stroke-linecap": "round"
|
|
1911
1902
|
})
|
|
1912
|
-
),
|
|
1903
|
+
), n.appendChild(l);
|
|
1913
1904
|
}
|
|
1914
|
-
return
|
|
1905
|
+
return n;
|
|
1915
1906
|
}
|
|
1916
|
-
function
|
|
1917
|
-
const
|
|
1907
|
+
function st(e, t, o) {
|
|
1908
|
+
const n = y("filter", {
|
|
1918
1909
|
id: e,
|
|
1919
1910
|
x: "-8%",
|
|
1920
1911
|
y: "-8%",
|
|
1921
1912
|
width: "116%",
|
|
1922
1913
|
height: "116%"
|
|
1923
1914
|
});
|
|
1924
|
-
return
|
|
1925
|
-
|
|
1915
|
+
return n.appendChild(
|
|
1916
|
+
y("feTurbulence", {
|
|
1926
1917
|
type: "fractalNoise",
|
|
1927
1918
|
baseFrequency: "0.012 0.028",
|
|
1928
1919
|
numOctaves: "3",
|
|
1929
1920
|
seed: t,
|
|
1930
1921
|
result: "stroke-noise"
|
|
1931
1922
|
})
|
|
1932
|
-
),
|
|
1933
|
-
|
|
1923
|
+
), n.appendChild(
|
|
1924
|
+
y("feDisplacementMap", {
|
|
1934
1925
|
in: "SourceGraphic",
|
|
1935
1926
|
in2: "stroke-noise",
|
|
1936
1927
|
scale: "3.5",
|
|
@@ -1938,26 +1929,26 @@ function lt(e, t, n) {
|
|
|
1938
1929
|
yChannelSelector: "G",
|
|
1939
1930
|
result: "warped"
|
|
1940
1931
|
})
|
|
1941
|
-
),
|
|
1942
|
-
|
|
1932
|
+
), n.appendChild(
|
|
1933
|
+
y("feTurbulence", {
|
|
1943
1934
|
type: "fractalNoise",
|
|
1944
1935
|
baseFrequency: "0.7",
|
|
1945
1936
|
numOctaves: "1",
|
|
1946
|
-
seed:
|
|
1937
|
+
seed: o,
|
|
1947
1938
|
result: "ink-noise"
|
|
1948
1939
|
})
|
|
1949
|
-
),
|
|
1950
|
-
|
|
1940
|
+
), n.appendChild(
|
|
1941
|
+
y("feDisplacementMap", {
|
|
1951
1942
|
in: "warped",
|
|
1952
1943
|
in2: "ink-noise",
|
|
1953
1944
|
scale: "0.9",
|
|
1954
1945
|
xChannelSelector: "R",
|
|
1955
1946
|
yChannelSelector: "G"
|
|
1956
1947
|
})
|
|
1957
|
-
),
|
|
1948
|
+
), n;
|
|
1958
1949
|
}
|
|
1959
|
-
function
|
|
1960
|
-
const t =
|
|
1950
|
+
function Ei(e) {
|
|
1951
|
+
const t = oe(
|
|
1961
1952
|
"0 0 24 24",
|
|
1962
1953
|
e,
|
|
1963
1954
|
e,
|
|
@@ -1965,10 +1956,10 @@ function vi(e) {
|
|
|
1965
1956
|
"currentColor",
|
|
1966
1957
|
"2.25"
|
|
1967
1958
|
);
|
|
1968
|
-
return t.appendChild(
|
|
1959
|
+
return t.appendChild(y("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1969
1960
|
}
|
|
1970
|
-
function
|
|
1971
|
-
const e =
|
|
1961
|
+
function ki() {
|
|
1962
|
+
const e = oe(
|
|
1972
1963
|
"0 0 24 24",
|
|
1973
1964
|
17,
|
|
1974
1965
|
17,
|
|
@@ -1977,17 +1968,17 @@ function Ci() {
|
|
|
1977
1968
|
"2.25"
|
|
1978
1969
|
);
|
|
1979
1970
|
return e.appendChild(
|
|
1980
|
-
|
|
1971
|
+
y("path", {
|
|
1981
1972
|
d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
|
1982
1973
|
})
|
|
1983
1974
|
), e.appendChild(
|
|
1984
|
-
|
|
1975
|
+
y("path", {
|
|
1985
1976
|
d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
|
|
1986
1977
|
})
|
|
1987
1978
|
), e;
|
|
1988
1979
|
}
|
|
1989
|
-
function
|
|
1990
|
-
const e =
|
|
1980
|
+
function Li() {
|
|
1981
|
+
const e = oe(
|
|
1991
1982
|
"0 0 24 24",
|
|
1992
1983
|
17,
|
|
1993
1984
|
17,
|
|
@@ -1995,10 +1986,10 @@ function Ei() {
|
|
|
1995
1986
|
"currentColor",
|
|
1996
1987
|
"2.25"
|
|
1997
1988
|
);
|
|
1998
|
-
return e.appendChild(
|
|
1989
|
+
return e.appendChild(y("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(y("path", { d: "M3 4v5h5" })), e.appendChild(y("path", { d: "M12 7v5l3 2" })), e;
|
|
1999
1990
|
}
|
|
2000
|
-
function
|
|
2001
|
-
const e =
|
|
1991
|
+
function Ii() {
|
|
1992
|
+
const e = oe(
|
|
2002
1993
|
"0 0 24 24",
|
|
2003
1994
|
15,
|
|
2004
1995
|
15,
|
|
@@ -2006,10 +1997,10 @@ function Si() {
|
|
|
2006
1997
|
"currentColor",
|
|
2007
1998
|
"2.4"
|
|
2008
1999
|
);
|
|
2009
|
-
return e.appendChild(
|
|
2000
|
+
return e.appendChild(y("path", { d: "M18 6 6 18" })), e.appendChild(y("path", { d: "m6 6 12 12" })), e;
|
|
2010
2001
|
}
|
|
2011
|
-
function
|
|
2012
|
-
const e =
|
|
2002
|
+
function An() {
|
|
2003
|
+
const e = oe(
|
|
2013
2004
|
"0 0 24 24",
|
|
2014
2005
|
14,
|
|
2015
2006
|
14,
|
|
@@ -2018,11 +2009,11 @@ function kn() {
|
|
|
2018
2009
|
"2.75"
|
|
2019
2010
|
);
|
|
2020
2011
|
return e.appendChild(
|
|
2021
|
-
|
|
2022
|
-
), e.appendChild(
|
|
2012
|
+
y("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
2013
|
+
), e.appendChild(y("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
2023
2014
|
}
|
|
2024
|
-
function
|
|
2025
|
-
const e =
|
|
2015
|
+
function Pi() {
|
|
2016
|
+
const e = oe(
|
|
2026
2017
|
"0 0 24 24",
|
|
2027
2018
|
16,
|
|
2028
2019
|
16,
|
|
@@ -2034,18 +2025,18 @@ function ki() {
|
|
|
2034
2025
|
"class",
|
|
2035
2026
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
|
|
2036
2027
|
), e.appendChild(
|
|
2037
|
-
|
|
2028
|
+
y("path", {
|
|
2038
2029
|
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"
|
|
2039
2030
|
})
|
|
2040
2031
|
), e;
|
|
2041
2032
|
}
|
|
2042
|
-
function
|
|
2043
|
-
const e =
|
|
2033
|
+
function Ai() {
|
|
2034
|
+
const e = oe("0 0 24 24", 19, 19, "none", "currentColor");
|
|
2044
2035
|
return e.setAttribute(
|
|
2045
2036
|
"class",
|
|
2046
2037
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
|
|
2047
2038
|
), e.appendChild(
|
|
2048
|
-
|
|
2039
|
+
y("path", {
|
|
2049
2040
|
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",
|
|
2050
2041
|
stroke: "currentColor",
|
|
2051
2042
|
"stroke-width": "2",
|
|
@@ -2054,10 +2045,10 @@ function Li() {
|
|
|
2054
2045
|
})
|
|
2055
2046
|
), e;
|
|
2056
2047
|
}
|
|
2057
|
-
function
|
|
2058
|
-
const e =
|
|
2048
|
+
function Ni() {
|
|
2049
|
+
const e = oe("0 0 24 24", 18, 18, "currentColor");
|
|
2059
2050
|
return e.appendChild(
|
|
2060
|
-
|
|
2051
|
+
y("rect", {
|
|
2061
2052
|
x: "6",
|
|
2062
2053
|
y: "6",
|
|
2063
2054
|
width: "12",
|
|
@@ -2066,8 +2057,8 @@ function Pi() {
|
|
|
2066
2057
|
})
|
|
2067
2058
|
), e;
|
|
2068
2059
|
}
|
|
2069
|
-
function
|
|
2070
|
-
const e =
|
|
2060
|
+
function Ti() {
|
|
2061
|
+
const e = oe(
|
|
2071
2062
|
"0 0 24 24",
|
|
2072
2063
|
12,
|
|
2073
2064
|
12,
|
|
@@ -2075,10 +2066,10 @@ function Ai() {
|
|
|
2075
2066
|
"currentColor",
|
|
2076
2067
|
"2.4"
|
|
2077
2068
|
);
|
|
2078
|
-
return e.appendChild(
|
|
2069
|
+
return e.appendChild(y("path", { d: "M18 6 6 18" })), e.appendChild(y("path", { d: "m6 6 12 12" })), e;
|
|
2079
2070
|
}
|
|
2080
|
-
function
|
|
2081
|
-
const e =
|
|
2071
|
+
function Di() {
|
|
2072
|
+
const e = oe(
|
|
2082
2073
|
"0 0 24 24",
|
|
2083
2074
|
13,
|
|
2084
2075
|
13,
|
|
@@ -2087,7 +2078,7 @@ function Ii() {
|
|
|
2087
2078
|
"2.25"
|
|
2088
2079
|
);
|
|
2089
2080
|
return e.appendChild(
|
|
2090
|
-
|
|
2081
|
+
y("rect", {
|
|
2091
2082
|
width: "14",
|
|
2092
2083
|
height: "14",
|
|
2093
2084
|
x: "8",
|
|
@@ -2096,379 +2087,341 @@ function Ii() {
|
|
|
2096
2087
|
ry: "2"
|
|
2097
2088
|
})
|
|
2098
2089
|
), e.appendChild(
|
|
2099
|
-
|
|
2090
|
+
y("path", {
|
|
2100
2091
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
2101
2092
|
})
|
|
2102
2093
|
), e;
|
|
2103
2094
|
}
|
|
2104
|
-
function
|
|
2095
|
+
function oe(e, t, o, n, i, a) {
|
|
2105
2096
|
const l = {
|
|
2106
2097
|
viewBox: e,
|
|
2107
2098
|
width: String(t),
|
|
2108
|
-
height: String(
|
|
2109
|
-
fill:
|
|
2099
|
+
height: String(o),
|
|
2100
|
+
fill: n,
|
|
2110
2101
|
"aria-hidden": "true"
|
|
2111
2102
|
};
|
|
2112
|
-
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a),
|
|
2103
|
+
return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), y("svg", l);
|
|
2113
2104
|
}
|
|
2114
|
-
function
|
|
2115
|
-
const
|
|
2116
|
-
for (const [
|
|
2117
|
-
|
|
2118
|
-
return
|
|
2105
|
+
function y(e, t = {}) {
|
|
2106
|
+
const o = document.createElementNS(vn, e);
|
|
2107
|
+
for (const [n, i] of Object.entries(t))
|
|
2108
|
+
o.setAttribute(n, i);
|
|
2109
|
+
return o;
|
|
2119
2110
|
}
|
|
2120
|
-
function
|
|
2111
|
+
function tn(e) {
|
|
2121
2112
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
2122
|
-
e.addEventListener(t, (
|
|
2123
|
-
|
|
2113
|
+
e.addEventListener(t, (o) => {
|
|
2114
|
+
o.stopPropagation();
|
|
2124
2115
|
});
|
|
2125
2116
|
}
|
|
2126
|
-
function
|
|
2117
|
+
function Ri(e, t, o) {
|
|
2127
2118
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
2128
|
-
for (const [
|
|
2119
|
+
for (const [n, i] of t.entries()) {
|
|
2129
2120
|
const a = document.createElement("div");
|
|
2130
|
-
a.className = "pluno-pa-widget__attachment", a.appendChild(
|
|
2121
|
+
a.className = "pluno-pa-widget__attachment", a.appendChild(Mi(i));
|
|
2131
2122
|
const l = document.createElement("span");
|
|
2132
2123
|
l.textContent = i.name, a.appendChild(l);
|
|
2133
2124
|
const p = document.createElement("button");
|
|
2134
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(
|
|
2125
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ti()), p.addEventListener("click", () => o(n)), a.appendChild(p), e.appendChild(a);
|
|
2135
2126
|
}
|
|
2136
2127
|
}
|
|
2137
|
-
function
|
|
2138
|
-
|
|
2128
|
+
function Mi(e) {
|
|
2129
|
+
const t = vt(e), o = Nn(e);
|
|
2130
|
+
if (t === "image" && o) {
|
|
2139
2131
|
const n = document.createElement("img");
|
|
2140
|
-
return n.src =
|
|
2132
|
+
return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n;
|
|
2141
2133
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2134
|
+
if (t === "video" && o) {
|
|
2135
|
+
const n = document.createElement("video");
|
|
2136
|
+
return n.src = o, n.muted = !0, n.preload = "metadata", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n.addEventListener("stalled", () => n.replaceWith(ee(e))), n;
|
|
2137
|
+
}
|
|
2138
|
+
return ee(e);
|
|
2144
2139
|
}
|
|
2145
|
-
function
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2140
|
+
function zi(e) {
|
|
2141
|
+
const t = vt(e), o = Nn(e);
|
|
2142
|
+
if (t === "image" && o) {
|
|
2143
|
+
const n = document.createElement("img");
|
|
2144
|
+
return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n;
|
|
2149
2145
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2146
|
+
if (t === "pdf" && o) {
|
|
2147
|
+
const n = document.createElement("object");
|
|
2148
|
+
return n.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", n.data = o, n.type = "application/pdf", n.setAttribute("aria-label", e.name), n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.appendChild(ee(e, "message")), n;
|
|
2149
|
+
}
|
|
2150
|
+
if (t === "video" && o) {
|
|
2151
|
+
const n = document.createElement("video");
|
|
2152
|
+
return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.muted = !0, n.preload = "metadata", n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.addEventListener("stalled", () => n.replaceWith(ee(e, "message"))), n;
|
|
2153
|
+
}
|
|
2154
|
+
return ee(e, "message");
|
|
2156
2155
|
}
|
|
2157
|
-
function
|
|
2158
|
-
|
|
2156
|
+
function ee(e, t = "composer") {
|
|
2157
|
+
if (t === "composer") {
|
|
2158
|
+
const a = document.createElement("span");
|
|
2159
|
+
return a.className = "pluno-pa-widget__attachment-file", a.textContent = nn(e), a;
|
|
2160
|
+
}
|
|
2161
|
+
const o = document.createElement("div");
|
|
2162
|
+
o.className = "pluno-pa-widget__message-attachment-file";
|
|
2163
|
+
const n = document.createElement("span");
|
|
2164
|
+
n.textContent = nn(e);
|
|
2165
|
+
const i = document.createElement("strong");
|
|
2166
|
+
return i.textContent = e.name, o.append(n, i), o;
|
|
2159
2167
|
}
|
|
2160
|
-
function
|
|
2161
|
-
return e === "application/pdf" ? "
|
|
2168
|
+
function vt(e) {
|
|
2169
|
+
return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
|
|
2162
2170
|
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
return [];
|
|
2166
|
-
const t = Array.from(e);
|
|
2167
|
-
if (t.length > We)
|
|
2168
|
-
throw new Error(
|
|
2169
|
-
`Attach up to ${We} files per message.`
|
|
2170
|
-
);
|
|
2171
|
-
return Promise.all(
|
|
2172
|
-
t.map(async (n) => {
|
|
2173
|
-
const o = zi(n);
|
|
2174
|
-
if (!o)
|
|
2175
|
-
throw new Error(
|
|
2176
|
-
"Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files."
|
|
2177
|
-
);
|
|
2178
|
-
if (n.size > So)
|
|
2179
|
-
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
2180
|
-
if (o === "image/gif") {
|
|
2181
|
-
const i = new Uint8Array(await qi(n));
|
|
2182
|
-
if (Oi(i))
|
|
2183
|
-
throw new Error("Pluno supports non-animated GIF images.");
|
|
2184
|
-
}
|
|
2185
|
-
return {
|
|
2186
|
-
name: n.name || Ri(o),
|
|
2187
|
-
mimeType: o,
|
|
2188
|
-
sizeBytes: n.size,
|
|
2189
|
-
dataUrl: Bi(
|
|
2190
|
-
await ji(n),
|
|
2191
|
-
o
|
|
2192
|
-
)
|
|
2193
|
-
};
|
|
2194
|
-
})
|
|
2195
|
-
);
|
|
2171
|
+
function Nn(e) {
|
|
2172
|
+
return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
|
|
2196
2173
|
}
|
|
2197
|
-
function
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
const t = e.name.toLowerCase();
|
|
2201
|
-
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
2174
|
+
function nn(e) {
|
|
2175
|
+
const t = vt(e);
|
|
2176
|
+
return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
|
|
2202
2177
|
}
|
|
2203
2178
|
function Bi(e, t) {
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
if (e.length < 14 || !Ui(e))
|
|
2209
|
-
return !1;
|
|
2210
|
-
const t = e[10];
|
|
2211
|
-
let n = 13;
|
|
2212
|
-
t & 128 && (n += 3 * 2 ** ((t & 7) + 1));
|
|
2213
|
-
let o = 0;
|
|
2214
|
-
for (; n < e.length; ) {
|
|
2215
|
-
const i = e[n];
|
|
2216
|
-
if (n += 1, i === 59)
|
|
2217
|
-
return !1;
|
|
2218
|
-
if (i === 33) {
|
|
2219
|
-
n += 1, n = Jt(e, n);
|
|
2220
|
-
continue;
|
|
2221
|
-
}
|
|
2222
|
-
if (i !== 44)
|
|
2223
|
-
return !1;
|
|
2224
|
-
if (o += 1, o > 1)
|
|
2225
|
-
return !0;
|
|
2226
|
-
if (n + 9 >= e.length)
|
|
2227
|
-
return !1;
|
|
2228
|
-
const a = e[n + 8];
|
|
2229
|
-
if (n += 9, a & 128 && (n += 3 * 2 ** ((a & 7) + 1)), n >= e.length)
|
|
2230
|
-
return !1;
|
|
2231
|
-
n += 1, n = Jt(e, n);
|
|
2232
|
-
}
|
|
2233
|
-
return !1;
|
|
2179
|
+
return t ? Array.from(t).map((n) => ({
|
|
2180
|
+
...e.createLocalAttachment(n),
|
|
2181
|
+
previewUrl: Ui(n)
|
|
2182
|
+
})) : [];
|
|
2234
2183
|
}
|
|
2235
2184
|
function Ui(e) {
|
|
2236
|
-
return
|
|
2237
|
-
}
|
|
2238
|
-
function Jt(e, t) {
|
|
2239
|
-
for (; t < e.length; ) {
|
|
2240
|
-
const n = e[t];
|
|
2241
|
-
if (t += 1, n === 0)
|
|
2242
|
-
return t;
|
|
2243
|
-
t += n;
|
|
2244
|
-
}
|
|
2245
|
-
return t;
|
|
2185
|
+
return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
|
|
2246
2186
|
}
|
|
2247
|
-
function
|
|
2187
|
+
function He(e) {
|
|
2248
2188
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
2249
2189
|
}
|
|
2250
|
-
function
|
|
2251
|
-
if (!e || !
|
|
2190
|
+
function dt(e, t, o = null) {
|
|
2191
|
+
if (!e || !ft(t, o)) {
|
|
2252
2192
|
e && (e.hidden = !0, e.replaceChildren());
|
|
2253
2193
|
return;
|
|
2254
2194
|
}
|
|
2255
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
2256
|
-
|
|
2257
|
-
) :
|
|
2195
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || yt(o) ? e.appendChild(
|
|
2196
|
+
Oi(t, o)
|
|
2197
|
+
) : Tn(t) && e.appendChild(Fi(t));
|
|
2258
2198
|
}
|
|
2259
|
-
function
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
const
|
|
2263
|
-
i.textContent =
|
|
2199
|
+
function Oi(e, t) {
|
|
2200
|
+
const o = document.createElement("div");
|
|
2201
|
+
o.className = "pluno-pa-widget__billing-action-card";
|
|
2202
|
+
const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
|
|
2203
|
+
i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
|
|
2264
2204
|
const a = document.createElement("span");
|
|
2265
|
-
return a.textContent =
|
|
2266
|
-
|
|
2205
|
+
return a.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(a), o.appendChild(
|
|
2206
|
+
Dn(
|
|
2267
2207
|
e,
|
|
2268
2208
|
"Upgrade plan",
|
|
2269
2209
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2270
2210
|
)
|
|
2271
|
-
),
|
|
2211
|
+
), o;
|
|
2272
2212
|
}
|
|
2273
|
-
function
|
|
2213
|
+
function Fi(e) {
|
|
2274
2214
|
const t = document.createElement("div");
|
|
2275
2215
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
const
|
|
2279
|
-
return
|
|
2280
|
-
|
|
2216
|
+
const o = document.createElement("strong");
|
|
2217
|
+
o.textContent = "Credits running low", t.appendChild(o);
|
|
2218
|
+
const n = document.createElement("span");
|
|
2219
|
+
return n.textContent = Wi(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
|
|
2220
|
+
Dn(
|
|
2281
2221
|
e,
|
|
2282
2222
|
"Upgrade",
|
|
2283
2223
|
"pluno-pa-widget__billing-action-card-actions"
|
|
2284
2224
|
)
|
|
2285
2225
|
), t;
|
|
2286
2226
|
}
|
|
2287
|
-
function
|
|
2288
|
-
return e !== null && (
|
|
2227
|
+
function ft(e, t) {
|
|
2228
|
+
return e !== null && (te(e) || Tn(e) || yt(t));
|
|
2289
2229
|
}
|
|
2290
|
-
function
|
|
2291
|
-
return
|
|
2230
|
+
function on(e, t, o) {
|
|
2231
|
+
return ft(t, o) || Hi(t) ? !0 : !ft(e, o);
|
|
2292
2232
|
}
|
|
2293
|
-
function
|
|
2294
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
2233
|
+
function Hi(e) {
|
|
2234
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || te(e));
|
|
2295
2235
|
}
|
|
2296
|
-
function
|
|
2236
|
+
function te(e) {
|
|
2297
2237
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
2298
2238
|
}
|
|
2299
|
-
function
|
|
2239
|
+
function yt(e) {
|
|
2300
2240
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
2301
2241
|
}
|
|
2302
|
-
function
|
|
2303
|
-
return !
|
|
2242
|
+
function Tn(e) {
|
|
2243
|
+
return !te(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
2304
2244
|
}
|
|
2305
2245
|
function Wi(e) {
|
|
2306
|
-
return e.creditsRemaining === null ? null : `${
|
|
2246
|
+
return e.creditsRemaining === null ? null : `${Gi(e.creditsRemaining)} credits left`;
|
|
2307
2247
|
}
|
|
2308
|
-
function
|
|
2248
|
+
function Gi(e) {
|
|
2309
2249
|
return new Intl.NumberFormat("en-US", {
|
|
2310
2250
|
maximumFractionDigits: 0
|
|
2311
2251
|
}).format(Math.ceil(e));
|
|
2312
2252
|
}
|
|
2313
|
-
function
|
|
2314
|
-
const
|
|
2315
|
-
return
|
|
2316
|
-
|
|
2317
|
-
),
|
|
2318
|
-
|
|
2319
|
-
),
|
|
2253
|
+
function Dn(e, t, o) {
|
|
2254
|
+
const n = document.createElement("div");
|
|
2255
|
+
return n.className = o, n.appendChild(
|
|
2256
|
+
an(t, e.pricingUrl)
|
|
2257
|
+
), n.appendChild(
|
|
2258
|
+
an("Earn credits", e.earnCreditsUrl)
|
|
2259
|
+
), n;
|
|
2320
2260
|
}
|
|
2321
|
-
function
|
|
2322
|
-
const
|
|
2323
|
-
if (
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2261
|
+
function an(e, t) {
|
|
2262
|
+
const o = document.createElement("button");
|
|
2263
|
+
if (o.type = "button", e === "Earn credits") {
|
|
2264
|
+
const n = document.createElement("span");
|
|
2265
|
+
n.className = "pluno-pa-widget__billing-action-card-earn-credits-label", n.textContent = e, o.appendChild(n);
|
|
2326
2266
|
} else
|
|
2327
|
-
|
|
2328
|
-
return
|
|
2267
|
+
o.textContent = e;
|
|
2268
|
+
return o.disabled = t.trim().length === 0, o.addEventListener("click", () => {
|
|
2329
2269
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
2330
|
-
}),
|
|
2331
|
-
}
|
|
2332
|
-
function qi(e) {
|
|
2333
|
-
return new Promise((t, n) => {
|
|
2334
|
-
const o = new FileReader();
|
|
2335
|
-
o.addEventListener("load", () => {
|
|
2336
|
-
if (o.result instanceof ArrayBuffer) {
|
|
2337
|
-
t(o.result);
|
|
2338
|
-
return;
|
|
2339
|
-
}
|
|
2340
|
-
n(new Error("Failed to read file"));
|
|
2341
|
-
}), o.addEventListener("error", () => {
|
|
2342
|
-
n(o.error ?? new Error("Failed to read file"));
|
|
2343
|
-
}), o.readAsArrayBuffer(e);
|
|
2344
|
-
});
|
|
2270
|
+
}), o;
|
|
2345
2271
|
}
|
|
2346
|
-
function
|
|
2347
|
-
return new Promise((t, n) => {
|
|
2348
|
-
const o = new FileReader();
|
|
2349
|
-
o.addEventListener("load", () => {
|
|
2350
|
-
if (typeof o.result == "string") {
|
|
2351
|
-
t(o.result);
|
|
2352
|
-
return;
|
|
2353
|
-
}
|
|
2354
|
-
n(new Error("Failed to read file"));
|
|
2355
|
-
}), o.addEventListener("error", () => {
|
|
2356
|
-
n(o.error ?? new Error("Failed to read file"));
|
|
2357
|
-
}), o.readAsDataURL(e);
|
|
2358
|
-
});
|
|
2359
|
-
}
|
|
2360
|
-
function tn(e, t) {
|
|
2272
|
+
function ct(e, t) {
|
|
2361
2273
|
return e.messages.filter(
|
|
2362
|
-
(
|
|
2274
|
+
(n) => !Rn(n)
|
|
2363
2275
|
).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
2364
2276
|
}
|
|
2365
|
-
function
|
|
2366
|
-
const
|
|
2367
|
-
(_) => !
|
|
2368
|
-
),
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2277
|
+
function $i(e, t, o, n, i, a, l, p, c, u, d, g, S, f, O, k) {
|
|
2278
|
+
const x = Ki(a), v = x.filter(
|
|
2279
|
+
(_) => !Rn(_)
|
|
2280
|
+
), h = e.scrollTop, A = [], T = /* @__PURE__ */ new Set(), I = (_) => {
|
|
2281
|
+
A.push(_);
|
|
2282
|
+
};
|
|
2283
|
+
zn(o, a.isThinking), i.hidden = !p, p && l !== null && Ln(i, l);
|
|
2284
|
+
const Ee = v.length > 0 || !!a.assistantDraft || a.isThinking;
|
|
2285
|
+
if (n(Ee), v.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
|
|
2372
2286
|
const _ = document.createElement("div");
|
|
2373
2287
|
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2376
|
-
const
|
|
2288
|
+
const M = document.createElement("div");
|
|
2289
|
+
M.className = "pluno-pa-widget__empty-hero";
|
|
2290
|
+
const P = se(
|
|
2377
2291
|
"pluno-pa-widget__character--empty",
|
|
2378
|
-
|
|
2292
|
+
f()
|
|
2379
2293
|
);
|
|
2380
|
-
|
|
2381
|
-
const
|
|
2382
|
-
if (
|
|
2383
|
-
for (const
|
|
2384
|
-
const
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
}),
|
|
2294
|
+
M.appendChild(P), _.appendChild(M), _.appendChild(kn());
|
|
2295
|
+
const G = document.createElement("div");
|
|
2296
|
+
if (G.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && G.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
|
|
2297
|
+
for (const C of a.starterPrompts) {
|
|
2298
|
+
const L = document.createElement("button");
|
|
2299
|
+
L.type = "button", L.className = "pluno-pa-widget__starter-prompt", L.textContent = `"${C}"`, L.addEventListener("click", () => {
|
|
2300
|
+
O(C);
|
|
2301
|
+
}), G.appendChild(L);
|
|
2388
2302
|
}
|
|
2389
2303
|
else if (a.starterPromptsLoading) {
|
|
2390
|
-
const
|
|
2391
|
-
|
|
2304
|
+
const C = document.createElement("button");
|
|
2305
|
+
C.type = "button", C.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", C.disabled = !0, C.tabIndex = -1, C.textContent = "Generating example tasks...", G.appendChild(C);
|
|
2392
2306
|
} else
|
|
2393
|
-
for (let
|
|
2394
|
-
const
|
|
2395
|
-
|
|
2307
|
+
for (let C = 0; C < Ao; C += 1) {
|
|
2308
|
+
const L = document.createElement("button");
|
|
2309
|
+
L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", L.disabled = !0, L.tabIndex = -1, L.textContent = "", G.appendChild(L);
|
|
2396
2310
|
}
|
|
2397
|
-
_.appendChild(
|
|
2311
|
+
_.appendChild(G), g.clear(), I(_), I(t), rn(e, A);
|
|
2398
2312
|
return;
|
|
2399
2313
|
}
|
|
2400
|
-
let
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2314
|
+
let b = null, D = null, de = [];
|
|
2315
|
+
const ce = v.some(wt), we = () => {
|
|
2316
|
+
if (de.length === 0)
|
|
2403
2317
|
return !1;
|
|
2404
2318
|
const _ = ia(
|
|
2405
|
-
|
|
2319
|
+
de,
|
|
2406
2320
|
d,
|
|
2407
|
-
|
|
2408
|
-
|
|
2321
|
+
S,
|
|
2322
|
+
f()
|
|
2409
2323
|
);
|
|
2410
|
-
return
|
|
2324
|
+
return I(_), b = null, D = _, de = [], !0;
|
|
2411
2325
|
};
|
|
2412
|
-
for (let _ = 0; _ <
|
|
2413
|
-
const
|
|
2414
|
-
if (
|
|
2415
|
-
|
|
2326
|
+
for (let _ = 0; _ < v.length; _ += 1) {
|
|
2327
|
+
const M = v[_];
|
|
2328
|
+
if (M.role === "tool") {
|
|
2329
|
+
de.push(M);
|
|
2416
2330
|
continue;
|
|
2417
2331
|
}
|
|
2418
|
-
if (
|
|
2419
|
-
if (
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2332
|
+
if (wt(M)) {
|
|
2333
|
+
if (we()) {
|
|
2334
|
+
const $ = _t();
|
|
2335
|
+
I($), b = null, D = $;
|
|
2422
2336
|
} else {
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2337
|
+
const $ = sn(f());
|
|
2338
|
+
I($), b = null, D = $;
|
|
2425
2339
|
}
|
|
2426
2340
|
continue;
|
|
2427
2341
|
}
|
|
2428
|
-
if (
|
|
2342
|
+
if (M.role === "system")
|
|
2429
2343
|
continue;
|
|
2430
|
-
const
|
|
2431
|
-
if (
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2434
|
-
}
|
|
2435
|
-
const
|
|
2436
|
-
|
|
2437
|
-
const I = document.createElement("div");
|
|
2438
|
-
I.className = "pluno-pa-widget__message-actions", I.appendChild(Xi(H)), L.appendChild(I), e.appendChild(L), S = L, k = null;
|
|
2344
|
+
const P = we(), G = oa(M.content);
|
|
2345
|
+
if (M.role === "assistant" && !P) {
|
|
2346
|
+
const L = Mn(f());
|
|
2347
|
+
I(L), b = null, D = L;
|
|
2348
|
+
}
|
|
2349
|
+
const C = qi(M, G, g, T);
|
|
2350
|
+
I(C), b = C, D = null;
|
|
2439
2351
|
}
|
|
2440
|
-
const
|
|
2441
|
-
if (a.isThinking && !
|
|
2442
|
-
if (
|
|
2443
|
-
const _ =
|
|
2444
|
-
|
|
2352
|
+
const W = we(), Re = v[v.length - 1]?.id === "assistant-draft";
|
|
2353
|
+
if (a.isThinking && !Re && !ce)
|
|
2354
|
+
if (W) {
|
|
2355
|
+
const _ = _t();
|
|
2356
|
+
I(_), b = null, D = _;
|
|
2445
2357
|
} else {
|
|
2446
|
-
const _ =
|
|
2447
|
-
|
|
2358
|
+
const _ = sn(f());
|
|
2359
|
+
I(_), b = null, D = _;
|
|
2448
2360
|
}
|
|
2449
2361
|
if (a.lastError) {
|
|
2450
2362
|
const _ = document.createElement("div");
|
|
2451
|
-
_.className = "pluno-pa-widget__error", _.textContent = a.lastError,
|
|
2363
|
+
_.className = "pluno-pa-widget__error", _.textContent = a.lastError, I(_), b = _, D = null;
|
|
2452
2364
|
}
|
|
2453
|
-
const
|
|
2454
|
-
if (
|
|
2455
|
-
const _ = Zi(
|
|
2456
|
-
isDrafting:
|
|
2457
|
-
error:
|
|
2458
|
-
characterIconOptions:
|
|
2459
|
-
onDraft:
|
|
2460
|
-
onDismiss:
|
|
2461
|
-
onDisable:
|
|
2365
|
+
const K = k && !a.isThinking ? ao(x) : null;
|
|
2366
|
+
if (k && K && !k.dismissedCandidateIds.has(K.id)) {
|
|
2367
|
+
const _ = Zi(K, {
|
|
2368
|
+
isDrafting: k.draftingCandidateId === K.id,
|
|
2369
|
+
error: k.error,
|
|
2370
|
+
characterIconOptions: k.characterIconOptions,
|
|
2371
|
+
onDraft: k.onDraft,
|
|
2372
|
+
onDismiss: k.onDismiss,
|
|
2373
|
+
onDisable: k.onDisable
|
|
2462
2374
|
});
|
|
2463
|
-
|
|
2375
|
+
I(_), k.onSeen(K), b = null, D = _;
|
|
2464
2376
|
}
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2377
|
+
b?.classList.add("pluno-pa-widget__message--bottom-reserve"), D?.classList.add("pluno-pa-widget__bottom-reserve-compact"), I(t), Vi(g, T), rn(e, A), c ? Te(e, u) : e.scrollTop = h;
|
|
2378
|
+
}
|
|
2379
|
+
function qi(e, t, o, n) {
|
|
2380
|
+
const i = ji(e, t), a = i ? o.get(i) : void 0;
|
|
2381
|
+
if (i && a)
|
|
2382
|
+
return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), a;
|
|
2383
|
+
const l = document.createElement("div");
|
|
2384
|
+
l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? ra(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Yi(e.attachments));
|
|
2385
|
+
const p = document.createElement("div");
|
|
2386
|
+
return p.className = "pluno-pa-widget__message-actions", p.appendChild(Xi(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
|
|
2387
|
+
}
|
|
2388
|
+
function ji(e, t) {
|
|
2389
|
+
return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
|
|
2390
|
+
id: e.id,
|
|
2391
|
+
content: t,
|
|
2392
|
+
attachments: e.attachments.map((o) => {
|
|
2393
|
+
const { previewUrl: n } = o;
|
|
2394
|
+
return {
|
|
2395
|
+
id: o.id ?? null,
|
|
2396
|
+
name: o.name,
|
|
2397
|
+
mimeType: o.mimeType,
|
|
2398
|
+
sizeBytes: o.sizeBytes,
|
|
2399
|
+
previewUrl: n ?? null,
|
|
2400
|
+
fileUrl: o.fileUrl ?? null,
|
|
2401
|
+
gcsPath: o.gcsPath ?? null
|
|
2402
|
+
};
|
|
2403
|
+
})
|
|
2404
|
+
});
|
|
2470
2405
|
}
|
|
2471
|
-
function
|
|
2406
|
+
function Vi(e, t) {
|
|
2407
|
+
for (const o of e.keys())
|
|
2408
|
+
t.has(o) || e.delete(o);
|
|
2409
|
+
}
|
|
2410
|
+
function rn(e, t) {
|
|
2411
|
+
let o = e.firstChild;
|
|
2412
|
+
for (const n of t) {
|
|
2413
|
+
if (n === o) {
|
|
2414
|
+
o = o.nextSibling;
|
|
2415
|
+
continue;
|
|
2416
|
+
}
|
|
2417
|
+
e.insertBefore(n, o);
|
|
2418
|
+
}
|
|
2419
|
+
for (; o; ) {
|
|
2420
|
+
const n = o;
|
|
2421
|
+
o = o.nextSibling, e.removeChild(n);
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
function Ki(e) {
|
|
2472
2425
|
if (!e.assistantDraft)
|
|
2473
2426
|
return [...e.messages];
|
|
2474
2427
|
const t = {
|
|
@@ -2482,22 +2435,22 @@ function Yi(e) {
|
|
|
2482
2435
|
};
|
|
2483
2436
|
if (!t.respondsToUserMessageId)
|
|
2484
2437
|
return [...e.messages, t];
|
|
2485
|
-
const
|
|
2438
|
+
const o = e.messages.findIndex(
|
|
2486
2439
|
(a) => a.role === "user" && a.id === t.respondsToUserMessageId
|
|
2487
2440
|
);
|
|
2488
|
-
if (
|
|
2441
|
+
if (o === -1)
|
|
2489
2442
|
return [...e.messages, t];
|
|
2490
|
-
const
|
|
2491
|
-
(a, l) => l >
|
|
2443
|
+
const n = e.messages.findIndex(
|
|
2444
|
+
(a, l) => l > o && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && ln(a, t) && wt(a)
|
|
2492
2445
|
);
|
|
2493
|
-
if (
|
|
2446
|
+
if (n !== -1)
|
|
2494
2447
|
return [
|
|
2495
|
-
...e.messages.slice(0,
|
|
2448
|
+
...e.messages.slice(0, n),
|
|
2496
2449
|
t,
|
|
2497
|
-
...e.messages.slice(
|
|
2450
|
+
...e.messages.slice(n + 1)
|
|
2498
2451
|
];
|
|
2499
|
-
let i =
|
|
2500
|
-
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId &&
|
|
2452
|
+
let i = o + 1;
|
|
2453
|
+
for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && ln(e.messages[i], t); )
|
|
2501
2454
|
i += 1;
|
|
2502
2455
|
return [
|
|
2503
2456
|
...e.messages.slice(0, i),
|
|
@@ -2505,49 +2458,49 @@ function Yi(e) {
|
|
|
2505
2458
|
...e.messages.slice(i)
|
|
2506
2459
|
];
|
|
2507
2460
|
}
|
|
2508
|
-
function
|
|
2461
|
+
function wt(e) {
|
|
2509
2462
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2510
2463
|
}
|
|
2511
|
-
function
|
|
2464
|
+
function ln(e, t) {
|
|
2512
2465
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2513
2466
|
}
|
|
2514
|
-
function
|
|
2515
|
-
e.replaceChildren(),
|
|
2467
|
+
function pn(e, t, o, n, i, a, l, p) {
|
|
2468
|
+
e.replaceChildren(), zn(t, !1), t.disabled = !0, o(!1);
|
|
2516
2469
|
const c = document.createElement("div");
|
|
2517
2470
|
c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
2518
2471
|
const u = se(
|
|
2519
2472
|
"pluno-pa-widget__character--empty",
|
|
2520
|
-
|
|
2473
|
+
n()
|
|
2521
2474
|
);
|
|
2522
2475
|
c.appendChild(u);
|
|
2523
2476
|
const d = document.createElement("div");
|
|
2524
2477
|
if (d.className = "pluno-pa-widget__empty", d.textContent = i, c.appendChild(d), l) {
|
|
2525
|
-
const
|
|
2526
|
-
|
|
2478
|
+
const g = document.createElement("a");
|
|
2479
|
+
g.className = "pluno-pa-widget__login", g.href = l, g.target = "_blank", g.rel = "noopener noreferrer", g.textContent = a, c.appendChild(g);
|
|
2527
2480
|
} else {
|
|
2528
|
-
const
|
|
2529
|
-
|
|
2481
|
+
const g = document.createElement("button");
|
|
2482
|
+
g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => p?.()), c.appendChild(g);
|
|
2530
2483
|
}
|
|
2531
2484
|
e.appendChild(c);
|
|
2532
2485
|
}
|
|
2533
|
-
function
|
|
2486
|
+
function Yi(e) {
|
|
2534
2487
|
const t = document.createElement("div");
|
|
2535
2488
|
t.className = "pluno-pa-widget__message-attachments";
|
|
2536
|
-
for (const
|
|
2537
|
-
t.appendChild(
|
|
2489
|
+
for (const o of e)
|
|
2490
|
+
t.appendChild(zi(o));
|
|
2538
2491
|
return t;
|
|
2539
2492
|
}
|
|
2540
2493
|
function Xi(e) {
|
|
2541
2494
|
const t = document.createElement("button");
|
|
2542
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
2543
|
-
|
|
2495
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Di()), t.addEventListener("click", (o) => {
|
|
2496
|
+
o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
|
|
2544
2497
|
}), t;
|
|
2545
2498
|
}
|
|
2546
2499
|
function Zi(e, t) {
|
|
2547
|
-
const
|
|
2548
|
-
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2500
|
+
const o = document.createElement("article");
|
|
2501
|
+
o.className = "pluno-pa-widget__share-prompt";
|
|
2502
|
+
const n = document.createElement("div");
|
|
2503
|
+
n.className = "pluno-pa-widget__share-prompt-body", n.appendChild(
|
|
2551
2504
|
se(
|
|
2552
2505
|
"pluno-pa-widget__share-prompt-icon",
|
|
2553
2506
|
t.characterIconOptions
|
|
@@ -2562,7 +2515,7 @@ function Zi(e, t) {
|
|
|
2562
2515
|
const d = document.createElement("span");
|
|
2563
2516
|
d.className = "pluno-pa-widget__share-prompt-error", d.textContent = t.error, i.appendChild(d);
|
|
2564
2517
|
}
|
|
2565
|
-
|
|
2518
|
+
n.appendChild(i);
|
|
2566
2519
|
const p = document.createElement("div");
|
|
2567
2520
|
p.className = "pluno-pa-widget__share-prompt-actions";
|
|
2568
2521
|
const c = document.createElement("div");
|
|
@@ -2570,31 +2523,31 @@ function Zi(e, t) {
|
|
|
2570
2523
|
const u = document.createElement("button");
|
|
2571
2524
|
if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
|
|
2572
2525
|
t.onDraft(e);
|
|
2573
|
-
}), t.isDrafting ? (u.appendChild(
|
|
2526
|
+
}), t.isDrafting ? (u.appendChild(xt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
|
|
2574
2527
|
p.appendChild(c);
|
|
2575
2528
|
else {
|
|
2576
2529
|
const d = document.createElement("button");
|
|
2577
2530
|
d.type = "button", d.className = "pluno-pa-widget__share-prompt-dismiss", d.setAttribute("aria-label", "Dismiss share prompt"), d.title = "Dismiss", d.textContent = "Dismiss", d.addEventListener("click", () => {
|
|
2578
2531
|
t.onDismiss(e);
|
|
2579
2532
|
}), c.appendChild(d), p.appendChild(c);
|
|
2580
|
-
const
|
|
2581
|
-
|
|
2533
|
+
const g = document.createElement("button");
|
|
2534
|
+
g.type = "button", g.className = "pluno-pa-widget__share-prompt-disable", g.textContent = "Don't ask again", g.addEventListener("click", () => {
|
|
2582
2535
|
t.onDisable(e);
|
|
2583
|
-
}), p.appendChild(
|
|
2536
|
+
}), p.appendChild(g);
|
|
2584
2537
|
}
|
|
2585
|
-
return
|
|
2538
|
+
return n.appendChild(p), o.appendChild(n), o;
|
|
2586
2539
|
}
|
|
2587
2540
|
function Ji(e, t) {
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2590
|
-
|
|
2541
|
+
const o = document.createElement("div");
|
|
2542
|
+
o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (x) => {
|
|
2543
|
+
x.target === o && t.onClose();
|
|
2591
2544
|
});
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2545
|
+
const n = document.createElement("section");
|
|
2546
|
+
n.className = "pluno-pa-widget__share-dialog", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Draft a social post");
|
|
2594
2547
|
const i = document.createElement("header"), a = document.createElement("strong");
|
|
2595
2548
|
a.textContent = "Share this win", i.appendChild(a);
|
|
2596
2549
|
const l = document.createElement("button");
|
|
2597
|
-
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l),
|
|
2550
|
+
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), n.appendChild(i);
|
|
2598
2551
|
const p = document.createElement("p");
|
|
2599
2552
|
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
2600
2553
|
const c = document.createElement("div");
|
|
@@ -2603,53 +2556,53 @@ function Ji(e, t) {
|
|
|
2603
2556
|
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
2604
2557
|
const d = document.createElement("strong");
|
|
2605
2558
|
d.textContent = "1) Copy Screenshot", u.appendChild(d);
|
|
2606
|
-
const
|
|
2559
|
+
const g = Qi(
|
|
2607
2560
|
"Copy Screenshot",
|
|
2608
2561
|
async () => {
|
|
2609
2562
|
try {
|
|
2610
|
-
return await
|
|
2563
|
+
return await ro(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
2611
2564
|
} catch {
|
|
2612
2565
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
2613
2566
|
}
|
|
2614
2567
|
}
|
|
2615
2568
|
);
|
|
2616
|
-
if (u.appendChild(
|
|
2617
|
-
const
|
|
2618
|
-
|
|
2619
|
-
const
|
|
2620
|
-
|
|
2569
|
+
if (u.appendChild(g), c.appendChild(u), e.screenshotDataUrl) {
|
|
2570
|
+
const x = document.createElement("div");
|
|
2571
|
+
x.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
2572
|
+
const v = document.createElement("img");
|
|
2573
|
+
v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", x.appendChild(v), c.appendChild(x);
|
|
2621
2574
|
}
|
|
2622
|
-
|
|
2623
|
-
const
|
|
2624
|
-
|
|
2625
|
-
const
|
|
2626
|
-
|
|
2627
|
-
const
|
|
2628
|
-
|
|
2629
|
-
const
|
|
2630
|
-
|
|
2631
|
-
for (const
|
|
2632
|
-
const
|
|
2633
|
-
|
|
2575
|
+
n.appendChild(c), n.appendChild(p);
|
|
2576
|
+
const S = document.createElement("div");
|
|
2577
|
+
S.className = "pluno-pa-widget__share-dialog-step";
|
|
2578
|
+
const f = document.createElement("strong");
|
|
2579
|
+
f.className = "pluno-pa-widget__share-dialog-step-title", f.textContent = "2) Share on", S.appendChild(f);
|
|
2580
|
+
const O = document.createElement("p");
|
|
2581
|
+
O.className = "pluno-pa-widget__share-dialog-hint", O.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(O);
|
|
2582
|
+
const k = document.createElement("footer");
|
|
2583
|
+
k.className = "pluno-pa-widget__share-dialog-platforms";
|
|
2584
|
+
for (const x of ea(e)) {
|
|
2585
|
+
const v = document.createElement("a");
|
|
2586
|
+
v.href = x.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = x.label, v.setAttribute("aria-label", `Open ${x.label}`), v.appendChild(ta(x.id)), k.appendChild(v);
|
|
2634
2587
|
}
|
|
2635
|
-
if (
|
|
2636
|
-
const
|
|
2637
|
-
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2640
|
-
const
|
|
2641
|
-
|
|
2588
|
+
if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
|
|
2589
|
+
const x = document.createElement("div");
|
|
2590
|
+
x.className = "pluno-pa-widget__share-dialog-step";
|
|
2591
|
+
const v = document.createElement("strong");
|
|
2592
|
+
v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", x.appendChild(v);
|
|
2593
|
+
const h = document.createElement("a");
|
|
2594
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(na()), x.appendChild(h), n.appendChild(x);
|
|
2642
2595
|
}
|
|
2643
|
-
return
|
|
2596
|
+
return o.appendChild(n), o;
|
|
2644
2597
|
}
|
|
2645
2598
|
function Qi(e, t) {
|
|
2646
|
-
const
|
|
2647
|
-
return
|
|
2648
|
-
|
|
2649
|
-
}),
|
|
2599
|
+
const o = document.createElement("button");
|
|
2600
|
+
return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
|
|
2601
|
+
n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
|
|
2602
|
+
}), o;
|
|
2650
2603
|
}
|
|
2651
2604
|
function ea(e) {
|
|
2652
|
-
const t = e.linkedinPost.trim(),
|
|
2605
|
+
const t = e.linkedinPost.trim(), o = e.xPost.trim();
|
|
2653
2606
|
return [
|
|
2654
2607
|
{
|
|
2655
2608
|
id: "linkedin",
|
|
@@ -2659,7 +2612,7 @@ function ea(e) {
|
|
|
2659
2612
|
{
|
|
2660
2613
|
id: "x",
|
|
2661
2614
|
label: "X",
|
|
2662
|
-
href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(
|
|
2615
|
+
href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(o)}`
|
|
2663
2616
|
},
|
|
2664
2617
|
{
|
|
2665
2618
|
id: "instagram",
|
|
@@ -2670,75 +2623,75 @@ function ea(e) {
|
|
|
2670
2623
|
}
|
|
2671
2624
|
function ta(e) {
|
|
2672
2625
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2673
|
-
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" ? (
|
|
2626
|
+
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" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(
|
|
2674
2627
|
t,
|
|
2675
2628
|
"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"
|
|
2676
|
-
),
|
|
2629
|
+
), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(
|
|
2677
2630
|
t,
|
|
2678
2631
|
"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"
|
|
2679
|
-
),
|
|
2632
|
+
), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(
|
|
2680
2633
|
t,
|
|
2681
2634
|
"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"
|
|
2682
|
-
),
|
|
2635
|
+
), B(
|
|
2683
2636
|
t,
|
|
2684
2637
|
"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",
|
|
2685
2638
|
"0.48"
|
|
2686
|
-
),
|
|
2639
|
+
), B(
|
|
2687
2640
|
t,
|
|
2688
2641
|
"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"
|
|
2689
|
-
),
|
|
2642
|
+
), B(
|
|
2690
2643
|
t,
|
|
2691
2644
|
"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"
|
|
2692
2645
|
), t);
|
|
2693
2646
|
}
|
|
2694
|
-
function
|
|
2695
|
-
const
|
|
2696
|
-
|
|
2647
|
+
function B(e, t, o) {
|
|
2648
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2649
|
+
n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
|
|
2697
2650
|
}
|
|
2698
2651
|
function na() {
|
|
2699
2652
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2700
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
2653
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(
|
|
2701
2654
|
e,
|
|
2702
2655
|
"M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
|
|
2703
2656
|
), e;
|
|
2704
2657
|
}
|
|
2705
|
-
function
|
|
2706
|
-
return e.role === "tool" && e.toolName ===
|
|
2658
|
+
function Rn(e) {
|
|
2659
|
+
return e.role === "tool" && e.toolName === bn;
|
|
2707
2660
|
}
|
|
2708
2661
|
function oa(e) {
|
|
2709
2662
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
2710
2663
|
}
|
|
2711
|
-
function ia(e, t,
|
|
2664
|
+
function ia(e, t, o, n) {
|
|
2712
2665
|
const i = document.createElement("article");
|
|
2713
2666
|
i.className = "pluno-pa-widget__tool-group", i.title = new Date(
|
|
2714
2667
|
e[e.length - 1].createdAt
|
|
2715
2668
|
).toLocaleString(), i.appendChild(
|
|
2716
2669
|
se(
|
|
2717
2670
|
"pluno-pa-widget__character--tool-group",
|
|
2718
|
-
|
|
2671
|
+
n
|
|
2719
2672
|
)
|
|
2720
2673
|
);
|
|
2721
2674
|
const a = document.createElement("details"), l = aa(e);
|
|
2722
2675
|
a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
|
|
2723
|
-
i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l),
|
|
2676
|
+
i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), o();
|
|
2724
2677
|
});
|
|
2725
2678
|
const p = document.createElement("summary");
|
|
2726
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(
|
|
2679
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((d) => d.loading) && p.appendChild(xt());
|
|
2727
2680
|
const u = document.createElement("span");
|
|
2728
2681
|
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), a.appendChild(p), e.length > 0) {
|
|
2729
2682
|
const d = document.createElement("div");
|
|
2730
2683
|
d.className = "pluno-pa-widget__tool-lines";
|
|
2731
|
-
for (const
|
|
2732
|
-
const
|
|
2733
|
-
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2684
|
+
for (const g of e) {
|
|
2685
|
+
const S = document.createElement("div");
|
|
2686
|
+
S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(xt());
|
|
2687
|
+
const f = document.createElement("span");
|
|
2688
|
+
f.textContent = g.content || "Run tool", S.appendChild(f), d.appendChild(S);
|
|
2736
2689
|
}
|
|
2737
2690
|
a.appendChild(d);
|
|
2738
2691
|
}
|
|
2739
2692
|
return i.appendChild(a), i;
|
|
2740
2693
|
}
|
|
2741
|
-
function
|
|
2694
|
+
function Mn(e) {
|
|
2742
2695
|
const t = document.createElement("article");
|
|
2743
2696
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
2744
2697
|
se(
|
|
@@ -2747,89 +2700,89 @@ function Tn(e) {
|
|
|
2747
2700
|
)
|
|
2748
2701
|
), t;
|
|
2749
2702
|
}
|
|
2750
|
-
function
|
|
2751
|
-
const t =
|
|
2752
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
2703
|
+
function sn(e) {
|
|
2704
|
+
const t = Mn(e);
|
|
2705
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(_t()), t;
|
|
2753
2706
|
}
|
|
2754
|
-
function
|
|
2707
|
+
function _t() {
|
|
2755
2708
|
const e = document.createElement("div");
|
|
2756
2709
|
e.className = "pluno-pa-widget__status";
|
|
2757
2710
|
const t = document.createElement("span");
|
|
2758
2711
|
t.className = "pluno-pa-widget__thinking-dot", t.setAttribute("aria-hidden", "true"), e.appendChild(t);
|
|
2759
|
-
const
|
|
2760
|
-
return
|
|
2712
|
+
const o = document.createElement("span");
|
|
2713
|
+
return o.textContent = "Thinking...", e.appendChild(o), e;
|
|
2761
2714
|
}
|
|
2762
2715
|
function aa(e) {
|
|
2763
2716
|
return `tools:${e[0]?.id ?? ""}`;
|
|
2764
2717
|
}
|
|
2765
|
-
function
|
|
2718
|
+
function xt() {
|
|
2766
2719
|
const e = document.createElement("span");
|
|
2767
2720
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
2768
2721
|
}
|
|
2769
|
-
function
|
|
2770
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
2722
|
+
function zn(e, t) {
|
|
2723
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ni() : An());
|
|
2771
2724
|
}
|
|
2772
2725
|
function ra(e, t) {
|
|
2773
|
-
const
|
|
2726
|
+
const o = t.replace(/\r\n/g, `
|
|
2774
2727
|
`).split(`
|
|
2775
2728
|
`);
|
|
2776
|
-
let
|
|
2777
|
-
for (;
|
|
2778
|
-
const i = n
|
|
2729
|
+
let n = 0;
|
|
2730
|
+
for (; n < o.length; ) {
|
|
2731
|
+
const i = o[n];
|
|
2779
2732
|
if (!i.trim()) {
|
|
2780
|
-
|
|
2733
|
+
n += 1;
|
|
2781
2734
|
continue;
|
|
2782
2735
|
}
|
|
2783
2736
|
if (i.match(/^```(\w+)?\s*$/)) {
|
|
2784
2737
|
const u = [];
|
|
2785
|
-
for (
|
|
2786
|
-
u.push(n
|
|
2787
|
-
|
|
2788
|
-
const d = document.createElement("pre"),
|
|
2789
|
-
|
|
2790
|
-
`), d.appendChild(
|
|
2738
|
+
for (n += 1; n < o.length && !/^```\s*$/.test(o[n]); )
|
|
2739
|
+
u.push(o[n]), n += 1;
|
|
2740
|
+
n += n < o.length ? 1 : 0;
|
|
2741
|
+
const d = document.createElement("pre"), g = document.createElement("code");
|
|
2742
|
+
g.textContent = u.join(`
|
|
2743
|
+
`), d.appendChild(g), e.appendChild(d);
|
|
2791
2744
|
continue;
|
|
2792
2745
|
}
|
|
2793
2746
|
const l = i.match(/^(#{1,3})\s+(.+)$/);
|
|
2794
2747
|
if (l) {
|
|
2795
2748
|
const u = document.createElement(`h${l[1].length + 2}`);
|
|
2796
|
-
|
|
2749
|
+
We(u, l[2]), e.appendChild(u), n += 1;
|
|
2797
2750
|
continue;
|
|
2798
2751
|
}
|
|
2799
2752
|
if (/^\s*[-*+]\s+/.test(i)) {
|
|
2800
2753
|
const u = document.createElement("ul");
|
|
2801
|
-
for (;
|
|
2754
|
+
for (; n < o.length && /^\s*[-*+]\s+/.test(o[n]); ) {
|
|
2802
2755
|
const d = document.createElement("li");
|
|
2803
|
-
|
|
2756
|
+
We(d, o[n].replace(/^\s*[-*+]\s+/, "")), u.appendChild(d), n += 1;
|
|
2804
2757
|
}
|
|
2805
2758
|
e.appendChild(u);
|
|
2806
2759
|
continue;
|
|
2807
2760
|
}
|
|
2808
2761
|
if (/^\s*\d+\.\s+/.test(i)) {
|
|
2809
2762
|
const u = document.createElement("ol");
|
|
2810
|
-
for (;
|
|
2763
|
+
for (; n < o.length && /^\s*\d+\.\s+/.test(o[n]); ) {
|
|
2811
2764
|
const d = document.createElement("li");
|
|
2812
|
-
|
|
2765
|
+
We(d, o[n].replace(/^\s*\d+\.\s+/, "")), u.appendChild(d), n += 1;
|
|
2813
2766
|
}
|
|
2814
2767
|
e.appendChild(u);
|
|
2815
2768
|
continue;
|
|
2816
2769
|
}
|
|
2817
2770
|
const p = [i];
|
|
2818
|
-
for (
|
|
2819
|
-
p.push(n
|
|
2771
|
+
for (n += 1; n < o.length && o[n].trim() && !/^```/.test(o[n]) && !/^(#{1,3})\s+/.test(o[n]) && !/^\s*[-*+]\s+/.test(o[n]) && !/^\s*\d+\.\s+/.test(o[n]); )
|
|
2772
|
+
p.push(o[n]), n += 1;
|
|
2820
2773
|
const c = document.createElement("p");
|
|
2821
2774
|
p.forEach((u, d) => {
|
|
2822
|
-
d > 0 && c.appendChild(document.createElement("br")),
|
|
2775
|
+
d > 0 && c.appendChild(document.createElement("br")), We(c, u);
|
|
2823
2776
|
}), e.appendChild(c);
|
|
2824
2777
|
}
|
|
2825
2778
|
}
|
|
2826
|
-
function
|
|
2827
|
-
const
|
|
2828
|
-
let
|
|
2829
|
-
for (const i of t.matchAll(
|
|
2779
|
+
function We(e, t) {
|
|
2780
|
+
const o = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
2781
|
+
let n = 0;
|
|
2782
|
+
for (const i of t.matchAll(o)) {
|
|
2830
2783
|
const a = i.index ?? 0;
|
|
2831
|
-
a >
|
|
2832
|
-
document.createTextNode(t.slice(
|
|
2784
|
+
a > n && e.appendChild(
|
|
2785
|
+
document.createTextNode(t.slice(n, a))
|
|
2833
2786
|
);
|
|
2834
2787
|
const l = i[0];
|
|
2835
2788
|
if (l.startsWith("`")) {
|
|
@@ -2849,9 +2802,9 @@ function Ue(e, t) {
|
|
|
2849
2802
|
} else
|
|
2850
2803
|
e.appendChild(document.createTextNode(l));
|
|
2851
2804
|
}
|
|
2852
|
-
|
|
2805
|
+
n = a + l.length;
|
|
2853
2806
|
}
|
|
2854
|
-
|
|
2807
|
+
n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
|
|
2855
2808
|
}
|
|
2856
2809
|
function la(e) {
|
|
2857
2810
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
@@ -2863,10 +2816,10 @@ function la(e) {
|
|
|
2863
2816
|
return !1;
|
|
2864
2817
|
}
|
|
2865
2818
|
}
|
|
2866
|
-
function
|
|
2819
|
+
function dn(e, t) {
|
|
2867
2820
|
if (pa(e))
|
|
2868
2821
|
return;
|
|
2869
|
-
const
|
|
2822
|
+
const o = `
|
|
2870
2823
|
:host {
|
|
2871
2824
|
all: initial;
|
|
2872
2825
|
color-scheme: light;
|
|
@@ -2917,7 +2870,7 @@ function rn(e, t) {
|
|
|
2917
2870
|
--pluno-pa-accent-contrast: #fafafa;
|
|
2918
2871
|
position: fixed;
|
|
2919
2872
|
z-index: 2147483645;
|
|
2920
|
-
font-family: ${
|
|
2873
|
+
font-family: ${Q.fontFamily};
|
|
2921
2874
|
font-size: 14px;
|
|
2922
2875
|
color: var(--pluno-pa-text);
|
|
2923
2876
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -3509,12 +3462,14 @@ function rn(e, t) {
|
|
|
3509
3462
|
margin-top: 8px;
|
|
3510
3463
|
max-width: 220px;
|
|
3511
3464
|
}
|
|
3512
|
-
.pluno-pa-widget__message-
|
|
3465
|
+
.pluno-pa-widget__message-attachment-preview {
|
|
3513
3466
|
width: 100%;
|
|
3514
3467
|
aspect-ratio: 1;
|
|
3515
3468
|
border-radius: 8px;
|
|
3516
3469
|
object-fit: cover;
|
|
3517
3470
|
border: 1px solid var(--pluno-pa-divider);
|
|
3471
|
+
background: var(--pluno-pa-surface);
|
|
3472
|
+
overflow: hidden;
|
|
3518
3473
|
}
|
|
3519
3474
|
.pluno-pa-widget__message-attachment-file {
|
|
3520
3475
|
min-width: 0;
|
|
@@ -3884,7 +3839,7 @@ function rn(e, t) {
|
|
|
3884
3839
|
place-items: center;
|
|
3885
3840
|
padding: 18px;
|
|
3886
3841
|
background: rgba(24, 24, 27, 0.28);
|
|
3887
|
-
font-family: var(--pluno-pa-font, ${
|
|
3842
|
+
font-family: var(--pluno-pa-font, ${Q.fontFamily});
|
|
3888
3843
|
color: var(--pluno-pa-text);
|
|
3889
3844
|
}
|
|
3890
3845
|
.pluno-pa-widget__share-dialog {
|
|
@@ -4200,7 +4155,8 @@ function rn(e, t) {
|
|
|
4200
4155
|
padding: 3px 5px 3px 3px;
|
|
4201
4156
|
font-size: 12px;
|
|
4202
4157
|
}
|
|
4203
|
-
.pluno-pa-widget__attachment img
|
|
4158
|
+
.pluno-pa-widget__attachment img,
|
|
4159
|
+
.pluno-pa-widget__attachment video {
|
|
4204
4160
|
width: 22px;
|
|
4205
4161
|
height: 22px;
|
|
4206
4162
|
border-radius: 5px;
|
|
@@ -4969,23 +4925,23 @@ function rn(e, t) {
|
|
|
4969
4925
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
4970
4926
|
}
|
|
4971
4927
|
`;
|
|
4972
|
-
if (sa(e,
|
|
4928
|
+
if (sa(e, o))
|
|
4973
4929
|
return;
|
|
4974
|
-
const
|
|
4975
|
-
|
|
4930
|
+
const n = e.ownerDocument.createElement("style");
|
|
4931
|
+
n.id = yn, n.textContent = o, e.appendChild(n), Bn(e);
|
|
4976
4932
|
}
|
|
4977
4933
|
function pa(e) {
|
|
4978
|
-
return e.getElementById(
|
|
4934
|
+
return e.getElementById(yn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Cn) === "true";
|
|
4979
4935
|
}
|
|
4980
|
-
function
|
|
4981
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
4936
|
+
function Bn(e) {
|
|
4937
|
+
e.host instanceof HTMLElement && e.host.setAttribute(Cn, "true");
|
|
4982
4938
|
}
|
|
4983
4939
|
function sa(e, t) {
|
|
4984
4940
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
4985
4941
|
return !1;
|
|
4986
4942
|
try {
|
|
4987
|
-
const
|
|
4988
|
-
return
|
|
4943
|
+
const o = new CSSStyleSheet();
|
|
4944
|
+
return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], Bn(e), !0;
|
|
4989
4945
|
} catch {
|
|
4990
4946
|
return !1;
|
|
4991
4947
|
}
|
|
@@ -4998,34 +4954,34 @@ async function da() {
|
|
|
4998
4954
|
t.observe(document.documentElement, { childList: !0 });
|
|
4999
4955
|
});
|
|
5000
4956
|
}
|
|
5001
|
-
function
|
|
4957
|
+
function Un(e) {
|
|
5002
4958
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
5003
4959
|
}
|
|
5004
4960
|
function ca(e) {
|
|
5005
4961
|
try {
|
|
5006
|
-
const t = window.localStorage.getItem(
|
|
4962
|
+
const t = window.localStorage.getItem(Un(e));
|
|
5007
4963
|
if (!t)
|
|
5008
|
-
return
|
|
5009
|
-
const
|
|
4964
|
+
return cn();
|
|
4965
|
+
const o = JSON.parse(t);
|
|
5010
4966
|
return {
|
|
5011
|
-
isOpen:
|
|
5012
|
-
composerValue: typeof
|
|
5013
|
-
openToolGroupKeys: Array.isArray(
|
|
5014
|
-
(
|
|
4967
|
+
isOpen: o.isOpen === !0,
|
|
4968
|
+
composerValue: typeof o.composerValue == "string" ? o.composerValue : "",
|
|
4969
|
+
openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
|
|
4970
|
+
(n) => typeof n == "string"
|
|
5015
4971
|
) : [],
|
|
5016
|
-
launcherPosition: ma(
|
|
5017
|
-
seenShareCandidateIds: Array.isArray(
|
|
5018
|
-
sharePromptsDisabled:
|
|
4972
|
+
launcherPosition: ma(o.launcherPosition) ? o.launcherPosition : null,
|
|
4973
|
+
seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-fn) : [],
|
|
4974
|
+
sharePromptsDisabled: o.sharePromptsDisabled === !0
|
|
5019
4975
|
};
|
|
5020
4976
|
} catch {
|
|
5021
|
-
return
|
|
4977
|
+
return cn();
|
|
5022
4978
|
}
|
|
5023
4979
|
}
|
|
5024
4980
|
async function ua(e) {
|
|
5025
4981
|
if (e.loadSharePromptsDisabled)
|
|
5026
4982
|
return e.loadSharePromptsDisabled();
|
|
5027
4983
|
try {
|
|
5028
|
-
return window.localStorage.getItem(
|
|
4984
|
+
return window.localStorage.getItem(wn) === "true";
|
|
5029
4985
|
} catch {
|
|
5030
4986
|
return !1;
|
|
5031
4987
|
}
|
|
@@ -5039,12 +4995,12 @@ function ga(e, t) {
|
|
|
5039
4995
|
return;
|
|
5040
4996
|
}
|
|
5041
4997
|
try {
|
|
5042
|
-
t && window.localStorage.setItem(
|
|
4998
|
+
t && window.localStorage.setItem(wn, "true");
|
|
5043
4999
|
} catch {
|
|
5044
5000
|
return;
|
|
5045
5001
|
}
|
|
5046
5002
|
}
|
|
5047
|
-
function
|
|
5003
|
+
function cn() {
|
|
5048
5004
|
return {
|
|
5049
5005
|
isOpen: !1,
|
|
5050
5006
|
composerValue: "",
|
|
@@ -5057,7 +5013,7 @@ function ln() {
|
|
|
5057
5013
|
function ha(e, t) {
|
|
5058
5014
|
try {
|
|
5059
5015
|
window.localStorage.setItem(
|
|
5060
|
-
|
|
5016
|
+
Un(e),
|
|
5061
5017
|
JSON.stringify(t)
|
|
5062
5018
|
);
|
|
5063
5019
|
} catch {
|
|
@@ -5070,32 +5026,32 @@ function ma(e) {
|
|
|
5070
5026
|
const t = e;
|
|
5071
5027
|
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");
|
|
5072
5028
|
}
|
|
5073
|
-
const
|
|
5029
|
+
const un = /* @__PURE__ */ new WeakSet();
|
|
5074
5030
|
function ba(e) {
|
|
5075
5031
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
5076
5032
|
}
|
|
5077
|
-
function
|
|
5033
|
+
function gn(e) {
|
|
5078
5034
|
const t = e.pathname.split("/");
|
|
5079
5035
|
return t[t.length - 1] ?? "";
|
|
5080
5036
|
}
|
|
5081
5037
|
function fa(e, t) {
|
|
5082
|
-
const
|
|
5083
|
-
return
|
|
5084
|
-
}
|
|
5085
|
-
class
|
|
5086
|
-
constructor(t,
|
|
5087
|
-
super(), this.channelId =
|
|
5088
|
-
this.readyState =
|
|
5089
|
-
}), this.addPreviewListener(
|
|
5090
|
-
const i =
|
|
5038
|
+
const o = new URL(e.src, document.baseURI);
|
|
5039
|
+
return o.href === t.href || o.pathname === t.pathname ? !0 : gn(o) === gn(t);
|
|
5040
|
+
}
|
|
5041
|
+
class ae extends EventTarget {
|
|
5042
|
+
constructor(t, o) {
|
|
5043
|
+
super(), this.channelId = o, this.url = t, this.addPreviewListener(So, () => {
|
|
5044
|
+
this.readyState = ae.OPEN, this.dispatchEvent(new Event("open"));
|
|
5045
|
+
}), this.addPreviewListener(Eo, (n) => {
|
|
5046
|
+
const i = n;
|
|
5091
5047
|
this.dispatchEvent(
|
|
5092
5048
|
new MessageEvent("message", { data: i.detail?.data ?? "" })
|
|
5093
5049
|
);
|
|
5094
|
-
}), this.addPreviewListener(
|
|
5095
|
-
this.readyState =
|
|
5096
|
-
}), this.addPreviewListener(
|
|
5097
|
-
const i =
|
|
5098
|
-
this.readyState =
|
|
5050
|
+
}), this.addPreviewListener(ko, () => {
|
|
5051
|
+
this.readyState = ae.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
5052
|
+
}), this.addPreviewListener(Lo, (n) => {
|
|
5053
|
+
const i = n;
|
|
5054
|
+
this.readyState = ae.CLOSED, this.dispatchEvent(
|
|
5099
5055
|
new CloseEvent("close", {
|
|
5100
5056
|
code: i.detail?.code ?? 1e3,
|
|
5101
5057
|
reason: i.detail?.reason ?? "",
|
|
@@ -5104,8 +5060,8 @@ class oe extends EventTarget {
|
|
|
5104
5060
|
), this.cleanup();
|
|
5105
5061
|
}), window.dispatchEvent(
|
|
5106
5062
|
new CustomEvent(
|
|
5107
|
-
|
|
5108
|
-
|
|
5063
|
+
Ge(
|
|
5064
|
+
vo,
|
|
5109
5065
|
this.channelId
|
|
5110
5066
|
),
|
|
5111
5067
|
{
|
|
@@ -5124,18 +5080,18 @@ class oe extends EventTarget {
|
|
|
5124
5080
|
extensions = "";
|
|
5125
5081
|
binaryType = "blob";
|
|
5126
5082
|
bufferedAmount = 0;
|
|
5127
|
-
readyState =
|
|
5083
|
+
readyState = ae.CONNECTING;
|
|
5128
5084
|
socketId = wa();
|
|
5129
5085
|
listeners = /* @__PURE__ */ new Map();
|
|
5130
5086
|
send(t) {
|
|
5131
|
-
if (this.readyState !==
|
|
5087
|
+
if (this.readyState !== ae.OPEN)
|
|
5132
5088
|
throw new DOMException(
|
|
5133
5089
|
"Pluno preview websocket is not open",
|
|
5134
5090
|
"InvalidStateError"
|
|
5135
5091
|
);
|
|
5136
5092
|
window.dispatchEvent(
|
|
5137
5093
|
new CustomEvent(
|
|
5138
|
-
|
|
5094
|
+
Ge(yo, this.channelId),
|
|
5139
5095
|
{
|
|
5140
5096
|
detail: {
|
|
5141
5097
|
socketId: this.socketId,
|
|
@@ -5145,78 +5101,78 @@ class oe extends EventTarget {
|
|
|
5145
5101
|
)
|
|
5146
5102
|
);
|
|
5147
5103
|
}
|
|
5148
|
-
close(t,
|
|
5149
|
-
this.readyState !==
|
|
5104
|
+
close(t, o) {
|
|
5105
|
+
this.readyState !== ae.CLOSED && (this.readyState = ae.CLOSING, window.dispatchEvent(
|
|
5150
5106
|
new CustomEvent(
|
|
5151
|
-
|
|
5107
|
+
Ge(Co, this.channelId),
|
|
5152
5108
|
{
|
|
5153
|
-
detail: { socketId: this.socketId, code: t, reason:
|
|
5109
|
+
detail: { socketId: this.socketId, code: t, reason: o }
|
|
5154
5110
|
}
|
|
5155
5111
|
)
|
|
5156
5112
|
), this.cleanup());
|
|
5157
5113
|
}
|
|
5158
|
-
addPreviewListener(t,
|
|
5159
|
-
const
|
|
5114
|
+
addPreviewListener(t, o) {
|
|
5115
|
+
const n = Ge(
|
|
5160
5116
|
t,
|
|
5161
5117
|
this.channelId
|
|
5162
5118
|
), i = (a) => {
|
|
5163
|
-
a.detail?.socketId === this.socketId &&
|
|
5119
|
+
a.detail?.socketId === this.socketId && o(a);
|
|
5164
5120
|
};
|
|
5165
|
-
this.listeners.set(
|
|
5121
|
+
this.listeners.set(n, i), window.addEventListener(n, i);
|
|
5166
5122
|
}
|
|
5167
5123
|
cleanup() {
|
|
5168
|
-
for (const [t,
|
|
5169
|
-
window.removeEventListener(t,
|
|
5124
|
+
for (const [t, o] of this.listeners.entries())
|
|
5125
|
+
window.removeEventListener(t, o);
|
|
5170
5126
|
this.listeners.clear();
|
|
5171
5127
|
}
|
|
5172
5128
|
}
|
|
5173
5129
|
function wa() {
|
|
5174
5130
|
const e = window.sessionStorage.getItem(
|
|
5175
|
-
|
|
5131
|
+
Ht
|
|
5176
5132
|
);
|
|
5177
5133
|
if (e)
|
|
5178
5134
|
return e;
|
|
5179
5135
|
const t = crypto.randomUUID();
|
|
5180
|
-
return window.sessionStorage.setItem(
|
|
5136
|
+
return window.sessionStorage.setItem(Ht, t), t;
|
|
5181
5137
|
}
|
|
5182
|
-
function
|
|
5138
|
+
function Ge(e, t) {
|
|
5183
5139
|
return `${e}:${t}`;
|
|
5184
5140
|
}
|
|
5185
5141
|
function _a(e) {
|
|
5186
5142
|
const t = document.currentScript;
|
|
5187
5143
|
if (t instanceof HTMLScriptElement)
|
|
5188
5144
|
return [t];
|
|
5189
|
-
const
|
|
5145
|
+
const o = new URL(e, document.baseURI).href, n = new URL(o);
|
|
5190
5146
|
return Array.from(
|
|
5191
5147
|
document.querySelectorAll("script[type='module'][src]")
|
|
5192
5148
|
).filter(
|
|
5193
|
-
(i) => i instanceof HTMLScriptElement && ba(i) && fa(i,
|
|
5149
|
+
(i) => i instanceof HTMLScriptElement && ba(i) && fa(i, n)
|
|
5194
5150
|
);
|
|
5195
5151
|
}
|
|
5196
5152
|
function xa(e) {
|
|
5197
5153
|
for (const t of _a(e)) {
|
|
5198
|
-
if (
|
|
5154
|
+
if (un.has(t) || t.dataset.plunoAutoMount === "false")
|
|
5199
5155
|
continue;
|
|
5200
|
-
|
|
5201
|
-
const
|
|
5202
|
-
|
|
5156
|
+
un.add(t);
|
|
5157
|
+
const o = t.dataset.plunoPreviewChannel;
|
|
5158
|
+
Xo({
|
|
5203
5159
|
token: t.dataset.plunoToken,
|
|
5204
5160
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
5205
5161
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
5206
|
-
webSocketFactory:
|
|
5162
|
+
webSocketFactory: o ? Yo(o) : void 0,
|
|
5207
5163
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
5208
5164
|
accentColor: t.dataset.plunoAccentColor,
|
|
5209
5165
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
5210
5166
|
fontFamily: t.dataset.plunoFontFamily,
|
|
5211
5167
|
scribbleStyle: t.dataset.plunoScribbleStyle === "true",
|
|
5212
5168
|
position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
5213
|
-
}).catch((
|
|
5214
|
-
console.error("Failed to mount Pluno widget",
|
|
5169
|
+
}).catch((n) => {
|
|
5170
|
+
console.error("Failed to mount Pluno widget", n);
|
|
5215
5171
|
});
|
|
5216
5172
|
}
|
|
5217
5173
|
}
|
|
5218
5174
|
xa(import.meta.url);
|
|
5219
5175
|
export {
|
|
5220
|
-
|
|
5221
|
-
|
|
5176
|
+
Yo as createProductAgentPreviewBridgeWebSocketFactory,
|
|
5177
|
+
Xo as mountPlunoProductAgentWidget
|
|
5222
5178
|
};
|