@pluno/product-agent-web 0.1.45 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-widget.js +593 -577
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const t =
|
|
5
|
-
if (
|
|
1
|
+
import { PlunoProductAgent as Un } from "./product-agent-sdk.js";
|
|
2
|
+
const Fn = "#7c3aed", Ue = "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", Fe = "#2c2a1e", kt = [253, 250, 241], Lt = 3.5;
|
|
3
|
+
function tn(e) {
|
|
4
|
+
const t = nn(e);
|
|
5
|
+
if (Pt(Le(t), kt) >= Lt)
|
|
6
6
|
return t;
|
|
7
|
-
let o =
|
|
8
|
-
const a =
|
|
7
|
+
let o = Le(t);
|
|
8
|
+
const a = Le(Fe);
|
|
9
9
|
for (let i = 0; i < 6; i += 1)
|
|
10
|
-
if (o =
|
|
11
|
-
return
|
|
12
|
-
return
|
|
10
|
+
if (o = Hn(o, a, 0.22), Pt(o, kt) >= Lt)
|
|
11
|
+
return ot(o);
|
|
12
|
+
return ot(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function zn() {
|
|
15
15
|
let n = "M 280 120", o = !1, a = 0;
|
|
16
16
|
for (let i = 150; i <= 1170; i += 62) {
|
|
17
17
|
const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
|
|
@@ -19,8 +19,8 @@ function On() {
|
|
|
19
19
|
}
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t =
|
|
22
|
+
function Gn(e) {
|
|
23
|
+
const t = nn(e), n = at(Le(t));
|
|
24
24
|
return n > 0.86 ? {
|
|
25
25
|
top: "#ffffff",
|
|
26
26
|
middle: "#f6f6f6",
|
|
@@ -56,34 +56,34 @@ function Un(e) {
|
|
|
56
56
|
shadow: V(t, -0.25, -0.08)
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function nn(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()}` : Fn;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Le(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 ot([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 at([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 Pt(e, t) {
|
|
82
|
+
const n = at(e), o = at(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 Hn(e, t, n) {
|
|
86
|
+
const o = it(n);
|
|
87
87
|
return [
|
|
88
88
|
e[0] + (t[0] - e[0]) * o,
|
|
89
89
|
e[1] + (t[1] - e[1]) * o,
|
|
@@ -91,43 +91,43 @@ function Fn(e, t, n) {
|
|
|
91
91
|
];
|
|
92
92
|
}
|
|
93
93
|
function V(e, t, n) {
|
|
94
|
-
const [o, a, i] =
|
|
95
|
-
return
|
|
94
|
+
const [o, a, i] = Wn(Le(e));
|
|
95
|
+
return ot($n(o, it(a + n), it(i + t)));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Wn([e, t, n]) {
|
|
98
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
99
|
if (l === p)
|
|
100
100
|
return [0, 0, c];
|
|
101
101
|
const u = l - p, s = c > 0.5 ? u / (2 - l - p) : u / (l + p);
|
|
102
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 $n(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
|
+
Je(a, o, e + 1 / 3) * 255,
|
|
110
|
+
Je(a, o, e) * 255,
|
|
111
|
+
Je(a, o, e - 1 / 3) * 255
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Je(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 it(e) {
|
|
119
119
|
return Math.max(0, Math.min(1, e));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
function
|
|
121
|
+
const on = "suggest_share_on_socials";
|
|
122
|
+
function qn(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 !== on)
|
|
126
126
|
continue;
|
|
127
|
-
const o =
|
|
127
|
+
const o = At(e, t, "assistant");
|
|
128
128
|
if (!o)
|
|
129
129
|
return null;
|
|
130
|
-
const a =
|
|
130
|
+
const a = At(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 Hn(e) {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
const t = await
|
|
139
|
+
async function jn(e) {
|
|
140
|
+
const t = await Vn(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 At(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,18 +150,18 @@ function Lt(e, t, n) {
|
|
|
150
150
|
}
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
async function
|
|
153
|
+
async function Vn(e) {
|
|
154
154
|
return await (await fetch(e)).blob();
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
156
|
+
const Yn = "https://app.pluno.ai", Kn = "/api/product-agent/embed/active-users", Xn = 1800, Zn = 15e3, Jn = 250, Qn = 1e3, eo = 3e4;
|
|
157
|
+
function to(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
163
|
u();
|
|
164
|
-
},
|
|
164
|
+
}, ao(s)));
|
|
165
165
|
}, c = (s) => {
|
|
166
166
|
if (l(), o === null) {
|
|
167
167
|
o = s, e(s);
|
|
@@ -173,50 +173,50 @@ function Jn(e, t = {}) {
|
|
|
173
173
|
l();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
const P = Math.min(1, (performance.now() - x) /
|
|
177
|
-
o = Math.round(b + (s - b) *
|
|
178
|
-
},
|
|
176
|
+
const P = Math.min(1, (performance.now() - x) / Xn);
|
|
177
|
+
o = Math.round(b + (s - b) * io(P)), e(o), P >= 1 && (o = s, e(s), l());
|
|
178
|
+
}, Jn);
|
|
179
179
|
}, u = async () => {
|
|
180
180
|
try {
|
|
181
|
-
const s = await
|
|
181
|
+
const s = await no(t);
|
|
182
182
|
if (n)
|
|
183
183
|
return;
|
|
184
184
|
c(s.count), p(s.refreshAfterMs);
|
|
185
185
|
} catch {
|
|
186
|
-
p(
|
|
186
|
+
p(Zn);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
return u(), () => {
|
|
190
190
|
n = !0, a !== null && window.clearTimeout(a), l();
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function no(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(Kn, oo(e.backendUrl ?? Yn)).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 = Tt(o.count), i = Tt(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 Tt(e) {
|
|
208
208
|
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function oo(e) {
|
|
211
211
|
return e.endsWith("/") ? e : `${e}/`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
return Math.min(
|
|
213
|
+
function ao(e) {
|
|
214
|
+
return Math.min(eo, Math.max(Qn, e));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function io(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 an = 100, ro = "product-agent:sdk-preview-socket-connect", lo = "product-agent:sdk-preview-socket-send", po = "product-agent:sdk-preview-socket-close", so = "product-agent:sdk-preview-socket-open", co = "product-agent:sdk-preview-socket-message", uo = "product-agent:sdk-preview-socket-error", go = "product-agent:sdk-preview-socket-closed", Nt = "product-agent:sdk-preview-socket-id", ho = "data-pluno-sdk-preview-channel", mo = "product-agent:preview-diagnostic", rn = "pluno.productAgent.sharePromptsDisabled", ze = 10, bo = 10 * 1024 * 1024, ln = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), fo = Array.from(ln).join(","), wo = 3, _o = "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 nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-a
|
|
|
224
224
|
scribbleStyle: !1,
|
|
225
225
|
position: "bottom-right",
|
|
226
226
|
movableLauncher: !1
|
|
227
|
-
},
|
|
227
|
+
}, xo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', It = "pluno-pa-scribble-font", pn = 190, sn = 41, yo = 48, vo = 420, Co = 520, Eo = 0.24, So = 680, ko = 800, Lo = 0.76, z = 8, rt = 50, dn = "http://www.w3.org/2000/svg", Dt = [
|
|
228
228
|
{
|
|
229
229
|
ellipseCx: "17.5",
|
|
230
230
|
ellipseCy: "24.5",
|
|
@@ -261,12 +261,12 @@ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "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
|
|
264
|
+
], Po = 11, Ao = 13, Rt = 4, To = 10, No = 40, Io = "movable-launcher-position-v2", cn = "pluno-pa-widget-styles", un = "data-pluno-pa-widget-styles";
|
|
265
|
+
let Mt = 0;
|
|
266
|
+
function Do(e) {
|
|
267
267
|
return (t) => new te(t, e);
|
|
268
268
|
}
|
|
269
|
-
async function
|
|
269
|
+
async function Ro(e = {}) {
|
|
270
270
|
const t = {
|
|
271
271
|
launcherLabel: e.launcherLabel ?? K.launcherLabel,
|
|
272
272
|
accentColor: e.accentColor ?? K.accentColor,
|
|
@@ -314,13 +314,13 @@ async function No(e = {}) {
|
|
|
314
314
|
initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
|
|
315
315
|
});
|
|
316
316
|
const n = document.createElement("div");
|
|
317
|
-
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
|
|
317
|
+
n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(ho, t.sdkPreviewChannelId);
|
|
318
318
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
319
319
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
320
|
-
let i =
|
|
321
|
-
|
|
322
|
-
const l = await
|
|
323
|
-
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`),
|
|
320
|
+
let i = Bt(t.accentColor, t.scribbleStyle);
|
|
321
|
+
ea(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
322
|
+
const l = await Ka(), p = l.ownerDocument;
|
|
323
|
+
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Zt(o, t.accentColor), Ot(a, i, {
|
|
324
324
|
accentColor: t.accentColor,
|
|
325
325
|
colorScheme: t.colorScheme,
|
|
326
326
|
fontFamily: t.fontFamily,
|
|
@@ -331,18 +331,18 @@ async function No(e = {}) {
|
|
|
331
331
|
fontFamily: t.fontFamily,
|
|
332
332
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
333
333
|
});
|
|
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"),
|
|
335
|
-
if (!c || !s || !b || !x || !P || !k || !
|
|
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"), B = 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"), F = a.querySelector(".pluno-pa-widget__top-actions"), le = a.querySelector(".pluno-pa-widget__history"), ye = a.querySelector(".pluno-pa-widget__history-panel"), D = 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"), R = 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 || !B || !y || !C || !h || !g || !E || !F || !le || !ye || !D || !_ || !L || !G || !R || !f || !A)
|
|
336
336
|
throw new Error("Failed to mount Pluno widget");
|
|
337
337
|
if (t.movableLauncher && !u)
|
|
338
338
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
339
|
-
|
|
339
|
+
Ht(s), Ht(g);
|
|
340
340
|
let T = [], J = null;
|
|
341
341
|
const me = () => {
|
|
342
|
-
|
|
343
|
-
T = T.filter((d, S) => S !== r), me(),
|
|
342
|
+
_a(y, T, (r) => {
|
|
343
|
+
T = T.filter((d, S) => S !== r), me(), O(w.getState()), W();
|
|
344
344
|
});
|
|
345
|
-
},
|
|
345
|
+
}, kn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
346
346
|
if (!t.tokenEndpoint)
|
|
347
347
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
348
348
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -357,11 +357,11 @@ async function No(e = {}) {
|
|
|
357
357
|
if (!d.token)
|
|
358
358
|
throw new Error("Pluno token endpoint did not return a token");
|
|
359
359
|
return d.token;
|
|
360
|
-
}),
|
|
360
|
+
}), Ln = window.fetch.bind(window);
|
|
361
361
|
let w;
|
|
362
|
-
w = await
|
|
362
|
+
w = await Un.init({
|
|
363
363
|
token: t.token,
|
|
364
|
-
tokenProvider:
|
|
364
|
+
tokenProvider: kn,
|
|
365
365
|
backendUrl: t.backendUrl,
|
|
366
366
|
metadata: () => ({
|
|
367
367
|
...t.metadata ?? {},
|
|
@@ -374,82 +374,82 @@ async function No(e = {}) {
|
|
|
374
374
|
webSocketFactory: t.webSocketFactory,
|
|
375
375
|
autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
|
|
376
376
|
});
|
|
377
|
-
const pe =
|
|
378
|
-
let
|
|
377
|
+
const pe = Xa(t), He = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Pe = new Set(be);
|
|
378
|
+
let We = pe.sharePromptsDisabled || await Za(t), Q = t.movableLauncher ? pe.launcherPosition : null, ut = Q !== null, oe = null, Ae = !1, se = !1, de = {
|
|
379
379
|
enabled: !0
|
|
380
|
-
}, ce = 0,
|
|
380
|
+
}, ce = 0, gt = "", ae = !1, ee = !1, ie = [], $e = null, ve = null;
|
|
381
381
|
const q = (r, d) => {
|
|
382
382
|
de = { enabled: r, reason: d };
|
|
383
383
|
}, j = () => {
|
|
384
384
|
G.hidden = !0;
|
|
385
|
-
},
|
|
385
|
+
}, Pn = () => {
|
|
386
386
|
G.hidden = !1;
|
|
387
|
-
},
|
|
388
|
-
q(!0, r), j(),
|
|
387
|
+
}, An = (r = "jump") => {
|
|
388
|
+
q(!0, r), j(), ke(f, () => de.enabled), ce = f.scrollTop;
|
|
389
389
|
}, ue = () => {
|
|
390
|
-
if (le.hidden = t.loginRequired,
|
|
390
|
+
if (le.hidden = t.loginRequired, ye.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), D.classList.toggle(
|
|
391
391
|
"pluno-pa-widget__history-list--center",
|
|
392
392
|
ee && ie.length === 0
|
|
393
|
-
),
|
|
393
|
+
), D.replaceChildren(), ee && ie.length === 0) {
|
|
394
394
|
const r = document.createElement("p");
|
|
395
|
-
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...",
|
|
395
|
+
r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", D.appendChild(r);
|
|
396
396
|
}
|
|
397
397
|
for (const r of ie) {
|
|
398
398
|
const d = document.createElement("button");
|
|
399
399
|
d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
|
|
400
400
|
const S = document.createElement("span");
|
|
401
|
-
S.className = "pluno-pa-widget__history-item-title", S.textContent =
|
|
402
|
-
const
|
|
403
|
-
|
|
401
|
+
S.className = "pluno-pa-widget__history-item-title", S.textContent = Zo(r);
|
|
402
|
+
const M = document.createElement("time");
|
|
403
|
+
M.className = "pluno-pa-widget__history-time", M.dateTime = r.lastActiveAt, M.textContent = Qo(r.lastActiveAt, Date.now());
|
|
404
404
|
const N = document.createElement("small");
|
|
405
|
-
N.className = "pluno-pa-widget__history-path", N.textContent =
|
|
406
|
-
ae = !1,
|
|
407
|
-
}),
|
|
405
|
+
N.className = "pluno-pa-widget__history-path", N.textContent = Jo(r), d.append(S, M, N), d.addEventListener("click", () => {
|
|
406
|
+
ae = !1, ve = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), O(w.getState());
|
|
407
|
+
}), D.appendChild(d);
|
|
408
408
|
}
|
|
409
409
|
if (ee && ie.length > 0) {
|
|
410
410
|
const r = document.createElement("p");
|
|
411
|
-
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...",
|
|
411
|
+
r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", D.appendChild(r);
|
|
412
412
|
}
|
|
413
|
-
L.textContent =
|
|
414
|
-
},
|
|
413
|
+
L.textContent = ve ?? (!ee && ie.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
|
|
414
|
+
}, ht = async (r) => {
|
|
415
415
|
if (!ee) {
|
|
416
|
-
ee = !0,
|
|
416
|
+
ee = !0, ve = null, ue();
|
|
417
417
|
try {
|
|
418
418
|
const d = await w.listSessions({ cursor: r, limit: 20 });
|
|
419
|
-
ie = r ? [...ie, ...d.sessions] : d.sessions,
|
|
419
|
+
ie = r ? [...ie, ...d.sessions] : d.sessions, $e = d.nextCursor;
|
|
420
420
|
} catch (d) {
|
|
421
421
|
Y("web-sdk.widget", "Failed to load session history", {
|
|
422
422
|
message: d instanceof Error ? d.message : String(d)
|
|
423
|
-
}),
|
|
423
|
+
}), ve = _o;
|
|
424
424
|
} finally {
|
|
425
425
|
ee = !1, ue();
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
},
|
|
429
|
-
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
},
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
const d =
|
|
436
|
-
return
|
|
428
|
+
}, Tn = () => {
|
|
429
|
+
!$e || ee || D.scrollHeight - D.scrollTop - D.clientHeight <= 24 && ht($e);
|
|
430
|
+
}, Nn = () => {
|
|
431
|
+
Ae || typeof document > "u" || (Zt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
432
|
+
}, mt = new MutationObserver(Nn);
|
|
433
|
+
mt.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
434
|
+
const qe = (r = !0) => {
|
|
435
|
+
const d = lt(a, r);
|
|
436
|
+
return Ut(
|
|
437
437
|
a,
|
|
438
|
-
Q ?
|
|
438
|
+
Q ? Go(Q, d) : zo(a, t.position, d),
|
|
439
439
|
d
|
|
440
440
|
);
|
|
441
441
|
}, H = () => {
|
|
442
|
-
|
|
442
|
+
Qa(t, {
|
|
443
443
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
444
444
|
composerValue: g.value,
|
|
445
|
-
openToolGroupKeys: [...
|
|
446
|
-
launcherPosition:
|
|
447
|
-
seenShareCandidateIds: [...be].slice(-
|
|
448
|
-
sharePromptsDisabled:
|
|
445
|
+
openToolGroupKeys: [...He],
|
|
446
|
+
launcherPosition: ut ? Q : null,
|
|
447
|
+
seenShareCandidateIds: [...be].slice(-an),
|
|
448
|
+
sharePromptsDisabled: We
|
|
449
449
|
});
|
|
450
450
|
}, ge = (r, d = {}) => {
|
|
451
|
-
|
|
452
|
-
debugVersion:
|
|
451
|
+
Yo(r, {
|
|
452
|
+
debugVersion: Io,
|
|
453
453
|
launcherPosition: Q,
|
|
454
454
|
rootClasses: a.className,
|
|
455
455
|
rootStyle: {
|
|
@@ -458,75 +458,75 @@ async function No(e = {}) {
|
|
|
458
458
|
right: a.style.right,
|
|
459
459
|
bottom: a.style.bottom
|
|
460
460
|
},
|
|
461
|
-
rootRect:
|
|
462
|
-
launcherRect:
|
|
463
|
-
panelRect:
|
|
461
|
+
rootRect: Qe(a),
|
|
462
|
+
launcherRect: Qe(c),
|
|
463
|
+
panelRect: Qe(b),
|
|
464
464
|
viewport: ne(),
|
|
465
465
|
panelHidden: b.hidden,
|
|
466
466
|
closeHidden: x.hidden,
|
|
467
467
|
...d
|
|
468
468
|
});
|
|
469
|
-
},
|
|
469
|
+
}, Te = (r = !0) => {
|
|
470
470
|
if (!Q)
|
|
471
|
-
return
|
|
472
|
-
const d =
|
|
473
|
-
return
|
|
474
|
-
},
|
|
471
|
+
return Re(a, null), qe(r);
|
|
472
|
+
const d = qe(r);
|
|
473
|
+
return Re(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
|
|
474
|
+
}, bt = (r, d) => {
|
|
475
475
|
if (!r || !d) {
|
|
476
|
-
|
|
476
|
+
Vo(a);
|
|
477
477
|
return;
|
|
478
478
|
}
|
|
479
|
-
|
|
479
|
+
jo(a, {
|
|
480
480
|
x: r.x - d.x,
|
|
481
481
|
y: r.y - d.y
|
|
482
482
|
});
|
|
483
|
-
},
|
|
484
|
-
const r =
|
|
483
|
+
}, ft = () => {
|
|
484
|
+
const r = Te();
|
|
485
485
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
486
|
-
const d =
|
|
487
|
-
|
|
486
|
+
const d = Ft(a, r, t.position);
|
|
487
|
+
bt(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
|
|
488
488
|
} else Q && ge("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
489
489
|
};
|
|
490
|
-
let
|
|
490
|
+
let wt = () => {
|
|
491
491
|
};
|
|
492
|
-
window.addEventListener("resize",
|
|
492
|
+
window.addEventListener("resize", ft), t.movableLauncher && u ? (Te(), wt = Fo({
|
|
493
493
|
root: a,
|
|
494
494
|
launcher: c,
|
|
495
495
|
launcherDragHandle: u,
|
|
496
|
-
getPosition: () =>
|
|
496
|
+
getPosition: () => qe(),
|
|
497
497
|
setPosition: (r) => {
|
|
498
|
-
const d = r, S =
|
|
499
|
-
Q =
|
|
498
|
+
const d = r, S = lt(a), M = Ut(a, r, S);
|
|
499
|
+
Q = Ho(M, S), Re(a, M), ge("Dragging closed launcher", { requestedPosition: d });
|
|
500
500
|
},
|
|
501
501
|
persist: () => {
|
|
502
|
-
|
|
502
|
+
ut = !0, H(), ge("Persisted closed launcher drag position");
|
|
503
503
|
}
|
|
504
|
-
})) :
|
|
505
|
-
let
|
|
506
|
-
const
|
|
507
|
-
if (!(!t.billingStatusLoader ||
|
|
508
|
-
|
|
504
|
+
})) : Re(a, null);
|
|
505
|
+
let je = !1;
|
|
506
|
+
const _t = async () => {
|
|
507
|
+
if (!(!t.billingStatusLoader || je)) {
|
|
508
|
+
je = !0;
|
|
509
509
|
try {
|
|
510
510
|
const r = await t.billingStatusLoader();
|
|
511
|
-
|
|
511
|
+
$t(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, nt(B, t.billingStatus, w.getState().lastErrorCode), W());
|
|
512
512
|
} finally {
|
|
513
|
-
|
|
513
|
+
je = !1;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
}, he = (r = "", d = !0) => {
|
|
517
|
-
|
|
518
|
-
const S =
|
|
519
|
-
if (
|
|
520
|
-
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r,
|
|
517
|
+
_t(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
518
|
+
const S = Te(), M = Ft(a, S, t.position);
|
|
519
|
+
if (bt(M, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: M, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
|
|
520
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Se(g)), ke(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
|
|
521
521
|
return;
|
|
522
522
|
}
|
|
523
523
|
window.requestAnimationFrame(() => {
|
|
524
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r,
|
|
525
|
-
c.hidden = !0,
|
|
524
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, Se(g)), ke(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H(), oe = window.setTimeout(() => {
|
|
525
|
+
c.hidden = !0, ke(f, () => de.enabled), ce = f.scrollTop;
|
|
526
526
|
}, 220);
|
|
527
527
|
});
|
|
528
|
-
},
|
|
529
|
-
oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (
|
|
528
|
+
}, In = () => {
|
|
529
|
+
oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Te(!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(() => {
|
|
530
530
|
b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
531
531
|
}, 220);
|
|
532
532
|
};
|
|
@@ -543,25 +543,25 @@ async function No(e = {}) {
|
|
|
543
543
|
return;
|
|
544
544
|
const r = s.value;
|
|
545
545
|
he(r), s.value = "";
|
|
546
|
-
}), x.addEventListener("click",
|
|
546
|
+
}), x.addEventListener("click", In), f.addEventListener("scroll", () => {
|
|
547
547
|
f.scrollTop < ce - 1 && q(!1, "userScroll"), ce = f.scrollTop;
|
|
548
548
|
}), G.addEventListener("click", () => {
|
|
549
|
-
|
|
549
|
+
An();
|
|
550
550
|
});
|
|
551
|
-
const
|
|
551
|
+
const xt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
552
552
|
([r]) => {
|
|
553
553
|
r?.isIntersecting && (q(!0, "bottom"), j());
|
|
554
554
|
},
|
|
555
555
|
{ root: f, threshold: 0 }
|
|
556
556
|
);
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
const r =
|
|
557
|
+
xt?.observe(A);
|
|
558
|
+
const Ne = () => t.loginRequired || t.signupRequired, yt = () => {
|
|
559
|
+
const r = Ne();
|
|
560
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
561
|
}, W = () => {
|
|
562
|
-
E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled =
|
|
562
|
+
E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Ne() || X(t.billingStatus);
|
|
563
563
|
};
|
|
564
|
-
|
|
564
|
+
yt(), P.addEventListener("submit", (r) => {
|
|
565
565
|
if (r.preventDefault(), t.loginRequired) {
|
|
566
566
|
t.onLoginClick?.();
|
|
567
567
|
return;
|
|
@@ -570,45 +570,45 @@ async function No(e = {}) {
|
|
|
570
570
|
t.onSignupClick?.();
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
|
-
X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T =
|
|
573
|
+
X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W());
|
|
574
574
|
});
|
|
575
|
-
let
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
},
|
|
575
|
+
let Ce = 0;
|
|
576
|
+
const Dn = () => {
|
|
577
|
+
Ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
|
|
578
|
+
}, vt = (r) => {
|
|
579
579
|
J !== null && window.clearTimeout(J), k.textContent = r, k.hidden = !1, J = window.setTimeout(() => {
|
|
580
580
|
k.textContent = "", k.hidden = !0, J = null;
|
|
581
581
|
}, 3e3);
|
|
582
|
-
},
|
|
582
|
+
}, Rn = () => {
|
|
583
583
|
J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
|
|
584
|
-
},
|
|
584
|
+
}, Ct = async (r) => {
|
|
585
585
|
if (r.length === 0)
|
|
586
586
|
return;
|
|
587
|
-
const d = await
|
|
588
|
-
if (T.length + d.length >
|
|
589
|
-
throw new Error(`Attach up to ${
|
|
590
|
-
T = [...T, ...d], me(),
|
|
587
|
+
const d = await Ca(r);
|
|
588
|
+
if (T.length + d.length > ze)
|
|
589
|
+
throw new Error(`Attach up to ${ze} files per message.`);
|
|
590
|
+
T = [...T, ...d], me(), Rn(), W(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
|
|
591
591
|
};
|
|
592
592
|
h.addEventListener("click", () => {
|
|
593
593
|
t.loginRequired || X(t.billingStatus) || C.click();
|
|
594
594
|
}), C.addEventListener("change", () => {
|
|
595
595
|
const r = Array.from(C.files ?? []);
|
|
596
|
-
C.value = "",
|
|
597
|
-
|
|
596
|
+
C.value = "", Ct(r).catch((d) => {
|
|
597
|
+
vt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
598
598
|
message: d instanceof Error ? d.message : String(d)
|
|
599
599
|
});
|
|
600
600
|
});
|
|
601
601
|
}), a.addEventListener("dragenter", (r) => {
|
|
602
|
-
!
|
|
602
|
+
!Me(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Ce += 1, a.classList.add("pluno-pa-widget--drag-over"));
|
|
603
603
|
}), a.addEventListener("dragover", (r) => {
|
|
604
604
|
const d = r.dataTransfer;
|
|
605
|
-
!
|
|
605
|
+
!Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
|
|
606
606
|
}), a.addEventListener("dragleave", (r) => {
|
|
607
|
-
|
|
607
|
+
Me(r.dataTransfer) && (r.stopPropagation(), Ce = Math.max(0, Ce - 1), Ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
608
608
|
}), a.addEventListener("drop", (r) => {
|
|
609
609
|
const d = r.dataTransfer;
|
|
610
|
-
!
|
|
611
|
-
|
|
610
|
+
!Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Dn(), Ct(d.files).catch((S) => {
|
|
611
|
+
vt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
612
612
|
message: S instanceof Error ? S.message : String(S)
|
|
613
613
|
});
|
|
614
614
|
}));
|
|
@@ -621,36 +621,44 @@ async function No(e = {}) {
|
|
|
621
621
|
w.stop();
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
|
-
se = !0, q(!0, "send"), j(), T =
|
|
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());
|
|
624
|
+
se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W(), O(w.getState());
|
|
627
625
|
}), le.addEventListener("click", () => {
|
|
628
|
-
ae = !ae,
|
|
626
|
+
ae = !ae, ve = null, ue(), ae && ie.length === 0 && ht(null);
|
|
629
627
|
}), _.addEventListener("click", () => {
|
|
630
628
|
ae = !1, ue();
|
|
631
|
-
}),
|
|
632
|
-
|
|
629
|
+
}), D.addEventListener("scroll", Tn), g.addEventListener("input", () => {
|
|
630
|
+
Se(g), H(), W(), O(w.getState());
|
|
633
631
|
}), g.addEventListener("keydown", (r) => {
|
|
634
632
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
635
633
|
if (r.preventDefault(), t.loginRequired) {
|
|
636
634
|
t.onLoginClick?.();
|
|
637
635
|
return;
|
|
638
636
|
}
|
|
639
|
-
se = !0, q(!0, "send"), j(), T =
|
|
637
|
+
se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W(), O(w.getState());
|
|
640
638
|
}
|
|
641
639
|
}), a.addEventListener("click", (r) => {
|
|
642
640
|
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
|
|
643
|
-
}), pe.composerValue && (g.value = pe.composerValue,
|
|
644
|
-
const
|
|
645
|
-
let
|
|
641
|
+
}), pe.composerValue && (g.value = pe.composerValue, Se(g)), pe.isOpen && he(g.value, !1);
|
|
642
|
+
const Ie = () => i;
|
|
643
|
+
let Ve = w.getState().appearance !== null, De = null, Ee = null, fe = null, Et = w.getState().isThinking, we = null, Ye = null, St = () => {
|
|
646
644
|
};
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
|
|
645
|
+
const Mn = !!t.socialPostDraftHandler;
|
|
646
|
+
let _e = null;
|
|
647
|
+
const Bn = () => {
|
|
648
|
+
se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), He.clear(), g.value = "", T = [], me(), Se(g), H(), W(), g.focus(), O(w.getState());
|
|
649
|
+
}, Ke = (r) => {
|
|
650
|
+
if (!r) {
|
|
651
|
+
_e?.remove(), _e = null;
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
_e || (_e = Ge("pluno-pa-widget__new-chat", "New chat", ca(), !1), _e.addEventListener("click", Bn), F.appendChild(_e));
|
|
655
|
+
}, O = (r) => {
|
|
656
|
+
if (ue(), ct(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(B, t.billingStatus, we), t.loginRequired) {
|
|
657
|
+
Vt(
|
|
650
658
|
f,
|
|
651
659
|
E,
|
|
652
|
-
|
|
653
|
-
|
|
660
|
+
Ke,
|
|
661
|
+
Ie,
|
|
654
662
|
"Log in to use Pluno on this page.",
|
|
655
663
|
t.loginButtonLabel,
|
|
656
664
|
t.loginUrl,
|
|
@@ -659,11 +667,11 @@ async function No(e = {}) {
|
|
|
659
667
|
return;
|
|
660
668
|
}
|
|
661
669
|
if (t.signupRequired) {
|
|
662
|
-
|
|
670
|
+
Vt(
|
|
663
671
|
f,
|
|
664
672
|
E,
|
|
665
|
-
|
|
666
|
-
|
|
673
|
+
Ke,
|
|
674
|
+
Ie,
|
|
667
675
|
"Complete signup to unlock your free trial credits.",
|
|
668
676
|
t.signupButtonLabel,
|
|
669
677
|
t.signupUrl,
|
|
@@ -671,73 +679,73 @@ async function No(e = {}) {
|
|
|
671
679
|
);
|
|
672
680
|
return;
|
|
673
681
|
}
|
|
674
|
-
const d =
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
se = !1,
|
|
682
|
+
const d = Ko(r), S = d !== gt;
|
|
683
|
+
gt = d;
|
|
684
|
+
const M = se || de.enabled;
|
|
685
|
+
se = !1, Ma(
|
|
678
686
|
f,
|
|
679
687
|
A,
|
|
680
688
|
E,
|
|
681
|
-
|
|
682
|
-
|
|
689
|
+
Ke,
|
|
690
|
+
R,
|
|
683
691
|
r,
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
692
|
+
Ye,
|
|
693
|
+
Ye !== null && jt(r, g.value.trim().length > 0 || T.length > 0),
|
|
694
|
+
M,
|
|
687
695
|
() => de.enabled,
|
|
688
|
-
|
|
696
|
+
He,
|
|
689
697
|
H,
|
|
690
|
-
|
|
698
|
+
Ie,
|
|
691
699
|
(N) => {
|
|
692
700
|
se = !0, q(!0, "send"), j(), w.sendMessage(N);
|
|
693
701
|
},
|
|
694
|
-
|
|
695
|
-
dismissedCandidateIds:
|
|
696
|
-
draftingCandidateId:
|
|
697
|
-
error:
|
|
698
|
-
characterIconOptions:
|
|
702
|
+
Mn && !We ? {
|
|
703
|
+
dismissedCandidateIds: Pe,
|
|
704
|
+
draftingCandidateId: De,
|
|
705
|
+
error: Ee,
|
|
706
|
+
characterIconOptions: Ie(),
|
|
699
707
|
onSeen: (N) => {
|
|
700
708
|
be.add(N.id), H();
|
|
701
709
|
},
|
|
702
710
|
onDraft: (N) => {
|
|
703
|
-
|
|
711
|
+
On(N);
|
|
704
712
|
},
|
|
705
713
|
onDismiss: (N) => {
|
|
706
|
-
be.add(N.id),
|
|
714
|
+
be.add(N.id), Pe.add(N.id), H(), Ee = null, O(w.getState());
|
|
707
715
|
},
|
|
708
716
|
onDisable: (N) => {
|
|
709
|
-
|
|
717
|
+
We = !0, be.add(N.id), Pe.add(N.id), H(), Ja(t, !0), Ee = null, O(w.getState());
|
|
710
718
|
}
|
|
711
719
|
} : void 0
|
|
712
|
-
),
|
|
720
|
+
), M ? (ce = f.scrollTop, j()) : S && Xo(r) && Pn();
|
|
713
721
|
};
|
|
714
|
-
return
|
|
715
|
-
|
|
716
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
717
|
-
const d =
|
|
718
|
-
|
|
722
|
+
return St = to((r) => {
|
|
723
|
+
Ye = r, !Ae && jt(w.getState(), g.value.trim().length > 0 || T.length > 0) && O(w.getState());
|
|
724
|
+
}, { backendUrl: t.backendUrl, fetcher: Ln, loader: t.activeUsersLoader }), w.on("state", (r) => {
|
|
725
|
+
const d = Et && !r.isThinking;
|
|
726
|
+
Et = r.isThinking, r.appearance ? (Ve = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
|
|
719
727
|
appearance: r.appearance
|
|
720
|
-
}),
|
|
728
|
+
}), Xe(r.appearance, "agent.state.appearance")) : Ve && (Ve = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
|
|
721
729
|
fallbackAccentColor: t.accentColor,
|
|
722
730
|
fallbackColorScheme: t.colorScheme,
|
|
723
731
|
fallbackFontFamily: t.fontFamily
|
|
724
|
-
}),
|
|
725
|
-
}),
|
|
732
|
+
}), Xe({}, "agent.state.appearance-cleared")), O(r), W(), d && _t();
|
|
733
|
+
}), O(w.getState()), W(), {
|
|
726
734
|
agent: w,
|
|
727
735
|
updateAppearance: (r) => {
|
|
728
|
-
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle),
|
|
736
|
+
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Xe(r, "widgetHandle.updateAppearance");
|
|
729
737
|
},
|
|
730
738
|
updateBillingStatus: (r) => {
|
|
731
739
|
const d = r ?? null;
|
|
732
|
-
|
|
740
|
+
$t(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(
|
|
733
741
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
734
742
|
t.billingStatus,
|
|
735
743
|
we
|
|
736
744
|
), W());
|
|
737
745
|
},
|
|
738
746
|
updateAuthGate: (r) => {
|
|
739
|
-
const d =
|
|
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),
|
|
747
|
+
const d = Ne();
|
|
748
|
+
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), yt(), O(w.getState()), W(), d && !Ne() && w.connect().catch((S) => {
|
|
741
749
|
Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
|
|
742
750
|
message: S instanceof Error ? S.message : String(S)
|
|
743
751
|
});
|
|
@@ -747,57 +755,57 @@ async function No(e = {}) {
|
|
|
747
755
|
he(g.value, !1);
|
|
748
756
|
},
|
|
749
757
|
destroy: () => {
|
|
750
|
-
|
|
758
|
+
Ae || (Ae = !0, mt.disconnect(), xt?.disconnect(), window.removeEventListener("resize", ft), wt(), J !== null && window.clearTimeout(J), St(), fe?.remove(), w.destroy(), n.remove());
|
|
751
759
|
}
|
|
752
760
|
};
|
|
753
|
-
async function
|
|
754
|
-
if (!
|
|
755
|
-
|
|
761
|
+
async function On(r) {
|
|
762
|
+
if (!De) {
|
|
763
|
+
De = r.id, Ee = null, O(w.getState());
|
|
756
764
|
try {
|
|
757
765
|
if (!t.socialPostDraftHandler)
|
|
758
766
|
throw new Error("Social post drafting is not available here.");
|
|
759
767
|
const d = await t.socialPostDraftHandler(r);
|
|
760
768
|
if (!d.linkedinPost || !d.xPost)
|
|
761
769
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
762
|
-
be.add(r.id),
|
|
770
|
+
be.add(r.id), Pe.add(r.id), H(), fe?.remove(), fe = Ua(d, {
|
|
763
771
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
764
772
|
onClose: () => {
|
|
765
773
|
fe?.remove(), fe = null;
|
|
766
774
|
}
|
|
767
775
|
}), a.appendChild(fe);
|
|
768
776
|
} catch (d) {
|
|
769
|
-
|
|
777
|
+
Ee = d instanceof Error ? d.message : "Could not draft social post.";
|
|
770
778
|
} finally {
|
|
771
|
-
|
|
779
|
+
De = null, O(w.getState());
|
|
772
780
|
}
|
|
773
781
|
}
|
|
774
782
|
}
|
|
775
|
-
function
|
|
776
|
-
const S = r.accentColor ?? t.accentColor,
|
|
777
|
-
i =
|
|
783
|
+
function Xe(r, d) {
|
|
784
|
+
const S = r.accentColor ?? t.accentColor, M = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, Ze = r.scribbleStyle ?? t.scribbleStyle;
|
|
785
|
+
i = Bt(S, Ze), Ot(a, i, {
|
|
778
786
|
accentColor: S,
|
|
779
|
-
colorScheme:
|
|
787
|
+
colorScheme: M,
|
|
780
788
|
fontFamily: N,
|
|
781
|
-
scribbleStyle:
|
|
789
|
+
scribbleStyle: Ze
|
|
782
790
|
}), Y("web-sdk.widget", "Updated widget appearance", {
|
|
783
791
|
source: d,
|
|
784
792
|
inputAppearance: r,
|
|
785
793
|
appliedAccentColor: S,
|
|
786
|
-
appliedColorScheme:
|
|
794
|
+
appliedColorScheme: M,
|
|
787
795
|
appliedFontFamily: N,
|
|
788
|
-
appliedScribbleStyle:
|
|
796
|
+
appliedScribbleStyle: Ze,
|
|
789
797
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
790
798
|
});
|
|
791
799
|
}
|
|
792
800
|
}
|
|
793
|
-
function
|
|
801
|
+
function Bt(e, t) {
|
|
794
802
|
return { accentColor: e, scribbleStyle: t };
|
|
795
803
|
}
|
|
796
|
-
function
|
|
797
|
-
const t =
|
|
798
|
-
return t === null ? "#fafafa" :
|
|
804
|
+
function Mo(e) {
|
|
805
|
+
const t = Bo(e);
|
|
806
|
+
return t === null ? "#fafafa" : Oo(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
799
807
|
}
|
|
800
|
-
function
|
|
808
|
+
function Bo(e) {
|
|
801
809
|
const t = e.trim();
|
|
802
810
|
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
803
811
|
Number.parseInt(t.slice(1, 3), 16),
|
|
@@ -809,26 +817,26 @@ function Do(e) {
|
|
|
809
817
|
Number.parseInt(t[3] + t[3], 16)
|
|
810
818
|
] : null;
|
|
811
819
|
}
|
|
812
|
-
function
|
|
820
|
+
function Oo([e, t, n]) {
|
|
813
821
|
const o = (a) => {
|
|
814
822
|
const i = a / 255;
|
|
815
823
|
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
816
824
|
};
|
|
817
825
|
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
818
826
|
}
|
|
819
|
-
function
|
|
827
|
+
function Ot(e, t, n) {
|
|
820
828
|
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);
|
|
821
|
-
const o = n.scribbleStyle ?
|
|
822
|
-
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast",
|
|
829
|
+
const o = n.scribbleStyle ? tn(n.accentColor) : n.accentColor;
|
|
830
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", Mo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? xo : n.fontFamily, n.scribbleStyle && Uo(e.ownerDocument);
|
|
823
831
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
824
832
|
for (const i of a)
|
|
825
833
|
i.replaceWith(re(Array.from(i.classList).join(" "), t));
|
|
826
834
|
}
|
|
827
|
-
function
|
|
828
|
-
if (e.getElementById(
|
|
835
|
+
function Uo(e) {
|
|
836
|
+
if (e.getElementById(It))
|
|
829
837
|
return;
|
|
830
838
|
const t = e.createElement("style");
|
|
831
|
-
t.id =
|
|
839
|
+
t.id = It, t.textContent = `@font-face {
|
|
832
840
|
font-family: "Architects Daughter";
|
|
833
841
|
font-style: normal;
|
|
834
842
|
font-weight: 400;
|
|
@@ -836,7 +844,7 @@ function Mo(e) {
|
|
|
836
844
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
837
845
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
838
846
|
}
|
|
839
|
-
function
|
|
847
|
+
function Fo({
|
|
840
848
|
root: e,
|
|
841
849
|
launcher: t,
|
|
842
850
|
launcherDragHandle: n,
|
|
@@ -854,48 +862,48 @@ function Bo({
|
|
|
854
862
|
return;
|
|
855
863
|
h.preventDefault();
|
|
856
864
|
const g = h.clientX - p.x, E = h.clientY - p.y;
|
|
857
|
-
!u && Math.hypot(g, E) <
|
|
865
|
+
!u && Math.hypot(g, E) < Rt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
|
|
858
866
|
}, k = (h) => {
|
|
859
867
|
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
|
|
860
|
-
},
|
|
868
|
+
}, B = (h) => {
|
|
861
869
|
l === h.pointerId && (h.preventDefault(), b());
|
|
862
870
|
}, y = (h) => {
|
|
863
871
|
if (!s)
|
|
864
872
|
return;
|
|
865
|
-
const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <=
|
|
873
|
+
const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= Rt;
|
|
866
874
|
s = null, g && (h.preventDefault(), h.stopPropagation());
|
|
867
875
|
}, C = (h) => {
|
|
868
876
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
869
877
|
return;
|
|
870
|
-
const g = h.shiftKey ?
|
|
871
|
-
let
|
|
872
|
-
h.key === "ArrowUp" ?
|
|
878
|
+
const g = h.shiftKey ? No : To, E = o();
|
|
879
|
+
let F = null;
|
|
880
|
+
h.key === "ArrowUp" ? F = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? F = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? F = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (F = { x: E.x + g, y: E.y }), F && (h.preventDefault(), h.stopPropagation(), a(F), i());
|
|
873
881
|
};
|
|
874
|
-
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", k), t.addEventListener("pointercancel",
|
|
875
|
-
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", k), t.removeEventListener("pointercancel",
|
|
882
|
+
return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", k), t.addEventListener("pointercancel", B), t.addEventListener("click", y, !0), n.addEventListener("keydown", C), () => {
|
|
883
|
+
t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", k), t.removeEventListener("pointercancel", B), t.removeEventListener("click", y, !0), n.removeEventListener("keydown", C);
|
|
876
884
|
};
|
|
877
885
|
}
|
|
878
|
-
function
|
|
886
|
+
function lt(e, t = !0) {
|
|
879
887
|
const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
880
888
|
return {
|
|
881
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
882
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
889
|
+
width: t && a && o.width > 0 ? o.width : Math.min(pn, n.width - 36),
|
|
890
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? yo : sn
|
|
883
891
|
};
|
|
884
892
|
}
|
|
885
|
-
function
|
|
893
|
+
function gn() {
|
|
886
894
|
const e = ne();
|
|
887
895
|
return {
|
|
888
896
|
width: Math.min(
|
|
889
|
-
|
|
897
|
+
xe(e.width * Eo, vo, Co),
|
|
890
898
|
e.width - z * 2
|
|
891
899
|
),
|
|
892
900
|
height: Math.min(
|
|
893
|
-
|
|
894
|
-
e.height -
|
|
901
|
+
xe(e.height * Lo, So, ko),
|
|
902
|
+
e.height - rt - z
|
|
895
903
|
)
|
|
896
904
|
};
|
|
897
905
|
}
|
|
898
|
-
function
|
|
906
|
+
function zo(e, t, n) {
|
|
899
907
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
900
908
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
901
909
|
return { x: o, y: a };
|
|
@@ -908,73 +916,73 @@ function Oo(e, t, n) {
|
|
|
908
916
|
y: l.height - 24 - n.height
|
|
909
917
|
};
|
|
910
918
|
}
|
|
911
|
-
function
|
|
912
|
-
const o = ne(), a = z +
|
|
919
|
+
function Ut(e, t, n) {
|
|
920
|
+
const o = ne(), a = z + $o(e);
|
|
913
921
|
return {
|
|
914
|
-
x:
|
|
915
|
-
y:
|
|
922
|
+
x: xe(t.x, z, Math.max(z, o.width - n.width - z)),
|
|
923
|
+
y: xe(t.y, a, Math.max(a, o.height - n.height - z))
|
|
916
924
|
};
|
|
917
925
|
}
|
|
918
|
-
function
|
|
926
|
+
function Go(e, t) {
|
|
919
927
|
const n = ne();
|
|
920
928
|
return {
|
|
921
929
|
x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
|
|
922
930
|
y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
|
|
923
931
|
};
|
|
924
932
|
}
|
|
925
|
-
function
|
|
926
|
-
const n =
|
|
933
|
+
function Ho(e, t) {
|
|
934
|
+
const n = Wo(e, t), o = ne();
|
|
927
935
|
return {
|
|
928
936
|
anchor: n,
|
|
929
937
|
x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
|
|
930
938
|
y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
|
|
931
939
|
};
|
|
932
940
|
}
|
|
933
|
-
function
|
|
941
|
+
function Wo(e, t) {
|
|
934
942
|
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";
|
|
935
943
|
return `${i}-${l}`;
|
|
936
944
|
}
|
|
937
|
-
function
|
|
938
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
945
|
+
function $o(e) {
|
|
946
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? Ao : Po;
|
|
939
947
|
}
|
|
940
|
-
function
|
|
941
|
-
const o =
|
|
948
|
+
function Ft(e, t, n) {
|
|
949
|
+
const o = lt(e), a = gn(), i = {
|
|
942
950
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
943
951
|
y: t.y + o.height - a.height
|
|
944
952
|
};
|
|
945
|
-
return
|
|
953
|
+
return qo(i);
|
|
946
954
|
}
|
|
947
|
-
function
|
|
948
|
-
const t = ne(), n =
|
|
955
|
+
function qo(e) {
|
|
956
|
+
const t = ne(), n = gn();
|
|
949
957
|
return {
|
|
950
|
-
x:
|
|
951
|
-
y:
|
|
958
|
+
x: xe(e.x, z, Math.max(z, t.width - n.width - z)),
|
|
959
|
+
y: xe(
|
|
952
960
|
e.y,
|
|
953
|
-
|
|
954
|
-
Math.max(
|
|
961
|
+
rt,
|
|
962
|
+
Math.max(rt, t.height - n.height - z)
|
|
955
963
|
)
|
|
956
964
|
};
|
|
957
965
|
}
|
|
958
|
-
function
|
|
966
|
+
function Re(e, t) {
|
|
959
967
|
if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
|
|
960
968
|
e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
|
|
961
969
|
return;
|
|
962
970
|
}
|
|
963
971
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
964
972
|
}
|
|
965
|
-
function
|
|
973
|
+
function jo(e, t) {
|
|
966
974
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
967
975
|
}
|
|
968
|
-
function
|
|
976
|
+
function Vo(e) {
|
|
969
977
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
970
978
|
}
|
|
971
979
|
function ne() {
|
|
972
980
|
return {
|
|
973
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
974
|
-
height: window.innerHeight || document.documentElement.clientHeight ||
|
|
981
|
+
width: window.innerWidth || document.documentElement.clientWidth || pn + z * 2,
|
|
982
|
+
height: window.innerHeight || document.documentElement.clientHeight || sn + z * 2
|
|
975
983
|
};
|
|
976
984
|
}
|
|
977
|
-
function
|
|
985
|
+
function Qe(e) {
|
|
978
986
|
const t = e.getBoundingClientRect();
|
|
979
987
|
return {
|
|
980
988
|
x: Math.round(t.x),
|
|
@@ -983,7 +991,7 @@ function Ze(e) {
|
|
|
983
991
|
height: Math.round(t.height)
|
|
984
992
|
};
|
|
985
993
|
}
|
|
986
|
-
function
|
|
994
|
+
function xe(e, t, n) {
|
|
987
995
|
return Math.min(Math.max(e, t), n);
|
|
988
996
|
}
|
|
989
997
|
function Y(e, t, n) {
|
|
@@ -995,26 +1003,26 @@ function Y(e, t, n) {
|
|
|
995
1003
|
message: t,
|
|
996
1004
|
details: n
|
|
997
1005
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
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(
|
|
1006
|
+
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(mo, { detail: a }));
|
|
999
1007
|
}
|
|
1000
|
-
function
|
|
1008
|
+
function Yo(e, t) {
|
|
1001
1009
|
Y("web-sdk.widget.position", e, t);
|
|
1002
1010
|
}
|
|
1003
|
-
function
|
|
1011
|
+
function et(e, t, n) {
|
|
1004
1012
|
const o = t.value.trim();
|
|
1005
1013
|
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 })), []);
|
|
1006
1014
|
}
|
|
1007
|
-
function
|
|
1015
|
+
function Se(e) {
|
|
1008
1016
|
e.style.height = "0px";
|
|
1009
1017
|
const t = Math.max(22, Math.min(e.scrollHeight, 140));
|
|
1010
1018
|
e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
|
|
1011
1019
|
}
|
|
1012
|
-
function
|
|
1020
|
+
function ke(e, t = () => !0) {
|
|
1013
1021
|
e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
|
|
1014
1022
|
t() && (e.scrollTop = e.scrollHeight);
|
|
1015
1023
|
});
|
|
1016
1024
|
}
|
|
1017
|
-
function
|
|
1025
|
+
function Ko(e) {
|
|
1018
1026
|
const t = e.messages[e.messages.length - 1];
|
|
1019
1027
|
return [
|
|
1020
1028
|
e.messages.length,
|
|
@@ -1025,13 +1033,13 @@ function jo(e) {
|
|
|
1025
1033
|
e.lastError ?? ""
|
|
1026
1034
|
].join(":");
|
|
1027
1035
|
}
|
|
1028
|
-
function
|
|
1036
|
+
function Xo(e) {
|
|
1029
1037
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
1030
1038
|
}
|
|
1031
|
-
function
|
|
1039
|
+
function Zo(e) {
|
|
1032
1040
|
return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
|
|
1033
1041
|
}
|
|
1034
|
-
function
|
|
1042
|
+
function Jo(e) {
|
|
1035
1043
|
const t = e.currentPage;
|
|
1036
1044
|
if (typeof t?.url == "string" && t.url.trim())
|
|
1037
1045
|
try {
|
|
@@ -1042,7 +1050,7 @@ function Ko(e) {
|
|
|
1042
1050
|
}
|
|
1043
1051
|
return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
|
|
1044
1052
|
}
|
|
1045
|
-
function
|
|
1053
|
+
function Qo(e, t) {
|
|
1046
1054
|
const n = new Date(e).getTime();
|
|
1047
1055
|
if (!Number.isFinite(n))
|
|
1048
1056
|
return "now";
|
|
@@ -1058,34 +1066,36 @@ function Xo(e, t) {
|
|
|
1058
1066
|
}
|
|
1059
1067
|
return "now";
|
|
1060
1068
|
}
|
|
1061
|
-
function
|
|
1062
|
-
e.appendChild(
|
|
1069
|
+
function ea(e, t, n, o) {
|
|
1070
|
+
e.appendChild(sa()), e.appendChild(ta(t, n, o)), e.appendChild(Ge("pluno-pa-widget__close", "Close", da(16), !0)), e.appendChild(na(n));
|
|
1063
1071
|
}
|
|
1064
|
-
function
|
|
1072
|
+
function ta(e, t, n) {
|
|
1065
1073
|
const o = document.createElement("form");
|
|
1066
1074
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
1067
1075
|
const i = document.createElement("button");
|
|
1068
1076
|
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);
|
|
1069
1077
|
}
|
|
1070
|
-
o.appendChild(
|
|
1078
|
+
o.appendChild(bn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
|
|
1071
1079
|
const a = document.createElement("input");
|
|
1072
1080
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
1073
1081
|
}
|
|
1074
|
-
function
|
|
1082
|
+
function na(e) {
|
|
1075
1083
|
const t = document.createElement("section");
|
|
1076
|
-
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
|
|
1084
|
+
t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(bn("pluno-pa-widget__scribble-spirals--panel", 16));
|
|
1077
1085
|
const n = document.createElement("div");
|
|
1078
1086
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
1079
1087
|
const o = document.createElement("main");
|
|
1080
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1088
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(ia(e));
|
|
1081
1089
|
const a = document.createElement("div");
|
|
1082
1090
|
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
1083
1091
|
const i = document.createElement("div");
|
|
1084
1092
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
1085
1093
|
const l = document.createElement("button");
|
|
1086
|
-
|
|
1094
|
+
l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
|
|
1095
|
+
const p = document.createElement("div");
|
|
1096
|
+
return p.className = "pluno-pa-widget__top-actions", p.appendChild(Ge("pluno-pa-widget__history", "Recent chats", ua(), !0)), n.appendChild(p), n.appendChild(aa()), t.appendChild(n), t.appendChild(oa()), t;
|
|
1087
1097
|
}
|
|
1088
|
-
function
|
|
1098
|
+
function oa() {
|
|
1089
1099
|
const e = document.createElement("form");
|
|
1090
1100
|
e.className = "pluno-pa-widget__composer";
|
|
1091
1101
|
const t = document.createElement("div");
|
|
@@ -1097,13 +1107,13 @@ function ea() {
|
|
|
1097
1107
|
const a = document.createElement("div");
|
|
1098
1108
|
a.className = "pluno-pa-widget__composer-inner";
|
|
1099
1109
|
const i = document.createElement("input");
|
|
1100
|
-
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept =
|
|
1110
|
+
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = fo, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1101
1111
|
const l = document.createElement("button");
|
|
1102
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1112
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ha()), l.appendChild(ma()), a.appendChild(l);
|
|
1103
1113
|
const p = document.createElement("textarea");
|
|
1104
1114
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
|
|
1105
1115
|
const c = document.createElement("button");
|
|
1106
|
-
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(
|
|
1116
|
+
c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(fn()), a.appendChild(c), e.appendChild(a);
|
|
1107
1117
|
const u = document.createElement("div");
|
|
1108
1118
|
u.className = "pluno-pa-widget__composer-meta";
|
|
1109
1119
|
const s = document.createElement("a");
|
|
@@ -1111,44 +1121,44 @@ function ea() {
|
|
|
1111
1121
|
const b = document.createElement("span");
|
|
1112
1122
|
return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
|
|
1113
1123
|
}
|
|
1114
|
-
function
|
|
1124
|
+
function aa() {
|
|
1115
1125
|
const e = document.createElement("section");
|
|
1116
1126
|
e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
|
|
1117
1127
|
const t = document.createElement("div");
|
|
1118
1128
|
t.className = "pluno-pa-widget__history-header";
|
|
1119
1129
|
const n = document.createElement("strong");
|
|
1120
1130
|
n.textContent = "Recent chats";
|
|
1121
|
-
const o =
|
|
1131
|
+
const o = Ge("pluno-pa-widget__history-close", "Close recent chats", ga(), !1);
|
|
1122
1132
|
t.append(n, o);
|
|
1123
1133
|
const a = document.createElement("div");
|
|
1124
1134
|
a.className = "pluno-pa-widget__history-list";
|
|
1125
1135
|
const i = document.createElement("p");
|
|
1126
1136
|
return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
|
|
1127
1137
|
}
|
|
1128
|
-
function
|
|
1138
|
+
function ia(e) {
|
|
1129
1139
|
const t = document.createElement("div");
|
|
1130
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(
|
|
1140
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(hn()), t;
|
|
1131
1141
|
}
|
|
1132
|
-
function
|
|
1142
|
+
function hn() {
|
|
1133
1143
|
const e = document.createElement("div");
|
|
1134
1144
|
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;
|
|
1135
1145
|
}
|
|
1136
|
-
function
|
|
1146
|
+
function ra(e, t) {
|
|
1137
1147
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1138
1148
|
const n = document.createElement("span");
|
|
1139
1149
|
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`));
|
|
1140
1150
|
}
|
|
1141
1151
|
function re(e, t) {
|
|
1142
|
-
const n = `pluno-pa-character-${
|
|
1143
|
-
|
|
1144
|
-
const o = t.scribbleStyle ?
|
|
1152
|
+
const n = `pluno-pa-character-${Mt}`;
|
|
1153
|
+
Mt += 1;
|
|
1154
|
+
const o = t.scribbleStyle ? pa(t.accentColor, n) : la(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
|
|
1145
1155
|
return o.setAttribute(
|
|
1146
1156
|
"class",
|
|
1147
1157
|
a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
|
|
1148
1158
|
), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
|
|
1149
1159
|
}
|
|
1150
|
-
function
|
|
1151
|
-
const n =
|
|
1160
|
+
function la(e, t) {
|
|
1161
|
+
const n = Gn(e), o = {
|
|
1152
1162
|
boltFill: `${t}-boltFill`,
|
|
1153
1163
|
boltEdge: `${t}-boltEdge`,
|
|
1154
1164
|
boltGlow: `${t}-boltGlow`,
|
|
@@ -1159,7 +1169,7 @@ function aa(e, t) {
|
|
|
1159
1169
|
eyeShadow: `${t}-eyeShadow`,
|
|
1160
1170
|
pupilGloss: `${t}-pupilGloss`,
|
|
1161
1171
|
boltClip: `${t}-boltClip`
|
|
1162
|
-
}, a =
|
|
1172
|
+
}, a = mn(), i = m(a, "defs"), l = m(i, "linearGradient", {
|
|
1163
1173
|
id: o.boltFill,
|
|
1164
1174
|
x1: "420",
|
|
1165
1175
|
y1: "180",
|
|
@@ -1167,7 +1177,7 @@ function aa(e, t) {
|
|
|
1167
1177
|
y2: "1040",
|
|
1168
1178
|
gradientUnits: "userSpaceOnUse"
|
|
1169
1179
|
});
|
|
1170
|
-
|
|
1180
|
+
I(l, "0", n.top), I(l, "0.36", n.middle), I(l, "0.72", n.bottom), I(l, "1", n.bottom);
|
|
1171
1181
|
const p = m(i, "linearGradient", {
|
|
1172
1182
|
id: o.boltEdge,
|
|
1173
1183
|
x1: "470",
|
|
@@ -1176,28 +1186,28 @@ function aa(e, t) {
|
|
|
1176
1186
|
y2: "980",
|
|
1177
1187
|
gradientUnits: "userSpaceOnUse"
|
|
1178
1188
|
});
|
|
1179
|
-
|
|
1189
|
+
I(p, "0", n.edgeStart), I(p, "0.32", n.edgeMiddle), I(p, "0.78", n.edgeEnd), I(p, "1", n.edgeEnd);
|
|
1180
1190
|
const c = m(i, "radialGradient", {
|
|
1181
1191
|
id: o.boltGlow,
|
|
1182
1192
|
cx: "50%",
|
|
1183
1193
|
cy: "22%",
|
|
1184
1194
|
r: "82%"
|
|
1185
1195
|
});
|
|
1186
|
-
|
|
1196
|
+
I(c, "0", n.glow, "0.72"), I(c, "0.5", n.middle, "0.44"), I(c, "1", n.bottom, "0");
|
|
1187
1197
|
const u = m(i, "radialGradient", {
|
|
1188
1198
|
id: o.eyeWhite,
|
|
1189
1199
|
cx: "35%",
|
|
1190
1200
|
cy: "25%",
|
|
1191
1201
|
r: "70%"
|
|
1192
1202
|
});
|
|
1193
|
-
|
|
1203
|
+
I(u, "0", "#ffffff"), I(u, "0.72", "#ffffff"), I(u, "1", "#e5e5e5");
|
|
1194
1204
|
const s = m(i, "radialGradient", {
|
|
1195
1205
|
id: o.pupil,
|
|
1196
1206
|
cx: "42%",
|
|
1197
1207
|
cy: "38%",
|
|
1198
1208
|
r: "65%"
|
|
1199
1209
|
});
|
|
1200
|
-
|
|
1210
|
+
I(s, "0", "#2a1f10"), I(s, "0.52", "#080604"), I(s, "1", "#000000");
|
|
1201
1211
|
const b = m(i, "filter", {
|
|
1202
1212
|
id: o.softDropShadow,
|
|
1203
1213
|
x: "-18%",
|
|
@@ -1264,10 +1274,10 @@ function aa(e, t) {
|
|
|
1264
1274
|
"flood-color": "#000000",
|
|
1265
1275
|
"flood-opacity": "0.22"
|
|
1266
1276
|
});
|
|
1267
|
-
const
|
|
1268
|
-
m(
|
|
1277
|
+
const B = m(i, "clipPath", { id: o.boltClip });
|
|
1278
|
+
m(B, "path", { d: Ue });
|
|
1269
1279
|
const y = m(a, "g", { filter: $(o.softDropShadow) });
|
|
1270
|
-
m(y, "path", { d:
|
|
1280
|
+
m(y, "path", { d: Ue, fill: $(o.boltEdge) });
|
|
1271
1281
|
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
1282
|
m(y, "path", {
|
|
1273
1283
|
d: C,
|
|
@@ -1305,14 +1315,14 @@ function aa(e, t) {
|
|
|
1305
1315
|
opacity: "0.48"
|
|
1306
1316
|
});
|
|
1307
1317
|
const g = m(a, "g", { filter: $(o.eyeShadow) });
|
|
1308
|
-
return
|
|
1318
|
+
return zt(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), zt(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
|
|
1309
1319
|
}
|
|
1310
|
-
function
|
|
1311
|
-
const n =
|
|
1320
|
+
function pa(e, t) {
|
|
1321
|
+
const n = tn(e), o = {
|
|
1312
1322
|
clip: `${t}-scribbleBoltClip`,
|
|
1313
1323
|
wobble: `${t}-scribbleBoltWobble`
|
|
1314
|
-
}, a =
|
|
1315
|
-
m(l, "path", { d:
|
|
1324
|
+
}, a = mn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
|
|
1325
|
+
m(l, "path", { d: Ue });
|
|
1316
1326
|
const p = m(i, "filter", {
|
|
1317
1327
|
id: o.wobble,
|
|
1318
1328
|
x: "-10%",
|
|
@@ -1336,7 +1346,7 @@ function ia(e, t) {
|
|
|
1336
1346
|
});
|
|
1337
1347
|
const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", { "clip-path": $(o.clip) });
|
|
1338
1348
|
return m(u, "path", {
|
|
1339
|
-
d:
|
|
1349
|
+
d: zn(),
|
|
1340
1350
|
fill: "none",
|
|
1341
1351
|
stroke: n,
|
|
1342
1352
|
"stroke-width": "56",
|
|
@@ -1345,20 +1355,20 @@ function ia(e, t) {
|
|
|
1345
1355
|
opacity: "0.9",
|
|
1346
1356
|
transform: "rotate(-14 627 600)"
|
|
1347
1357
|
}), m(c, "path", {
|
|
1348
|
-
d:
|
|
1358
|
+
d: Ue,
|
|
1349
1359
|
fill: "none",
|
|
1350
|
-
stroke:
|
|
1360
|
+
stroke: Fe,
|
|
1351
1361
|
"stroke-width": "18",
|
|
1352
1362
|
"stroke-linejoin": "round"
|
|
1353
|
-
}),
|
|
1363
|
+
}), Gt(c, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), Gt(c, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
|
|
1354
1364
|
}
|
|
1355
|
-
function
|
|
1365
|
+
function mn() {
|
|
1356
1366
|
return v("svg", {
|
|
1357
|
-
xmlns:
|
|
1367
|
+
xmlns: dn,
|
|
1358
1368
|
viewBox: "0 0 1254 1254"
|
|
1359
1369
|
});
|
|
1360
1370
|
}
|
|
1361
|
-
function
|
|
1371
|
+
function zt(e, t, n, o, a, i, l, p, c) {
|
|
1362
1372
|
const u = m(e, "g", { transform: t });
|
|
1363
1373
|
m(u, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: $(c.eyeWhite) }), m(u, "ellipse", {
|
|
1364
1374
|
cx: a,
|
|
@@ -1369,7 +1379,7 @@ function Ut(e, t, n, o, a, i, l, p, c) {
|
|
|
1369
1379
|
filter: $(c.pupilGloss)
|
|
1370
1380
|
}), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
|
|
1371
1381
|
}
|
|
1372
|
-
function
|
|
1382
|
+
function Gt(e, t, n, o, a, i, l, p) {
|
|
1373
1383
|
const c = m(e, "g", { transform: t });
|
|
1374
1384
|
m(c, "ellipse", {
|
|
1375
1385
|
cx: n,
|
|
@@ -1377,26 +1387,26 @@ function Ft(e, t, n, o, a, i, l, p) {
|
|
|
1377
1387
|
rx: "73",
|
|
1378
1388
|
ry: "80",
|
|
1379
1389
|
fill: "#ffffff",
|
|
1380
|
-
stroke:
|
|
1390
|
+
stroke: Fe,
|
|
1381
1391
|
"stroke-width": "13"
|
|
1382
|
-
}), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill:
|
|
1392
|
+
}), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Fe }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
|
|
1383
1393
|
}
|
|
1384
1394
|
function m(e, t, n = {}) {
|
|
1385
1395
|
const o = v(t, n);
|
|
1386
1396
|
return e.appendChild(o), o;
|
|
1387
1397
|
}
|
|
1388
|
-
function
|
|
1398
|
+
function I(e, t, n, o) {
|
|
1389
1399
|
const a = { offset: t, "stop-color": n };
|
|
1390
1400
|
o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
|
|
1391
1401
|
}
|
|
1392
1402
|
function $(e) {
|
|
1393
1403
|
return `url(#${e})`;
|
|
1394
1404
|
}
|
|
1395
|
-
function
|
|
1405
|
+
function Ge(e, t, n, o) {
|
|
1396
1406
|
const a = document.createElement("button");
|
|
1397
1407
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1398
1408
|
}
|
|
1399
|
-
function
|
|
1409
|
+
function sa() {
|
|
1400
1410
|
const e = v("svg", {
|
|
1401
1411
|
class: "pluno-pa-widget__scribble-defs",
|
|
1402
1412
|
"aria-hidden": "true",
|
|
@@ -1404,9 +1414,9 @@ function ra() {
|
|
|
1404
1414
|
width: "0",
|
|
1405
1415
|
height: "0"
|
|
1406
1416
|
}), t = v("defs");
|
|
1407
|
-
return t.appendChild(
|
|
1417
|
+
return t.appendChild(tt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(tt("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(tt("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1408
1418
|
}
|
|
1409
|
-
function
|
|
1419
|
+
function bn(e, t) {
|
|
1410
1420
|
const n = v("svg", {
|
|
1411
1421
|
class: `pluno-pa-widget__scribble-spirals ${e}`,
|
|
1412
1422
|
viewBox: `0 0 ${t * 26} 36`,
|
|
@@ -1415,7 +1425,7 @@ function hn(e, t) {
|
|
|
1415
1425
|
focusable: "false"
|
|
1416
1426
|
});
|
|
1417
1427
|
for (let o = 0; o < t; o += 1) {
|
|
1418
|
-
const a =
|
|
1428
|
+
const a = Dt[o % Dt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
|
|
1419
1429
|
i.appendChild(
|
|
1420
1430
|
v("ellipse", {
|
|
1421
1431
|
cx: a.ellipseCx,
|
|
@@ -1439,7 +1449,7 @@ function hn(e, t) {
|
|
|
1439
1449
|
}
|
|
1440
1450
|
return n;
|
|
1441
1451
|
}
|
|
1442
|
-
function
|
|
1452
|
+
function tt(e, t, n) {
|
|
1443
1453
|
const o = v("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1444
1454
|
return o.appendChild(
|
|
1445
1455
|
v("feTurbulence", {
|
|
@@ -1476,27 +1486,27 @@ function Qe(e, t, n) {
|
|
|
1476
1486
|
})
|
|
1477
1487
|
), o;
|
|
1478
1488
|
}
|
|
1479
|
-
function
|
|
1489
|
+
function da(e) {
|
|
1480
1490
|
const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1481
1491
|
return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1482
1492
|
}
|
|
1483
|
-
function
|
|
1493
|
+
function ca() {
|
|
1484
1494
|
const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1485
1495
|
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
1496
|
}
|
|
1487
|
-
function
|
|
1497
|
+
function ua() {
|
|
1488
1498
|
const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1489
1499
|
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;
|
|
1490
1500
|
}
|
|
1491
|
-
function
|
|
1501
|
+
function ga() {
|
|
1492
1502
|
const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
|
|
1493
1503
|
return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
|
|
1494
1504
|
}
|
|
1495
|
-
function
|
|
1505
|
+
function fn() {
|
|
1496
1506
|
const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1497
1507
|
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;
|
|
1498
1508
|
}
|
|
1499
|
-
function
|
|
1509
|
+
function ha() {
|
|
1500
1510
|
const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1501
1511
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1502
1512
|
v("path", {
|
|
@@ -1504,7 +1514,7 @@ function ca() {
|
|
|
1504
1514
|
})
|
|
1505
1515
|
), e;
|
|
1506
1516
|
}
|
|
1507
|
-
function
|
|
1517
|
+
function ma() {
|
|
1508
1518
|
const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1509
1519
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1510
1520
|
v("path", {
|
|
@@ -1516,15 +1526,15 @@ function ua() {
|
|
|
1516
1526
|
})
|
|
1517
1527
|
), e;
|
|
1518
1528
|
}
|
|
1519
|
-
function
|
|
1529
|
+
function ba() {
|
|
1520
1530
|
const e = Z("0 0 24 24", 18, 18, "currentColor");
|
|
1521
1531
|
return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1522
1532
|
}
|
|
1523
|
-
function
|
|
1533
|
+
function fa() {
|
|
1524
1534
|
const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1525
1535
|
return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
|
|
1526
1536
|
}
|
|
1527
|
-
function
|
|
1537
|
+
function wa() {
|
|
1528
1538
|
const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1529
1539
|
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;
|
|
1530
1540
|
}
|
|
@@ -1539,38 +1549,38 @@ function Z(e, t, n, o, a, i) {
|
|
|
1539
1549
|
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
|
|
1540
1550
|
}
|
|
1541
1551
|
function v(e, t = {}) {
|
|
1542
|
-
const n = document.createElementNS(
|
|
1552
|
+
const n = document.createElementNS(dn, e);
|
|
1543
1553
|
for (const [o, a] of Object.entries(t))
|
|
1544
1554
|
n.setAttribute(o, a);
|
|
1545
1555
|
return n;
|
|
1546
1556
|
}
|
|
1547
|
-
function
|
|
1557
|
+
function Ht(e) {
|
|
1548
1558
|
for (const t of ["keydown", "keypress", "keyup"])
|
|
1549
1559
|
e.addEventListener(t, (n) => {
|
|
1550
1560
|
n.stopPropagation();
|
|
1551
1561
|
});
|
|
1552
1562
|
}
|
|
1553
|
-
function
|
|
1563
|
+
function _a(e, t, n) {
|
|
1554
1564
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1555
1565
|
for (const [o, a] of t.entries()) {
|
|
1556
1566
|
const i = document.createElement("div");
|
|
1557
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1567
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(xa(a));
|
|
1558
1568
|
const l = document.createElement("span");
|
|
1559
1569
|
l.textContent = a.name, i.appendChild(l);
|
|
1560
1570
|
const p = document.createElement("button");
|
|
1561
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1571
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(fa()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1562
1572
|
}
|
|
1563
1573
|
}
|
|
1564
|
-
function
|
|
1565
|
-
if (
|
|
1574
|
+
function xa(e) {
|
|
1575
|
+
if (wn(e)) {
|
|
1566
1576
|
const n = document.createElement("img");
|
|
1567
1577
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
1568
1578
|
}
|
|
1569
1579
|
const t = document.createElement("span");
|
|
1570
1580
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1571
1581
|
}
|
|
1572
|
-
function
|
|
1573
|
-
if (
|
|
1582
|
+
function ya(e) {
|
|
1583
|
+
if (wn(e)) {
|
|
1574
1584
|
const a = document.createElement("img");
|
|
1575
1585
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
1576
1586
|
}
|
|
@@ -1581,51 +1591,51 @@ function wa(e) {
|
|
|
1581
1591
|
const o = document.createElement("strong");
|
|
1582
1592
|
return o.textContent = e.name, t.append(n, o), t;
|
|
1583
1593
|
}
|
|
1584
|
-
function
|
|
1594
|
+
function wn(e) {
|
|
1585
1595
|
return e.mimeType.startsWith("image/");
|
|
1586
1596
|
}
|
|
1587
|
-
function
|
|
1597
|
+
function va(e) {
|
|
1588
1598
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1589
1599
|
}
|
|
1590
|
-
async function
|
|
1600
|
+
async function Ca(e) {
|
|
1591
1601
|
if (!e)
|
|
1592
1602
|
return [];
|
|
1593
1603
|
const t = Array.from(e);
|
|
1594
|
-
if (t.length >
|
|
1595
|
-
throw new Error(`Attach up to ${
|
|
1604
|
+
if (t.length > ze)
|
|
1605
|
+
throw new Error(`Attach up to ${ze} files per message.`);
|
|
1596
1606
|
return Promise.all(
|
|
1597
1607
|
t.map(async (n) => {
|
|
1598
|
-
const o =
|
|
1608
|
+
const o = Ea(n);
|
|
1599
1609
|
if (!o)
|
|
1600
1610
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1601
|
-
if (n.size >
|
|
1611
|
+
if (n.size > bo)
|
|
1602
1612
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1603
1613
|
if (o === "image/gif") {
|
|
1604
|
-
const a = new Uint8Array(await
|
|
1605
|
-
if (
|
|
1614
|
+
const a = new Uint8Array(await Da(n));
|
|
1615
|
+
if (ka(a))
|
|
1606
1616
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1607
1617
|
}
|
|
1608
1618
|
return {
|
|
1609
|
-
name: n.name ||
|
|
1619
|
+
name: n.name || va(o),
|
|
1610
1620
|
mimeType: o,
|
|
1611
1621
|
sizeBytes: n.size,
|
|
1612
|
-
dataUrl:
|
|
1622
|
+
dataUrl: Sa(await Ra(n), o)
|
|
1613
1623
|
};
|
|
1614
1624
|
})
|
|
1615
1625
|
);
|
|
1616
1626
|
}
|
|
1617
|
-
function
|
|
1618
|
-
if (
|
|
1627
|
+
function Ea(e) {
|
|
1628
|
+
if (ln.has(e.type))
|
|
1619
1629
|
return e.type;
|
|
1620
1630
|
const t = e.name.toLowerCase();
|
|
1621
1631
|
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;
|
|
1622
1632
|
}
|
|
1623
|
-
function
|
|
1633
|
+
function Sa(e, t) {
|
|
1624
1634
|
const n = `data:${t};base64,`;
|
|
1625
1635
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1626
1636
|
}
|
|
1627
|
-
function
|
|
1628
|
-
if (e.length < 14 || !
|
|
1637
|
+
function ka(e) {
|
|
1638
|
+
if (e.length < 14 || !La(e))
|
|
1629
1639
|
return !1;
|
|
1630
1640
|
const t = e[10];
|
|
1631
1641
|
let n = 13;
|
|
@@ -1636,7 +1646,7 @@ function Ca(e) {
|
|
|
1636
1646
|
if (n += 1, a === 59)
|
|
1637
1647
|
return !1;
|
|
1638
1648
|
if (a === 33) {
|
|
1639
|
-
n += 1, n =
|
|
1649
|
+
n += 1, n = Wt(e, n);
|
|
1640
1650
|
continue;
|
|
1641
1651
|
}
|
|
1642
1652
|
if (a !== 44)
|
|
@@ -1648,14 +1658,14 @@ function Ca(e) {
|
|
|
1648
1658
|
const i = e[n + 8];
|
|
1649
1659
|
if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
|
|
1650
1660
|
return !1;
|
|
1651
|
-
n += 1, n =
|
|
1661
|
+
n += 1, n = Wt(e, n);
|
|
1652
1662
|
}
|
|
1653
1663
|
return !1;
|
|
1654
1664
|
}
|
|
1655
|
-
function
|
|
1665
|
+
function La(e) {
|
|
1656
1666
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1657
1667
|
}
|
|
1658
|
-
function
|
|
1668
|
+
function Wt(e, t) {
|
|
1659
1669
|
for (; t < e.length; ) {
|
|
1660
1670
|
const n = e[t];
|
|
1661
1671
|
if (t += 1, n === 0)
|
|
@@ -1664,63 +1674,63 @@ function Gt(e, t) {
|
|
|
1664
1674
|
}
|
|
1665
1675
|
return t;
|
|
1666
1676
|
}
|
|
1667
|
-
function
|
|
1677
|
+
function Me(e) {
|
|
1668
1678
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1669
1679
|
}
|
|
1670
|
-
function
|
|
1671
|
-
if (!e || !
|
|
1680
|
+
function nt(e, t, n = null) {
|
|
1681
|
+
if (!e || !pt(t, n)) {
|
|
1672
1682
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1673
1683
|
return;
|
|
1674
1684
|
}
|
|
1675
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) ||
|
|
1685
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || ct(n) ? e.appendChild(Pa(t, n)) : _n(t) && e.appendChild(Aa(t));
|
|
1676
1686
|
}
|
|
1677
|
-
function
|
|
1687
|
+
function Pa(e, t) {
|
|
1678
1688
|
const n = document.createElement("div");
|
|
1679
1689
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1680
1690
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
1681
1691
|
a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
|
|
1682
1692
|
const i = document.createElement("span");
|
|
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(
|
|
1693
|
+
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(xn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1684
1694
|
}
|
|
1685
|
-
function
|
|
1695
|
+
function Aa(e) {
|
|
1686
1696
|
const t = document.createElement("div");
|
|
1687
1697
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1688
1698
|
const n = document.createElement("strong");
|
|
1689
1699
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1690
1700
|
const o = document.createElement("span");
|
|
1691
|
-
return o.textContent =
|
|
1701
|
+
return o.textContent = Na(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(xn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1692
1702
|
}
|
|
1693
|
-
function
|
|
1694
|
-
return e !== null && (X(e) ||
|
|
1703
|
+
function pt(e, t) {
|
|
1704
|
+
return e !== null && (X(e) || _n(e) || ct(t));
|
|
1695
1705
|
}
|
|
1696
|
-
function
|
|
1697
|
-
return
|
|
1706
|
+
function $t(e, t, n) {
|
|
1707
|
+
return pt(t, n) || Ta(t) ? !0 : !pt(e, n);
|
|
1698
1708
|
}
|
|
1699
|
-
function
|
|
1709
|
+
function Ta(e) {
|
|
1700
1710
|
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
|
|
1701
1711
|
}
|
|
1702
1712
|
function X(e) {
|
|
1703
1713
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1704
1714
|
}
|
|
1705
|
-
function
|
|
1715
|
+
function ct(e) {
|
|
1706
1716
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1707
1717
|
}
|
|
1708
|
-
function
|
|
1718
|
+
function _n(e) {
|
|
1709
1719
|
return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1710
1720
|
}
|
|
1711
|
-
function
|
|
1712
|
-
return e.creditsRemaining === null ? null : `${
|
|
1721
|
+
function Na(e) {
|
|
1722
|
+
return e.creditsRemaining === null ? null : `${Ia(e.creditsRemaining)} credits left`;
|
|
1713
1723
|
}
|
|
1714
|
-
function
|
|
1724
|
+
function Ia(e) {
|
|
1715
1725
|
return new Intl.NumberFormat("en-US", {
|
|
1716
1726
|
maximumFractionDigits: 0
|
|
1717
1727
|
}).format(Math.ceil(e));
|
|
1718
1728
|
}
|
|
1719
|
-
function
|
|
1729
|
+
function xn(e, t, n) {
|
|
1720
1730
|
const o = document.createElement("div");
|
|
1721
|
-
return o.className = n, o.appendChild(
|
|
1731
|
+
return o.className = n, o.appendChild(qt(t, e.pricingUrl)), o.appendChild(qt("Earn credits", e.earnCreditsUrl)), o;
|
|
1722
1732
|
}
|
|
1723
|
-
function
|
|
1733
|
+
function qt(e, t) {
|
|
1724
1734
|
const n = document.createElement("button");
|
|
1725
1735
|
if (n.type = "button", e === "Earn credits") {
|
|
1726
1736
|
const o = document.createElement("span");
|
|
@@ -1731,7 +1741,7 @@ function Wt(e, t) {
|
|
|
1731
1741
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1732
1742
|
}), n;
|
|
1733
1743
|
}
|
|
1734
|
-
function
|
|
1744
|
+
function Da(e) {
|
|
1735
1745
|
return new Promise((t, n) => {
|
|
1736
1746
|
const o = new FileReader();
|
|
1737
1747
|
o.addEventListener("load", () => {
|
|
@@ -1745,7 +1755,7 @@ function Ta(e) {
|
|
|
1745
1755
|
}), o.readAsArrayBuffer(e);
|
|
1746
1756
|
});
|
|
1747
1757
|
}
|
|
1748
|
-
function
|
|
1758
|
+
function Ra(e) {
|
|
1749
1759
|
return new Promise((t, n) => {
|
|
1750
1760
|
const o = new FileReader();
|
|
1751
1761
|
o.addEventListener("load", () => {
|
|
@@ -1759,103 +1769,103 @@ function Na(e) {
|
|
|
1759
1769
|
}), o.readAsDataURL(e);
|
|
1760
1770
|
});
|
|
1761
1771
|
}
|
|
1762
|
-
function
|
|
1763
|
-
return e.messages.filter((o) => !
|
|
1772
|
+
function jt(e, t) {
|
|
1773
|
+
return e.messages.filter((o) => !yn(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1764
1774
|
}
|
|
1765
|
-
function
|
|
1766
|
-
const
|
|
1767
|
-
e.replaceChildren(),
|
|
1775
|
+
function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
|
|
1776
|
+
const B = [...i.messages], y = B.filter((_) => !yn(_)), C = e.scrollTop;
|
|
1777
|
+
e.replaceChildren(), Cn(n, i.isThinking), a.hidden = !p, p && l !== null && ra(a, l);
|
|
1768
1778
|
const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1769
|
-
if (o
|
|
1779
|
+
if (o(h), y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1770
1780
|
const _ = document.createElement("div");
|
|
1771
1781
|
_.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1772
1782
|
const L = document.createElement("div");
|
|
1773
1783
|
L.className = "pluno-pa-widget__empty-hero";
|
|
1774
1784
|
const G = re("pluno-pa-widget__character--empty", x());
|
|
1775
|
-
L.appendChild(G), _.appendChild(L), _.appendChild(
|
|
1776
|
-
const
|
|
1777
|
-
if (
|
|
1785
|
+
L.appendChild(G), _.appendChild(L), _.appendChild(hn());
|
|
1786
|
+
const R = document.createElement("div");
|
|
1787
|
+
if (R.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 && R.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1778
1788
|
for (const f of i.starterPrompts) {
|
|
1779
1789
|
const A = document.createElement("button");
|
|
1780
1790
|
A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
|
|
1781
1791
|
P(f);
|
|
1782
|
-
}),
|
|
1792
|
+
}), R.appendChild(A);
|
|
1783
1793
|
}
|
|
1784
1794
|
else if (i.starterPromptsLoading) {
|
|
1785
1795
|
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...",
|
|
1796
|
+
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...", R.appendChild(f);
|
|
1787
1797
|
} else
|
|
1788
|
-
for (let f = 0; f <
|
|
1798
|
+
for (let f = 0; f < wo; f += 1) {
|
|
1789
1799
|
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 = "",
|
|
1800
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", R.appendChild(A);
|
|
1791
1801
|
}
|
|
1792
|
-
_.appendChild(
|
|
1802
|
+
_.appendChild(R), e.appendChild(_), e.appendChild(t);
|
|
1793
1803
|
return;
|
|
1794
1804
|
}
|
|
1795
|
-
let g = null, E = null,
|
|
1805
|
+
let g = null, E = null, F = [];
|
|
1796
1806
|
const le = () => {
|
|
1797
|
-
if (
|
|
1807
|
+
if (F.length === 0)
|
|
1798
1808
|
return !1;
|
|
1799
|
-
const _ =
|
|
1800
|
-
return e.appendChild(_), g = null, E = _,
|
|
1809
|
+
const _ = Wa(F, s, b, x());
|
|
1810
|
+
return e.appendChild(_), g = null, E = _, F = [], !0;
|
|
1801
1811
|
};
|
|
1802
1812
|
for (let _ = 0; _ < y.length; _ += 1) {
|
|
1803
1813
|
const L = y[_];
|
|
1804
1814
|
if (L.role === "tool") {
|
|
1805
|
-
|
|
1815
|
+
F.push(L);
|
|
1806
1816
|
continue;
|
|
1807
1817
|
}
|
|
1808
1818
|
if (L.role === "system")
|
|
1809
1819
|
continue;
|
|
1810
|
-
const G = le(),
|
|
1820
|
+
const G = le(), R = Kt(L.content);
|
|
1811
1821
|
if (L.role === "assistant" && !G) {
|
|
1812
|
-
const T =
|
|
1822
|
+
const T = st(x());
|
|
1813
1823
|
e.appendChild(T), g = null, E = T;
|
|
1814
1824
|
}
|
|
1815
1825
|
const f = document.createElement("div");
|
|
1816
|
-
f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ?
|
|
1826
|
+
f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Xt(f, R) : f.textContent = R, L.role === "user" && L.attachments?.length && f.appendChild(Ba(L.attachments));
|
|
1817
1827
|
const A = document.createElement("div");
|
|
1818
|
-
A.className = "pluno-pa-widget__message-actions", A.appendChild(
|
|
1828
|
+
A.className = "pluno-pa-widget__message-actions", A.appendChild(Yt(R)), f.appendChild(A), e.appendChild(f), g = f, E = null;
|
|
1819
1829
|
}
|
|
1820
|
-
const
|
|
1830
|
+
const ye = le();
|
|
1821
1831
|
if (i.assistantDraft) {
|
|
1822
|
-
if (!
|
|
1823
|
-
const
|
|
1824
|
-
e.appendChild(
|
|
1832
|
+
if (!ye) {
|
|
1833
|
+
const R = st(x());
|
|
1834
|
+
e.appendChild(R), g = null, E = R;
|
|
1825
1835
|
}
|
|
1826
|
-
const _ =
|
|
1827
|
-
L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant",
|
|
1836
|
+
const _ = Kt(i.assistantDraft), L = document.createElement("div");
|
|
1837
|
+
L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Xt(L, _);
|
|
1828
1838
|
const G = document.createElement("div");
|
|
1829
|
-
G.className = "pluno-pa-widget__message-actions", G.appendChild(
|
|
1839
|
+
G.className = "pluno-pa-widget__message-actions", G.appendChild(Yt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
|
|
1830
1840
|
}
|
|
1831
1841
|
if (i.isThinking && !i.assistantDraft)
|
|
1832
|
-
if (
|
|
1833
|
-
const _ =
|
|
1842
|
+
if (ye) {
|
|
1843
|
+
const _ = vn();
|
|
1834
1844
|
e.appendChild(_), g = null, E = _;
|
|
1835
1845
|
} else {
|
|
1836
|
-
const _ =
|
|
1846
|
+
const _ = $a(x());
|
|
1837
1847
|
e.appendChild(_), g = null, E = _;
|
|
1838
1848
|
}
|
|
1839
1849
|
if (i.lastError) {
|
|
1840
1850
|
const _ = document.createElement("div");
|
|
1841
1851
|
_.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
|
|
1842
1852
|
}
|
|
1843
|
-
const
|
|
1844
|
-
if (k &&
|
|
1845
|
-
const _ =
|
|
1846
|
-
isDrafting: k.draftingCandidateId ===
|
|
1853
|
+
const D = k && !i.isThinking ? qn(B) : null;
|
|
1854
|
+
if (k && D && !k.dismissedCandidateIds.has(D.id)) {
|
|
1855
|
+
const _ = Oa(D, {
|
|
1856
|
+
isDrafting: k.draftingCandidateId === D.id,
|
|
1847
1857
|
error: k.error,
|
|
1848
1858
|
characterIconOptions: k.characterIconOptions,
|
|
1849
1859
|
onDraft: k.onDraft,
|
|
1850
1860
|
onDismiss: k.onDismiss,
|
|
1851
1861
|
onDisable: k.onDisable
|
|
1852
1862
|
});
|
|
1853
|
-
e.appendChild(_), k.onSeen(
|
|
1863
|
+
e.appendChild(_), k.onSeen(D), g = null, E = _;
|
|
1854
1864
|
}
|
|
1855
|
-
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), E?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ?
|
|
1865
|
+
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), E?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? ke(e, u) : e.scrollTop = C;
|
|
1856
1866
|
}
|
|
1857
|
-
function
|
|
1858
|
-
e.replaceChildren(),
|
|
1867
|
+
function Vt(e, t, n, o, a, i, l, p) {
|
|
1868
|
+
e.replaceChildren(), Cn(t, !1), t.disabled = !0, n(!1);
|
|
1859
1869
|
const c = document.createElement("div");
|
|
1860
1870
|
c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
1861
1871
|
const u = re("pluno-pa-widget__character--empty", o());
|
|
@@ -1870,20 +1880,20 @@ function qt(e, t, n, o, a, i, l, p) {
|
|
|
1870
1880
|
}
|
|
1871
1881
|
e.appendChild(c);
|
|
1872
1882
|
}
|
|
1873
|
-
function
|
|
1883
|
+
function Ba(e) {
|
|
1874
1884
|
const t = document.createElement("div");
|
|
1875
1885
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1876
1886
|
for (const n of e)
|
|
1877
|
-
t.appendChild(
|
|
1887
|
+
t.appendChild(ya(n));
|
|
1878
1888
|
return t;
|
|
1879
1889
|
}
|
|
1880
|
-
function
|
|
1890
|
+
function Yt(e) {
|
|
1881
1891
|
const t = document.createElement("button");
|
|
1882
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1892
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(wa()), t.addEventListener("click", (n) => {
|
|
1883
1893
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1884
1894
|
}), t;
|
|
1885
1895
|
}
|
|
1886
|
-
function
|
|
1896
|
+
function Oa(e, t) {
|
|
1887
1897
|
const n = document.createElement("article");
|
|
1888
1898
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1889
1899
|
const o = document.createElement("div");
|
|
@@ -1905,7 +1915,7 @@ function Ra(e, t) {
|
|
|
1905
1915
|
const u = document.createElement("button");
|
|
1906
1916
|
if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
|
|
1907
1917
|
t.onDraft(e);
|
|
1908
|
-
}), t.isDrafting ? (u.appendChild(
|
|
1918
|
+
}), t.isDrafting ? (u.appendChild(dt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
|
|
1909
1919
|
p.appendChild(c);
|
|
1910
1920
|
else {
|
|
1911
1921
|
const s = document.createElement("button");
|
|
@@ -1919,7 +1929,7 @@ function Ra(e, t) {
|
|
|
1919
1929
|
}
|
|
1920
1930
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1921
1931
|
}
|
|
1922
|
-
function
|
|
1932
|
+
function Ua(e, t) {
|
|
1923
1933
|
const n = document.createElement("div");
|
|
1924
1934
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
|
|
1925
1935
|
y.target === n && t.onClose();
|
|
@@ -1938,9 +1948,9 @@ function Ma(e, t) {
|
|
|
1938
1948
|
u.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1939
1949
|
const s = document.createElement("strong");
|
|
1940
1950
|
s.textContent = "1) Copy Screenshot", u.appendChild(s);
|
|
1941
|
-
const b =
|
|
1951
|
+
const b = Fa("Copy Screenshot", async () => {
|
|
1942
1952
|
try {
|
|
1943
|
-
return await
|
|
1953
|
+
return await jn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1944
1954
|
} catch {
|
|
1945
1955
|
return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
|
|
1946
1956
|
}
|
|
@@ -1958,29 +1968,29 @@ function Ma(e, t) {
|
|
|
1958
1968
|
P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
|
|
1959
1969
|
const k = document.createElement("p");
|
|
1960
1970
|
k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
for (const y of
|
|
1971
|
+
const B = document.createElement("footer");
|
|
1972
|
+
B.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1973
|
+
for (const y of za(e)) {
|
|
1964
1974
|
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(
|
|
1975
|
+
C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Ga(y.id)), B.appendChild(C);
|
|
1966
1976
|
}
|
|
1967
|
-
if (x.appendChild(
|
|
1977
|
+
if (x.appendChild(B), o.appendChild(x), t.socialPostRewardsUrl) {
|
|
1968
1978
|
const y = document.createElement("div");
|
|
1969
1979
|
y.className = "pluno-pa-widget__share-dialog-step";
|
|
1970
1980
|
const C = document.createElement("strong");
|
|
1971
1981
|
C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
|
|
1972
1982
|
const h = document.createElement("a");
|
|
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(
|
|
1983
|
+
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(Ha()), y.appendChild(h), o.appendChild(y);
|
|
1974
1984
|
}
|
|
1975
1985
|
return n.appendChild(o), n;
|
|
1976
1986
|
}
|
|
1977
|
-
function
|
|
1987
|
+
function Fa(e, t) {
|
|
1978
1988
|
const n = document.createElement("button");
|
|
1979
1989
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1980
1990
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1981
1991
|
}), n;
|
|
1982
1992
|
}
|
|
1983
|
-
function
|
|
1993
|
+
function za(e) {
|
|
1984
1994
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1985
1995
|
return [
|
|
1986
1996
|
{
|
|
@@ -2000,40 +2010,40 @@ function Oa(e) {
|
|
|
2000
2010
|
}
|
|
2001
2011
|
];
|
|
2002
2012
|
}
|
|
2003
|
-
function
|
|
2013
|
+
function Ga(e) {
|
|
2004
2014
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
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" ? (
|
|
2015
|
+
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" ? (U(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), U(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"), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(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"), U(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (U(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), U(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), U(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (U(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"), U(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"), U(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"), U(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);
|
|
2006
2016
|
}
|
|
2007
|
-
function
|
|
2017
|
+
function U(e, t, n) {
|
|
2008
2018
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2009
2019
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
2010
2020
|
}
|
|
2011
|
-
function
|
|
2021
|
+
function Ha() {
|
|
2012
2022
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2013
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
2023
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), U(e, "M14 5h5v5"), U(e, "M19 5l-8 8"), U(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
2014
2024
|
}
|
|
2015
|
-
function
|
|
2016
|
-
return e.role === "tool" && e.toolName ===
|
|
2025
|
+
function yn(e) {
|
|
2026
|
+
return e.role === "tool" && e.toolName === on;
|
|
2017
2027
|
}
|
|
2018
|
-
function
|
|
2028
|
+
function Kt(e) {
|
|
2019
2029
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
2020
2030
|
}
|
|
2021
|
-
function
|
|
2031
|
+
function Wa(e, t, n, o) {
|
|
2022
2032
|
const a = document.createElement("article");
|
|
2023
2033
|
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 =
|
|
2034
|
+
const i = document.createElement("details"), l = qa(e);
|
|
2025
2035
|
i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
|
|
2026
2036
|
a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
|
|
2027
2037
|
});
|
|
2028
2038
|
const p = document.createElement("summary");
|
|
2029
|
-
p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(
|
|
2039
|
+
p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(dt());
|
|
2030
2040
|
const u = document.createElement("span");
|
|
2031
2041
|
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
2042
|
const s = document.createElement("div");
|
|
2033
2043
|
s.className = "pluno-pa-widget__tool-lines";
|
|
2034
2044
|
for (const b of e) {
|
|
2035
2045
|
const x = document.createElement("div");
|
|
2036
|
-
x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(
|
|
2046
|
+
x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(dt());
|
|
2037
2047
|
const P = document.createElement("span");
|
|
2038
2048
|
P.textContent = b.content || "Run tool", x.appendChild(P), s.appendChild(x);
|
|
2039
2049
|
}
|
|
@@ -2041,15 +2051,15 @@ function za(e, t, n, o) {
|
|
|
2041
2051
|
}
|
|
2042
2052
|
return a.appendChild(i), a;
|
|
2043
2053
|
}
|
|
2044
|
-
function
|
|
2054
|
+
function st(e) {
|
|
2045
2055
|
const t = document.createElement("article");
|
|
2046
2056
|
return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(re("pluno-pa-widget__character--tool-group", e)), t;
|
|
2047
2057
|
}
|
|
2048
|
-
function
|
|
2049
|
-
const t =
|
|
2050
|
-
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(
|
|
2058
|
+
function $a(e) {
|
|
2059
|
+
const t = st(e);
|
|
2060
|
+
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(vn()), t;
|
|
2051
2061
|
}
|
|
2052
|
-
function
|
|
2062
|
+
function vn() {
|
|
2053
2063
|
const e = document.createElement("div");
|
|
2054
2064
|
e.className = "pluno-pa-widget__status";
|
|
2055
2065
|
const t = document.createElement("span");
|
|
@@ -2057,17 +2067,17 @@ function xn() {
|
|
|
2057
2067
|
const n = document.createElement("span");
|
|
2058
2068
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
2059
2069
|
}
|
|
2060
|
-
function
|
|
2070
|
+
function qa(e) {
|
|
2061
2071
|
return `tools:${e[0]?.id ?? ""}`;
|
|
2062
2072
|
}
|
|
2063
|
-
function
|
|
2073
|
+
function dt() {
|
|
2064
2074
|
const e = document.createElement("span");
|
|
2065
2075
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
2066
2076
|
}
|
|
2067
|
-
function
|
|
2068
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
2077
|
+
function Cn(e, t) {
|
|
2078
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ba() : fn());
|
|
2069
2079
|
}
|
|
2070
|
-
function
|
|
2080
|
+
function Xt(e, t) {
|
|
2071
2081
|
const n = t.replace(/\r\n/g, `
|
|
2072
2082
|
`).split(`
|
|
2073
2083
|
`);
|
|
@@ -2091,14 +2101,14 @@ function Yt(e, t) {
|
|
|
2091
2101
|
const l = a.match(/^(#{1,3})\s+(.+)$/);
|
|
2092
2102
|
if (l) {
|
|
2093
2103
|
const u = document.createElement(`h${l[1].length + 2}`);
|
|
2094
|
-
|
|
2104
|
+
Be(u, l[2]), e.appendChild(u), o += 1;
|
|
2095
2105
|
continue;
|
|
2096
2106
|
}
|
|
2097
2107
|
if (/^\s*[-*+]\s+/.test(a)) {
|
|
2098
2108
|
const u = document.createElement("ul");
|
|
2099
2109
|
for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
|
|
2100
2110
|
const s = document.createElement("li");
|
|
2101
|
-
|
|
2111
|
+
Be(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
|
|
2102
2112
|
}
|
|
2103
2113
|
e.appendChild(u);
|
|
2104
2114
|
continue;
|
|
@@ -2107,7 +2117,7 @@ function Yt(e, t) {
|
|
|
2107
2117
|
const u = document.createElement("ol");
|
|
2108
2118
|
for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
|
|
2109
2119
|
const s = document.createElement("li");
|
|
2110
|
-
|
|
2120
|
+
Be(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
|
|
2111
2121
|
}
|
|
2112
2122
|
e.appendChild(u);
|
|
2113
2123
|
continue;
|
|
@@ -2117,11 +2127,11 @@ function Yt(e, t) {
|
|
|
2117
2127
|
p.push(n[o]), o += 1;
|
|
2118
2128
|
const c = document.createElement("p");
|
|
2119
2129
|
p.forEach((u, s) => {
|
|
2120
|
-
s > 0 && c.appendChild(document.createElement("br")),
|
|
2130
|
+
s > 0 && c.appendChild(document.createElement("br")), Be(c, u);
|
|
2121
2131
|
}), e.appendChild(c);
|
|
2122
2132
|
}
|
|
2123
2133
|
}
|
|
2124
|
-
function
|
|
2134
|
+
function Be(e, t) {
|
|
2125
2135
|
const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
|
|
2126
2136
|
let o = 0;
|
|
2127
2137
|
for (const a of t.matchAll(n)) {
|
|
@@ -2139,7 +2149,7 @@ function Me(e, t) {
|
|
|
2139
2149
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
2140
2150
|
} else {
|
|
2141
2151
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
2142
|
-
if (p &&
|
|
2152
|
+
if (p && ja(p[2])) {
|
|
2143
2153
|
const c = document.createElement("a");
|
|
2144
2154
|
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
2145
2155
|
} else
|
|
@@ -2149,7 +2159,7 @@ function Me(e, t) {
|
|
|
2149
2159
|
}
|
|
2150
2160
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
2151
2161
|
}
|
|
2152
|
-
function
|
|
2162
|
+
function ja(e) {
|
|
2153
2163
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
2154
2164
|
return !0;
|
|
2155
2165
|
try {
|
|
@@ -2159,8 +2169,8 @@ function Wa(e) {
|
|
|
2159
2169
|
return !1;
|
|
2160
2170
|
}
|
|
2161
2171
|
}
|
|
2162
|
-
function
|
|
2163
|
-
if (
|
|
2172
|
+
function Zt(e, t) {
|
|
2173
|
+
if (Va(e))
|
|
2164
2174
|
return;
|
|
2165
2175
|
const n = `
|
|
2166
2176
|
:host {
|
|
@@ -2506,34 +2516,40 @@ function Kt(e, t) {
|
|
|
2506
2516
|
.pluno-pa-widget__timeline-jump:active {
|
|
2507
2517
|
transform: translateX(-50%) scale(0.98);
|
|
2508
2518
|
}
|
|
2519
|
+
.pluno-pa-widget__top-actions {
|
|
2520
|
+
position: absolute;
|
|
2521
|
+
top: 14px;
|
|
2522
|
+
right: 14px;
|
|
2523
|
+
z-index: 4;
|
|
2524
|
+
display: flex;
|
|
2525
|
+
align-items: center;
|
|
2526
|
+
justify-content: flex-end;
|
|
2527
|
+
gap: 6px;
|
|
2528
|
+
pointer-events: none;
|
|
2529
|
+
}
|
|
2509
2530
|
.pluno-pa-widget__history,
|
|
2510
2531
|
.pluno-pa-widget__new-chat {
|
|
2511
|
-
position:
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
width:
|
|
2515
|
-
height:
|
|
2532
|
+
position: relative;
|
|
2533
|
+
box-sizing: border-box;
|
|
2534
|
+
flex: 0 0 30px;
|
|
2535
|
+
width: 30px;
|
|
2536
|
+
height: 30px;
|
|
2516
2537
|
display: inline-flex;
|
|
2517
2538
|
align-items: center;
|
|
2518
2539
|
justify-content: center;
|
|
2519
2540
|
border: 1px solid var(--pluno-pa-divider);
|
|
2520
|
-
border-radius:
|
|
2541
|
+
border-radius: 6px;
|
|
2521
2542
|
background: color-mix(in srgb, var(--pluno-pa-bg) 92%, transparent);
|
|
2522
2543
|
color: var(--pluno-pa-text);
|
|
2523
2544
|
box-shadow: 0 6px 14px rgba(24, 24, 27, 0.08);
|
|
2524
2545
|
cursor: pointer;
|
|
2525
2546
|
padding: 0;
|
|
2547
|
+
pointer-events: auto;
|
|
2526
2548
|
transition:
|
|
2527
2549
|
background 120ms ease,
|
|
2528
2550
|
transform 120ms ease,
|
|
2529
2551
|
box-shadow 120ms ease;
|
|
2530
2552
|
}
|
|
2531
|
-
.pluno-pa-widget__history {
|
|
2532
|
-
right: 58px;
|
|
2533
|
-
}
|
|
2534
|
-
.pluno-pa-widget__new-chat {
|
|
2535
|
-
right: 14px;
|
|
2536
|
-
}
|
|
2537
2553
|
.pluno-pa-widget__history:hover:not(:disabled),
|
|
2538
2554
|
.pluno-pa-widget__new-chat:hover:not(:disabled) {
|
|
2539
2555
|
background: var(--pluno-pa-surface);
|
|
@@ -2546,14 +2562,14 @@ function Kt(e, t) {
|
|
|
2546
2562
|
.pluno-pa-widget__history-panel {
|
|
2547
2563
|
position: absolute;
|
|
2548
2564
|
right: 18px;
|
|
2549
|
-
|
|
2565
|
+
top: 52px;
|
|
2550
2566
|
z-index: 4;
|
|
2551
2567
|
display: grid;
|
|
2552
2568
|
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
2553
2569
|
gap: 7px;
|
|
2554
2570
|
box-sizing: border-box;
|
|
2555
2571
|
width: min(260px, calc(100% - 36px));
|
|
2556
|
-
max-height: min(270px, calc(100% -
|
|
2572
|
+
max-height: min(270px, calc(100% - 66px));
|
|
2557
2573
|
border: 1px solid var(--pluno-pa-divider);
|
|
2558
2574
|
border-radius: 8px;
|
|
2559
2575
|
background: color-mix(in srgb, var(--pluno-pa-bg) 96%, transparent);
|
|
@@ -3836,7 +3852,7 @@ function Kt(e, t) {
|
|
|
3836
3852
|
position: absolute;
|
|
3837
3853
|
top: -16px;
|
|
3838
3854
|
left: 16px;
|
|
3839
|
-
|
|
3855
|
+
width: min(416px, calc(100% - 104px));
|
|
3840
3856
|
height: 36px;
|
|
3841
3857
|
z-index: 3;
|
|
3842
3858
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
@@ -4140,28 +4156,28 @@ function Kt(e, t) {
|
|
|
4140
4156
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
4141
4157
|
}
|
|
4142
4158
|
`;
|
|
4143
|
-
if (
|
|
4159
|
+
if (Ya(e, n))
|
|
4144
4160
|
return;
|
|
4145
4161
|
const o = e.ownerDocument.createElement("style");
|
|
4146
|
-
o.id =
|
|
4162
|
+
o.id = cn, o.textContent = n, e.appendChild(o), En(e);
|
|
4147
4163
|
}
|
|
4148
|
-
function
|
|
4149
|
-
return e.getElementById(
|
|
4164
|
+
function Va(e) {
|
|
4165
|
+
return e.getElementById(cn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(un) === "true";
|
|
4150
4166
|
}
|
|
4151
|
-
function
|
|
4152
|
-
e.host instanceof HTMLElement && e.host.setAttribute(
|
|
4167
|
+
function En(e) {
|
|
4168
|
+
e.host instanceof HTMLElement && e.host.setAttribute(un, "true");
|
|
4153
4169
|
}
|
|
4154
|
-
function
|
|
4170
|
+
function Ya(e, t) {
|
|
4155
4171
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
4156
4172
|
return !1;
|
|
4157
4173
|
try {
|
|
4158
4174
|
const n = new CSSStyleSheet();
|
|
4159
|
-
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n],
|
|
4175
|
+
return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], En(e), !0;
|
|
4160
4176
|
} catch {
|
|
4161
4177
|
return !1;
|
|
4162
4178
|
}
|
|
4163
4179
|
}
|
|
4164
|
-
async function
|
|
4180
|
+
async function Ka() {
|
|
4165
4181
|
return document.body ? document.body : await new Promise((e) => {
|
|
4166
4182
|
const t = new MutationObserver(() => {
|
|
4167
4183
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -4169,49 +4185,49 @@ async function ja() {
|
|
|
4169
4185
|
t.observe(document.documentElement, { childList: !0 });
|
|
4170
4186
|
});
|
|
4171
4187
|
}
|
|
4172
|
-
function
|
|
4188
|
+
function Sn(e) {
|
|
4173
4189
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
4174
4190
|
}
|
|
4175
|
-
function
|
|
4191
|
+
function Xa(e) {
|
|
4176
4192
|
try {
|
|
4177
|
-
const t = window.localStorage.getItem(
|
|
4193
|
+
const t = window.localStorage.getItem(Sn(e));
|
|
4178
4194
|
if (!t)
|
|
4179
|
-
return
|
|
4195
|
+
return Jt();
|
|
4180
4196
|
const n = JSON.parse(t);
|
|
4181
4197
|
return {
|
|
4182
4198
|
isOpen: n.isOpen === !0,
|
|
4183
4199
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
4184
4200
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
4185
|
-
launcherPosition:
|
|
4186
|
-
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-
|
|
4201
|
+
launcherPosition: ei(n.launcherPosition) ? n.launcherPosition : null,
|
|
4202
|
+
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-an) : [],
|
|
4187
4203
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
4188
4204
|
};
|
|
4189
4205
|
} catch {
|
|
4190
|
-
return
|
|
4206
|
+
return Jt();
|
|
4191
4207
|
}
|
|
4192
4208
|
}
|
|
4193
|
-
async function
|
|
4209
|
+
async function Za(e) {
|
|
4194
4210
|
if (e.loadSharePromptsDisabled)
|
|
4195
4211
|
return e.loadSharePromptsDisabled();
|
|
4196
4212
|
try {
|
|
4197
|
-
return window.localStorage.getItem(
|
|
4213
|
+
return window.localStorage.getItem(rn) === "true";
|
|
4198
4214
|
} catch {
|
|
4199
4215
|
return !1;
|
|
4200
4216
|
}
|
|
4201
4217
|
}
|
|
4202
|
-
function
|
|
4218
|
+
function Ja(e, t) {
|
|
4203
4219
|
if (e.persistSharePromptsDisabled) {
|
|
4204
4220
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
4205
4221
|
});
|
|
4206
4222
|
return;
|
|
4207
4223
|
}
|
|
4208
4224
|
try {
|
|
4209
|
-
t && window.localStorage.setItem(
|
|
4225
|
+
t && window.localStorage.setItem(rn, "true");
|
|
4210
4226
|
} catch {
|
|
4211
4227
|
return;
|
|
4212
4228
|
}
|
|
4213
4229
|
}
|
|
4214
|
-
function
|
|
4230
|
+
function Jt() {
|
|
4215
4231
|
return {
|
|
4216
4232
|
isOpen: !1,
|
|
4217
4233
|
composerValue: "",
|
|
@@ -4221,41 +4237,41 @@ function Xt() {
|
|
|
4221
4237
|
sharePromptsDisabled: !1
|
|
4222
4238
|
};
|
|
4223
4239
|
}
|
|
4224
|
-
function
|
|
4240
|
+
function Qa(e, t) {
|
|
4225
4241
|
try {
|
|
4226
|
-
window.localStorage.setItem(
|
|
4242
|
+
window.localStorage.setItem(Sn(e), JSON.stringify(t));
|
|
4227
4243
|
} catch {
|
|
4228
4244
|
return;
|
|
4229
4245
|
}
|
|
4230
4246
|
}
|
|
4231
|
-
function
|
|
4247
|
+
function ei(e) {
|
|
4232
4248
|
if (!e || typeof e != "object")
|
|
4233
4249
|
return !1;
|
|
4234
4250
|
const t = e;
|
|
4235
4251
|
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");
|
|
4236
4252
|
}
|
|
4237
|
-
const
|
|
4238
|
-
function
|
|
4253
|
+
const Qt = /* @__PURE__ */ new WeakSet();
|
|
4254
|
+
function ti(e) {
|
|
4239
4255
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
4240
4256
|
}
|
|
4241
|
-
function
|
|
4257
|
+
function en(e) {
|
|
4242
4258
|
const t = e.pathname.split("/");
|
|
4243
4259
|
return t[t.length - 1] ?? "";
|
|
4244
4260
|
}
|
|
4245
|
-
function
|
|
4261
|
+
function ni(e, t) {
|
|
4246
4262
|
const n = new URL(e.src, document.baseURI);
|
|
4247
|
-
return n.href === t.href || n.pathname === t.pathname ? !0 :
|
|
4263
|
+
return n.href === t.href || n.pathname === t.pathname ? !0 : en(n) === en(t);
|
|
4248
4264
|
}
|
|
4249
4265
|
class te extends EventTarget {
|
|
4250
4266
|
constructor(t, n) {
|
|
4251
|
-
super(), this.channelId = n, this.url = t, this.addPreviewListener(
|
|
4267
|
+
super(), this.channelId = n, this.url = t, this.addPreviewListener(so, () => {
|
|
4252
4268
|
this.readyState = te.OPEN, this.dispatchEvent(new Event("open"));
|
|
4253
|
-
}), this.addPreviewListener(
|
|
4269
|
+
}), this.addPreviewListener(co, (o) => {
|
|
4254
4270
|
const a = o;
|
|
4255
4271
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
4256
|
-
}), this.addPreviewListener(
|
|
4272
|
+
}), this.addPreviewListener(uo, () => {
|
|
4257
4273
|
this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
4258
|
-
}), this.addPreviewListener(
|
|
4274
|
+
}), this.addPreviewListener(go, (o) => {
|
|
4259
4275
|
const a = o;
|
|
4260
4276
|
this.readyState = te.CLOSED, this.dispatchEvent(
|
|
4261
4277
|
new CloseEvent("close", {
|
|
@@ -4265,7 +4281,7 @@ class te extends EventTarget {
|
|
|
4265
4281
|
})
|
|
4266
4282
|
), this.cleanup();
|
|
4267
4283
|
}), window.dispatchEvent(
|
|
4268
|
-
new CustomEvent(
|
|
4284
|
+
new CustomEvent(Oe(ro, this.channelId), {
|
|
4269
4285
|
detail: { socketId: this.socketId, url: t }
|
|
4270
4286
|
})
|
|
4271
4287
|
);
|
|
@@ -4281,26 +4297,26 @@ class te extends EventTarget {
|
|
|
4281
4297
|
binaryType = "blob";
|
|
4282
4298
|
bufferedAmount = 0;
|
|
4283
4299
|
readyState = te.CONNECTING;
|
|
4284
|
-
socketId =
|
|
4300
|
+
socketId = oi();
|
|
4285
4301
|
listeners = /* @__PURE__ */ new Map();
|
|
4286
4302
|
send(t) {
|
|
4287
4303
|
if (this.readyState !== te.OPEN)
|
|
4288
4304
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
4289
4305
|
window.dispatchEvent(
|
|
4290
|
-
new CustomEvent(
|
|
4306
|
+
new CustomEvent(Oe(lo, this.channelId), {
|
|
4291
4307
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
4292
4308
|
})
|
|
4293
4309
|
);
|
|
4294
4310
|
}
|
|
4295
4311
|
close(t, n) {
|
|
4296
4312
|
this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
|
|
4297
|
-
new CustomEvent(
|
|
4313
|
+
new CustomEvent(Oe(po, this.channelId), {
|
|
4298
4314
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
4299
4315
|
})
|
|
4300
4316
|
), this.cleanup());
|
|
4301
4317
|
}
|
|
4302
4318
|
addPreviewListener(t, n) {
|
|
4303
|
-
const o =
|
|
4319
|
+
const o = Oe(t, this.channelId), a = (i) => {
|
|
4304
4320
|
i.detail?.socketId === this.socketId && n(i);
|
|
4305
4321
|
};
|
|
4306
4322
|
this.listeners.set(o, a), window.addEventListener(o, a);
|
|
@@ -4311,36 +4327,36 @@ class te extends EventTarget {
|
|
|
4311
4327
|
this.listeners.clear();
|
|
4312
4328
|
}
|
|
4313
4329
|
}
|
|
4314
|
-
function
|
|
4315
|
-
const e = window.sessionStorage.getItem(
|
|
4330
|
+
function oi() {
|
|
4331
|
+
const e = window.sessionStorage.getItem(Nt);
|
|
4316
4332
|
if (e)
|
|
4317
4333
|
return e;
|
|
4318
4334
|
const t = crypto.randomUUID();
|
|
4319
|
-
return window.sessionStorage.setItem(
|
|
4335
|
+
return window.sessionStorage.setItem(Nt, t), t;
|
|
4320
4336
|
}
|
|
4321
|
-
function
|
|
4337
|
+
function Oe(e, t) {
|
|
4322
4338
|
return `${e}:${t}`;
|
|
4323
4339
|
}
|
|
4324
|
-
function
|
|
4340
|
+
function ai(e) {
|
|
4325
4341
|
const t = document.currentScript;
|
|
4326
4342
|
if (t instanceof HTMLScriptElement)
|
|
4327
4343
|
return [t];
|
|
4328
4344
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
4329
4345
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
4330
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
4346
|
+
(a) => a instanceof HTMLScriptElement && ti(a) && ni(a, o)
|
|
4331
4347
|
);
|
|
4332
4348
|
}
|
|
4333
|
-
function
|
|
4334
|
-
for (const t of
|
|
4335
|
-
if (
|
|
4349
|
+
function ii(e) {
|
|
4350
|
+
for (const t of ai(e)) {
|
|
4351
|
+
if (Qt.has(t) || t.dataset.plunoAutoMount === "false")
|
|
4336
4352
|
continue;
|
|
4337
|
-
|
|
4353
|
+
Qt.add(t);
|
|
4338
4354
|
const n = t.dataset.plunoPreviewChannel;
|
|
4339
|
-
|
|
4355
|
+
Ro({
|
|
4340
4356
|
token: t.dataset.plunoToken,
|
|
4341
4357
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
4342
4358
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
4343
|
-
webSocketFactory: n ?
|
|
4359
|
+
webSocketFactory: n ? Do(n) : void 0,
|
|
4344
4360
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
4345
4361
|
accentColor: t.dataset.plunoAccentColor,
|
|
4346
4362
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -4352,8 +4368,8 @@ function ni(e) {
|
|
|
4352
4368
|
});
|
|
4353
4369
|
}
|
|
4354
4370
|
}
|
|
4355
|
-
|
|
4371
|
+
ii(import.meta.url);
|
|
4356
4372
|
export {
|
|
4357
|
-
|
|
4358
|
-
|
|
4373
|
+
Do as createProductAgentPreviewBridgeWebSocketFactory,
|
|
4374
|
+
Ro as mountPlunoProductAgentWidget
|
|
4359
4375
|
};
|