@pluno/product-agent-web 0.1.41 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -0
- package/dist/product-agent-sdk.js +400 -273
- package/dist/product-agent-widget.js +1147 -889
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as Mn } from "./product-agent-sdk.js";
|
|
2
|
+
const Bn = "#7c3aed", Oe = "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", Ue = "#2c2a1e", Et = [253, 250, 241], St = 3.5;
|
|
3
|
+
function Qt(e) {
|
|
4
|
+
const t = en(e);
|
|
5
|
+
if (kt(ke(t), Et) >= St)
|
|
6
6
|
return t;
|
|
7
|
-
let o =
|
|
8
|
-
const a =
|
|
7
|
+
let o = ke(t);
|
|
8
|
+
const a = ke(Ue);
|
|
9
9
|
for (let i = 0; i < 6; i += 1)
|
|
10
|
-
if (o =
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (o = Fn(o, a, 0.22), kt(o, Et) >= St)
|
|
11
|
+
return tt(o);
|
|
12
|
+
return tt(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function On() {
|
|
15
15
|
let n = "M 280 120", o = !1, a = 0;
|
|
16
16
|
for (let i = 150; i <= 1170; i += 62) {
|
|
17
|
-
const l = (a % 3 - 1) * 18,
|
|
18
|
-
n += ` L ${
|
|
17
|
+
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
18
|
+
n += ` L ${p} ${i}`, o = !o, a += 1;
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function Un(e) {
|
|
23
|
+
const t = en(e), n = nt(ke(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -44,90 +44,90 @@ function Sn(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: V(t, 0.28, -0.03),
|
|
48
|
+
middle: V(t, 0.08, 0.04),
|
|
49
|
+
bottom: V(t, -0.1, 0.02),
|
|
50
|
+
edgeStart: V(t, 0.08, 0.08),
|
|
51
|
+
edgeMiddle: V(t, -0.08, 0.08),
|
|
52
|
+
edgeEnd: V(t, -0.18, 0.05),
|
|
53
|
+
glow: V(t, 0.32, -0.12),
|
|
54
|
+
highlight: V(t, 0.38, -0.18),
|
|
55
|
+
inner: V(t, 0.24, -0.1),
|
|
56
|
+
shadow: V(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function en(e) {
|
|
60
60
|
const t = e.trim();
|
|
61
|
-
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` :
|
|
61
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Bn;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ke(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
|
|
70
|
+
function tt([e, t, n]) {
|
|
71
71
|
const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
|
|
72
72
|
return `#${o(e)}${o(t)}${o(n)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function nt([e, t, n]) {
|
|
75
75
|
const o = (a) => {
|
|
76
76
|
const i = a / 255;
|
|
77
77
|
return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
78
78
|
};
|
|
79
79
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
const n =
|
|
81
|
+
function kt(e, t) {
|
|
82
|
+
const n = nt(e), o = nt(t), [a, i] = n > o ? [n, o] : [o, n];
|
|
83
83
|
return (a + 0.05) / (i + 0.05);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const o =
|
|
85
|
+
function Fn(e, t, n) {
|
|
86
|
+
const o = ot(n);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * o,
|
|
89
89
|
e[1] + (t[1] - e[1]) * o,
|
|
90
90
|
e[2] + (t[2] - e[2]) * o
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const [o, a, i] =
|
|
95
|
-
return
|
|
93
|
+
function V(e, t, n) {
|
|
94
|
+
const [o, a, i] = zn(ke(e));
|
|
95
|
+
return tt(Gn(o, ot(a + n), ot(i + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i),
|
|
99
|
-
if (l ===
|
|
100
|
-
return [0, 0,
|
|
101
|
-
const
|
|
102
|
-
return [(l === o ? (a - i) /
|
|
97
|
+
function zn([e, t, n]) {
|
|
98
|
+
const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
|
|
99
|
+
if (l === p)
|
|
100
|
+
return [0, 0, c];
|
|
101
|
+
const u = l - p, s = c > 0.5 ? u / (2 - l - p) : u / (l + p);
|
|
102
|
+
return [(l === o ? (a - i) / u + (a < i ? 6 : 0) : l === a ? (i - o) / u + 2 : (o - a) / u + 4) / 6, s, c];
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Gn(e, t, n) {
|
|
105
105
|
if (t === 0)
|
|
106
106
|
return [n * 255, n * 255, n * 255];
|
|
107
107
|
const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
|
|
108
108
|
return [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
Xe(a, o, e + 1 / 3) * 255,
|
|
110
|
+
Xe(a, o, e) * 255,
|
|
111
|
+
Xe(a, o, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Xe(e, t, n) {
|
|
115
115
|
let o = n;
|
|
116
116
|
return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function ot(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const tn = "suggest_share_on_socials";
|
|
122
|
+
function Hn(e) {
|
|
123
123
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
124
124
|
const n = e[t];
|
|
125
|
-
if (n.role !== "tool" || n.toolName !==
|
|
125
|
+
if (n.role !== "tool" || n.toolName !== tn)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = Lt(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const a =
|
|
130
|
+
const a = Lt(e, o.index, "user");
|
|
131
131
|
return a ? {
|
|
132
132
|
id: `share:${n.callId ?? n.id}`,
|
|
133
133
|
userPrompt: a.content,
|
|
@@ -136,13 +136,13 @@ function Pn(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function Wn(e) {
|
|
140
|
+
const t = await $n(e);
|
|
141
141
|
if (!navigator.clipboard || typeof ClipboardItem > "u")
|
|
142
142
|
throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
|
|
143
143
|
await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Lt(e, t, n) {
|
|
146
146
|
for (let o = t - 1; o >= 0; o -= 1) {
|
|
147
147
|
const a = e[o];
|
|
148
148
|
if (a.role === n && a.content.trim())
|
|
@@ -150,21 +150,21 @@ function bt(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function $n(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
156
|
+
const qn = "https://app.pluno.ai", jn = "/api/product-agent/embed/active-users", Vn = 1800, Yn = 15e3, Kn = 250, Xn = 1e3, Zn = 3e4;
|
|
157
|
+
function Jn(e, t = {}) {
|
|
158
158
|
let n = !1, o = null, a = null, i = null;
|
|
159
159
|
const l = () => {
|
|
160
160
|
i !== null && (window.clearInterval(i), i = null);
|
|
161
|
-
},
|
|
161
|
+
}, p = (s) => {
|
|
162
162
|
n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
},
|
|
163
|
+
u();
|
|
164
|
+
}, to(s)));
|
|
165
|
+
}, c = (s) => {
|
|
166
166
|
if (l(), o === null) {
|
|
167
|
-
o =
|
|
167
|
+
o = s, e(s);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
170
|
const b = o, x = performance.now();
|
|
@@ -173,50 +173,50 @@ function Fn(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
o = Math.round(b + (
|
|
178
|
-
},
|
|
179
|
-
},
|
|
176
|
+
const P = Math.min(1, (performance.now() - x) / Vn);
|
|
177
|
+
o = Math.round(b + (s - b) * no(P)), e(o), P >= 1 && (o = s, e(s), l());
|
|
178
|
+
}, Kn);
|
|
179
|
+
}, u = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const
|
|
181
|
+
const s = await Qn(t);
|
|
182
182
|
if (n)
|
|
183
183
|
return;
|
|
184
|
-
|
|
184
|
+
c(s.count), p(s.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
|
|
186
|
+
p(Yn);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
return
|
|
189
|
+
return u(), () => {
|
|
190
190
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function Qn(e) {
|
|
194
194
|
if (e.loader)
|
|
195
195
|
return e.loader();
|
|
196
|
-
const n = await (e.fetcher ?? fetch)(new URL(
|
|
196
|
+
const n = await (e.fetcher ?? fetch)(new URL(jn, eo(e.backendUrl ?? qn)).toString(), {
|
|
197
197
|
cache: "no-store",
|
|
198
198
|
credentials: "omit"
|
|
199
199
|
});
|
|
200
200
|
if (!n.ok)
|
|
201
201
|
throw new Error("Failed to load active users");
|
|
202
|
-
const o = await n.json(), a =
|
|
202
|
+
const o = await n.json(), a = Pt(o.count), i = Pt(o.refreshAfterMs ?? o.refresh_after_ms);
|
|
203
203
|
if (a === null || i === null)
|
|
204
204
|
throw new Error("Invalid active users response");
|
|
205
205
|
return { count: a, refreshAfterMs: i };
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Pt(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function eo(e) {
|
|
211
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return Math.min(
|
|
213
|
+
function to(e) {
|
|
214
|
+
return Math.min(Zn, Math.max(Xn, e));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function no(e) {
|
|
217
217
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
218
218
|
}
|
|
219
|
-
const
|
|
219
|
+
const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-agent:sdk-preview-socket-send", io = "product-agent:sdk-preview-socket-close", ro = "product-agent:sdk-preview-socket-open", lo = "product-agent:sdk-preview-socket-message", po = "product-agent:sdk-preview-socket-error", so = "product-agent:sdk-preview-socket-closed", At = "product-agent:sdk-preview-socket-id", co = "data-pluno-sdk-preview-channel", uo = "product-agent:preview-diagnostic", on = "pluno.productAgent.sharePromptsDisabled", Fe = 10, go = 10 * 1024 * 1024, an = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), ho = Array.from(an).join(","), mo = 3, bo = "No recent chats for this page yet.", K = {
|
|
220
220
|
launcherLabel: "Ask for anything...",
|
|
221
221
|
accentColor: "#7c3aed",
|
|
222
222
|
colorScheme: "light",
|
|
@@ -224,7 +224,7 @@ const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-a
|
|
|
224
224
|
scribbleStyle: !1,
|
|
225
225
|
position: "bottom-right",
|
|
226
226
|
movableLauncher: !1
|
|
227
|
-
},
|
|
227
|
+
}, fo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tt = "pluno-pa-scribble-font", rn = 190, ln = 41, wo = 48, _o = 420, xo = 520, yo = 0.24, vo = 680, Co = 800, Eo = 0.76, z = 8, at = 50, pn = "http://www.w3.org/2000/svg", Nt = [
|
|
228
228
|
{
|
|
229
229
|
ellipseCx: "17.5",
|
|
230
230
|
ellipseCy: "24.5",
|
|
@@ -261,20 +261,20 @@ const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-a
|
|
|
261
261
|
path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
|
|
262
262
|
pathStrokeWidth: "2.45"
|
|
263
263
|
}
|
|
264
|
-
],
|
|
265
|
-
let
|
|
266
|
-
function
|
|
267
|
-
return (t) => new
|
|
264
|
+
], So = 11, ko = 13, It = 4, Lo = 10, Po = 40, Ao = "movable-launcher-position-v2", sn = "pluno-pa-widget-styles", dn = "data-pluno-pa-widget-styles";
|
|
265
|
+
let Dt = 0;
|
|
266
|
+
function To(e) {
|
|
267
|
+
return (t) => new te(t, e);
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function No(e = {}) {
|
|
270
270
|
const t = {
|
|
271
|
-
launcherLabel: e.launcherLabel ??
|
|
272
|
-
accentColor: e.accentColor ??
|
|
273
|
-
colorScheme: e.colorScheme ??
|
|
274
|
-
fontFamily: e.fontFamily ??
|
|
275
|
-
scribbleStyle: e.scribbleStyle ??
|
|
276
|
-
position: e.position ??
|
|
277
|
-
movableLauncher: e.movableLauncher ??
|
|
271
|
+
launcherLabel: e.launcherLabel ?? K.launcherLabel,
|
|
272
|
+
accentColor: e.accentColor ?? K.accentColor,
|
|
273
|
+
colorScheme: e.colorScheme ?? K.colorScheme,
|
|
274
|
+
fontFamily: e.fontFamily ?? K.fontFamily,
|
|
275
|
+
scribbleStyle: e.scribbleStyle ?? K.scribbleStyle,
|
|
276
|
+
position: e.position ?? K.position,
|
|
277
|
+
movableLauncher: e.movableLauncher ?? K.movableLauncher,
|
|
278
278
|
token: e.token,
|
|
279
279
|
tokenProvider: e.tokenProvider,
|
|
280
280
|
tokenEndpoint: e.tokenEndpoint,
|
|
@@ -299,9 +299,10 @@ async function bo(e = {}) {
|
|
|
299
299
|
activeUsersLoader: e.activeUsersLoader,
|
|
300
300
|
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
301
301
|
loadSharePromptsDisabled: e.loadSharePromptsDisabled,
|
|
302
|
-
persistSharePromptsDisabled: e.persistSharePromptsDisabled
|
|
302
|
+
persistSharePromptsDisabled: e.persistSharePromptsDisabled,
|
|
303
|
+
sdkPreviewChannelId: e.sdkPreviewChannelId
|
|
303
304
|
};
|
|
304
|
-
|
|
305
|
+
Y("web-sdk.widget", "Mounting widget with merged options", {
|
|
305
306
|
accentColor: t.accentColor,
|
|
306
307
|
colorScheme: t.colorScheme,
|
|
307
308
|
fontFamily: t.fontFamily,
|
|
@@ -313,35 +314,35 @@ async function bo(e = {}) {
|
|
|
313
314
|
initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
|
|
314
315
|
});
|
|
315
316
|
const n = document.createElement("div");
|
|
316
|
-
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
|
|
317
|
+
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(co, t.sdkPreviewChannelId);
|
|
317
318
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
318
319
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
319
|
-
let i =
|
|
320
|
-
|
|
321
|
-
const l = await
|
|
322
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
320
|
+
let i = Rt(t.accentColor, t.scribbleStyle);
|
|
321
|
+
Zo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
322
|
+
const l = await ja(), p = l.ownerDocument;
|
|
323
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Kt(o, t.accentColor), Mt(a, i, {
|
|
323
324
|
accentColor: t.accentColor,
|
|
324
325
|
colorScheme: t.colorScheme,
|
|
325
326
|
fontFamily: t.fontFamily,
|
|
326
327
|
scribbleStyle: t.scribbleStyle
|
|
327
|
-
}),
|
|
328
|
+
}), Y("web-sdk.widget", "Applied initial widget appearance", {
|
|
328
329
|
accentColor: t.accentColor,
|
|
329
330
|
colorScheme: t.colorScheme,
|
|
330
331
|
fontFamily: t.fontFamily,
|
|
331
332
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
332
333
|
});
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
334
|
+
const c = a.querySelector(".pluno-pa-widget__launcher"), u = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), P = a.querySelector(".pluno-pa-widget__composer"), k = a.querySelector(".pluno-pa-widget__attachment-error"), O = a.querySelector(".pluno-pa-widget__billing-status"), y = a.querySelector(".pluno-pa-widget__attachments"), C = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), E = a.querySelector(".pluno-pa-widget__send"), I = a.querySelector(".pluno-pa-widget__new-chat"), le = a.querySelector(".pluno-pa-widget__history"), xe = a.querySelector(".pluno-pa-widget__history-panel"), R = a.querySelector(".pluno-pa-widget__history-list"), _ = a.querySelector(".pluno-pa-widget__history-close"), L = a.querySelector(".pluno-pa-widget__history-status"), G = a.querySelector(".pluno-pa-widget__timeline-jump"), M = a.querySelector(".pluno-pa-widget__active-users-counter"), f = a.querySelector(".pluno-pa-widget__timeline"), A = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
335
|
+
if (!c || !s || !b || !x || !P || !k || !O || !y || !C || !h || !g || !E || !I || !le || !xe || !R || !_ || !L || !G || !M || !f || !A)
|
|
335
336
|
throw new Error("Failed to mount Pluno widget");
|
|
336
|
-
if (t.movableLauncher && !
|
|
337
|
+
if (t.movableLauncher && !u)
|
|
337
338
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
338
|
-
|
|
339
|
-
let
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
zt(s), zt(g);
|
|
340
|
+
let T = [], J = null;
|
|
341
|
+
const me = () => {
|
|
342
|
+
ba(y, T, (r) => {
|
|
343
|
+
T = T.filter((d, S) => S !== r), me(), U(w.getState()), W();
|
|
343
344
|
});
|
|
344
|
-
},
|
|
345
|
+
}, En = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
345
346
|
if (!t.tokenEndpoint)
|
|
346
347
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
347
348
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -352,19 +353,19 @@ async function bo(e = {}) {
|
|
|
352
353
|
});
|
|
353
354
|
if (!r.ok)
|
|
354
355
|
throw new Error("Failed to load Pluno token");
|
|
355
|
-
const
|
|
356
|
-
if (!
|
|
356
|
+
const d = await r.json();
|
|
357
|
+
if (!d.token)
|
|
357
358
|
throw new Error("Pluno token endpoint did not return a token");
|
|
358
|
-
return
|
|
359
|
-
}),
|
|
360
|
-
let
|
|
361
|
-
|
|
359
|
+
return d.token;
|
|
360
|
+
}), Sn = window.fetch.bind(window);
|
|
361
|
+
let w;
|
|
362
|
+
w = await Mn.init({
|
|
362
363
|
token: t.token,
|
|
363
|
-
tokenProvider:
|
|
364
|
+
tokenProvider: En,
|
|
364
365
|
backendUrl: t.backendUrl,
|
|
365
366
|
metadata: () => ({
|
|
366
367
|
...t.metadata ?? {},
|
|
367
|
-
...!
|
|
368
|
+
...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
|
|
368
369
|
}),
|
|
369
370
|
initialStarterPrompts: t.initialStarterPrompts,
|
|
370
371
|
clientId: t.clientId,
|
|
@@ -373,42 +374,83 @@ async function bo(e = {}) {
|
|
|
373
374
|
webSocketFactory: t.webSocketFactory,
|
|
374
375
|
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
|
|
375
376
|
});
|
|
376
|
-
const
|
|
377
|
-
let
|
|
377
|
+
const pe = Va(t), Ge = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Le = new Set(be);
|
|
378
|
+
let He = pe.sharePromptsDisabled || await Ya(t), Q = t.movableLauncher ? pe.launcherPosition : null, dt = Q !== null, oe = null, Pe = !1, se = !1, de = {
|
|
378
379
|
enabled: !0
|
|
379
|
-
},
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
},
|
|
385
|
-
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
380
|
+
}, ce = 0, ct = "", ae = !1, ee = !1, ie = [], We = null, ye = null;
|
|
381
|
+
const q = (r, d) => {
|
|
382
|
+
de = { enabled: r, reason: d };
|
|
383
|
+
}, j = () => {
|
|
384
|
+
G.hidden = !0;
|
|
385
|
+
}, kn = () => {
|
|
386
|
+
G.hidden = !1;
|
|
387
|
+
}, Ln = (r = "jump") => {
|
|
388
|
+
q(!0, r), j(), Se(f, () => de.enabled), ce = f.scrollTop;
|
|
389
|
+
}, ue = () => {
|
|
390
|
+
if (le.hidden = t.loginRequired, xe.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), R.classList.toggle(
|
|
391
|
+
"pluno-pa-widget__history-list--center",
|
|
392
|
+
ee && ie.length === 0
|
|
393
|
+
), R.replaceChildren(), ee && ie.length === 0) {
|
|
394
|
+
const r = document.createElement("p");
|
|
395
|
+
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", R.appendChild(r);
|
|
396
|
+
}
|
|
397
|
+
for (const r of ie) {
|
|
398
|
+
const d = document.createElement("button");
|
|
399
|
+
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
|
|
400
|
+
const S = document.createElement("span");
|
|
401
|
+
S.className = "pluno-pa-widget__history-item-title", S.textContent = Yo(r);
|
|
402
|
+
const B = document.createElement("time");
|
|
403
|
+
B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = Xo(r.lastActiveAt, Date.now());
|
|
404
|
+
const N = document.createElement("small");
|
|
405
|
+
N.className = "pluno-pa-widget__history-path", N.textContent = Ko(r), d.append(S, B, N), d.addEventListener("click", () => {
|
|
406
|
+
ae = !1, ye = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), U(w.getState());
|
|
407
|
+
}), R.appendChild(d);
|
|
408
|
+
}
|
|
409
|
+
if (ee && ie.length > 0) {
|
|
410
|
+
const r = document.createElement("p");
|
|
411
|
+
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", R.appendChild(r);
|
|
412
|
+
}
|
|
413
|
+
L.textContent = ye ?? (!ee && ie.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
|
|
414
|
+
}, ut = async (r) => {
|
|
415
|
+
if (!ee) {
|
|
416
|
+
ee = !0, ye = null, ue();
|
|
417
|
+
try {
|
|
418
|
+
const d = await w.listSessions({ cursor: r, limit: 20 });
|
|
419
|
+
ie = r ? [...ie, ...d.sessions] : d.sessions, We = d.nextCursor;
|
|
420
|
+
} catch (d) {
|
|
421
|
+
Y("web-sdk.widget", "Failed to load session history", {
|
|
422
|
+
message: d instanceof Error ? d.message : String(d)
|
|
423
|
+
}), ye = bo;
|
|
424
|
+
} finally {
|
|
425
|
+
ee = !1, ue();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}, Pn = () => {
|
|
429
|
+
!We || ee || R.scrollHeight - R.scrollTop - R.clientHeight <= 24 && ut(We);
|
|
430
|
+
}, An = () => {
|
|
431
|
+
Pe || typeof document > "u" || (Kt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
432
|
+
}, gt = new MutationObserver(An);
|
|
433
|
+
gt.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
434
|
+
const $e = (r = !0) => {
|
|
435
|
+
const d = it(a, r);
|
|
436
|
+
return Bt(
|
|
395
437
|
a,
|
|
396
|
-
|
|
397
|
-
|
|
438
|
+
Q ? Uo(Q, d) : Oo(a, t.position, d),
|
|
439
|
+
d
|
|
398
440
|
);
|
|
399
|
-
},
|
|
400
|
-
|
|
441
|
+
}, H = () => {
|
|
442
|
+
Xa(t, {
|
|
401
443
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
402
444
|
composerValue: g.value,
|
|
403
|
-
openToolGroupKeys: [...
|
|
404
|
-
launcherPosition:
|
|
405
|
-
seenShareCandidateIds: [...
|
|
406
|
-
sharePromptsDisabled:
|
|
445
|
+
openToolGroupKeys: [...Ge],
|
|
446
|
+
launcherPosition: dt ? Q : null,
|
|
447
|
+
seenShareCandidateIds: [...be].slice(-nn),
|
|
448
|
+
sharePromptsDisabled: He
|
|
407
449
|
});
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
debugVersion:
|
|
411
|
-
launcherPosition:
|
|
450
|
+
}, ge = (r, d = {}) => {
|
|
451
|
+
qo(r, {
|
|
452
|
+
debugVersion: Ao,
|
|
453
|
+
launcherPosition: Q,
|
|
412
454
|
rootClasses: a.className,
|
|
413
455
|
rootStyle: {
|
|
414
456
|
left: a.style.left,
|
|
@@ -416,110 +458,110 @@ async function bo(e = {}) {
|
|
|
416
458
|
right: a.style.right,
|
|
417
459
|
bottom: a.style.bottom
|
|
418
460
|
},
|
|
419
|
-
rootRect:
|
|
420
|
-
launcherRect:
|
|
421
|
-
panelRect:
|
|
422
|
-
viewport:
|
|
461
|
+
rootRect: Ze(a),
|
|
462
|
+
launcherRect: Ze(c),
|
|
463
|
+
panelRect: Ze(b),
|
|
464
|
+
viewport: ne(),
|
|
423
465
|
panelHidden: b.hidden,
|
|
424
466
|
closeHidden: x.hidden,
|
|
425
|
-
...
|
|
467
|
+
...d
|
|
426
468
|
});
|
|
427
|
-
},
|
|
428
|
-
if (!
|
|
429
|
-
return
|
|
430
|
-
const
|
|
431
|
-
return
|
|
432
|
-
},
|
|
433
|
-
if (!r || !
|
|
434
|
-
|
|
469
|
+
}, Ae = (r = !0) => {
|
|
470
|
+
if (!Q)
|
|
471
|
+
return De(a, null), $e(r);
|
|
472
|
+
const d = $e(r);
|
|
473
|
+
return De(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
|
|
474
|
+
}, ht = (r, d) => {
|
|
475
|
+
if (!r || !d) {
|
|
476
|
+
$o(a);
|
|
435
477
|
return;
|
|
436
478
|
}
|
|
437
|
-
|
|
438
|
-
x: r.x -
|
|
439
|
-
y: r.y -
|
|
479
|
+
Wo(a, {
|
|
480
|
+
x: r.x - d.x,
|
|
481
|
+
y: r.y - d.y
|
|
440
482
|
});
|
|
441
|
-
},
|
|
442
|
-
const r =
|
|
483
|
+
}, mt = () => {
|
|
484
|
+
const r = Ae();
|
|
443
485
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
} else
|
|
486
|
+
const d = Ot(a, r, t.position);
|
|
487
|
+
ht(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
|
|
488
|
+
} else Q && ge("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
447
489
|
};
|
|
448
|
-
let
|
|
490
|
+
let bt = () => {
|
|
449
491
|
};
|
|
450
|
-
window.addEventListener("resize",
|
|
492
|
+
window.addEventListener("resize", mt), t.movableLauncher && u ? (Ae(), bt = Bo({
|
|
451
493
|
root: a,
|
|
452
|
-
launcher:
|
|
453
|
-
launcherDragHandle:
|
|
454
|
-
getPosition: () =>
|
|
494
|
+
launcher: c,
|
|
495
|
+
launcherDragHandle: u,
|
|
496
|
+
getPosition: () => $e(),
|
|
455
497
|
setPosition: (r) => {
|
|
456
|
-
const
|
|
457
|
-
|
|
498
|
+
const d = r, S = it(a), B = Bt(a, r, S);
|
|
499
|
+
Q = Fo(B, S), De(a, B), ge("Dragging closed launcher", { requestedPosition: d });
|
|
458
500
|
},
|
|
459
501
|
persist: () => {
|
|
460
|
-
|
|
502
|
+
dt = !0, H(), ge("Persisted closed launcher drag position");
|
|
461
503
|
}
|
|
462
|
-
})) :
|
|
463
|
-
let
|
|
464
|
-
const
|
|
465
|
-
if (!(!t.billingStatusLoader ||
|
|
466
|
-
|
|
504
|
+
})) : De(a, null);
|
|
505
|
+
let qe = !1;
|
|
506
|
+
const ft = async () => {
|
|
507
|
+
if (!(!t.billingStatusLoader || qe)) {
|
|
508
|
+
qe = !0;
|
|
467
509
|
try {
|
|
468
510
|
const r = await t.billingStatusLoader();
|
|
469
|
-
|
|
511
|
+
Ht(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, et(O, t.billingStatus, w.getState().lastErrorCode), W());
|
|
470
512
|
} finally {
|
|
471
|
-
|
|
513
|
+
qe = !1;
|
|
472
514
|
}
|
|
473
515
|
}
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
if (
|
|
478
|
-
a.classList.add("pluno-pa-widget--open"),
|
|
516
|
+
}, he = (r = "", d = !0) => {
|
|
517
|
+
ft(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
518
|
+
const S = Ae(), B = Ot(a, S, t.position);
|
|
519
|
+
if (ht(B, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: B, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
|
|
520
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
|
|
479
521
|
return;
|
|
480
522
|
}
|
|
481
523
|
window.requestAnimationFrame(() => {
|
|
482
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r,
|
|
483
|
-
|
|
524
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
|
|
525
|
+
c.hidden = !0, Se(f, () => de.enabled), ce = f.scrollTop;
|
|
484
526
|
}, 220);
|
|
485
527
|
});
|
|
486
|
-
},
|
|
487
|
-
|
|
528
|
+
}, Tn = () => {
|
|
529
|
+
oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Ae(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
|
|
488
530
|
b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
489
531
|
}, 220);
|
|
490
532
|
};
|
|
491
|
-
|
|
492
|
-
r.preventDefault(),
|
|
493
|
-
}),
|
|
533
|
+
c.addEventListener("submit", (r) => {
|
|
534
|
+
r.preventDefault(), he(s.value), s.value = "";
|
|
535
|
+
}), u?.addEventListener("click", (r) => {
|
|
494
536
|
r.preventDefault(), r.stopPropagation();
|
|
495
|
-
}),
|
|
496
|
-
r.target ===
|
|
497
|
-
}),
|
|
498
|
-
|
|
499
|
-
}),
|
|
500
|
-
if (!
|
|
537
|
+
}), c.addEventListener("click", (r) => {
|
|
538
|
+
r.target === s && !u || (he(s.value), s.value = "");
|
|
539
|
+
}), s.addEventListener("focus", () => {
|
|
540
|
+
he(s.value), s.value = "";
|
|
541
|
+
}), s.addEventListener("input", () => {
|
|
542
|
+
if (!s.value)
|
|
501
543
|
return;
|
|
502
|
-
const r =
|
|
503
|
-
|
|
504
|
-
}), x.addEventListener("click",
|
|
505
|
-
|
|
506
|
-
}),
|
|
507
|
-
|
|
544
|
+
const r = s.value;
|
|
545
|
+
he(r), s.value = "";
|
|
546
|
+
}), x.addEventListener("click", Tn), f.addEventListener("scroll", () => {
|
|
547
|
+
f.scrollTop < ce - 1 && q(!1, "userScroll"), ce = f.scrollTop;
|
|
548
|
+
}), G.addEventListener("click", () => {
|
|
549
|
+
Ln();
|
|
508
550
|
});
|
|
509
|
-
const
|
|
551
|
+
const wt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
510
552
|
([r]) => {
|
|
511
|
-
r?.isIntersecting && (
|
|
553
|
+
r?.isIntersecting && (q(!0, "bottom"), j());
|
|
512
554
|
},
|
|
513
|
-
{ root:
|
|
555
|
+
{ root: f, threshold: 0 }
|
|
514
556
|
);
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
const r =
|
|
518
|
-
|
|
519
|
-
},
|
|
520
|
-
|
|
557
|
+
wt?.observe(A);
|
|
558
|
+
const Te = () => t.loginRequired || t.signupRequired, _t = () => {
|
|
559
|
+
const r = Te();
|
|
560
|
+
s.readOnly = r, s.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : K.launcherLabel, P.hidden = r;
|
|
561
|
+
}, W = () => {
|
|
562
|
+
E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Te() || X(t.billingStatus);
|
|
521
563
|
};
|
|
522
|
-
|
|
564
|
+
_t(), P.addEventListener("submit", (r) => {
|
|
523
565
|
if (r.preventDefault(), t.loginRequired) {
|
|
524
566
|
t.onLoginClick?.();
|
|
525
567
|
return;
|
|
@@ -528,83 +570,87 @@ async function bo(e = {}) {
|
|
|
528
570
|
t.onSignupClick?.();
|
|
529
571
|
return;
|
|
530
572
|
}
|
|
531
|
-
|
|
573
|
+
X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W());
|
|
532
574
|
});
|
|
533
|
-
let
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
},
|
|
537
|
-
|
|
538
|
-
|
|
575
|
+
let ve = 0;
|
|
576
|
+
const Nn = () => {
|
|
577
|
+
ve = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
578
|
+
}, xt = (r) => {
|
|
579
|
+
J !== null && window.clearTimeout(J), k.textContent = r, k.hidden = !1, J = window.setTimeout(() => {
|
|
580
|
+
k.textContent = "", k.hidden = !0, J = null;
|
|
539
581
|
}, 3e3);
|
|
540
|
-
},
|
|
541
|
-
|
|
542
|
-
},
|
|
582
|
+
}, In = () => {
|
|
583
|
+
J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
|
|
584
|
+
}, yt = async (r) => {
|
|
543
585
|
if (r.length === 0)
|
|
544
586
|
return;
|
|
545
|
-
const
|
|
546
|
-
if (
|
|
547
|
-
throw new Error(`Attach up to ${
|
|
548
|
-
|
|
587
|
+
const d = await xa(r);
|
|
588
|
+
if (T.length + d.length > Fe)
|
|
589
|
+
throw new Error(`Attach up to ${Fe} files per message.`);
|
|
590
|
+
T = [...T, ...d], me(), In(), W(), U(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
|
|
549
591
|
};
|
|
550
592
|
h.addEventListener("click", () => {
|
|
551
|
-
t.loginRequired ||
|
|
552
|
-
}),
|
|
553
|
-
const r = Array.from(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
message:
|
|
593
|
+
t.loginRequired || X(t.billingStatus) || C.click();
|
|
594
|
+
}), C.addEventListener("change", () => {
|
|
595
|
+
const r = Array.from(C.files ?? []);
|
|
596
|
+
C.value = "", yt(r).catch((d) => {
|
|
597
|
+
xt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
598
|
+
message: d instanceof Error ? d.message : String(d)
|
|
557
599
|
});
|
|
558
600
|
});
|
|
559
601
|
}), a.addEventListener("dragenter", (r) => {
|
|
560
|
-
!
|
|
602
|
+
!Re(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ve += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
561
603
|
}), a.addEventListener("dragover", (r) => {
|
|
562
|
-
const
|
|
563
|
-
!
|
|
604
|
+
const d = r.dataTransfer;
|
|
605
|
+
!Re(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
|
|
564
606
|
}), a.addEventListener("dragleave", (r) => {
|
|
565
|
-
|
|
607
|
+
Re(r.dataTransfer) && (r.stopPropagation(), ve = Math.max(0, ve - 1), ve === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
566
608
|
}), a.addEventListener("drop", (r) => {
|
|
567
|
-
const
|
|
568
|
-
!
|
|
569
|
-
|
|
570
|
-
message:
|
|
609
|
+
const d = r.dataTransfer;
|
|
610
|
+
!Re(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Nn(), yt(d.files).catch((S) => {
|
|
611
|
+
xt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
612
|
+
message: S instanceof Error ? S.message : String(S)
|
|
571
613
|
});
|
|
572
614
|
}));
|
|
573
|
-
}),
|
|
615
|
+
}), E.addEventListener("click", () => {
|
|
574
616
|
if (t.loginRequired) {
|
|
575
617
|
t.onLoginClick?.();
|
|
576
618
|
return;
|
|
577
619
|
}
|
|
578
|
-
if (
|
|
579
|
-
|
|
620
|
+
if (w.getState().isThinking) {
|
|
621
|
+
w.stop();
|
|
580
622
|
return;
|
|
581
623
|
}
|
|
582
|
-
|
|
583
|
-
}),
|
|
584
|
-
|
|
585
|
-
}),
|
|
586
|
-
|
|
624
|
+
se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
|
|
625
|
+
}), I.addEventListener("click", () => {
|
|
626
|
+
se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), Ge.clear(), g.value = "", T = [], me(), Ee(g), H(), W(), g.focus(), U(w.getState());
|
|
627
|
+
}), le.addEventListener("click", () => {
|
|
628
|
+
ae = !ae, ye = null, ue(), ae && ie.length === 0 && ut(null);
|
|
629
|
+
}), _.addEventListener("click", () => {
|
|
630
|
+
ae = !1, ue();
|
|
631
|
+
}), R.addEventListener("scroll", Pn), g.addEventListener("input", () => {
|
|
632
|
+
Ee(g), H(), W(), U(w.getState());
|
|
587
633
|
}), g.addEventListener("keydown", (r) => {
|
|
588
634
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
589
635
|
if (r.preventDefault(), t.loginRequired) {
|
|
590
636
|
t.onLoginClick?.();
|
|
591
637
|
return;
|
|
592
638
|
}
|
|
593
|
-
|
|
639
|
+
se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
|
|
594
640
|
}
|
|
595
641
|
}), a.addEventListener("click", (r) => {
|
|
596
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
597
|
-
}),
|
|
598
|
-
const
|
|
599
|
-
let
|
|
642
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
|
|
643
|
+
}), pe.composerValue && (g.value = pe.composerValue, Ee(g)), pe.isOpen && he(g.value, !1);
|
|
644
|
+
const Ne = () => i;
|
|
645
|
+
let je = w.getState().appearance !== null, Ie = null, Ce = null, fe = null, vt = w.getState().isThinking, we = null, Ve = null, Ct = () => {
|
|
600
646
|
};
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
647
|
+
const Dn = !!t.socialPostDraftHandler, U = (r) => {
|
|
648
|
+
if (ue(), st(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(O, t.billingStatus, we), t.loginRequired) {
|
|
649
|
+
qt(
|
|
650
|
+
f,
|
|
651
|
+
E,
|
|
652
|
+
I,
|
|
653
|
+
Ne,
|
|
608
654
|
"Log in to use Pluno on this page.",
|
|
609
655
|
t.loginButtonLabel,
|
|
610
656
|
t.loginUrl,
|
|
@@ -613,11 +659,11 @@ async function bo(e = {}) {
|
|
|
613
659
|
return;
|
|
614
660
|
}
|
|
615
661
|
if (t.signupRequired) {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
662
|
+
qt(
|
|
663
|
+
f,
|
|
664
|
+
E,
|
|
665
|
+
I,
|
|
666
|
+
Ne,
|
|
621
667
|
"Complete signup to unlock your free trial credits.",
|
|
622
668
|
t.signupButtonLabel,
|
|
623
669
|
t.signupUrl,
|
|
@@ -625,133 +671,133 @@ async function bo(e = {}) {
|
|
|
625
671
|
);
|
|
626
672
|
return;
|
|
627
673
|
}
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
674
|
+
const d = jo(r), S = d !== ct;
|
|
675
|
+
ct = d;
|
|
676
|
+
const B = se || de.enabled;
|
|
677
|
+
se = !1, Ia(
|
|
678
|
+
f,
|
|
679
|
+
A,
|
|
680
|
+
E,
|
|
681
|
+
I,
|
|
682
|
+
M,
|
|
637
683
|
r,
|
|
638
|
-
|
|
639
|
-
|
|
684
|
+
Ve,
|
|
685
|
+
Ve !== null && $t(r, g.value.trim().length > 0 || T.length > 0),
|
|
686
|
+
B,
|
|
687
|
+
() => de.enabled,
|
|
688
|
+
Ge,
|
|
640
689
|
H,
|
|
641
|
-
() => ie.enabled,
|
|
642
690
|
Ne,
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
(U) => {
|
|
646
|
-
ae = !0, Y(!0, "send"), K(), _.sendMessage(U);
|
|
691
|
+
(N) => {
|
|
692
|
+
se = !0, q(!0, "send"), j(), w.sendMessage(N);
|
|
647
693
|
},
|
|
648
|
-
|
|
649
|
-
dismissedCandidateIds:
|
|
650
|
-
draftingCandidateId:
|
|
651
|
-
error:
|
|
652
|
-
characterIconOptions:
|
|
653
|
-
onSeen: (
|
|
654
|
-
|
|
694
|
+
Dn && !He ? {
|
|
695
|
+
dismissedCandidateIds: Le,
|
|
696
|
+
draftingCandidateId: Ie,
|
|
697
|
+
error: Ce,
|
|
698
|
+
characterIconOptions: Ne(),
|
|
699
|
+
onSeen: (N) => {
|
|
700
|
+
be.add(N.id), H();
|
|
655
701
|
},
|
|
656
|
-
onDraft: (
|
|
657
|
-
|
|
702
|
+
onDraft: (N) => {
|
|
703
|
+
Rn(N);
|
|
658
704
|
},
|
|
659
|
-
onDismiss: (
|
|
660
|
-
|
|
705
|
+
onDismiss: (N) => {
|
|
706
|
+
be.add(N.id), Le.add(N.id), H(), Ce = null, U(w.getState());
|
|
661
707
|
},
|
|
662
|
-
onDisable: (
|
|
663
|
-
|
|
708
|
+
onDisable: (N) => {
|
|
709
|
+
He = !0, be.add(N.id), Le.add(N.id), H(), Ka(t, !0), Ce = null, U(w.getState());
|
|
664
710
|
}
|
|
665
711
|
} : void 0
|
|
666
|
-
),
|
|
712
|
+
), B ? (ce = f.scrollTop, j()) : S && Vo(r) && kn();
|
|
667
713
|
};
|
|
668
|
-
return
|
|
669
|
-
|
|
670
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
671
|
-
const
|
|
672
|
-
|
|
714
|
+
return Ct = Jn((r) => {
|
|
715
|
+
Ve = r, !Pe && $t(w.getState(), g.value.trim().length > 0 || T.length > 0) && U(w.getState());
|
|
716
|
+
}, { backendUrl: t.backendUrl, fetcher: Sn, loader: t.activeUsersLoader }), w.on("state", (r) => {
|
|
717
|
+
const d = vt && !r.isThinking;
|
|
718
|
+
vt = r.isThinking, r.appearance ? (je = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
|
|
673
719
|
appearance: r.appearance
|
|
674
|
-
}),
|
|
720
|
+
}), Ye(r.appearance, "agent.state.appearance")) : je && (je = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
675
721
|
fallbackAccentColor: t.accentColor,
|
|
676
722
|
fallbackColorScheme: t.colorScheme,
|
|
677
723
|
fallbackFontFamily: t.fontFamily
|
|
678
|
-
}),
|
|
679
|
-
}),
|
|
680
|
-
agent:
|
|
724
|
+
}), Ye({}, "agent.state.appearance-cleared")), U(r), W(), d && ft();
|
|
725
|
+
}), U(w.getState()), W(), {
|
|
726
|
+
agent: w,
|
|
681
727
|
updateAppearance: (r) => {
|
|
682
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
728
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ye(r, "widgetHandle.updateAppearance");
|
|
683
729
|
},
|
|
684
730
|
updateBillingStatus: (r) => {
|
|
685
|
-
const
|
|
686
|
-
|
|
731
|
+
const d = r ?? null;
|
|
732
|
+
Ht(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(
|
|
687
733
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
688
734
|
t.billingStatus,
|
|
689
|
-
|
|
690
|
-
),
|
|
735
|
+
we
|
|
736
|
+
), W());
|
|
691
737
|
},
|
|
692
738
|
updateAuthGate: (r) => {
|
|
693
|
-
const
|
|
694
|
-
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),
|
|
695
|
-
|
|
696
|
-
message:
|
|
739
|
+
const d = Te();
|
|
740
|
+
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), _t(), U(w.getState()), W(), d && !Te() && w.connect().catch((S) => {
|
|
741
|
+
Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
|
|
742
|
+
message: S instanceof Error ? S.message : String(S)
|
|
697
743
|
});
|
|
698
744
|
});
|
|
699
745
|
},
|
|
700
746
|
openPanel: () => {
|
|
701
|
-
|
|
747
|
+
he(g.value, !1);
|
|
702
748
|
},
|
|
703
749
|
destroy: () => {
|
|
704
|
-
|
|
750
|
+
Pe || (Pe = !0, gt.disconnect(), wt?.disconnect(), window.removeEventListener("resize", mt), bt(), J !== null && window.clearTimeout(J), Ct(), fe?.remove(), w.destroy(), n.remove());
|
|
705
751
|
}
|
|
706
752
|
};
|
|
707
|
-
async function
|
|
708
|
-
if (!
|
|
709
|
-
|
|
753
|
+
async function Rn(r) {
|
|
754
|
+
if (!Ie) {
|
|
755
|
+
Ie = r.id, Ce = null, U(w.getState());
|
|
710
756
|
try {
|
|
711
757
|
if (!t.socialPostDraftHandler)
|
|
712
758
|
throw new Error("Social post drafting is not available here.");
|
|
713
|
-
const
|
|
714
|
-
if (!
|
|
759
|
+
const d = await t.socialPostDraftHandler(r);
|
|
760
|
+
if (!d.linkedinPost || !d.xPost)
|
|
715
761
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
716
|
-
|
|
762
|
+
be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ma(d, {
|
|
717
763
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
718
764
|
onClose: () => {
|
|
719
|
-
|
|
765
|
+
fe?.remove(), fe = null;
|
|
720
766
|
}
|
|
721
|
-
}), a.appendChild(
|
|
722
|
-
} catch (
|
|
723
|
-
|
|
767
|
+
}), a.appendChild(fe);
|
|
768
|
+
} catch (d) {
|
|
769
|
+
Ce = d instanceof Error ? d.message : "Could not draft social post.";
|
|
724
770
|
} finally {
|
|
725
|
-
|
|
771
|
+
Ie = null, U(w.getState());
|
|
726
772
|
}
|
|
727
773
|
}
|
|
728
774
|
}
|
|
729
|
-
function
|
|
730
|
-
const
|
|
731
|
-
i =
|
|
732
|
-
accentColor:
|
|
733
|
-
colorScheme:
|
|
734
|
-
fontFamily:
|
|
735
|
-
scribbleStyle:
|
|
736
|
-
}),
|
|
737
|
-
source:
|
|
775
|
+
function Ye(r, d) {
|
|
776
|
+
const S = r.accentColor ?? t.accentColor, B = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, Ke = r.scribbleStyle ?? t.scribbleStyle;
|
|
777
|
+
i = Rt(S, Ke), Mt(a, i, {
|
|
778
|
+
accentColor: S,
|
|
779
|
+
colorScheme: B,
|
|
780
|
+
fontFamily: N,
|
|
781
|
+
scribbleStyle: Ke
|
|
782
|
+
}), Y("web-sdk.widget", "Updated widget appearance", {
|
|
783
|
+
source: d,
|
|
738
784
|
inputAppearance: r,
|
|
739
|
-
appliedAccentColor:
|
|
740
|
-
appliedColorScheme:
|
|
741
|
-
appliedFontFamily:
|
|
742
|
-
appliedScribbleStyle:
|
|
785
|
+
appliedAccentColor: S,
|
|
786
|
+
appliedColorScheme: B,
|
|
787
|
+
appliedFontFamily: N,
|
|
788
|
+
appliedScribbleStyle: Ke,
|
|
743
789
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
744
790
|
});
|
|
745
791
|
}
|
|
746
792
|
}
|
|
747
|
-
function
|
|
793
|
+
function Rt(e, t) {
|
|
748
794
|
return { accentColor: e, scribbleStyle: t };
|
|
749
795
|
}
|
|
750
|
-
function
|
|
751
|
-
const t =
|
|
752
|
-
return t === null ? "#fafafa" :
|
|
796
|
+
function Io(e) {
|
|
797
|
+
const t = Do(e);
|
|
798
|
+
return t === null ? "#fafafa" : Ro(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
753
799
|
}
|
|
754
|
-
function
|
|
800
|
+
function Do(e) {
|
|
755
801
|
const t = e.trim();
|
|
756
802
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
757
803
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -763,26 +809,26 @@ function wo(e) {
|
|
|
763
809
|
Number.parseInt(t[3] + t[3], 16)
|
|
764
810
|
] : null;
|
|
765
811
|
}
|
|
766
|
-
function
|
|
812
|
+
function Ro([e, t, n]) {
|
|
767
813
|
const o = (a) => {
|
|
768
814
|
const i = a / 255;
|
|
769
815
|
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
770
816
|
};
|
|
771
817
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
772
818
|
}
|
|
773
|
-
function
|
|
819
|
+
function Mt(e, t, n) {
|
|
774
820
|
e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
775
|
-
const o = n.scribbleStyle ?
|
|
776
|
-
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast",
|
|
821
|
+
const o = n.scribbleStyle ? Qt(n.accentColor) : n.accentColor;
|
|
822
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", Io(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? fo : n.fontFamily, n.scribbleStyle && Mo(e.ownerDocument);
|
|
777
823
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
778
824
|
for (const i of a)
|
|
779
|
-
i.replaceWith(
|
|
825
|
+
i.replaceWith(re(Array.from(i.classList).join(" "), t));
|
|
780
826
|
}
|
|
781
|
-
function
|
|
782
|
-
if (e.getElementById(
|
|
827
|
+
function Mo(e) {
|
|
828
|
+
if (e.getElementById(Tt))
|
|
783
829
|
return;
|
|
784
830
|
const t = e.createElement("style");
|
|
785
|
-
t.id =
|
|
831
|
+
t.id = Tt, t.textContent = `@font-face {
|
|
786
832
|
font-family: "Architects Daughter";
|
|
787
833
|
font-style: normal;
|
|
788
834
|
font-weight: 400;
|
|
@@ -790,7 +836,7 @@ function xo(e) {
|
|
|
790
836
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
791
837
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
792
838
|
}
|
|
793
|
-
function
|
|
839
|
+
function Bo({
|
|
794
840
|
root: e,
|
|
795
841
|
launcher: t,
|
|
796
842
|
launcherDragHandle: n,
|
|
@@ -798,137 +844,137 @@ function vo({
|
|
|
798
844
|
setPosition: a,
|
|
799
845
|
persist: i
|
|
800
846
|
}) {
|
|
801
|
-
let l = null,
|
|
847
|
+
let l = null, p = null, c = null, u = !1, s = null;
|
|
802
848
|
const b = () => {
|
|
803
|
-
l = null,
|
|
849
|
+
l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
|
|
804
850
|
}, x = (h) => {
|
|
805
|
-
e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId,
|
|
806
|
-
},
|
|
807
|
-
if (l !== h.pointerId || !
|
|
851
|
+
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 = o(), u = !1, t.setPointerCapture?.(h.pointerId));
|
|
852
|
+
}, P = (h) => {
|
|
853
|
+
if (l !== h.pointerId || !p || !c)
|
|
808
854
|
return;
|
|
809
855
|
h.preventDefault();
|
|
810
|
-
const g = h.clientX -
|
|
811
|
-
!
|
|
812
|
-
},
|
|
813
|
-
l === h.pointerId && (h.preventDefault(), h.stopPropagation(),
|
|
814
|
-
},
|
|
856
|
+
const g = h.clientX - p.x, E = h.clientY - p.y;
|
|
857
|
+
!u && Math.hypot(g, E) < It || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
|
|
858
|
+
}, k = (h) => {
|
|
859
|
+
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
|
|
860
|
+
}, O = (h) => {
|
|
815
861
|
l === h.pointerId && (h.preventDefault(), b());
|
|
816
|
-
}, v = (h) => {
|
|
817
|
-
if (!p)
|
|
818
|
-
return;
|
|
819
|
-
const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= vt;
|
|
820
|
-
p = null, g && (h.preventDefault(), h.stopPropagation());
|
|
821
862
|
}, y = (h) => {
|
|
863
|
+
if (!s)
|
|
864
|
+
return;
|
|
865
|
+
const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= It;
|
|
866
|
+
s = null, g && (h.preventDefault(), h.stopPropagation());
|
|
867
|
+
}, C = (h) => {
|
|
822
868
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
823
869
|
return;
|
|
824
|
-
const g = h.shiftKey ?
|
|
825
|
-
let
|
|
826
|
-
h.key === "ArrowUp" ?
|
|
870
|
+
const g = h.shiftKey ? Po : Lo, E = o();
|
|
871
|
+
let I = null;
|
|
872
|
+
h.key === "ArrowUp" ? I = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? I = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? I = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (I = { x: E.x + g, y: E.y }), I && (h.preventDefault(), h.stopPropagation(), a(I), i());
|
|
827
873
|
};
|
|
828
|
-
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove",
|
|
829
|
-
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove",
|
|
874
|
+
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", k), t.addEventListener("pointercancel", O), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
|
|
875
|
+
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", k), t.removeEventListener("pointercancel", O), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
|
|
830
876
|
};
|
|
831
877
|
}
|
|
832
|
-
function
|
|
833
|
-
const n =
|
|
878
|
+
function it(e, t = !0) {
|
|
879
|
+
const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
834
880
|
return {
|
|
835
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
836
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
881
|
+
width: t && a && o.width > 0 ? o.width : Math.min(rn, n.width - 36),
|
|
882
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? wo : ln
|
|
837
883
|
};
|
|
838
884
|
}
|
|
839
|
-
function
|
|
840
|
-
const e =
|
|
885
|
+
function cn() {
|
|
886
|
+
const e = ne();
|
|
841
887
|
return {
|
|
842
888
|
width: Math.min(
|
|
843
|
-
|
|
844
|
-
e.width -
|
|
889
|
+
_e(e.width * yo, _o, xo),
|
|
890
|
+
e.width - z * 2
|
|
845
891
|
),
|
|
846
892
|
height: Math.min(
|
|
847
|
-
|
|
848
|
-
e.height -
|
|
893
|
+
_e(e.height * Eo, vo, Co),
|
|
894
|
+
e.height - at - z
|
|
849
895
|
)
|
|
850
896
|
};
|
|
851
897
|
}
|
|
852
|
-
function
|
|
898
|
+
function Oo(e, t, n) {
|
|
853
899
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
854
900
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
855
901
|
return { x: o, y: a };
|
|
856
902
|
const i = e.getBoundingClientRect();
|
|
857
903
|
if (i.width > 0 || i.height > 0)
|
|
858
904
|
return { x: i.left, y: i.top };
|
|
859
|
-
const l =
|
|
905
|
+
const l = ne();
|
|
860
906
|
return {
|
|
861
907
|
x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
|
|
862
908
|
y: l.height - 24 - n.height
|
|
863
909
|
};
|
|
864
910
|
}
|
|
865
|
-
function
|
|
866
|
-
const o =
|
|
911
|
+
function Bt(e, t, n) {
|
|
912
|
+
const o = ne(), a = z + Go(e);
|
|
867
913
|
return {
|
|
868
|
-
x:
|
|
869
|
-
y:
|
|
914
|
+
x: _e(t.x, z, Math.max(z, o.width - n.width - z)),
|
|
915
|
+
y: _e(t.y, a, Math.max(a, o.height - n.height - z))
|
|
870
916
|
};
|
|
871
917
|
}
|
|
872
|
-
function
|
|
873
|
-
const n =
|
|
918
|
+
function Uo(e, t) {
|
|
919
|
+
const n = ne();
|
|
874
920
|
return {
|
|
875
921
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
876
922
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
877
923
|
};
|
|
878
924
|
}
|
|
879
|
-
function
|
|
880
|
-
const n =
|
|
925
|
+
function Fo(e, t) {
|
|
926
|
+
const n = zo(e, t), o = ne();
|
|
881
927
|
return {
|
|
882
928
|
anchor: n,
|
|
883
929
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
884
930
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
885
931
|
};
|
|
886
932
|
}
|
|
887
|
-
function
|
|
888
|
-
const n =
|
|
933
|
+
function zo(e, t) {
|
|
934
|
+
const n = ne(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
|
|
889
935
|
return `${i}-${l}`;
|
|
890
936
|
}
|
|
891
|
-
function
|
|
892
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
937
|
+
function Go(e) {
|
|
938
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? ko : So;
|
|
893
939
|
}
|
|
894
|
-
function
|
|
895
|
-
const o =
|
|
940
|
+
function Ot(e, t, n) {
|
|
941
|
+
const o = it(e), a = cn(), i = {
|
|
896
942
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
897
943
|
y: t.y + o.height - a.height
|
|
898
944
|
};
|
|
899
|
-
return
|
|
945
|
+
return Ho(i);
|
|
900
946
|
}
|
|
901
|
-
function
|
|
902
|
-
const t =
|
|
947
|
+
function Ho(e) {
|
|
948
|
+
const t = ne(), n = cn();
|
|
903
949
|
return {
|
|
904
|
-
x:
|
|
905
|
-
y:
|
|
950
|
+
x: _e(e.x, z, Math.max(z, t.width - n.width - z)),
|
|
951
|
+
y: _e(
|
|
906
952
|
e.y,
|
|
907
|
-
|
|
908
|
-
Math.max(
|
|
953
|
+
at,
|
|
954
|
+
Math.max(at, t.height - n.height - z)
|
|
909
955
|
)
|
|
910
956
|
};
|
|
911
957
|
}
|
|
912
|
-
function
|
|
958
|
+
function De(e, t) {
|
|
913
959
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
914
960
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
915
961
|
return;
|
|
916
962
|
}
|
|
917
963
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
918
964
|
}
|
|
919
|
-
function
|
|
965
|
+
function Wo(e, t) {
|
|
920
966
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
921
967
|
}
|
|
922
|
-
function
|
|
968
|
+
function $o(e) {
|
|
923
969
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
924
970
|
}
|
|
925
|
-
function
|
|
971
|
+
function ne() {
|
|
926
972
|
return {
|
|
927
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
928
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
973
|
+
width: window.innerWidth || document.documentElement.clientWidth || rn + z * 2,
|
|
974
|
+
height: window.innerHeight || document.documentElement.clientHeight || ln + z * 2
|
|
929
975
|
};
|
|
930
976
|
}
|
|
931
|
-
function
|
|
977
|
+
function Ze(e) {
|
|
932
978
|
const t = e.getBoundingClientRect();
|
|
933
979
|
return {
|
|
934
980
|
x: Math.round(t.x),
|
|
@@ -937,10 +983,10 @@ function Ge(e) {
|
|
|
937
983
|
height: Math.round(t.height)
|
|
938
984
|
};
|
|
939
985
|
}
|
|
940
|
-
function
|
|
986
|
+
function _e(e, t, n) {
|
|
941
987
|
return Math.min(Math.max(e, t), n);
|
|
942
988
|
}
|
|
943
|
-
function
|
|
989
|
+
function Y(e, t, n) {
|
|
944
990
|
if (typeof window > "u")
|
|
945
991
|
return;
|
|
946
992
|
const o = window, a = {
|
|
@@ -949,26 +995,26 @@ function X(e, t, n) {
|
|
|
949
995
|
message: t,
|
|
950
996
|
details: n
|
|
951
997
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
952
|
-
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(
|
|
998
|
+
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(uo, { detail: a }));
|
|
953
999
|
}
|
|
954
|
-
function
|
|
955
|
-
|
|
1000
|
+
function qo(e, t) {
|
|
1001
|
+
Y("web-sdk.widget.position", e, t);
|
|
956
1002
|
}
|
|
957
|
-
function
|
|
1003
|
+
function Je(e, t, n) {
|
|
958
1004
|
const o = t.value.trim();
|
|
959
1005
|
return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
|
|
960
1006
|
}
|
|
961
|
-
function
|
|
1007
|
+
function Ee(e) {
|
|
962
1008
|
e.style.height = "0px";
|
|
963
1009
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
964
1010
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
965
1011
|
}
|
|
966
|
-
function
|
|
1012
|
+
function Se(e, t = () => !0) {
|
|
967
1013
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
968
1014
|
t() && (e.scrollTop = e.scrollHeight);
|
|
969
1015
|
});
|
|
970
1016
|
}
|
|
971
|
-
function
|
|
1017
|
+
function jo(e) {
|
|
972
1018
|
const t = e.messages[e.messages.length - 1];
|
|
973
1019
|
return [
|
|
974
1020
|
e.messages.length,
|
|
@@ -979,37 +1025,67 @@ function No(e) {
|
|
|
979
1025
|
e.lastError ?? ""
|
|
980
1026
|
].join(":");
|
|
981
1027
|
}
|
|
982
|
-
function
|
|
1028
|
+
function Vo(e) {
|
|
983
1029
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
984
1030
|
}
|
|
985
|
-
function
|
|
986
|
-
e.
|
|
1031
|
+
function Yo(e) {
|
|
1032
|
+
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1033
|
+
}
|
|
1034
|
+
function Ko(e) {
|
|
1035
|
+
const t = e.currentPage;
|
|
1036
|
+
if (typeof t?.url == "string" && t.url.trim())
|
|
1037
|
+
try {
|
|
1038
|
+
const n = new URL(t.url);
|
|
1039
|
+
return `${n.pathname || "/"}${n.search}`;
|
|
1040
|
+
} catch {
|
|
1041
|
+
return t.url;
|
|
1042
|
+
}
|
|
1043
|
+
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1044
|
+
}
|
|
1045
|
+
function Xo(e, t) {
|
|
1046
|
+
const n = new Date(e).getTime();
|
|
1047
|
+
if (!Number.isFinite(n))
|
|
1048
|
+
return "now";
|
|
1049
|
+
const o = Math.max(0, t - n), a = [
|
|
1050
|
+
["day", 864e5],
|
|
1051
|
+
["hour", 36e5],
|
|
1052
|
+
["min", 6e4]
|
|
1053
|
+
];
|
|
1054
|
+
for (const [i, l] of a)
|
|
1055
|
+
if (o >= l) {
|
|
1056
|
+
const p = Math.max(1, Math.floor(o / l));
|
|
1057
|
+
return i === "min" ? `${p} min` : `${p} ${i}${p === 1 ? "" : "s"}`;
|
|
1058
|
+
}
|
|
1059
|
+
return "now";
|
|
987
1060
|
}
|
|
988
|
-
function
|
|
1061
|
+
function Zo(e, t, n, o) {
|
|
1062
|
+
e.appendChild(ra()), e.appendChild(Jo(t, n, o)), e.appendChild(ze("pluno-pa-widget__close", "Close", la(16), !0)), e.appendChild(Qo(n));
|
|
1063
|
+
}
|
|
1064
|
+
function Jo(e, t, n) {
|
|
989
1065
|
const o = document.createElement("form");
|
|
990
1066
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
991
1067
|
const i = document.createElement("button");
|
|
992
1068
|
i.type = "button", i.className = "pluno-pa-widget__launcher-drag-handle", i.setAttribute("aria-label", "Move Pluno launcher"), i.title = "Move Pluno launcher", o.appendChild(i);
|
|
993
1069
|
}
|
|
994
|
-
o.appendChild(
|
|
1070
|
+
o.appendChild(hn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
|
|
995
1071
|
const a = document.createElement("input");
|
|
996
1072
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
997
1073
|
}
|
|
998
|
-
function
|
|
1074
|
+
function Qo(e) {
|
|
999
1075
|
const t = document.createElement("section");
|
|
1000
|
-
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1076
|
+
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(hn("pluno-pa-widget__scribble-spirals--panel", 16));
|
|
1001
1077
|
const n = document.createElement("div");
|
|
1002
1078
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1003
1079
|
const o = document.createElement("main");
|
|
1004
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1080
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(na(e));
|
|
1005
1081
|
const a = document.createElement("div");
|
|
1006
1082
|
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
1007
1083
|
const i = document.createElement("div");
|
|
1008
1084
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
1009
1085
|
const l = document.createElement("button");
|
|
1010
|
-
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(
|
|
1086
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(ze("pluno-pa-widget__history", "Recent chats", sa(), !0)), n.appendChild(ze("pluno-pa-widget__new-chat", "New chat", pa(), !0)), n.appendChild(ta()), t.appendChild(n), t.appendChild(ea()), t;
|
|
1011
1087
|
}
|
|
1012
|
-
function
|
|
1088
|
+
function ea() {
|
|
1013
1089
|
const e = document.createElement("form");
|
|
1014
1090
|
e.className = "pluno-pa-widget__composer";
|
|
1015
1091
|
const t = document.createElement("div");
|
|
@@ -1021,44 +1097,58 @@ function Bo() {
|
|
|
1021
1097
|
const a = document.createElement("div");
|
|
1022
1098
|
a.className = "pluno-pa-widget__composer-inner";
|
|
1023
1099
|
const i = document.createElement("input");
|
|
1024
|
-
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept =
|
|
1100
|
+
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = ho, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1025
1101
|
const l = document.createElement("button");
|
|
1026
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1102
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ca()), l.appendChild(ua()), a.appendChild(l);
|
|
1103
|
+
const p = document.createElement("textarea");
|
|
1104
|
+
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
|
|
1105
|
+
const c = document.createElement("button");
|
|
1106
|
+
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(mn()), a.appendChild(c), e.appendChild(a);
|
|
1107
|
+
const u = document.createElement("div");
|
|
1108
|
+
u.className = "pluno-pa-widget__composer-meta";
|
|
1109
|
+
const s = document.createElement("a");
|
|
1110
|
+
s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai.", u.appendChild(s);
|
|
1035
1111
|
const b = document.createElement("span");
|
|
1036
|
-
return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.",
|
|
1112
|
+
return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
|
|
1113
|
+
}
|
|
1114
|
+
function ta() {
|
|
1115
|
+
const e = document.createElement("section");
|
|
1116
|
+
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
|
|
1117
|
+
const t = document.createElement("div");
|
|
1118
|
+
t.className = "pluno-pa-widget__history-header";
|
|
1119
|
+
const n = document.createElement("strong");
|
|
1120
|
+
n.textContent = "Recent chats";
|
|
1121
|
+
const o = ze("pluno-pa-widget__history-close", "Close recent chats", da(), !1);
|
|
1122
|
+
t.append(n, o);
|
|
1123
|
+
const a = document.createElement("div");
|
|
1124
|
+
a.className = "pluno-pa-widget__history-list";
|
|
1125
|
+
const i = document.createElement("p");
|
|
1126
|
+
return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
|
|
1037
1127
|
}
|
|
1038
|
-
function
|
|
1128
|
+
function na(e) {
|
|
1039
1129
|
const t = document.createElement("div");
|
|
1040
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(
|
|
1130
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(un()), t;
|
|
1041
1131
|
}
|
|
1042
|
-
function
|
|
1132
|
+
function un() {
|
|
1043
1133
|
const e = document.createElement("div");
|
|
1044
1134
|
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;
|
|
1045
1135
|
}
|
|
1046
|
-
function
|
|
1136
|
+
function oa(e, t) {
|
|
1047
1137
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1048
1138
|
const n = document.createElement("span");
|
|
1049
1139
|
n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
|
|
1050
1140
|
}
|
|
1051
|
-
function
|
|
1052
|
-
const n = `pluno-pa-character-${
|
|
1053
|
-
|
|
1054
|
-
const o = t.scribbleStyle ?
|
|
1141
|
+
function re(e, t) {
|
|
1142
|
+
const n = `pluno-pa-character-${Dt}`;
|
|
1143
|
+
Dt += 1;
|
|
1144
|
+
const o = t.scribbleStyle ? ia(t.accentColor, n) : aa(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
|
|
1055
1145
|
return o.setAttribute(
|
|
1056
1146
|
"class",
|
|
1057
1147
|
a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1058
1148
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1059
1149
|
}
|
|
1060
|
-
function
|
|
1061
|
-
const n =
|
|
1150
|
+
function aa(e, t) {
|
|
1151
|
+
const n = Un(e), o = {
|
|
1062
1152
|
boltFill: `${t}-boltFill`,
|
|
1063
1153
|
boltEdge: `${t}-boltEdge`,
|
|
1064
1154
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1069,7 +1159,7 @@ function Fo(e, t) {
|
|
|
1069
1159
|
eyeShadow: `${t}-eyeShadow`,
|
|
1070
1160
|
pupilGloss: `${t}-pupilGloss`,
|
|
1071
1161
|
boltClip: `${t}-boltClip`
|
|
1072
|
-
}, a =
|
|
1162
|
+
}, a = gn(), i = m(a, "defs"), l = m(i, "linearGradient", {
|
|
1073
1163
|
id: o.boltFill,
|
|
1074
1164
|
x1: "420",
|
|
1075
1165
|
y1: "180",
|
|
@@ -1078,7 +1168,7 @@ function Fo(e, t) {
|
|
|
1078
1168
|
gradientUnits: "userSpaceOnUse"
|
|
1079
1169
|
});
|
|
1080
1170
|
D(l, "0", n.top), D(l, "0.36", n.middle), D(l, "0.72", n.bottom), D(l, "1", n.bottom);
|
|
1081
|
-
const
|
|
1171
|
+
const p = m(i, "linearGradient", {
|
|
1082
1172
|
id: o.boltEdge,
|
|
1083
1173
|
x1: "470",
|
|
1084
1174
|
y1: "145",
|
|
@@ -1086,28 +1176,28 @@ function Fo(e, t) {
|
|
|
1086
1176
|
y2: "980",
|
|
1087
1177
|
gradientUnits: "userSpaceOnUse"
|
|
1088
1178
|
});
|
|
1089
|
-
D(
|
|
1090
|
-
const
|
|
1179
|
+
D(p, "0", n.edgeStart), D(p, "0.32", n.edgeMiddle), D(p, "0.78", n.edgeEnd), D(p, "1", n.edgeEnd);
|
|
1180
|
+
const c = m(i, "radialGradient", {
|
|
1091
1181
|
id: o.boltGlow,
|
|
1092
1182
|
cx: "50%",
|
|
1093
1183
|
cy: "22%",
|
|
1094
1184
|
r: "82%"
|
|
1095
1185
|
});
|
|
1096
|
-
D(
|
|
1097
|
-
const
|
|
1186
|
+
D(c, "0", n.glow, "0.72"), D(c, "0.5", n.middle, "0.44"), D(c, "1", n.bottom, "0");
|
|
1187
|
+
const u = m(i, "radialGradient", {
|
|
1098
1188
|
id: o.eyeWhite,
|
|
1099
1189
|
cx: "35%",
|
|
1100
1190
|
cy: "25%",
|
|
1101
1191
|
r: "70%"
|
|
1102
1192
|
});
|
|
1103
|
-
D(
|
|
1104
|
-
const
|
|
1193
|
+
D(u, "0", "#ffffff"), D(u, "0.72", "#ffffff"), D(u, "1", "#e5e5e5");
|
|
1194
|
+
const s = m(i, "radialGradient", {
|
|
1105
1195
|
id: o.pupil,
|
|
1106
1196
|
cx: "42%",
|
|
1107
1197
|
cy: "38%",
|
|
1108
1198
|
r: "65%"
|
|
1109
1199
|
});
|
|
1110
|
-
D(
|
|
1200
|
+
D(s, "0", "#2a1f10"), D(s, "0.52", "#080604"), D(s, "1", "#000000");
|
|
1111
1201
|
const b = m(i, "filter", {
|
|
1112
1202
|
id: o.softDropShadow,
|
|
1113
1203
|
x: "-18%",
|
|
@@ -1144,7 +1234,7 @@ function Fo(e, t) {
|
|
|
1144
1234
|
values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
|
|
1145
1235
|
result: "innerLight"
|
|
1146
1236
|
}), m(x, "feBlend", { in: "SourceGraphic", in2: "innerLight", mode: "screen" });
|
|
1147
|
-
const
|
|
1237
|
+
const P = m(i, "filter", {
|
|
1148
1238
|
id: o.eyeShadow,
|
|
1149
1239
|
x: "-24%",
|
|
1150
1240
|
y: "-20%",
|
|
@@ -1152,14 +1242,14 @@ function Fo(e, t) {
|
|
|
1152
1242
|
height: "148%",
|
|
1153
1243
|
"color-interpolation-filters": "sRGB"
|
|
1154
1244
|
});
|
|
1155
|
-
m(
|
|
1245
|
+
m(P, "feDropShadow", {
|
|
1156
1246
|
dx: "0",
|
|
1157
1247
|
dy: "8",
|
|
1158
1248
|
stdDeviation: "5",
|
|
1159
1249
|
"flood-color": n.shadow,
|
|
1160
1250
|
"flood-opacity": "0.3"
|
|
1161
1251
|
});
|
|
1162
|
-
const
|
|
1252
|
+
const k = m(i, "filter", {
|
|
1163
1253
|
id: o.pupilGloss,
|
|
1164
1254
|
x: "-15%",
|
|
1165
1255
|
y: "-15%",
|
|
@@ -1167,29 +1257,29 @@ function Fo(e, t) {
|
|
|
1167
1257
|
height: "130%",
|
|
1168
1258
|
"color-interpolation-filters": "sRGB"
|
|
1169
1259
|
});
|
|
1170
|
-
m(
|
|
1260
|
+
m(k, "feDropShadow", {
|
|
1171
1261
|
dx: "0",
|
|
1172
1262
|
dy: "3",
|
|
1173
1263
|
stdDeviation: "3",
|
|
1174
1264
|
"flood-color": "#000000",
|
|
1175
1265
|
"flood-opacity": "0.22"
|
|
1176
1266
|
});
|
|
1177
|
-
const
|
|
1178
|
-
m(
|
|
1179
|
-
const
|
|
1180
|
-
m(
|
|
1181
|
-
const
|
|
1182
|
-
m(
|
|
1183
|
-
d:
|
|
1184
|
-
fill:
|
|
1185
|
-
filter:
|
|
1186
|
-
}), m(
|
|
1187
|
-
d:
|
|
1188
|
-
fill:
|
|
1267
|
+
const O = m(i, "clipPath", { id: o.boltClip });
|
|
1268
|
+
m(O, "path", { d: Oe });
|
|
1269
|
+
const y = m(a, "g", { filter: $(o.softDropShadow) });
|
|
1270
|
+
m(y, "path", { d: Oe, fill: $(o.boltEdge) });
|
|
1271
|
+
const C = "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";
|
|
1272
|
+
m(y, "path", {
|
|
1273
|
+
d: C,
|
|
1274
|
+
fill: $(o.boltFill),
|
|
1275
|
+
filter: $(o.innerDepth)
|
|
1276
|
+
}), m(y, "path", {
|
|
1277
|
+
d: C,
|
|
1278
|
+
fill: $(o.boltGlow),
|
|
1189
1279
|
opacity: "0.74"
|
|
1190
1280
|
});
|
|
1191
|
-
const h = m(
|
|
1192
|
-
"clip-path":
|
|
1281
|
+
const h = m(y, "g", {
|
|
1282
|
+
"clip-path": $(o.boltClip),
|
|
1193
1283
|
opacity: "0.42"
|
|
1194
1284
|
});
|
|
1195
1285
|
m(h, "path", {
|
|
@@ -1214,16 +1304,16 @@ function Fo(e, t) {
|
|
|
1214
1304
|
"stroke-linecap": "round",
|
|
1215
1305
|
opacity: "0.48"
|
|
1216
1306
|
});
|
|
1217
|
-
const g = m(a, "g", { filter:
|
|
1218
|
-
return
|
|
1307
|
+
const g = m(a, "g", { filter: $(o.eyeShadow) });
|
|
1308
|
+
return Ut(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Ut(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
|
|
1219
1309
|
}
|
|
1220
|
-
function
|
|
1221
|
-
const n =
|
|
1310
|
+
function ia(e, t) {
|
|
1311
|
+
const n = Qt(e), o = {
|
|
1222
1312
|
clip: `${t}-scribbleBoltClip`,
|
|
1223
1313
|
wobble: `${t}-scribbleBoltWobble`
|
|
1224
|
-
}, a =
|
|
1225
|
-
m(l, "path", { d:
|
|
1226
|
-
const
|
|
1314
|
+
}, a = gn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
|
|
1315
|
+
m(l, "path", { d: Oe });
|
|
1316
|
+
const p = m(i, "filter", {
|
|
1227
1317
|
id: o.wobble,
|
|
1228
1318
|
x: "-10%",
|
|
1229
1319
|
y: "-10%",
|
|
@@ -1231,22 +1321,22 @@ function zo(e, t) {
|
|
|
1231
1321
|
height: "120%",
|
|
1232
1322
|
"color-interpolation-filters": "sRGB"
|
|
1233
1323
|
});
|
|
1234
|
-
m(
|
|
1324
|
+
m(p, "feTurbulence", {
|
|
1235
1325
|
type: "fractalNoise",
|
|
1236
1326
|
baseFrequency: "0.011",
|
|
1237
1327
|
numOctaves: "3",
|
|
1238
1328
|
seed: "7",
|
|
1239
1329
|
result: "noise"
|
|
1240
|
-
}), m(
|
|
1330
|
+
}), m(p, "feDisplacementMap", {
|
|
1241
1331
|
in: "SourceGraphic",
|
|
1242
1332
|
in2: "noise",
|
|
1243
1333
|
scale: "16",
|
|
1244
1334
|
xChannelSelector: "R",
|
|
1245
1335
|
yChannelSelector: "G"
|
|
1246
1336
|
});
|
|
1247
|
-
const
|
|
1248
|
-
return m(
|
|
1249
|
-
d:
|
|
1337
|
+
const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", { "clip-path": $(o.clip) });
|
|
1338
|
+
return m(u, "path", {
|
|
1339
|
+
d: On(),
|
|
1250
1340
|
fill: "none",
|
|
1251
1341
|
stroke: n,
|
|
1252
1342
|
"stroke-width": "56",
|
|
@@ -1254,70 +1344,70 @@ function zo(e, t) {
|
|
|
1254
1344
|
"stroke-linejoin": "round",
|
|
1255
1345
|
opacity: "0.9",
|
|
1256
1346
|
transform: "rotate(-14 627 600)"
|
|
1257
|
-
}), m(
|
|
1258
|
-
d:
|
|
1347
|
+
}), m(c, "path", {
|
|
1348
|
+
d: Oe,
|
|
1259
1349
|
fill: "none",
|
|
1260
|
-
stroke:
|
|
1350
|
+
stroke: Ue,
|
|
1261
1351
|
"stroke-width": "18",
|
|
1262
1352
|
"stroke-linejoin": "round"
|
|
1263
|
-
}),
|
|
1353
|
+
}), Ft(c, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), Ft(c, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
|
|
1264
1354
|
}
|
|
1265
|
-
function
|
|
1266
|
-
return
|
|
1267
|
-
xmlns:
|
|
1355
|
+
function gn() {
|
|
1356
|
+
return v("svg", {
|
|
1357
|
+
xmlns: pn,
|
|
1268
1358
|
viewBox: "0 0 1254 1254"
|
|
1269
1359
|
});
|
|
1270
1360
|
}
|
|
1271
|
-
function
|
|
1272
|
-
const
|
|
1273
|
-
m(
|
|
1361
|
+
function Ut(e, t, n, o, a, i, l, p, c) {
|
|
1362
|
+
const u = m(e, "g", { transform: t });
|
|
1363
|
+
m(u, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: $(c.eyeWhite) }), m(u, "ellipse", {
|
|
1274
1364
|
cx: a,
|
|
1275
1365
|
cy: i,
|
|
1276
1366
|
rx: "49",
|
|
1277
1367
|
ry: "57",
|
|
1278
|
-
fill:
|
|
1279
|
-
filter:
|
|
1280
|
-
}), m(
|
|
1368
|
+
fill: $(c.pupil),
|
|
1369
|
+
filter: $(c.pupilGloss)
|
|
1370
|
+
}), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
|
|
1281
1371
|
}
|
|
1282
|
-
function
|
|
1283
|
-
const
|
|
1284
|
-
m(
|
|
1372
|
+
function Ft(e, t, n, o, a, i, l, p) {
|
|
1373
|
+
const c = m(e, "g", { transform: t });
|
|
1374
|
+
m(c, "ellipse", {
|
|
1285
1375
|
cx: n,
|
|
1286
1376
|
cy: o,
|
|
1287
1377
|
rx: "73",
|
|
1288
1378
|
ry: "80",
|
|
1289
1379
|
fill: "#ffffff",
|
|
1290
|
-
stroke:
|
|
1380
|
+
stroke: Ue,
|
|
1291
1381
|
"stroke-width": "13"
|
|
1292
|
-
}), m(
|
|
1382
|
+
}), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Ue }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
|
|
1293
1383
|
}
|
|
1294
1384
|
function m(e, t, n = {}) {
|
|
1295
|
-
const o =
|
|
1385
|
+
const o = v(t, n);
|
|
1296
1386
|
return e.appendChild(o), o;
|
|
1297
1387
|
}
|
|
1298
1388
|
function D(e, t, n, o) {
|
|
1299
1389
|
const a = { offset: t, "stop-color": n };
|
|
1300
1390
|
o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
|
|
1301
1391
|
}
|
|
1302
|
-
function
|
|
1392
|
+
function $(e) {
|
|
1303
1393
|
return `url(#${e})`;
|
|
1304
1394
|
}
|
|
1305
|
-
function
|
|
1395
|
+
function ze(e, t, n, o) {
|
|
1306
1396
|
const a = document.createElement("button");
|
|
1307
1397
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1308
1398
|
}
|
|
1309
|
-
function
|
|
1310
|
-
const e =
|
|
1399
|
+
function ra() {
|
|
1400
|
+
const e = v("svg", {
|
|
1311
1401
|
class: "pluno-pa-widget__scribble-defs",
|
|
1312
1402
|
"aria-hidden": "true",
|
|
1313
1403
|
focusable: "false",
|
|
1314
1404
|
width: "0",
|
|
1315
1405
|
height: "0"
|
|
1316
|
-
}), t =
|
|
1317
|
-
return t.appendChild(
|
|
1406
|
+
}), t = v("defs");
|
|
1407
|
+
return t.appendChild(Qe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Qe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Qe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1318
1408
|
}
|
|
1319
|
-
function
|
|
1320
|
-
const n =
|
|
1409
|
+
function hn(e, t) {
|
|
1410
|
+
const n = v("svg", {
|
|
1321
1411
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1322
1412
|
viewBox: `0 0 ${t * 26} 36`,
|
|
1323
1413
|
preserveAspectRatio: "none",
|
|
@@ -1325,9 +1415,9 @@ function on(e, t) {
|
|
|
1325
1415
|
focusable: "false"
|
|
1326
1416
|
});
|
|
1327
1417
|
for (let o = 0; o < t; o += 1) {
|
|
1328
|
-
const a =
|
|
1418
|
+
const a = Nt[o % Nt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
|
|
1329
1419
|
i.appendChild(
|
|
1330
|
-
|
|
1420
|
+
v("ellipse", {
|
|
1331
1421
|
cx: a.ellipseCx,
|
|
1332
1422
|
cy: a.ellipseCy,
|
|
1333
1423
|
rx: a.ellipseRx,
|
|
@@ -1338,7 +1428,7 @@ function on(e, t) {
|
|
|
1338
1428
|
opacity: "0.8"
|
|
1339
1429
|
})
|
|
1340
1430
|
), i.appendChild(
|
|
1341
|
-
|
|
1431
|
+
v("path", {
|
|
1342
1432
|
d: a.path,
|
|
1343
1433
|
fill: "none",
|
|
1344
1434
|
stroke: "#2c2a1e",
|
|
@@ -1349,10 +1439,10 @@ function on(e, t) {
|
|
|
1349
1439
|
}
|
|
1350
1440
|
return n;
|
|
1351
1441
|
}
|
|
1352
|
-
function
|
|
1353
|
-
const o =
|
|
1442
|
+
function Qe(e, t, n) {
|
|
1443
|
+
const o = v("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1354
1444
|
return o.appendChild(
|
|
1355
|
-
|
|
1445
|
+
v("feTurbulence", {
|
|
1356
1446
|
type: "fractalNoise",
|
|
1357
1447
|
baseFrequency: "0.012 0.028",
|
|
1358
1448
|
numOctaves: "3",
|
|
@@ -1360,7 +1450,7 @@ function He(e, t, n) {
|
|
|
1360
1450
|
result: "stroke-noise"
|
|
1361
1451
|
})
|
|
1362
1452
|
), o.appendChild(
|
|
1363
|
-
|
|
1453
|
+
v("feDisplacementMap", {
|
|
1364
1454
|
in: "SourceGraphic",
|
|
1365
1455
|
in2: "stroke-noise",
|
|
1366
1456
|
scale: "3.5",
|
|
@@ -1369,7 +1459,7 @@ function He(e, t, n) {
|
|
|
1369
1459
|
result: "warped"
|
|
1370
1460
|
})
|
|
1371
1461
|
), o.appendChild(
|
|
1372
|
-
|
|
1462
|
+
v("feTurbulence", {
|
|
1373
1463
|
type: "fractalNoise",
|
|
1374
1464
|
baseFrequency: "0.7",
|
|
1375
1465
|
numOctaves: "1",
|
|
@@ -1377,7 +1467,7 @@ function He(e, t, n) {
|
|
|
1377
1467
|
result: "ink-noise"
|
|
1378
1468
|
})
|
|
1379
1469
|
), o.appendChild(
|
|
1380
|
-
|
|
1470
|
+
v("feDisplacementMap", {
|
|
1381
1471
|
in: "warped",
|
|
1382
1472
|
in2: "ink-noise",
|
|
1383
1473
|
scale: "0.9",
|
|
@@ -1386,30 +1476,38 @@ function He(e, t, n) {
|
|
|
1386
1476
|
})
|
|
1387
1477
|
), o;
|
|
1388
1478
|
}
|
|
1389
|
-
function
|
|
1390
|
-
const t =
|
|
1391
|
-
return t.appendChild(
|
|
1479
|
+
function la(e) {
|
|
1480
|
+
const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1481
|
+
return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1482
|
+
}
|
|
1483
|
+
function pa() {
|
|
1484
|
+
const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1485
|
+
return e.appendChild(v("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(v("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1486
|
+
}
|
|
1487
|
+
function sa() {
|
|
1488
|
+
const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1489
|
+
return e.appendChild(v("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(v("path", { d: "M3 4v5h5" })), e.appendChild(v("path", { d: "M12 7v5l3 2" })), e;
|
|
1392
1490
|
}
|
|
1393
|
-
function
|
|
1394
|
-
const e =
|
|
1395
|
-
return e.appendChild(
|
|
1491
|
+
function da() {
|
|
1492
|
+
const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
|
|
1493
|
+
return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
|
|
1396
1494
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const e =
|
|
1399
|
-
return e.appendChild(
|
|
1495
|
+
function mn() {
|
|
1496
|
+
const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1497
|
+
return e.appendChild(v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1400
1498
|
}
|
|
1401
|
-
function
|
|
1402
|
-
const e =
|
|
1499
|
+
function ca() {
|
|
1500
|
+
const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1403
1501
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1404
|
-
|
|
1502
|
+
v("path", {
|
|
1405
1503
|
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"
|
|
1406
1504
|
})
|
|
1407
1505
|
), e;
|
|
1408
1506
|
}
|
|
1409
|
-
function
|
|
1410
|
-
const e =
|
|
1507
|
+
function ua() {
|
|
1508
|
+
const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1411
1509
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1412
|
-
|
|
1510
|
+
v("path", {
|
|
1413
1511
|
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",
|
|
1414
1512
|
stroke: "currentColor",
|
|
1415
1513
|
"stroke-width": "2",
|
|
@@ -1418,19 +1516,19 @@ function qo() {
|
|
|
1418
1516
|
})
|
|
1419
1517
|
), e;
|
|
1420
1518
|
}
|
|
1421
|
-
function
|
|
1422
|
-
const e =
|
|
1423
|
-
return e.appendChild(
|
|
1519
|
+
function ga() {
|
|
1520
|
+
const e = Z("0 0 24 24", 18, 18, "currentColor");
|
|
1521
|
+
return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1424
1522
|
}
|
|
1425
|
-
function
|
|
1426
|
-
const e =
|
|
1427
|
-
return e.appendChild(
|
|
1523
|
+
function ha() {
|
|
1524
|
+
const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1525
|
+
return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
|
|
1428
1526
|
}
|
|
1429
|
-
function
|
|
1430
|
-
const e =
|
|
1431
|
-
return e.appendChild(
|
|
1527
|
+
function ma() {
|
|
1528
|
+
const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1529
|
+
return e.appendChild(v("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(v("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1432
1530
|
}
|
|
1433
|
-
function
|
|
1531
|
+
function Z(e, t, n, o, a, i) {
|
|
1434
1532
|
const l = {
|
|
1435
1533
|
viewBox: e,
|
|
1436
1534
|
width: String(t),
|
|
@@ -1438,41 +1536,41 @@ function te(e, t, n, o, a, i) {
|
|
|
1438
1536
|
fill: o,
|
|
1439
1537
|
"aria-hidden": "true"
|
|
1440
1538
|
};
|
|
1441
|
-
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i),
|
|
1539
|
+
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
|
|
1442
1540
|
}
|
|
1443
|
-
function
|
|
1444
|
-
const n = document.createElementNS(
|
|
1541
|
+
function v(e, t = {}) {
|
|
1542
|
+
const n = document.createElementNS(pn, e);
|
|
1445
1543
|
for (const [o, a] of Object.entries(t))
|
|
1446
1544
|
n.setAttribute(o, a);
|
|
1447
1545
|
return n;
|
|
1448
1546
|
}
|
|
1449
|
-
function
|
|
1547
|
+
function zt(e) {
|
|
1450
1548
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1451
1549
|
e.addEventListener(t, (n) => {
|
|
1452
1550
|
n.stopPropagation();
|
|
1453
1551
|
});
|
|
1454
1552
|
}
|
|
1455
|
-
function
|
|
1553
|
+
function ba(e, t, n) {
|
|
1456
1554
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1457
1555
|
for (const [o, a] of t.entries()) {
|
|
1458
1556
|
const i = document.createElement("div");
|
|
1459
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1557
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(fa(a));
|
|
1460
1558
|
const l = document.createElement("span");
|
|
1461
1559
|
l.textContent = a.name, i.appendChild(l);
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1560
|
+
const p = document.createElement("button");
|
|
1561
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(ha()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1464
1562
|
}
|
|
1465
1563
|
}
|
|
1466
|
-
function
|
|
1467
|
-
if (
|
|
1564
|
+
function fa(e) {
|
|
1565
|
+
if (bn(e)) {
|
|
1468
1566
|
const n = document.createElement("img");
|
|
1469
1567
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1470
1568
|
}
|
|
1471
1569
|
const t = document.createElement("span");
|
|
1472
1570
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1473
1571
|
}
|
|
1474
|
-
function
|
|
1475
|
-
if (
|
|
1572
|
+
function wa(e) {
|
|
1573
|
+
if (bn(e)) {
|
|
1476
1574
|
const a = document.createElement("img");
|
|
1477
1575
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1478
1576
|
}
|
|
@@ -1483,51 +1581,51 @@ function Zo(e) {
|
|
|
1483
1581
|
const o = document.createElement("strong");
|
|
1484
1582
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1485
1583
|
}
|
|
1486
|
-
function
|
|
1584
|
+
function bn(e) {
|
|
1487
1585
|
return e.mimeType.startsWith("image/");
|
|
1488
1586
|
}
|
|
1489
|
-
function
|
|
1587
|
+
function _a(e) {
|
|
1490
1588
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1491
1589
|
}
|
|
1492
|
-
async function
|
|
1590
|
+
async function xa(e) {
|
|
1493
1591
|
if (!e)
|
|
1494
1592
|
return [];
|
|
1495
1593
|
const t = Array.from(e);
|
|
1496
|
-
if (t.length >
|
|
1497
|
-
throw new Error(`Attach up to ${
|
|
1594
|
+
if (t.length > Fe)
|
|
1595
|
+
throw new Error(`Attach up to ${Fe} files per message.`);
|
|
1498
1596
|
return Promise.all(
|
|
1499
1597
|
t.map(async (n) => {
|
|
1500
|
-
const o =
|
|
1598
|
+
const o = ya(n);
|
|
1501
1599
|
if (!o)
|
|
1502
1600
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1503
|
-
if (n.size >
|
|
1601
|
+
if (n.size > go)
|
|
1504
1602
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1505
1603
|
if (o === "image/gif") {
|
|
1506
|
-
const a = new Uint8Array(await
|
|
1507
|
-
if (
|
|
1604
|
+
const a = new Uint8Array(await Ta(n));
|
|
1605
|
+
if (Ca(a))
|
|
1508
1606
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1509
1607
|
}
|
|
1510
1608
|
return {
|
|
1511
|
-
name: n.name ||
|
|
1609
|
+
name: n.name || _a(o),
|
|
1512
1610
|
mimeType: o,
|
|
1513
1611
|
sizeBytes: n.size,
|
|
1514
|
-
dataUrl:
|
|
1612
|
+
dataUrl: va(await Na(n), o)
|
|
1515
1613
|
};
|
|
1516
1614
|
})
|
|
1517
1615
|
);
|
|
1518
1616
|
}
|
|
1519
|
-
function
|
|
1520
|
-
if (
|
|
1617
|
+
function ya(e) {
|
|
1618
|
+
if (an.has(e.type))
|
|
1521
1619
|
return e.type;
|
|
1522
1620
|
const t = e.name.toLowerCase();
|
|
1523
1621
|
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;
|
|
1524
1622
|
}
|
|
1525
|
-
function
|
|
1623
|
+
function va(e, t) {
|
|
1526
1624
|
const n = `data:${t};base64,`;
|
|
1527
1625
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1528
1626
|
}
|
|
1529
|
-
function
|
|
1530
|
-
if (e.length < 14 || !
|
|
1627
|
+
function Ca(e) {
|
|
1628
|
+
if (e.length < 14 || !Ea(e))
|
|
1531
1629
|
return !1;
|
|
1532
1630
|
const t = e[10];
|
|
1533
1631
|
let n = 13;
|
|
@@ -1538,7 +1636,7 @@ function na(e) {
|
|
|
1538
1636
|
if (n += 1, a === 59)
|
|
1539
1637
|
return !1;
|
|
1540
1638
|
if (a === 33) {
|
|
1541
|
-
n += 1, n =
|
|
1639
|
+
n += 1, n = Gt(e, n);
|
|
1542
1640
|
continue;
|
|
1543
1641
|
}
|
|
1544
1642
|
if (a !== 44)
|
|
@@ -1550,14 +1648,14 @@ function na(e) {
|
|
|
1550
1648
|
const i = e[n + 8];
|
|
1551
1649
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1552
1650
|
return !1;
|
|
1553
|
-
n += 1, n =
|
|
1651
|
+
n += 1, n = Gt(e, n);
|
|
1554
1652
|
}
|
|
1555
1653
|
return !1;
|
|
1556
1654
|
}
|
|
1557
|
-
function
|
|
1655
|
+
function Ea(e) {
|
|
1558
1656
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1559
1657
|
}
|
|
1560
|
-
function
|
|
1658
|
+
function Gt(e, t) {
|
|
1561
1659
|
for (; t < e.length; ) {
|
|
1562
1660
|
const n = e[t];
|
|
1563
1661
|
if (t += 1, n === 0)
|
|
@@ -1566,63 +1664,63 @@ function Tt(e, t) {
|
|
|
1566
1664
|
}
|
|
1567
1665
|
return t;
|
|
1568
1666
|
}
|
|
1569
|
-
function
|
|
1667
|
+
function Re(e) {
|
|
1570
1668
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1571
1669
|
}
|
|
1572
|
-
function
|
|
1573
|
-
if (!e || !
|
|
1670
|
+
function et(e, t, n = null) {
|
|
1671
|
+
if (!e || !rt(t, n)) {
|
|
1574
1672
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1575
1673
|
return;
|
|
1576
1674
|
}
|
|
1577
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1675
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || st(n) ? e.appendChild(Sa(t, n)) : fn(t) && e.appendChild(ka(t));
|
|
1578
1676
|
}
|
|
1579
|
-
function
|
|
1677
|
+
function Sa(e, t) {
|
|
1580
1678
|
const n = document.createElement("div");
|
|
1581
1679
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1582
1680
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1583
1681
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1584
1682
|
const i = document.createElement("span");
|
|
1585
|
-
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(
|
|
1683
|
+
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(wn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1586
1684
|
}
|
|
1587
|
-
function
|
|
1685
|
+
function ka(e) {
|
|
1588
1686
|
const t = document.createElement("div");
|
|
1589
1687
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1590
1688
|
const n = document.createElement("strong");
|
|
1591
1689
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1592
1690
|
const o = document.createElement("span");
|
|
1593
|
-
return o.textContent =
|
|
1691
|
+
return o.textContent = Pa(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(wn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1594
1692
|
}
|
|
1595
|
-
function
|
|
1596
|
-
return e !== null && (
|
|
1693
|
+
function rt(e, t) {
|
|
1694
|
+
return e !== null && (X(e) || fn(e) || st(t));
|
|
1597
1695
|
}
|
|
1598
|
-
function
|
|
1599
|
-
return
|
|
1696
|
+
function Ht(e, t, n) {
|
|
1697
|
+
return rt(t, n) || La(t) ? !0 : !rt(e, n);
|
|
1600
1698
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1699
|
+
function La(e) {
|
|
1700
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
|
|
1603
1701
|
}
|
|
1604
|
-
function
|
|
1702
|
+
function X(e) {
|
|
1605
1703
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1606
1704
|
}
|
|
1607
|
-
function
|
|
1705
|
+
function st(e) {
|
|
1608
1706
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1609
1707
|
}
|
|
1610
|
-
function
|
|
1611
|
-
return !
|
|
1708
|
+
function fn(e) {
|
|
1709
|
+
return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1612
1710
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return e.creditsRemaining === null ? null : `${
|
|
1711
|
+
function Pa(e) {
|
|
1712
|
+
return e.creditsRemaining === null ? null : `${Aa(e.creditsRemaining)} credits left`;
|
|
1615
1713
|
}
|
|
1616
|
-
function
|
|
1714
|
+
function Aa(e) {
|
|
1617
1715
|
return new Intl.NumberFormat("en-US", {
|
|
1618
1716
|
maximumFractionDigits: 0
|
|
1619
1717
|
}).format(Math.ceil(e));
|
|
1620
1718
|
}
|
|
1621
|
-
function
|
|
1719
|
+
function wn(e, t, n) {
|
|
1622
1720
|
const o = document.createElement("div");
|
|
1623
|
-
return o.className = n, o.appendChild(
|
|
1721
|
+
return o.className = n, o.appendChild(Wt(t, e.pricingUrl)), o.appendChild(Wt("Earn credits", e.earnCreditsUrl)), o;
|
|
1624
1722
|
}
|
|
1625
|
-
function
|
|
1723
|
+
function Wt(e, t) {
|
|
1626
1724
|
const n = document.createElement("button");
|
|
1627
1725
|
if (n.type = "button", e === "Earn credits") {
|
|
1628
1726
|
const o = document.createElement("span");
|
|
@@ -1633,7 +1731,7 @@ function It(e, t) {
|
|
|
1633
1731
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1634
1732
|
}), n;
|
|
1635
1733
|
}
|
|
1636
|
-
function
|
|
1734
|
+
function Ta(e) {
|
|
1637
1735
|
return new Promise((t, n) => {
|
|
1638
1736
|
const o = new FileReader();
|
|
1639
1737
|
o.addEventListener("load", () => {
|
|
@@ -1647,7 +1745,7 @@ function sa(e) {
|
|
|
1647
1745
|
}), o.readAsArrayBuffer(e);
|
|
1648
1746
|
});
|
|
1649
1747
|
}
|
|
1650
|
-
function
|
|
1748
|
+
function Na(e) {
|
|
1651
1749
|
return new Promise((t, n) => {
|
|
1652
1750
|
const o = new FileReader();
|
|
1653
1751
|
o.addEventListener("load", () => {
|
|
@@ -1661,167 +1759,170 @@ function da(e) {
|
|
|
1661
1759
|
}), o.readAsDataURL(e);
|
|
1662
1760
|
});
|
|
1663
1761
|
}
|
|
1664
|
-
function
|
|
1665
|
-
return e.messages.filter((o) => !
|
|
1666
|
-
}
|
|
1667
|
-
function
|
|
1668
|
-
const
|
|
1669
|
-
e.replaceChildren(),
|
|
1670
|
-
const h =
|
|
1671
|
-
if (o.hidden = !h,
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1674
|
-
const
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1678
|
-
const
|
|
1679
|
-
if (
|
|
1680
|
-
for (const
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
}),
|
|
1762
|
+
function $t(e, t) {
|
|
1763
|
+
return e.messages.filter((o) => !_n(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1764
|
+
}
|
|
1765
|
+
function Ia(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
|
|
1766
|
+
const O = [...i.messages], y = O.filter((_) => !_n(_)), C = e.scrollTop;
|
|
1767
|
+
e.replaceChildren(), yn(n, i.isThinking), a.hidden = !p, p && l !== null && oa(a, l);
|
|
1768
|
+
const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1769
|
+
if (o.hidden = !h, y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1770
|
+
const _ = document.createElement("div");
|
|
1771
|
+
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1772
|
+
const L = document.createElement("div");
|
|
1773
|
+
L.className = "pluno-pa-widget__empty-hero";
|
|
1774
|
+
const G = re("pluno-pa-widget__character--empty", x());
|
|
1775
|
+
L.appendChild(G), _.appendChild(L), _.appendChild(un());
|
|
1776
|
+
const M = document.createElement("div");
|
|
1777
|
+
if (M.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && !i.starterPromptsLoading && M.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1778
|
+
for (const f of i.starterPrompts) {
|
|
1779
|
+
const A = document.createElement("button");
|
|
1780
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
|
|
1781
|
+
P(f);
|
|
1782
|
+
}), M.appendChild(A);
|
|
1685
1783
|
}
|
|
1686
|
-
else
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1784
|
+
else if (i.starterPromptsLoading) {
|
|
1785
|
+
const f = document.createElement("button");
|
|
1786
|
+
f.type = "button", f.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", f.disabled = !0, f.tabIndex = -1, f.textContent = "Generating example tasks...", M.appendChild(f);
|
|
1787
|
+
} else
|
|
1788
|
+
for (let f = 0; f < mo; f += 1) {
|
|
1789
|
+
const A = document.createElement("button");
|
|
1790
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", M.appendChild(A);
|
|
1690
1791
|
}
|
|
1691
|
-
|
|
1792
|
+
_.appendChild(M), e.appendChild(_), e.appendChild(t);
|
|
1692
1793
|
return;
|
|
1693
1794
|
}
|
|
1694
|
-
let g = null,
|
|
1695
|
-
const
|
|
1696
|
-
if (
|
|
1795
|
+
let g = null, E = null, I = [];
|
|
1796
|
+
const le = () => {
|
|
1797
|
+
if (I.length === 0)
|
|
1697
1798
|
return !1;
|
|
1698
|
-
const
|
|
1699
|
-
return e.appendChild(
|
|
1799
|
+
const _ = za(I, s, b, x());
|
|
1800
|
+
return e.appendChild(_), g = null, E = _, I = [], !0;
|
|
1700
1801
|
};
|
|
1701
|
-
for (let
|
|
1702
|
-
const
|
|
1703
|
-
if (
|
|
1704
|
-
|
|
1802
|
+
for (let _ = 0; _ < y.length; _ += 1) {
|
|
1803
|
+
const L = y[_];
|
|
1804
|
+
if (L.role === "tool") {
|
|
1805
|
+
I.push(L);
|
|
1705
1806
|
continue;
|
|
1706
1807
|
}
|
|
1707
|
-
if (
|
|
1808
|
+
if (L.role === "system")
|
|
1708
1809
|
continue;
|
|
1709
|
-
const
|
|
1710
|
-
if (
|
|
1711
|
-
const
|
|
1712
|
-
e.appendChild(
|
|
1810
|
+
const G = le(), M = Vt(L.content);
|
|
1811
|
+
if (L.role === "assistant" && !G) {
|
|
1812
|
+
const T = lt(x());
|
|
1813
|
+
e.appendChild(T), g = null, E = T;
|
|
1713
1814
|
}
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1815
|
+
const f = document.createElement("div");
|
|
1816
|
+
f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Yt(f, M) : f.textContent = M, L.role === "user" && L.attachments?.length && f.appendChild(Da(L.attachments));
|
|
1817
|
+
const A = document.createElement("div");
|
|
1818
|
+
A.className = "pluno-pa-widget__message-actions", A.appendChild(jt(M)), f.appendChild(A), e.appendChild(f), g = f, E = null;
|
|
1718
1819
|
}
|
|
1719
|
-
const
|
|
1820
|
+
const xe = le();
|
|
1720
1821
|
if (i.assistantDraft) {
|
|
1721
|
-
if (!
|
|
1722
|
-
const
|
|
1723
|
-
e.appendChild(
|
|
1724
|
-
}
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1822
|
+
if (!xe) {
|
|
1823
|
+
const M = lt(x());
|
|
1824
|
+
e.appendChild(M), g = null, E = M;
|
|
1825
|
+
}
|
|
1826
|
+
const _ = Vt(i.assistantDraft), L = document.createElement("div");
|
|
1827
|
+
L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Yt(L, _);
|
|
1828
|
+
const G = document.createElement("div");
|
|
1829
|
+
G.className = "pluno-pa-widget__message-actions", G.appendChild(jt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
|
|
1729
1830
|
}
|
|
1730
1831
|
if (i.isThinking && !i.assistantDraft)
|
|
1731
|
-
if (
|
|
1732
|
-
const
|
|
1733
|
-
e.appendChild(
|
|
1832
|
+
if (xe) {
|
|
1833
|
+
const _ = xn();
|
|
1834
|
+
e.appendChild(_), g = null, E = _;
|
|
1734
1835
|
} else {
|
|
1735
|
-
const
|
|
1736
|
-
e.appendChild(
|
|
1836
|
+
const _ = Ga(x());
|
|
1837
|
+
e.appendChild(_), g = null, E = _;
|
|
1737
1838
|
}
|
|
1738
1839
|
if (i.lastError) {
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1840
|
+
const _ = document.createElement("div");
|
|
1841
|
+
_.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
|
|
1741
1842
|
}
|
|
1742
|
-
const
|
|
1743
|
-
if (
|
|
1744
|
-
const
|
|
1745
|
-
isDrafting:
|
|
1746
|
-
error:
|
|
1747
|
-
characterIconOptions:
|
|
1748
|
-
onDraft:
|
|
1749
|
-
onDismiss:
|
|
1750
|
-
onDisable:
|
|
1843
|
+
const R = k && !i.isThinking ? Hn(O) : null;
|
|
1844
|
+
if (k && R && !k.dismissedCandidateIds.has(R.id)) {
|
|
1845
|
+
const _ = Ra(R, {
|
|
1846
|
+
isDrafting: k.draftingCandidateId === R.id,
|
|
1847
|
+
error: k.error,
|
|
1848
|
+
characterIconOptions: k.characterIconOptions,
|
|
1849
|
+
onDraft: k.onDraft,
|
|
1850
|
+
onDismiss: k.onDismiss,
|
|
1851
|
+
onDisable: k.onDisable
|
|
1751
1852
|
});
|
|
1752
|
-
e.appendChild(
|
|
1853
|
+
e.appendChild(_), k.onSeen(R), g = null, E = _;
|
|
1753
1854
|
}
|
|
1754
|
-
g?.classList.add("pluno-pa-widget__message--bottom-reserve"),
|
|
1755
|
-
}
|
|
1756
|
-
function
|
|
1757
|
-
e.replaceChildren(),
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
const
|
|
1763
|
-
if (
|
|
1855
|
+
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), E?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? Se(e, u) : e.scrollTop = C;
|
|
1856
|
+
}
|
|
1857
|
+
function qt(e, t, n, o, a, i, l, p) {
|
|
1858
|
+
e.replaceChildren(), yn(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1859
|
+
const c = document.createElement("div");
|
|
1860
|
+
c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1861
|
+
const u = re("pluno-pa-widget__character--empty", o());
|
|
1862
|
+
c.appendChild(u);
|
|
1863
|
+
const s = document.createElement("div");
|
|
1864
|
+
if (s.className = "pluno-pa-widget__empty", s.textContent = a, c.appendChild(s), l) {
|
|
1764
1865
|
const b = document.createElement("a");
|
|
1765
|
-
b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i,
|
|
1866
|
+
b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, c.appendChild(b);
|
|
1766
1867
|
} else {
|
|
1767
1868
|
const b = document.createElement("button");
|
|
1768
|
-
b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () =>
|
|
1869
|
+
b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => p?.()), c.appendChild(b);
|
|
1769
1870
|
}
|
|
1770
|
-
e.appendChild(
|
|
1871
|
+
e.appendChild(c);
|
|
1771
1872
|
}
|
|
1772
|
-
function
|
|
1873
|
+
function Da(e) {
|
|
1773
1874
|
const t = document.createElement("div");
|
|
1774
1875
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1775
1876
|
for (const n of e)
|
|
1776
|
-
t.appendChild(
|
|
1877
|
+
t.appendChild(wa(n));
|
|
1777
1878
|
return t;
|
|
1778
1879
|
}
|
|
1779
|
-
function
|
|
1880
|
+
function jt(e) {
|
|
1780
1881
|
const t = document.createElement("button");
|
|
1781
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1882
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ma()), t.addEventListener("click", (n) => {
|
|
1782
1883
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1783
1884
|
}), t;
|
|
1784
1885
|
}
|
|
1785
|
-
function
|
|
1886
|
+
function Ra(e, t) {
|
|
1786
1887
|
const n = document.createElement("article");
|
|
1787
1888
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1788
1889
|
const o = document.createElement("div");
|
|
1789
|
-
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
|
|
1890
|
+
o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(re("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
|
|
1790
1891
|
const a = document.createElement("div");
|
|
1791
1892
|
a.className = "pluno-pa-widget__share-prompt-copy";
|
|
1792
1893
|
const i = document.createElement("strong");
|
|
1793
1894
|
i.textContent = "Share this win?", a.appendChild(i);
|
|
1794
1895
|
const l = document.createElement("span");
|
|
1795
1896
|
if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1897
|
+
const s = document.createElement("span");
|
|
1898
|
+
s.className = "pluno-pa-widget__share-prompt-error", s.textContent = t.error, a.appendChild(s);
|
|
1798
1899
|
}
|
|
1799
1900
|
o.appendChild(a);
|
|
1800
|
-
const
|
|
1801
|
-
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1804
|
-
const
|
|
1805
|
-
if (
|
|
1901
|
+
const p = document.createElement("div");
|
|
1902
|
+
p.className = "pluno-pa-widget__share-prompt-actions";
|
|
1903
|
+
const c = document.createElement("div");
|
|
1904
|
+
c.className = "pluno-pa-widget__share-prompt-primary-actions";
|
|
1905
|
+
const u = document.createElement("button");
|
|
1906
|
+
if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
|
|
1806
1907
|
t.onDraft(e);
|
|
1807
|
-
}), t.isDrafting ? (
|
|
1808
|
-
|
|
1908
|
+
}), t.isDrafting ? (u.appendChild(pt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
|
|
1909
|
+
p.appendChild(c);
|
|
1809
1910
|
else {
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1911
|
+
const s = document.createElement("button");
|
|
1912
|
+
s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
|
|
1812
1913
|
t.onDismiss(e);
|
|
1813
|
-
}),
|
|
1914
|
+
}), c.appendChild(s), p.appendChild(c);
|
|
1814
1915
|
const b = document.createElement("button");
|
|
1815
1916
|
b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
|
|
1816
1917
|
t.onDisable(e);
|
|
1817
|
-
}),
|
|
1918
|
+
}), p.appendChild(b);
|
|
1818
1919
|
}
|
|
1819
|
-
return o.appendChild(
|
|
1920
|
+
return o.appendChild(p), n.appendChild(o), n;
|
|
1820
1921
|
}
|
|
1821
|
-
function
|
|
1922
|
+
function Ma(e, t) {
|
|
1822
1923
|
const n = document.createElement("div");
|
|
1823
|
-
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (
|
|
1824
|
-
|
|
1924
|
+
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
|
|
1925
|
+
y.target === n && t.onClose();
|
|
1825
1926
|
});
|
|
1826
1927
|
const o = document.createElement("section");
|
|
1827
1928
|
o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
|
|
@@ -1829,57 +1930,57 @@ function ha(e, t) {
|
|
|
1829
1930
|
i.textContent = "Share this win", a.appendChild(i);
|
|
1830
1931
|
const l = document.createElement("button");
|
|
1831
1932
|
l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
const d = document.createElement("div");
|
|
1835
|
-
d.className = "pluno-pa-widget__share-dialog-step";
|
|
1933
|
+
const p = document.createElement("p");
|
|
1934
|
+
p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
|
|
1836
1935
|
const c = document.createElement("div");
|
|
1837
|
-
c.className = "pluno-pa-widget__share-dialog-step
|
|
1838
|
-
const
|
|
1839
|
-
|
|
1840
|
-
const
|
|
1936
|
+
c.className = "pluno-pa-widget__share-dialog-step";
|
|
1937
|
+
const u = document.createElement("div");
|
|
1938
|
+
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1939
|
+
const s = document.createElement("strong");
|
|
1940
|
+
s.textContent = "1) Copy Screenshot", u.appendChild(s);
|
|
1941
|
+
const b = Ba("Copy Screenshot", async () => {
|
|
1841
1942
|
try {
|
|
1842
|
-
return await
|
|
1943
|
+
return await Wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1843
1944
|
} catch {
|
|
1844
|
-
return
|
|
1945
|
+
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1845
1946
|
}
|
|
1846
1947
|
});
|
|
1847
|
-
if (
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1948
|
+
if (u.appendChild(b), c.appendChild(u), e.screenshotDataUrl) {
|
|
1949
|
+
const y = document.createElement("div");
|
|
1950
|
+
y.className = "pluno-pa-widget__share-dialog-screenshot";
|
|
1951
|
+
const C = document.createElement("img");
|
|
1952
|
+
C.src = e.screenshotDataUrl, C.alt = "Product page with Pluno open", y.appendChild(C), c.appendChild(y);
|
|
1852
1953
|
}
|
|
1853
|
-
o.appendChild(
|
|
1954
|
+
o.appendChild(c), o.appendChild(p);
|
|
1854
1955
|
const x = document.createElement("div");
|
|
1855
1956
|
x.className = "pluno-pa-widget__share-dialog-step";
|
|
1856
|
-
const
|
|
1857
|
-
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
for (const
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1957
|
+
const P = document.createElement("strong");
|
|
1958
|
+
P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
|
|
1959
|
+
const k = document.createElement("p");
|
|
1960
|
+
k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
|
|
1961
|
+
const O = document.createElement("footer");
|
|
1962
|
+
O.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1963
|
+
for (const y of Oa(e)) {
|
|
1964
|
+
const C = document.createElement("a");
|
|
1965
|
+
C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Ua(y.id)), O.appendChild(C);
|
|
1865
1966
|
}
|
|
1866
|
-
if (x.appendChild(
|
|
1867
|
-
const
|
|
1868
|
-
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1967
|
+
if (x.appendChild(O), o.appendChild(x), t.socialPostRewardsUrl) {
|
|
1968
|
+
const y = document.createElement("div");
|
|
1969
|
+
y.className = "pluno-pa-widget__share-dialog-step";
|
|
1970
|
+
const C = document.createElement("strong");
|
|
1971
|
+
C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
|
|
1871
1972
|
const h = document.createElement("a");
|
|
1872
|
-
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(
|
|
1973
|
+
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(Fa()), y.appendChild(h), o.appendChild(y);
|
|
1873
1974
|
}
|
|
1874
1975
|
return n.appendChild(o), n;
|
|
1875
1976
|
}
|
|
1876
|
-
function
|
|
1977
|
+
function Ba(e, t) {
|
|
1877
1978
|
const n = document.createElement("button");
|
|
1878
1979
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1879
1980
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1880
1981
|
}), n;
|
|
1881
1982
|
}
|
|
1882
|
-
function
|
|
1983
|
+
function Oa(e) {
|
|
1883
1984
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1884
1985
|
return [
|
|
1885
1986
|
{
|
|
@@ -1899,56 +2000,56 @@ function ba(e) {
|
|
|
1899
2000
|
}
|
|
1900
2001
|
];
|
|
1901
2002
|
}
|
|
1902
|
-
function
|
|
2003
|
+
function Ua(e) {
|
|
1903
2004
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1904
|
-
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" ? (
|
|
2005
|
+
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" ? (F(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), F(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), F(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), F(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), F(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (F(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), F(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), F(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (F(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), F(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), F(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), F(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
|
|
1905
2006
|
}
|
|
1906
|
-
function
|
|
2007
|
+
function F(e, t, n) {
|
|
1907
2008
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1908
2009
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1909
2010
|
}
|
|
1910
|
-
function
|
|
2011
|
+
function Fa() {
|
|
1911
2012
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1912
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
2013
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), F(e, "M14 5h5v5"), F(e, "M19 5l-8 8"), F(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1913
2014
|
}
|
|
1914
|
-
function
|
|
1915
|
-
return e.role === "tool" && e.toolName ===
|
|
2015
|
+
function _n(e) {
|
|
2016
|
+
return e.role === "tool" && e.toolName === tn;
|
|
1916
2017
|
}
|
|
1917
|
-
function
|
|
2018
|
+
function Vt(e) {
|
|
1918
2019
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1919
2020
|
}
|
|
1920
|
-
function
|
|
2021
|
+
function za(e, t, n, o) {
|
|
1921
2022
|
const a = document.createElement("article");
|
|
1922
|
-
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(
|
|
1923
|
-
const i = document.createElement("details"), l =
|
|
2023
|
+
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(re("pluno-pa-widget__character--tool-group", o));
|
|
2024
|
+
const i = document.createElement("details"), l = Ha(e);
|
|
1924
2025
|
i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
|
|
1925
2026
|
a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
|
|
1926
2027
|
});
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
const
|
|
1930
|
-
if (
|
|
1931
|
-
const
|
|
1932
|
-
|
|
2028
|
+
const p = document.createElement("summary");
|
|
2029
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(pt());
|
|
2030
|
+
const u = document.createElement("span");
|
|
2031
|
+
if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), i.appendChild(p), e.length > 0) {
|
|
2032
|
+
const s = document.createElement("div");
|
|
2033
|
+
s.className = "pluno-pa-widget__tool-lines";
|
|
1933
2034
|
for (const b of e) {
|
|
1934
2035
|
const x = document.createElement("div");
|
|
1935
|
-
x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(
|
|
1936
|
-
const
|
|
1937
|
-
|
|
2036
|
+
x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(pt());
|
|
2037
|
+
const P = document.createElement("span");
|
|
2038
|
+
P.textContent = b.content || "Run tool", x.appendChild(P), s.appendChild(x);
|
|
1938
2039
|
}
|
|
1939
|
-
i.appendChild(
|
|
2040
|
+
i.appendChild(s);
|
|
1940
2041
|
}
|
|
1941
2042
|
return a.appendChild(i), a;
|
|
1942
2043
|
}
|
|
1943
|
-
function
|
|
2044
|
+
function lt(e) {
|
|
1944
2045
|
const t = document.createElement("article");
|
|
1945
|
-
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
|
|
2046
|
+
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(re("pluno-pa-widget__character--tool-group", e)), t;
|
|
1946
2047
|
}
|
|
1947
|
-
function
|
|
1948
|
-
const t =
|
|
1949
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
2048
|
+
function Ga(e) {
|
|
2049
|
+
const t = lt(e);
|
|
2050
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(xn()), t;
|
|
1950
2051
|
}
|
|
1951
|
-
function
|
|
2052
|
+
function xn() {
|
|
1952
2053
|
const e = document.createElement("div");
|
|
1953
2054
|
e.className = "pluno-pa-widget__status";
|
|
1954
2055
|
const t = document.createElement("span");
|
|
@@ -1956,17 +2057,17 @@ function dn() {
|
|
|
1956
2057
|
const n = document.createElement("span");
|
|
1957
2058
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1958
2059
|
}
|
|
1959
|
-
function
|
|
2060
|
+
function Ha(e) {
|
|
1960
2061
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1961
2062
|
}
|
|
1962
|
-
function
|
|
2063
|
+
function pt() {
|
|
1963
2064
|
const e = document.createElement("span");
|
|
1964
2065
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1965
2066
|
}
|
|
1966
|
-
function
|
|
1967
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
2067
|
+
function yn(e, t) {
|
|
2068
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ga() : mn());
|
|
1968
2069
|
}
|
|
1969
|
-
function
|
|
2070
|
+
function Yt(e, t) {
|
|
1970
2071
|
const n = t.replace(/\r\n/g, `
|
|
1971
2072
|
`).split(`
|
|
1972
2073
|
`);
|
|
@@ -1978,49 +2079,49 @@ function Ot(e, t) {
|
|
|
1978
2079
|
continue;
|
|
1979
2080
|
}
|
|
1980
2081
|
if (a.match(/^```(\w+)?\s*$/)) {
|
|
1981
|
-
const
|
|
2082
|
+
const u = [];
|
|
1982
2083
|
for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
|
|
1983
|
-
|
|
2084
|
+
u.push(n[o]), o += 1;
|
|
1984
2085
|
o += o < n.length ? 1 : 0;
|
|
1985
|
-
const
|
|
1986
|
-
b.textContent =
|
|
1987
|
-
`),
|
|
2086
|
+
const s = document.createElement("pre"), b = document.createElement("code");
|
|
2087
|
+
b.textContent = u.join(`
|
|
2088
|
+
`), s.appendChild(b), e.appendChild(s);
|
|
1988
2089
|
continue;
|
|
1989
2090
|
}
|
|
1990
2091
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
1991
2092
|
if (l) {
|
|
1992
|
-
const
|
|
1993
|
-
|
|
2093
|
+
const u = document.createElement(`h${l[1].length + 2}`);
|
|
2094
|
+
Me(u, l[2]), e.appendChild(u), o += 1;
|
|
1994
2095
|
continue;
|
|
1995
2096
|
}
|
|
1996
2097
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
1997
|
-
const
|
|
2098
|
+
const u = document.createElement("ul");
|
|
1998
2099
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
1999
|
-
const
|
|
2000
|
-
|
|
2100
|
+
const s = document.createElement("li");
|
|
2101
|
+
Me(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
|
|
2001
2102
|
}
|
|
2002
|
-
e.appendChild(
|
|
2103
|
+
e.appendChild(u);
|
|
2003
2104
|
continue;
|
|
2004
2105
|
}
|
|
2005
2106
|
if (/^\s*\d+\.\s+/.test(a)) {
|
|
2006
|
-
const
|
|
2107
|
+
const u = document.createElement("ol");
|
|
2007
2108
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2109
|
+
const s = document.createElement("li");
|
|
2110
|
+
Me(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
|
|
2010
2111
|
}
|
|
2011
|
-
e.appendChild(
|
|
2112
|
+
e.appendChild(u);
|
|
2012
2113
|
continue;
|
|
2013
2114
|
}
|
|
2014
|
-
const
|
|
2115
|
+
const p = [a];
|
|
2015
2116
|
for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
|
|
2016
|
-
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
}), e.appendChild(
|
|
2117
|
+
p.push(n[o]), o += 1;
|
|
2118
|
+
const c = document.createElement("p");
|
|
2119
|
+
p.forEach((u, s) => {
|
|
2120
|
+
s > 0 && c.appendChild(document.createElement("br")), Me(c, u);
|
|
2121
|
+
}), e.appendChild(c);
|
|
2021
2122
|
}
|
|
2022
2123
|
}
|
|
2023
|
-
function
|
|
2124
|
+
function Me(e, t) {
|
|
2024
2125
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
2025
2126
|
let o = 0;
|
|
2026
2127
|
for (const a of t.matchAll(n)) {
|
|
@@ -2028,19 +2129,19 @@ function ke(e, t) {
|
|
|
2028
2129
|
i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
|
|
2029
2130
|
const l = a[0];
|
|
2030
2131
|
if (l.startsWith("`")) {
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2132
|
+
const p = document.createElement("code");
|
|
2133
|
+
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
2033
2134
|
} else if (l.startsWith("**")) {
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2135
|
+
const p = document.createElement("strong");
|
|
2136
|
+
p.textContent = l.slice(2, -2), e.appendChild(p);
|
|
2036
2137
|
} else if (l.startsWith("*")) {
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2138
|
+
const p = document.createElement("em");
|
|
2139
|
+
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
2039
2140
|
} else {
|
|
2040
|
-
const
|
|
2041
|
-
if (
|
|
2042
|
-
const
|
|
2043
|
-
|
|
2141
|
+
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
2142
|
+
if (p && Wa(p[2])) {
|
|
2143
|
+
const c = document.createElement("a");
|
|
2144
|
+
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
2044
2145
|
} else
|
|
2045
2146
|
e.appendChild(document.createTextNode(l));
|
|
2046
2147
|
}
|
|
@@ -2048,7 +2149,7 @@ function ke(e, t) {
|
|
|
2048
2149
|
}
|
|
2049
2150
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
2050
2151
|
}
|
|
2051
|
-
function
|
|
2152
|
+
function Wa(e) {
|
|
2052
2153
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
2053
2154
|
return !0;
|
|
2054
2155
|
try {
|
|
@@ -2058,8 +2159,8 @@ function ya(e) {
|
|
|
2058
2159
|
return !1;
|
|
2059
2160
|
}
|
|
2060
2161
|
}
|
|
2061
|
-
function
|
|
2062
|
-
if (
|
|
2162
|
+
function Kt(e, t) {
|
|
2163
|
+
if ($a(e))
|
|
2063
2164
|
return;
|
|
2064
2165
|
const n = `
|
|
2065
2166
|
:host {
|
|
@@ -2112,7 +2213,7 @@ function Ut(e, t) {
|
|
|
2112
2213
|
--pluno-pa-accent-contrast: #fafafa;
|
|
2113
2214
|
position: fixed;
|
|
2114
2215
|
z-index: 2147483645;
|
|
2115
|
-
font-family: ${
|
|
2216
|
+
font-family: ${K.fontFamily};
|
|
2116
2217
|
font-size: 14px;
|
|
2117
2218
|
color: var(--pluno-pa-text);
|
|
2118
2219
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -2405,9 +2506,9 @@ function Ut(e, t) {
|
|
|
2405
2506
|
.pluno-pa-widget__timeline-jump:active {
|
|
2406
2507
|
transform: translateX(-50%) scale(0.98);
|
|
2407
2508
|
}
|
|
2509
|
+
.pluno-pa-widget__history,
|
|
2408
2510
|
.pluno-pa-widget__new-chat {
|
|
2409
2511
|
position: absolute;
|
|
2410
|
-
right: 14px;
|
|
2411
2512
|
bottom: 14px;
|
|
2412
2513
|
z-index: 2;
|
|
2413
2514
|
width: 36px;
|
|
@@ -2427,13 +2528,142 @@ function Ut(e, t) {
|
|
|
2427
2528
|
transform 120ms ease,
|
|
2428
2529
|
box-shadow 120ms ease;
|
|
2429
2530
|
}
|
|
2531
|
+
.pluno-pa-widget__history {
|
|
2532
|
+
right: 58px;
|
|
2533
|
+
}
|
|
2534
|
+
.pluno-pa-widget__new-chat {
|
|
2535
|
+
right: 14px;
|
|
2536
|
+
}
|
|
2537
|
+
.pluno-pa-widget__history:hover:not(:disabled),
|
|
2430
2538
|
.pluno-pa-widget__new-chat:hover:not(:disabled) {
|
|
2431
2539
|
background: var(--pluno-pa-surface);
|
|
2432
2540
|
box-shadow: 0 8px 18px rgba(24, 24, 27, 0.1);
|
|
2433
2541
|
}
|
|
2542
|
+
.pluno-pa-widget__history:active:not(:disabled),
|
|
2434
2543
|
.pluno-pa-widget__new-chat:active:not(:disabled) {
|
|
2435
2544
|
transform: scale(0.96);
|
|
2436
2545
|
}
|
|
2546
|
+
.pluno-pa-widget__history-panel {
|
|
2547
|
+
position: absolute;
|
|
2548
|
+
right: 18px;
|
|
2549
|
+
bottom: 116px;
|
|
2550
|
+
z-index: 4;
|
|
2551
|
+
display: grid;
|
|
2552
|
+
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
2553
|
+
gap: 7px;
|
|
2554
|
+
box-sizing: border-box;
|
|
2555
|
+
width: min(260px, calc(100% - 36px));
|
|
2556
|
+
max-height: min(270px, calc(100% - 170px));
|
|
2557
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
2558
|
+
border-radius: 8px;
|
|
2559
|
+
background: color-mix(in srgb, var(--pluno-pa-bg) 96%, transparent);
|
|
2560
|
+
color: var(--pluno-pa-text);
|
|
2561
|
+
box-shadow: 0 16px 36px rgba(24, 24, 27, 0.18);
|
|
2562
|
+
padding: 8px;
|
|
2563
|
+
}
|
|
2564
|
+
.pluno-pa-widget__history-header {
|
|
2565
|
+
display: flex;
|
|
2566
|
+
align-items: center;
|
|
2567
|
+
justify-content: space-between;
|
|
2568
|
+
gap: 8px;
|
|
2569
|
+
}
|
|
2570
|
+
.pluno-pa-widget__history-header strong {
|
|
2571
|
+
min-width: 0;
|
|
2572
|
+
overflow: hidden;
|
|
2573
|
+
text-overflow: ellipsis;
|
|
2574
|
+
white-space: nowrap;
|
|
2575
|
+
font-size: 12px;
|
|
2576
|
+
line-height: 1.2;
|
|
2577
|
+
}
|
|
2578
|
+
.pluno-pa-widget__history-close {
|
|
2579
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
2580
|
+
border-radius: 6px;
|
|
2581
|
+
background: var(--pluno-pa-surface);
|
|
2582
|
+
color: var(--pluno-pa-text);
|
|
2583
|
+
font: inherit;
|
|
2584
|
+
font-size: 12px;
|
|
2585
|
+
cursor: pointer;
|
|
2586
|
+
}
|
|
2587
|
+
.pluno-pa-widget__history-close {
|
|
2588
|
+
display: inline-flex;
|
|
2589
|
+
width: 24px;
|
|
2590
|
+
height: 24px;
|
|
2591
|
+
align-items: center;
|
|
2592
|
+
justify-content: center;
|
|
2593
|
+
padding: 0;
|
|
2594
|
+
}
|
|
2595
|
+
.pluno-pa-widget__history-list {
|
|
2596
|
+
display: grid;
|
|
2597
|
+
gap: 5px;
|
|
2598
|
+
align-content: start;
|
|
2599
|
+
min-height: 0;
|
|
2600
|
+
overflow: auto;
|
|
2601
|
+
}
|
|
2602
|
+
.pluno-pa-widget__history-list--center {
|
|
2603
|
+
align-content: center;
|
|
2604
|
+
justify-items: center;
|
|
2605
|
+
}
|
|
2606
|
+
.pluno-pa-widget__history-loading {
|
|
2607
|
+
justify-self: center;
|
|
2608
|
+
margin: 0;
|
|
2609
|
+
}
|
|
2610
|
+
.pluno-pa-widget__history-loading--inline {
|
|
2611
|
+
padding: 4px 0;
|
|
2612
|
+
}
|
|
2613
|
+
.pluno-pa-widget__history-item {
|
|
2614
|
+
display: grid;
|
|
2615
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
2616
|
+
gap: 3px;
|
|
2617
|
+
width: 100%;
|
|
2618
|
+
border: 1px solid var(--pluno-pa-divider);
|
|
2619
|
+
border-radius: 6px;
|
|
2620
|
+
padding: 5px 7px;
|
|
2621
|
+
background: var(--pluno-pa-surface);
|
|
2622
|
+
color: var(--pluno-pa-text);
|
|
2623
|
+
font: inherit;
|
|
2624
|
+
text-align: left;
|
|
2625
|
+
cursor: pointer;
|
|
2626
|
+
}
|
|
2627
|
+
.pluno-pa-widget__history-item:hover:not(:disabled),
|
|
2628
|
+
.pluno-pa-widget__history-item:focus-visible,
|
|
2629
|
+
.pluno-pa-widget__history-close:hover,
|
|
2630
|
+
.pluno-pa-widget__history-close:focus-visible {
|
|
2631
|
+
border-color: color-mix(in srgb, var(--pluno-pa-accent) 42%, var(--pluno-pa-divider));
|
|
2632
|
+
background: color-mix(in srgb, var(--pluno-pa-accent) 8%, var(--pluno-pa-surface));
|
|
2633
|
+
}
|
|
2634
|
+
.pluno-pa-widget__history-item span,
|
|
2635
|
+
.pluno-pa-widget__history-item time,
|
|
2636
|
+
.pluno-pa-widget__history-item small {
|
|
2637
|
+
min-width: 0;
|
|
2638
|
+
overflow: hidden;
|
|
2639
|
+
text-overflow: ellipsis;
|
|
2640
|
+
white-space: nowrap;
|
|
2641
|
+
}
|
|
2642
|
+
.pluno-pa-widget__history-item-title {
|
|
2643
|
+
font-size: 11px;
|
|
2644
|
+
font-weight: 650;
|
|
2645
|
+
line-height: 1.2;
|
|
2646
|
+
}
|
|
2647
|
+
.pluno-pa-widget__history-time {
|
|
2648
|
+
color: var(--pluno-pa-faint);
|
|
2649
|
+
font-size: 9px;
|
|
2650
|
+
line-height: 1.2;
|
|
2651
|
+
justify-self: end;
|
|
2652
|
+
}
|
|
2653
|
+
.pluno-pa-widget__history-path {
|
|
2654
|
+
grid-column: 1 / -1;
|
|
2655
|
+
}
|
|
2656
|
+
.pluno-pa-widget__history-item small,
|
|
2657
|
+
.pluno-pa-widget__history-loading,
|
|
2658
|
+
.pluno-pa-widget__history-status {
|
|
2659
|
+
color: var(--pluno-pa-muted);
|
|
2660
|
+
font-size: 10px;
|
|
2661
|
+
line-height: 1.25;
|
|
2662
|
+
}
|
|
2663
|
+
.pluno-pa-widget__history-status {
|
|
2664
|
+
margin: 0;
|
|
2665
|
+
overflow-wrap: anywhere;
|
|
2666
|
+
}
|
|
2437
2667
|
.pluno-pa-widget__timeline::-webkit-scrollbar,
|
|
2438
2668
|
.pluno-pa-widget__message--assistant pre::-webkit-scrollbar,
|
|
2439
2669
|
.pluno-pa-widget__input::-webkit-scrollbar {
|
|
@@ -2864,7 +3094,7 @@ function Ut(e, t) {
|
|
|
2864
3094
|
place-items: center;
|
|
2865
3095
|
padding: 18px;
|
|
2866
3096
|
background: rgba(24, 24, 27, 0.28);
|
|
2867
|
-
font-family: var(--pluno-pa-font, ${
|
|
3097
|
+
font-family: var(--pluno-pa-font, ${K.fontFamily});
|
|
2868
3098
|
color: var(--pluno-pa-text);
|
|
2869
3099
|
}
|
|
2870
3100
|
.pluno-pa-widget__share-dialog {
|
|
@@ -3483,6 +3713,9 @@ function Ut(e, t) {
|
|
|
3483
3713
|
.pluno-pa-widget__starter-prompt--placeholder {
|
|
3484
3714
|
visibility: hidden;
|
|
3485
3715
|
}
|
|
3716
|
+
.pluno-pa-widget__starter-prompt--loading {
|
|
3717
|
+
visibility: visible;
|
|
3718
|
+
}
|
|
3486
3719
|
.pluno-pa-widget__login {
|
|
3487
3720
|
display: inline-flex;
|
|
3488
3721
|
align-items: center;
|
|
@@ -3686,6 +3919,15 @@ function Ut(e, t) {
|
|
|
3686
3919
|
}
|
|
3687
3920
|
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button {
|
|
3688
3921
|
position: relative;
|
|
3922
|
+
border-radius: var(--pluno-pa-scribble-wobble);
|
|
3923
|
+
}
|
|
3924
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
|
|
3925
|
+
border-radius: var(--pluno-pa-scribble-wobble);
|
|
3926
|
+
}
|
|
3927
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-close,
|
|
3928
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-item {
|
|
3929
|
+
position: relative;
|
|
3930
|
+
border-radius: var(--pluno-pa-scribble-wobble);
|
|
3689
3931
|
}
|
|
3690
3932
|
.pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
|
|
3691
3933
|
position: relative;
|
|
@@ -3698,7 +3940,11 @@ function Ut(e, t) {
|
|
|
3698
3940
|
.pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
|
|
3699
3941
|
.pluno-pa-widget--scribble .pluno-pa-widget__launcher,
|
|
3700
3942
|
.pluno-pa-widget--scribble .pluno-pa-widget__send,
|
|
3943
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history,
|
|
3701
3944
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
|
|
3945
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-close,
|
|
3946
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel,
|
|
3947
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-item,
|
|
3702
3948
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
|
|
3703
3949
|
.pluno-pa-widget--scribble .pluno-pa-widget__close,
|
|
3704
3950
|
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card,
|
|
@@ -3714,7 +3960,11 @@ function Ut(e, t) {
|
|
|
3714
3960
|
.pluno-pa-widget--scribble .pluno-pa-widget__composer-inner::before,
|
|
3715
3961
|
.pluno-pa-widget--scribble .pluno-pa-widget__launcher::before,
|
|
3716
3962
|
.pluno-pa-widget--scribble .pluno-pa-widget__send::before,
|
|
3963
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history::before,
|
|
3717
3964
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
|
|
3965
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
|
|
3966
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
|
|
3967
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-item::before,
|
|
3718
3968
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
|
|
3719
3969
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::before,
|
|
3720
3970
|
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before,
|
|
@@ -3744,7 +3994,10 @@ function Ut(e, t) {
|
|
|
3744
3994
|
.pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
|
|
3745
3995
|
background: var(--pluno-pa-surface);
|
|
3746
3996
|
}
|
|
3997
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history::before,
|
|
3747
3998
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
|
|
3999
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
|
|
4000
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
|
|
3748
4001
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
|
|
3749
4002
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::before,
|
|
3750
4003
|
.pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
|
|
@@ -3769,6 +4022,7 @@ function Ut(e, t) {
|
|
|
3769
4022
|
border-color: var(--pluno-pa-accent);
|
|
3770
4023
|
}
|
|
3771
4024
|
.pluno-pa-widget--scribble .pluno-pa-widget__send,
|
|
4025
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history,
|
|
3772
4026
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
|
|
3773
4027
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
|
|
3774
4028
|
.pluno-pa-widget--scribble .pluno-pa-widget__close,
|
|
@@ -3777,6 +4031,7 @@ function Ut(e, t) {
|
|
|
3777
4031
|
border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
|
|
3778
4032
|
}
|
|
3779
4033
|
.pluno-pa-widget--scribble .pluno-pa-widget__send::after,
|
|
4034
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history::after,
|
|
3780
4035
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
|
|
3781
4036
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
|
|
3782
4037
|
.pluno-pa-widget--scribble .pluno-pa-widget__close::after,
|
|
@@ -3806,6 +4061,7 @@ function Ut(e, t) {
|
|
|
3806
4061
|
transform: rotate(-8deg);
|
|
3807
4062
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3808
4063
|
}
|
|
4064
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history::after,
|
|
3809
4065
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
|
|
3810
4066
|
transform: rotate(-10deg);
|
|
3811
4067
|
filter: url(#pluno-pa-scribble-wobble);
|
|
@@ -3822,6 +4078,7 @@ function Ut(e, t) {
|
|
|
3822
4078
|
transform: rotate(-7deg);
|
|
3823
4079
|
filter: url(#pluno-pa-scribble-wobble);
|
|
3824
4080
|
}
|
|
4081
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history::before,
|
|
3825
4082
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before {
|
|
3826
4083
|
transform: rotate(6deg);
|
|
3827
4084
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -3876,34 +4133,35 @@ function Ut(e, t) {
|
|
|
3876
4133
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3877
4134
|
}
|
|
3878
4135
|
.pluno-pa-widget--scribble .pluno-pa-widget__send svg,
|
|
4136
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__history svg,
|
|
3879
4137
|
.pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
|
|
3880
4138
|
.pluno-pa-widget--scribble .pluno-pa-widget__message-copy svg,
|
|
3881
4139
|
.pluno-pa-widget--scribble .pluno-pa-widget__close svg {
|
|
3882
4140
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3883
4141
|
}
|
|
3884
4142
|
`;
|
|
3885
|
-
if (
|
|
4143
|
+
if (qa(e, n))
|
|
3886
4144
|
return;
|
|
3887
4145
|
const o = e.ownerDocument.createElement("style");
|
|
3888
|
-
o.id =
|
|
4146
|
+
o.id = sn, o.textContent = n, e.appendChild(o), vn(e);
|
|
3889
4147
|
}
|
|
3890
|
-
function
|
|
3891
|
-
return e.getElementById(
|
|
4148
|
+
function $a(e) {
|
|
4149
|
+
return e.getElementById(sn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(dn) === "true";
|
|
3892
4150
|
}
|
|
3893
|
-
function
|
|
3894
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
4151
|
+
function vn(e) {
|
|
4152
|
+
e.host instanceof HTMLElement && e.host.setAttribute(dn, "true");
|
|
3895
4153
|
}
|
|
3896
|
-
function
|
|
4154
|
+
function qa(e, t) {
|
|
3897
4155
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3898
4156
|
return !1;
|
|
3899
4157
|
try {
|
|
3900
4158
|
const n = new CSSStyleSheet();
|
|
3901
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
4159
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], vn(e), !0;
|
|
3902
4160
|
} catch {
|
|
3903
4161
|
return !1;
|
|
3904
4162
|
}
|
|
3905
4163
|
}
|
|
3906
|
-
async function
|
|
4164
|
+
async function ja() {
|
|
3907
4165
|
return document.body ? document.body : await new Promise((e) => {
|
|
3908
4166
|
const t = new MutationObserver(() => {
|
|
3909
4167
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3911,49 +4169,49 @@ async function Sa() {
|
|
|
3911
4169
|
t.observe(document.documentElement, { childList: !0 });
|
|
3912
4170
|
});
|
|
3913
4171
|
}
|
|
3914
|
-
function
|
|
4172
|
+
function Cn(e) {
|
|
3915
4173
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3916
4174
|
}
|
|
3917
|
-
function
|
|
4175
|
+
function Va(e) {
|
|
3918
4176
|
try {
|
|
3919
|
-
const t = window.localStorage.getItem(
|
|
4177
|
+
const t = window.localStorage.getItem(Cn(e));
|
|
3920
4178
|
if (!t)
|
|
3921
|
-
return
|
|
4179
|
+
return Xt();
|
|
3922
4180
|
const n = JSON.parse(t);
|
|
3923
4181
|
return {
|
|
3924
4182
|
isOpen: n.isOpen === !0,
|
|
3925
4183
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3926
4184
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3927
|
-
launcherPosition:
|
|
3928
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
4185
|
+
launcherPosition: Za(n.launcherPosition) ? n.launcherPosition : null,
|
|
4186
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nn) : [],
|
|
3929
4187
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3930
4188
|
};
|
|
3931
4189
|
} catch {
|
|
3932
|
-
return
|
|
4190
|
+
return Xt();
|
|
3933
4191
|
}
|
|
3934
4192
|
}
|
|
3935
|
-
async function
|
|
4193
|
+
async function Ya(e) {
|
|
3936
4194
|
if (e.loadSharePromptsDisabled)
|
|
3937
4195
|
return e.loadSharePromptsDisabled();
|
|
3938
4196
|
try {
|
|
3939
|
-
return window.localStorage.getItem(
|
|
4197
|
+
return window.localStorage.getItem(on) === "true";
|
|
3940
4198
|
} catch {
|
|
3941
4199
|
return !1;
|
|
3942
4200
|
}
|
|
3943
4201
|
}
|
|
3944
|
-
function
|
|
4202
|
+
function Ka(e, t) {
|
|
3945
4203
|
if (e.persistSharePromptsDisabled) {
|
|
3946
4204
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3947
4205
|
});
|
|
3948
4206
|
return;
|
|
3949
4207
|
}
|
|
3950
4208
|
try {
|
|
3951
|
-
t && window.localStorage.setItem(
|
|
4209
|
+
t && window.localStorage.setItem(on, "true");
|
|
3952
4210
|
} catch {
|
|
3953
4211
|
return;
|
|
3954
4212
|
}
|
|
3955
4213
|
}
|
|
3956
|
-
function
|
|
4214
|
+
function Xt() {
|
|
3957
4215
|
return {
|
|
3958
4216
|
isOpen: !1,
|
|
3959
4217
|
composerValue: "",
|
|
@@ -3963,43 +4221,43 @@ function Ft() {
|
|
|
3963
4221
|
sharePromptsDisabled: !1
|
|
3964
4222
|
};
|
|
3965
4223
|
}
|
|
3966
|
-
function
|
|
4224
|
+
function Xa(e, t) {
|
|
3967
4225
|
try {
|
|
3968
|
-
window.localStorage.setItem(
|
|
4226
|
+
window.localStorage.setItem(Cn(e), JSON.stringify(t));
|
|
3969
4227
|
} catch {
|
|
3970
4228
|
return;
|
|
3971
4229
|
}
|
|
3972
4230
|
}
|
|
3973
|
-
function
|
|
4231
|
+
function Za(e) {
|
|
3974
4232
|
if (!e || typeof e != "object")
|
|
3975
4233
|
return !1;
|
|
3976
4234
|
const t = e;
|
|
3977
4235
|
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");
|
|
3978
4236
|
}
|
|
3979
|
-
const
|
|
3980
|
-
function
|
|
4237
|
+
const Zt = /* @__PURE__ */ new WeakSet();
|
|
4238
|
+
function Ja(e) {
|
|
3981
4239
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3982
4240
|
}
|
|
3983
|
-
function
|
|
4241
|
+
function Jt(e) {
|
|
3984
4242
|
const t = e.pathname.split("/");
|
|
3985
4243
|
return t[t.length - 1] ?? "";
|
|
3986
4244
|
}
|
|
3987
|
-
function
|
|
4245
|
+
function Qa(e, t) {
|
|
3988
4246
|
const n = new URL(e.src, document.baseURI);
|
|
3989
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
4247
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : Jt(n) === Jt(t);
|
|
3990
4248
|
}
|
|
3991
|
-
class
|
|
4249
|
+
class te extends EventTarget {
|
|
3992
4250
|
constructor(t, n) {
|
|
3993
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
3994
|
-
this.readyState =
|
|
3995
|
-
}), this.addPreviewListener(
|
|
4251
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(ro, () => {
|
|
4252
|
+
this.readyState = te.OPEN, this.dispatchEvent(new Event("open"));
|
|
4253
|
+
}), this.addPreviewListener(lo, (o) => {
|
|
3996
4254
|
const a = o;
|
|
3997
4255
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3998
|
-
}), this.addPreviewListener(
|
|
3999
|
-
this.readyState =
|
|
4000
|
-
}), this.addPreviewListener(
|
|
4256
|
+
}), this.addPreviewListener(po, () => {
|
|
4257
|
+
this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
4258
|
+
}), this.addPreviewListener(so, (o) => {
|
|
4001
4259
|
const a = o;
|
|
4002
|
-
this.readyState =
|
|
4260
|
+
this.readyState = te.CLOSED, this.dispatchEvent(
|
|
4003
4261
|
new CloseEvent("close", {
|
|
4004
4262
|
code: a.detail?.code ?? 1e3,
|
|
4005
4263
|
reason: a.detail?.reason ?? "",
|
|
@@ -4007,7 +4265,7 @@ class Z extends EventTarget {
|
|
|
4007
4265
|
})
|
|
4008
4266
|
), this.cleanup();
|
|
4009
4267
|
}), window.dispatchEvent(
|
|
4010
|
-
new CustomEvent(
|
|
4268
|
+
new CustomEvent(Be(oo, this.channelId), {
|
|
4011
4269
|
detail: { socketId: this.socketId, url: t }
|
|
4012
4270
|
})
|
|
4013
4271
|
);
|
|
@@ -4022,27 +4280,27 @@ class Z extends EventTarget {
|
|
|
4022
4280
|
extensions = "";
|
|
4023
4281
|
binaryType = "blob";
|
|
4024
4282
|
bufferedAmount = 0;
|
|
4025
|
-
readyState =
|
|
4026
|
-
socketId =
|
|
4283
|
+
readyState = te.CONNECTING;
|
|
4284
|
+
socketId = ei();
|
|
4027
4285
|
listeners = /* @__PURE__ */ new Map();
|
|
4028
4286
|
send(t) {
|
|
4029
|
-
if (this.readyState !==
|
|
4287
|
+
if (this.readyState !== te.OPEN)
|
|
4030
4288
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
4031
4289
|
window.dispatchEvent(
|
|
4032
|
-
new CustomEvent(
|
|
4290
|
+
new CustomEvent(Be(ao, this.channelId), {
|
|
4033
4291
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
4034
4292
|
})
|
|
4035
4293
|
);
|
|
4036
4294
|
}
|
|
4037
4295
|
close(t, n) {
|
|
4038
|
-
this.readyState !==
|
|
4039
|
-
new CustomEvent(
|
|
4296
|
+
this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
|
|
4297
|
+
new CustomEvent(Be(io, this.channelId), {
|
|
4040
4298
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
4041
4299
|
})
|
|
4042
4300
|
), this.cleanup());
|
|
4043
4301
|
}
|
|
4044
4302
|
addPreviewListener(t, n) {
|
|
4045
|
-
const o =
|
|
4303
|
+
const o = Be(t, this.channelId), a = (i) => {
|
|
4046
4304
|
i.detail?.socketId === this.socketId && n(i);
|
|
4047
4305
|
};
|
|
4048
4306
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -4053,36 +4311,36 @@ class Z extends EventTarget {
|
|
|
4053
4311
|
this.listeners.clear();
|
|
4054
4312
|
}
|
|
4055
4313
|
}
|
|
4056
|
-
function
|
|
4057
|
-
const e = window.sessionStorage.getItem(
|
|
4314
|
+
function ei() {
|
|
4315
|
+
const e = window.sessionStorage.getItem(At);
|
|
4058
4316
|
if (e)
|
|
4059
4317
|
return e;
|
|
4060
4318
|
const t = crypto.randomUUID();
|
|
4061
|
-
return window.sessionStorage.setItem(
|
|
4319
|
+
return window.sessionStorage.setItem(At, t), t;
|
|
4062
4320
|
}
|
|
4063
|
-
function
|
|
4321
|
+
function Be(e, t) {
|
|
4064
4322
|
return `${e}:${t}`;
|
|
4065
4323
|
}
|
|
4066
|
-
function
|
|
4324
|
+
function ti(e) {
|
|
4067
4325
|
const t = document.currentScript;
|
|
4068
4326
|
if (t instanceof HTMLScriptElement)
|
|
4069
4327
|
return [t];
|
|
4070
4328
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
4071
4329
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
4072
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
4330
|
+
(a) => a instanceof HTMLScriptElement && Ja(a) && Qa(a, o)
|
|
4073
4331
|
);
|
|
4074
4332
|
}
|
|
4075
|
-
function
|
|
4076
|
-
for (const t of
|
|
4077
|
-
if (
|
|
4333
|
+
function ni(e) {
|
|
4334
|
+
for (const t of ti(e)) {
|
|
4335
|
+
if (Zt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
4078
4336
|
continue;
|
|
4079
|
-
|
|
4337
|
+
Zt.add(t);
|
|
4080
4338
|
const n = t.dataset.plunoPreviewChannel;
|
|
4081
|
-
|
|
4339
|
+
No({
|
|
4082
4340
|
token: t.dataset.plunoToken,
|
|
4083
4341
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
4084
4342
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
4085
|
-
webSocketFactory: n ?
|
|
4343
|
+
webSocketFactory: n ? To(n) : void 0,
|
|
4086
4344
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
4087
4345
|
accentColor: t.dataset.plunoAccentColor,
|
|
4088
4346
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -4094,8 +4352,8 @@ function Ma(e) {
|
|
|
4094
4352
|
});
|
|
4095
4353
|
}
|
|
4096
4354
|
}
|
|
4097
|
-
|
|
4355
|
+
ni(import.meta.url);
|
|
4098
4356
|
export {
|
|
4099
|
-
|
|
4100
|
-
|
|
4357
|
+
To as createProductAgentPreviewBridgeWebSocketFactory,
|
|
4358
|
+
No as mountPlunoProductAgentWidget
|
|
4101
4359
|
};
|