@pluno/product-agent-web 0.1.46 → 0.1.47

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.
@@ -1,17 +1,17 @@
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);
1
+ import { PlunoProductAgent as zn } from "./product-agent-sdk.js";
2
+ const Hn = "#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 on(e) {
4
+ const t = an(e);
5
5
  if (Pt(Le(t), kt) >= Lt)
6
6
  return t;
7
7
  let o = Le(t);
8
8
  const a = Le(Fe);
9
9
  for (let i = 0; i < 6; i += 1)
10
- if (o = Hn(o, a, 0.22), Pt(o, kt) >= Lt)
10
+ if (o = $n(o, a, 0.22), Pt(o, kt) >= Lt)
11
11
  return ot(o);
12
12
  return ot(o);
13
13
  }
14
- function zn() {
14
+ function Gn() {
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 zn() {
19
19
  }
20
20
  return n;
21
21
  }
22
- function Gn(e) {
23
- const t = nn(e), n = at(Le(t));
22
+ function Wn(e) {
23
+ const t = an(e), n = at(Le(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,9 +56,9 @@ function Gn(e) {
56
56
  shadow: V(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function nn(e) {
59
+ function an(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()}` : Fn;
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()}` : Hn;
62
62
  }
63
63
  function Le(e) {
64
64
  return [
@@ -82,7 +82,7 @@ function Pt(e, t) {
82
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 Hn(e, t, n) {
85
+ function $n(e, t, n) {
86
86
  const o = it(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
@@ -91,17 +91,17 @@ function Hn(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function V(e, t, n) {
94
- const [o, a, i] = Wn(Le(e));
95
- return ot($n(o, it(a + n), it(i + t)));
94
+ const [o, a, i] = qn(Le(e));
95
+ return ot(jn(o, it(a + n), it(i + t)));
96
96
  }
97
- function Wn([e, t, n]) {
97
+ function qn([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 $n(e, t, n) {
104
+ function jn(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;
@@ -118,11 +118,11 @@ function Je(e, t, n) {
118
118
  function it(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const on = "suggest_share_on_socials";
122
- function qn(e) {
121
+ const rn = "suggest_share_on_socials";
122
+ function Vn(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 !== on)
125
+ if (n.role !== "tool" || n.toolName !== rn)
126
126
  continue;
127
127
  const o = At(e, t, "assistant");
128
128
  if (!o)
@@ -136,8 +136,8 @@ function qn(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function jn(e) {
140
- const t = await Vn(e);
139
+ async function Yn(e) {
140
+ const t = await Kn(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 })]);
@@ -150,18 +150,18 @@ function At(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Vn(e) {
153
+ async function Kn(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
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 = {}) {
156
+ const Xn = "https://app.pluno.ai", Zn = "/api/product-agent/embed/active-users", Jn = 1800, Qn = 15e3, eo = 250, to = 1e3, no = 3e4;
157
+ function oo(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
- }, ao(s)));
164
+ }, ro(s)));
165
165
  }, c = (s) => {
166
166
  if (l(), o === null) {
167
167
  o = s, e(s);
@@ -173,27 +173,27 @@ function to(e, t = {}) {
173
173
  l();
174
174
  return;
175
175
  }
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);
176
+ const P = Math.min(1, (performance.now() - x) / Jn);
177
+ o = Math.round(b + (s - b) * lo(P)), e(o), P >= 1 && (o = s, e(s), l());
178
+ }, eo);
179
179
  }, u = async () => {
180
180
  try {
181
- const s = await no(t);
181
+ const s = await ao(t);
182
182
  if (n)
183
183
  return;
184
184
  c(s.count), p(s.refreshAfterMs);
185
185
  } catch {
186
- p(Zn);
186
+ p(Qn);
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 no(e) {
193
+ async function ao(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(Kn, oo(e.backendUrl ?? Yn)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(Zn, io(e.backendUrl ?? Xn)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
@@ -207,16 +207,24 @@ async function no(e) {
207
207
  function Tt(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function oo(e) {
210
+ function io(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function ao(e) {
214
- return Math.min(eo, Math.max(Qn, e));
213
+ function ro(e) {
214
+ return Math.min(no, Math.max(to, e));
215
215
  }
216
- function io(e) {
216
+ function lo(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
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 = {
219
+ const ln = 100, po = "product-agent:sdk-preview-socket-connect", so = "product-agent:sdk-preview-socket-send", co = "product-agent:sdk-preview-socket-close", uo = "product-agent:sdk-preview-socket-open", go = "product-agent:sdk-preview-socket-message", ho = "product-agent:sdk-preview-socket-error", mo = "product-agent:sdk-preview-socket-closed", Nt = "product-agent:sdk-preview-socket-id", bo = "data-pluno-sdk-preview-channel", fo = "product-agent:preview-diagnostic", pn = "pluno.productAgent.sharePromptsDisabled", ze = 10, wo = 10 * 1024 * 1024, sn = /* @__PURE__ */ new Set([
220
+ "image/png",
221
+ "image/jpeg",
222
+ "image/webp",
223
+ "image/gif",
224
+ "application/pdf"
225
+ ]), _o = Array.from(
226
+ sn
227
+ ).join(","), xo = 3, yo = "No recent chats for this page yet.", K = {
220
228
  launcherLabel: "Ask for anything...",
221
229
  accentColor: "#7c3aed",
222
230
  colorScheme: "light",
@@ -224,7 +232,7 @@ const an = 100, ro = "product-agent:sdk-preview-socket-connect", lo = "product-a
224
232
  scribbleStyle: !1,
225
233
  position: "bottom-right",
226
234
  movableLauncher: !1
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 = [
235
+ }, vo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', It = "pluno-pa-scribble-font", dn = 190, cn = 41, Co = 48, Eo = 420, So = 520, ko = 0.24, Lo = 680, Po = 800, Ao = 0.76, z = 8, rt = 50, un = "http://www.w3.org/2000/svg", Dt = 26, Rt = 8, To = 36, Mt = [
228
236
  {
229
237
  ellipseCx: "17.5",
230
238
  ellipseCy: "24.5",
@@ -261,12 +269,12 @@ const an = 100, ro = "product-agent:sdk-preview-socket-connect", lo = "product-a
261
269
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
270
  pathStrokeWidth: "2.45"
263
271
  }
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) {
272
+ ], No = 11, Io = 13, Bt = 4, Do = 10, Ro = 40, Mo = "movable-launcher-position-v2", gn = "pluno-pa-widget-styles", hn = "data-pluno-pa-widget-styles";
273
+ let Ot = 0;
274
+ function Bo(e) {
267
275
  return (t) => new te(t, e);
268
276
  }
269
- async function Ro(e = {}) {
277
+ async function Oo(e = {}) {
270
278
  const t = {
271
279
  launcherLabel: e.launcherLabel ?? K.launcherLabel,
272
280
  accentColor: e.accentColor ?? K.accentColor,
@@ -302,54 +310,126 @@ async function Ro(e = {}) {
302
310
  persistSharePromptsDisabled: e.persistSharePromptsDisabled,
303
311
  sdkPreviewChannelId: e.sdkPreviewChannelId
304
312
  };
305
- Y("web-sdk.widget", "Mounting widget with merged options", {
306
- accentColor: t.accentColor,
307
- colorScheme: t.colorScheme,
308
- fontFamily: t.fontFamily,
309
- backendUrl: t.backendUrl,
310
- hasToken: !!t.token,
311
- hasTokenProvider: !!t.tokenProvider,
312
- hasTokenEndpoint: !!t.tokenEndpoint,
313
- hasWebSocketFactory: !!t.webSocketFactory,
314
- initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
315
- });
313
+ Y(
314
+ "web-sdk.widget",
315
+ "Mounting widget with merged options",
316
+ {
317
+ accentColor: t.accentColor,
318
+ colorScheme: t.colorScheme,
319
+ fontFamily: t.fontFamily,
320
+ backendUrl: t.backendUrl,
321
+ hasToken: !!t.token,
322
+ hasTokenProvider: !!t.tokenProvider,
323
+ hasTokenEndpoint: !!t.tokenEndpoint,
324
+ hasWebSocketFactory: !!t.webSocketFactory,
325
+ initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
326
+ }
327
+ );
316
328
  const n = document.createElement("div");
317
- n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(ho, t.sdkPreviewChannelId);
329
+ n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
330
+ bo,
331
+ t.sdkPreviewChannelId
332
+ );
318
333
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
319
334
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
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, {
335
+ let i = Ut(
336
+ t.accentColor,
337
+ t.scribbleStyle
338
+ );
339
+ oa(
340
+ a,
341
+ t.launcherLabel,
342
+ i,
343
+ t.movableLauncher
344
+ ), o.appendChild(a);
345
+ const l = await Ja(), p = l.ownerDocument;
346
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Qt(o, t.accentColor), Ft(a, i, {
324
347
  accentColor: t.accentColor,
325
348
  colorScheme: t.colorScheme,
326
349
  fontFamily: t.fontFamily,
327
350
  scribbleStyle: t.scribbleStyle
328
- }), Y("web-sdk.widget", "Applied initial widget appearance", {
329
- accentColor: t.accentColor,
330
- colorScheme: t.colorScheme,
331
- fontFamily: t.fontFamily,
332
- cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
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"), 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)
351
+ }), Y(
352
+ "web-sdk.widget",
353
+ "Applied initial widget appearance",
354
+ {
355
+ accentColor: t.accentColor,
356
+ colorScheme: t.colorScheme,
357
+ fontFamily: t.fontFamily,
358
+ cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
359
+ }
360
+ );
361
+ const c = a.querySelector(
362
+ ".pluno-pa-widget__launcher"
363
+ ), u = a.querySelector(
364
+ ".pluno-pa-widget__launcher-drag-handle"
365
+ ), s = a.querySelector(
366
+ ".pluno-pa-widget__launcher-input"
367
+ ), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(
368
+ ".pluno-pa-widget__close"
369
+ ), P = a.querySelector(
370
+ ".pluno-pa-widget__composer"
371
+ ), k = a.querySelector(
372
+ ".pluno-pa-widget__attachment-error"
373
+ ), B = a.querySelector(
374
+ ".pluno-pa-widget__billing-status"
375
+ ), y = a.querySelector(
376
+ ".pluno-pa-widget__attachments"
377
+ ), C = a.querySelector(
378
+ ".pluno-pa-widget__attachment-input"
379
+ ), h = a.querySelector(
380
+ ".pluno-pa-widget__attach"
381
+ ), g = a.querySelector(
382
+ ".pluno-pa-widget__input"
383
+ ), E = a.querySelector(
384
+ ".pluno-pa-widget__send"
385
+ ), F = a.querySelector(
386
+ ".pluno-pa-widget__top-actions"
387
+ ), le = a.querySelector(
388
+ ".pluno-pa-widget__history"
389
+ ), ye = a.querySelector(
390
+ ".pluno-pa-widget__history-panel"
391
+ ), D = a.querySelector(
392
+ ".pluno-pa-widget__history-list"
393
+ ), _ = a.querySelector(
394
+ ".pluno-pa-widget__history-close"
395
+ ), L = a.querySelector(
396
+ ".pluno-pa-widget__history-status"
397
+ ), H = a.querySelector(
398
+ ".pluno-pa-widget__timeline-jump"
399
+ ), R = a.querySelector(
400
+ ".pluno-pa-widget__active-users-counter"
401
+ ), f = a.querySelector(
402
+ ".pluno-pa-widget__timeline"
403
+ ), A = a.querySelector(
404
+ ".pluno-pa-widget__timeline-bottom-sentinel"
405
+ );
406
+ if (!c || !s || !b || !x || !P || !k || !B || !y || !C || !h || !g || !E || !F || !le || !ye || !D || !_ || !L || !H || !R || !f || !A)
336
407
  throw new Error("Failed to mount Pluno widget");
337
408
  if (t.movableLauncher && !u)
338
409
  throw new Error("Failed to mount Pluno widget drag handle");
339
- Ht(s), Ht(g);
410
+ $t(s), $t(g);
340
411
  let T = [], J = null;
341
412
  const me = () => {
342
- _a(y, T, (r) => {
343
- T = T.filter((d, S) => S !== r), me(), O(w.getState()), W();
344
- });
345
- }, kn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
413
+ va(
414
+ y,
415
+ T,
416
+ (r) => {
417
+ T = T.filter(
418
+ (d, S) => S !== r
419
+ ), me(), O(w.getState()), W();
420
+ }
421
+ );
422
+ }, Pn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
346
423
  if (!t.tokenEndpoint)
347
424
  throw new Error("Pluno widget requires token or tokenEndpoint");
348
425
  const r = await fetch(t.tokenEndpoint, {
349
426
  method: "POST",
350
427
  credentials: "include",
351
428
  headers: { "content-type": "application/json" },
352
- body: JSON.stringify({ origin: location.origin, url: location.href })
429
+ body: JSON.stringify({
430
+ origin: location.origin,
431
+ url: location.href
432
+ })
353
433
  });
354
434
  if (!r.ok)
355
435
  throw new Error("Failed to load Pluno token");
@@ -357,11 +437,11 @@ async function Ro(e = {}) {
357
437
  if (!d.token)
358
438
  throw new Error("Pluno token endpoint did not return a token");
359
439
  return d.token;
360
- }), Ln = window.fetch.bind(window);
440
+ }), An = window.fetch.bind(window);
361
441
  let w;
362
- w = await Un.init({
442
+ w = await zn.init({
363
443
  token: t.token,
364
- tokenProvider: kn,
444
+ tokenProvider: Pn,
365
445
  backendUrl: t.backendUrl,
366
446
  metadata: () => ({
367
447
  ...t.metadata ?? {},
@@ -374,17 +454,19 @@ async function Ro(e = {}) {
374
454
  webSocketFactory: t.webSocketFactory,
375
455
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
376
456
  });
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 = {
457
+ const pe = Qa(t), Ge = new Set(pe.openToolGroupKeys), be = new Set(
458
+ pe.seenShareCandidateIds
459
+ ), Pe = new Set(be);
460
+ let We = pe.sharePromptsDisabled || await ei(t), Q = t.movableLauncher ? pe.launcherPosition : null, ut = Q !== null, oe = null, Ae = !1, se = !1, de = {
379
461
  enabled: !0
380
462
  }, ce = 0, gt = "", ae = !1, ee = !1, ie = [], $e = null, ve = null;
381
463
  const q = (r, d) => {
382
464
  de = { enabled: r, reason: d };
383
465
  }, j = () => {
384
- G.hidden = !0;
385
- }, Pn = () => {
386
- G.hidden = !1;
387
- }, An = (r = "jump") => {
466
+ H.hidden = !0;
467
+ }, Tn = () => {
468
+ H.hidden = !1;
469
+ }, Nn = (r = "jump") => {
388
470
  q(!0, r), j(), ke(f, () => de.enabled), ce = f.scrollTop;
389
471
  }, ue = () => {
390
472
  if (le.hidden = t.loginRequired, ye.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), D.classList.toggle(
@@ -398,11 +480,14 @@ async function Ro(e = {}) {
398
480
  const d = document.createElement("button");
399
481
  d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
400
482
  const S = document.createElement("span");
401
- S.className = "pluno-pa-widget__history-item-title", S.textContent = Zo(r);
483
+ S.className = "pluno-pa-widget__history-item-title", S.textContent = ea(r);
402
484
  const M = document.createElement("time");
403
- M.className = "pluno-pa-widget__history-time", M.dateTime = r.lastActiveAt, M.textContent = Qo(r.lastActiveAt, Date.now());
485
+ M.className = "pluno-pa-widget__history-time", M.dateTime = r.lastActiveAt, M.textContent = na(
486
+ r.lastActiveAt,
487
+ Date.now()
488
+ );
404
489
  const N = document.createElement("small");
405
- N.className = "pluno-pa-widget__history-path", N.textContent = Jo(r), d.append(S, M, N), d.addEventListener("click", () => {
490
+ N.className = "pluno-pa-widget__history-path", N.textContent = ta(r), d.append(S, M, N), d.addEventListener("click", () => {
406
491
  ae = !1, ve = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), O(w.getState());
407
492
  }), D.appendChild(d);
408
493
  }
@@ -418,38 +503,51 @@ async function Ro(e = {}) {
418
503
  const d = await w.listSessions({ cursor: r, limit: 20 });
419
504
  ie = r ? [...ie, ...d.sessions] : d.sessions, $e = d.nextCursor;
420
505
  } catch (d) {
421
- Y("web-sdk.widget", "Failed to load session history", {
422
- message: d instanceof Error ? d.message : String(d)
423
- }), ve = _o;
506
+ Y(
507
+ "web-sdk.widget",
508
+ "Failed to load session history",
509
+ {
510
+ message: d instanceof Error ? d.message : String(d)
511
+ }
512
+ ), ve = yo;
424
513
  } finally {
425
514
  ee = !1, ue();
426
515
  }
427
516
  }
428
- }, Tn = () => {
517
+ }, In = () => {
429
518
  !$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 });
519
+ }, Dn = () => {
520
+ Ae || typeof document > "u" || (Qt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
521
+ }, mt = new MutationObserver(Dn);
522
+ mt.observe(p.documentElement, {
523
+ childList: !0,
524
+ subtree: !0
525
+ });
434
526
  const qe = (r = !0) => {
435
527
  const d = lt(a, r);
436
- return Ut(
528
+ return zt(
437
529
  a,
438
- Q ? Go(Q, d) : zo(a, t.position, d),
530
+ Q ? $o(Q, d) : Wo(
531
+ a,
532
+ t.position,
533
+ d
534
+ ),
439
535
  d
440
536
  );
441
- }, H = () => {
442
- Qa(t, {
537
+ }, G = () => {
538
+ ni(t, {
443
539
  isOpen: a.classList.contains("pluno-pa-widget--open"),
444
540
  composerValue: g.value,
445
- openToolGroupKeys: [...He],
541
+ openToolGroupKeys: [...Ge],
446
542
  launcherPosition: ut ? Q : null,
447
- seenShareCandidateIds: [...be].slice(-an),
543
+ seenShareCandidateIds: [...be].slice(
544
+ -ln
545
+ ),
448
546
  sharePromptsDisabled: We
449
547
  });
450
548
  }, ge = (r, d = {}) => {
451
- Yo(r, {
452
- debugVersion: Io,
549
+ Zo(r, {
550
+ debugVersion: Mo,
453
551
  launcherPosition: Q,
454
552
  rootClasses: a.className,
455
553
  rootStyle: {
@@ -470,36 +568,57 @@ async function Ro(e = {}) {
470
568
  if (!Q)
471
569
  return Re(a, null), qe(r);
472
570
  const d = qe(r);
473
- return Re(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
571
+ return Re(a, d), ge("Applied stored closed launcher position", {
572
+ visibleLauncherPosition: d
573
+ }), d;
474
574
  }, bt = (r, d) => {
475
575
  if (!r || !d) {
476
- Vo(a);
576
+ Xo(a);
477
577
  return;
478
578
  }
479
- jo(a, {
579
+ Ko(a, {
480
580
  x: r.x - d.x,
481
581
  y: r.y - d.y
482
582
  });
483
583
  }, ft = () => {
484
584
  const r = Te();
485
585
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
486
- const d = Ft(a, r, t.position);
487
- bt(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
488
- } else Q && ge("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
586
+ const d = Ht(
587
+ a,
588
+ r,
589
+ t.position
590
+ );
591
+ bt(d, r), ge(
592
+ "Applied open panel position after viewport resize",
593
+ { openPanelPosition: d }
594
+ );
595
+ } else Q && ge(
596
+ "Applied visible launcher position after viewport resize",
597
+ { visibleLauncherPosition: r }
598
+ );
489
599
  };
490
600
  let wt = () => {
491
601
  };
492
- window.addEventListener("resize", ft), t.movableLauncher && u ? (Te(), wt = Fo({
602
+ window.addEventListener("resize", ft), t.movableLauncher && u ? (Te(), wt = Go({
493
603
  root: a,
494
604
  launcher: c,
495
605
  launcherDragHandle: u,
496
606
  getPosition: () => qe(),
497
607
  setPosition: (r) => {
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 });
608
+ const d = r, S = lt(a), M = zt(
609
+ a,
610
+ r,
611
+ S
612
+ );
613
+ Q = qo(
614
+ M,
615
+ S
616
+ ), Re(a, M), ge("Dragging closed launcher", {
617
+ requestedPosition: d
618
+ });
500
619
  },
501
620
  persist: () => {
502
- ut = !0, H(), ge("Persisted closed launcher drag position");
621
+ ut = !0, G(), ge("Persisted closed launcher drag position");
503
622
  }
504
623
  })) : Re(a, null);
505
624
  let je = !1;
@@ -508,25 +627,40 @@ async function Ro(e = {}) {
508
627
  je = !0;
509
628
  try {
510
629
  const r = await t.billingStatusLoader();
511
- $t(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, nt(B, t.billingStatus, w.getState().lastErrorCode), W());
630
+ jt(
631
+ t.billingStatus,
632
+ r,
633
+ w.getState().lastErrorCode
634
+ ) && (t.billingStatus = r, nt(
635
+ B,
636
+ t.billingStatus,
637
+ w.getState().lastErrorCode
638
+ ), W());
512
639
  } finally {
513
640
  je = !1;
514
641
  }
515
642
  }
516
643
  }, he = (r = "", d = !0) => {
517
644
  _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();
645
+ const S = Te(), M = Ht(
646
+ a,
647
+ S,
648
+ t.position
649
+ );
650
+ if (bt(M, S), ge("Opening launcher at clamped open panel position", {
651
+ openPanelPosition: M,
652
+ visibleLauncherPosition: S
653
+ }), q(!0, "open"), j(), !d) {
654
+ 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), G();
521
655
  return;
522
656
  }
523
657
  window.requestAnimationFrame(() => {
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(() => {
658
+ 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), G(), oe = window.setTimeout(() => {
525
659
  c.hidden = !0, ke(f, () => de.enabled), ce = f.scrollTop;
526
660
  }, 220);
527
661
  });
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(() => {
662
+ }, Rn = () => {
663
+ 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"), G(), oe = window.setTimeout(() => {
530
664
  b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
531
665
  }, 220);
532
666
  };
@@ -543,10 +677,10 @@ async function Ro(e = {}) {
543
677
  return;
544
678
  const r = s.value;
545
679
  he(r), s.value = "";
546
- }), x.addEventListener("click", In), f.addEventListener("scroll", () => {
680
+ }), x.addEventListener("click", Rn), f.addEventListener("scroll", () => {
547
681
  f.scrollTop < ce - 1 && q(!1, "userScroll"), ce = f.scrollTop;
548
- }), G.addEventListener("click", () => {
549
- An();
682
+ }), H.addEventListener("click", () => {
683
+ Nn();
550
684
  });
551
685
  const xt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
552
686
  ([r]) => {
@@ -570,31 +704,39 @@ async function Ro(e = {}) {
570
704
  t.onSignupClick?.();
571
705
  return;
572
706
  }
573
- X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W());
707
+ X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = et(
708
+ w,
709
+ g,
710
+ T
711
+ ), me(), W());
574
712
  });
575
713
  let Ce = 0;
576
- const Dn = () => {
714
+ const Mn = () => {
577
715
  Ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
578
716
  }, vt = (r) => {
579
717
  J !== null && window.clearTimeout(J), k.textContent = r, k.hidden = !1, J = window.setTimeout(() => {
580
718
  k.textContent = "", k.hidden = !0, J = null;
581
719
  }, 3e3);
582
- }, Rn = () => {
720
+ }, Bn = () => {
583
721
  J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
584
722
  }, Ct = async (r) => {
585
723
  if (r.length === 0)
586
724
  return;
587
- const d = await Ca(r);
725
+ const d = await ka(r);
588
726
  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();
727
+ throw new Error(
728
+ `Attach up to ${ze} files per message.`
729
+ );
730
+ T = [...T, ...d], me(), Bn(), W(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
591
731
  };
592
732
  h.addEventListener("click", () => {
593
733
  t.loginRequired || X(t.billingStatus) || C.click();
594
734
  }), C.addEventListener("change", () => {
595
735
  const r = Array.from(C.files ?? []);
596
736
  C.value = "", Ct(r).catch((d) => {
597
- vt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
737
+ vt(
738
+ d instanceof Error ? d.message : "Failed to attach file"
739
+ ), Y("web-sdk.widget", "Attachment failed", {
598
740
  message: d instanceof Error ? d.message : String(d)
599
741
  });
600
742
  });
@@ -607,8 +749,10 @@ async function Ro(e = {}) {
607
749
  Me(r.dataTransfer) && (r.stopPropagation(), Ce = Math.max(0, Ce - 1), Ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
608
750
  }), a.addEventListener("drop", (r) => {
609
751
  const d = r.dataTransfer;
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", {
752
+ !Me(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Mn(), Ct(d.files).catch((S) => {
753
+ vt(
754
+ S instanceof Error ? S.message : "Failed to attach file"
755
+ ), Y("web-sdk.widget", "Attachment failed", {
612
756
  message: S instanceof Error ? S.message : String(S)
613
757
  });
614
758
  }));
@@ -621,40 +765,57 @@ async function Ro(e = {}) {
621
765
  w.stop();
622
766
  return;
623
767
  }
624
- se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W(), O(w.getState());
768
+ se = !0, q(!0, "send"), j(), T = et(
769
+ w,
770
+ g,
771
+ T
772
+ ), me(), W(), O(w.getState());
625
773
  }), le.addEventListener("click", () => {
626
774
  ae = !ae, ve = null, ue(), ae && ie.length === 0 && ht(null);
627
775
  }), _.addEventListener("click", () => {
628
776
  ae = !1, ue();
629
- }), D.addEventListener("scroll", Tn), g.addEventListener("input", () => {
630
- Se(g), H(), W(), O(w.getState());
777
+ }), D.addEventListener("scroll", In), g.addEventListener("input", () => {
778
+ Se(g), G(), W(), O(w.getState());
631
779
  }), g.addEventListener("keydown", (r) => {
632
780
  if (!(r.key !== "Enter" || r.shiftKey)) {
633
781
  if (r.preventDefault(), t.loginRequired) {
634
782
  t.onLoginClick?.();
635
783
  return;
636
784
  }
637
- se = !0, q(!0, "send"), j(), T = et(w, g, T), me(), W(), O(w.getState());
785
+ se = !0, q(!0, "send"), j(), T = et(
786
+ w,
787
+ g,
788
+ T
789
+ ), me(), W(), O(w.getState());
638
790
  }
639
791
  }), a.addEventListener("click", (r) => {
640
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
792
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && G();
641
793
  }), pe.composerValue && (g.value = pe.composerValue, Se(g)), pe.isOpen && he(g.value, !1);
642
794
  const Ie = () => i;
643
795
  let Ve = w.getState().appearance !== null, De = null, Ee = null, fe = null, Et = w.getState().isThinking, we = null, Ye = null, St = () => {
644
796
  };
645
- const Mn = !!t.socialPostDraftHandler;
797
+ const On = !!t.socialPostDraftHandler;
646
798
  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());
799
+ const Un = () => {
800
+ se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), Ge.clear(), g.value = "", T = [], me(), Se(g), G(), W(), g.focus(), O(w.getState());
649
801
  }, Ke = (r) => {
650
802
  if (!r) {
651
803
  _e?.remove(), _e = null;
652
804
  return;
653
805
  }
654
- _e || (_e = Ge("pluno-pa-widget__new-chat", "New chat", ca(), !1), _e.addEventListener("click", Bn), F.appendChild(_e));
806
+ _e || (_e = He(
807
+ "pluno-pa-widget__new-chat",
808
+ "New chat",
809
+ ha(),
810
+ !1
811
+ ), _e.addEventListener("click", Un), F.appendChild(_e));
655
812
  }, 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(
813
+ if (ue(), ct(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(
814
+ B,
815
+ t.billingStatus,
816
+ we
817
+ ), t.loginRequired) {
818
+ Kt(
658
819
  f,
659
820
  E,
660
821
  Ke,
@@ -667,7 +828,7 @@ async function Ro(e = {}) {
667
828
  return;
668
829
  }
669
830
  if (t.signupRequired) {
670
- Vt(
831
+ Kt(
671
832
  f,
672
833
  E,
673
834
  Ke,
@@ -679,10 +840,10 @@ async function Ro(e = {}) {
679
840
  );
680
841
  return;
681
842
  }
682
- const d = Ko(r), S = d !== gt;
843
+ const d = Jo(r), S = d !== gt;
683
844
  gt = d;
684
845
  const M = se || de.enabled;
685
- se = !1, Ma(
846
+ se = !1, Ua(
686
847
  f,
687
848
  A,
688
849
  E,
@@ -690,46 +851,67 @@ async function Ro(e = {}) {
690
851
  R,
691
852
  r,
692
853
  Ye,
693
- Ye !== null && jt(r, g.value.trim().length > 0 || T.length > 0),
854
+ Ye !== null && Yt(
855
+ r,
856
+ g.value.trim().length > 0 || T.length > 0
857
+ ),
694
858
  M,
695
859
  () => de.enabled,
696
- He,
697
- H,
860
+ Ge,
861
+ G,
698
862
  Ie,
699
863
  (N) => {
700
864
  se = !0, q(!0, "send"), j(), w.sendMessage(N);
701
865
  },
702
- Mn && !We ? {
866
+ On && !We ? {
703
867
  dismissedCandidateIds: Pe,
704
868
  draftingCandidateId: De,
705
869
  error: Ee,
706
870
  characterIconOptions: Ie(),
707
871
  onSeen: (N) => {
708
- be.add(N.id), H();
872
+ be.add(N.id), G();
709
873
  },
710
874
  onDraft: (N) => {
711
- On(N);
875
+ Fn(N);
712
876
  },
713
877
  onDismiss: (N) => {
714
- be.add(N.id), Pe.add(N.id), H(), Ee = null, O(w.getState());
878
+ be.add(N.id), Pe.add(N.id), G(), Ee = null, O(w.getState());
715
879
  },
716
880
  onDisable: (N) => {
717
- We = !0, be.add(N.id), Pe.add(N.id), H(), Ja(t, !0), Ee = null, O(w.getState());
881
+ We = !0, be.add(N.id), Pe.add(N.id), G(), ti(t, !0), Ee = null, O(w.getState());
718
882
  }
719
883
  } : void 0
720
- ), M ? (ce = f.scrollTop, j()) : S && Xo(r) && Pn();
884
+ ), M ? (ce = f.scrollTop, j()) : S && Qo(r) && Tn();
721
885
  };
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) => {
886
+ return St = oo(
887
+ (r) => {
888
+ Ye = r, !Ae && Yt(
889
+ w.getState(),
890
+ g.value.trim().length > 0 || T.length > 0
891
+ ) && O(w.getState());
892
+ },
893
+ {
894
+ backendUrl: t.backendUrl,
895
+ fetcher: An,
896
+ loader: t.activeUsersLoader
897
+ }
898
+ ), w.on("state", (r) => {
725
899
  const d = Et && !r.isThinking;
726
- Et = r.isThinking, r.appearance ? (Ve = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
727
- appearance: r.appearance
728
- }), Xe(r.appearance, "agent.state.appearance")) : Ve && (Ve = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
729
- fallbackAccentColor: t.accentColor,
730
- fallbackColorScheme: t.colorScheme,
731
- fallbackFontFamily: t.fontFamily
732
- }), Xe({}, "agent.state.appearance-cleared")), O(r), W(), d && _t();
900
+ Et = r.isThinking, r.appearance ? (Ve = !0, Y(
901
+ "web-sdk.widget",
902
+ "Agent state supplied appearance",
903
+ {
904
+ appearance: r.appearance
905
+ }
906
+ ), Xe(r.appearance, "agent.state.appearance")) : Ve && (Ve = !1, Y(
907
+ "web-sdk.widget",
908
+ "Agent state cleared appearance; reverting to configured widget options",
909
+ {
910
+ fallbackAccentColor: t.accentColor,
911
+ fallbackColorScheme: t.colorScheme,
912
+ fallbackFontFamily: t.fontFamily
913
+ }
914
+ ), Xe({}, "agent.state.appearance-cleared")), O(r), W(), d && _t();
733
915
  }), O(w.getState()), W(), {
734
916
  agent: w,
735
917
  updateAppearance: (r) => {
@@ -737,7 +919,11 @@ async function Ro(e = {}) {
737
919
  },
738
920
  updateBillingStatus: (r) => {
739
921
  const d = r ?? null;
740
- $t(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(
922
+ jt(
923
+ t.billingStatus,
924
+ d,
925
+ we
926
+ ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), nt(
741
927
  a.querySelector(".pluno-pa-widget__billing-status"),
742
928
  t.billingStatus,
743
929
  we
@@ -746,9 +932,13 @@ async function Ro(e = {}) {
746
932
  updateAuthGate: (r) => {
747
933
  const d = Ne();
748
934
  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) => {
749
- Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
750
- message: S instanceof Error ? S.message : String(S)
751
- });
935
+ Y(
936
+ "web-sdk.widget",
937
+ "Failed to connect after auth gate cleared",
938
+ {
939
+ message: S instanceof Error ? S.message : String(S)
940
+ }
941
+ );
752
942
  });
753
943
  },
754
944
  openPanel: () => {
@@ -758,7 +948,7 @@ async function Ro(e = {}) {
758
948
  Ae || (Ae = !0, mt.disconnect(), xt?.disconnect(), window.removeEventListener("resize", ft), wt(), J !== null && window.clearTimeout(J), St(), fe?.remove(), w.destroy(), n.remove());
759
949
  }
760
950
  };
761
- async function On(r) {
951
+ async function Fn(r) {
762
952
  if (!De) {
763
953
  De = r.id, Ee = null, O(w.getState());
764
954
  try {
@@ -767,7 +957,7 @@ async function Ro(e = {}) {
767
957
  const d = await t.socialPostDraftHandler(r);
768
958
  if (!d.linkedinPost || !d.xPost)
769
959
  throw new Error("Pluno did not return a complete social post draft.");
770
- be.add(r.id), Pe.add(r.id), H(), fe?.remove(), fe = Ua(d, {
960
+ be.add(r.id), Pe.add(r.id), G(), fe?.remove(), fe = Ha(d, {
771
961
  socialPostRewardsUrl: t.socialPostRewardsUrl,
772
962
  onClose: () => {
773
963
  fe?.remove(), fe = null;
@@ -782,7 +972,10 @@ async function Ro(e = {}) {
782
972
  }
783
973
  function Xe(r, d) {
784
974
  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, {
975
+ i = Ut(
976
+ S,
977
+ Ze
978
+ ), Ft(a, i, {
786
979
  accentColor: S,
787
980
  colorScheme: M,
788
981
  fontFamily: N,
@@ -798,14 +991,14 @@ async function Ro(e = {}) {
798
991
  });
799
992
  }
800
993
  }
801
- function Bt(e, t) {
994
+ function Ut(e, t) {
802
995
  return { accentColor: e, scribbleStyle: t };
803
996
  }
804
- function Mo(e) {
805
- const t = Bo(e);
806
- return t === null ? "#fafafa" : Oo(t) > 0.5 ? "#18181b" : "#fafaf9";
997
+ function Uo(e) {
998
+ const t = Fo(e);
999
+ return t === null ? "#fafafa" : zo(t) > 0.5 ? "#18181b" : "#fafaf9";
807
1000
  }
808
- function Bo(e) {
1001
+ function Fo(e) {
809
1002
  const t = e.trim();
810
1003
  return /^#[0-9a-f]{6}$/i.test(t) ? [
811
1004
  Number.parseInt(t.slice(1, 3), 16),
@@ -817,22 +1010,38 @@ function Bo(e) {
817
1010
  Number.parseInt(t[3] + t[3], 16)
818
1011
  ] : null;
819
1012
  }
820
- function Oo([e, t, n]) {
1013
+ function zo([e, t, n]) {
821
1014
  const o = (a) => {
822
1015
  const i = a / 255;
823
1016
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
824
1017
  };
825
1018
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
826
1019
  }
827
- function Ot(e, t, n) {
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);
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);
831
- const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
1020
+ function Ft(e, t, n) {
1021
+ e.classList.toggle(
1022
+ "pluno-pa-widget--dark",
1023
+ n.colorScheme === "dark"
1024
+ ), e.classList.toggle(
1025
+ "pluno-pa-widget--light",
1026
+ n.colorScheme !== "dark"
1027
+ ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1028
+ const o = n.scribbleStyle ? on(n.accentColor) : n.accentColor;
1029
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1030
+ "--pluno-pa-accent-contrast",
1031
+ Uo(o)
1032
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? vo : n.fontFamily, n.scribbleStyle && Ho(e.ownerDocument);
1033
+ const a = Array.from(
1034
+ e.querySelectorAll(".pluno-pa-widget__character")
1035
+ );
832
1036
  for (const i of a)
833
- i.replaceWith(re(Array.from(i.classList).join(" "), t));
1037
+ i.replaceWith(
1038
+ re(
1039
+ Array.from(i.classList).join(" "),
1040
+ t
1041
+ )
1042
+ );
834
1043
  }
835
- function Uo(e) {
1044
+ function Ho(e) {
836
1045
  if (e.getElementById(It))
837
1046
  return;
838
1047
  const t = e.createElement("style");
@@ -844,7 +1053,7 @@ function Uo(e) {
844
1053
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
845
1054
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
846
1055
  }
847
- function Fo({
1056
+ function Go({
848
1057
  root: e,
849
1058
  launcher: t,
850
1059
  launcherDragHandle: n,
@@ -862,7 +1071,7 @@ function Fo({
862
1071
  return;
863
1072
  h.preventDefault();
864
1073
  const g = h.clientX - p.x, E = h.clientY - p.y;
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 }));
1074
+ !u && Math.hypot(g, E) < Bt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
866
1075
  }, k = (h) => {
867
1076
  l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
868
1077
  }, B = (h) => {
@@ -870,12 +1079,15 @@ function Fo({
870
1079
  }, y = (h) => {
871
1080
  if (!s)
872
1081
  return;
873
- const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= Rt;
1082
+ const g = Math.hypot(
1083
+ h.clientX - s.x,
1084
+ h.clientY - s.y
1085
+ ) <= Bt;
874
1086
  s = null, g && (h.preventDefault(), h.stopPropagation());
875
1087
  }, C = (h) => {
876
1088
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
877
1089
  return;
878
- const g = h.shiftKey ? No : To, E = o();
1090
+ const g = h.shiftKey ? Ro : Do, E = o();
879
1091
  let F = null;
880
1092
  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());
881
1093
  };
@@ -886,24 +1098,32 @@ function Fo({
886
1098
  function lt(e, t = !0) {
887
1099
  const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
888
1100
  return {
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
1101
+ width: t && a && o.width > 0 ? o.width : Math.min(dn, n.width - 36),
1102
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Co : cn
891
1103
  };
892
1104
  }
893
- function gn() {
1105
+ function mn() {
894
1106
  const e = ne();
895
1107
  return {
896
1108
  width: Math.min(
897
- xe(e.width * Eo, vo, Co),
1109
+ xe(
1110
+ e.width * ko,
1111
+ Eo,
1112
+ So
1113
+ ),
898
1114
  e.width - z * 2
899
1115
  ),
900
1116
  height: Math.min(
901
- xe(e.height * Lo, So, ko),
1117
+ xe(
1118
+ e.height * Ao,
1119
+ Lo,
1120
+ Po
1121
+ ),
902
1122
  e.height - rt - z
903
1123
  )
904
1124
  };
905
1125
  }
906
- function zo(e, t, n) {
1126
+ function Wo(e, t, n) {
907
1127
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
908
1128
  if (Number.isFinite(o) && Number.isFinite(a))
909
1129
  return { x: o, y: a };
@@ -916,50 +1136,74 @@ function zo(e, t, n) {
916
1136
  y: l.height - 24 - n.height
917
1137
  };
918
1138
  }
919
- function Ut(e, t, n) {
920
- const o = ne(), a = z + $o(e);
1139
+ function zt(e, t, n) {
1140
+ const o = ne(), a = z + Vo(e);
921
1141
  return {
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))
1142
+ x: xe(
1143
+ t.x,
1144
+ z,
1145
+ Math.max(
1146
+ z,
1147
+ o.width - n.width - z
1148
+ )
1149
+ ),
1150
+ y: xe(
1151
+ t.y,
1152
+ a,
1153
+ Math.max(
1154
+ a,
1155
+ o.height - n.height - z
1156
+ )
1157
+ )
924
1158
  };
925
1159
  }
926
- function Go(e, t) {
1160
+ function $o(e, t) {
927
1161
  const n = ne();
928
1162
  return {
929
1163
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
930
1164
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
931
1165
  };
932
1166
  }
933
- function Ho(e, t) {
934
- const n = Wo(e, t), o = ne();
1167
+ function qo(e, t) {
1168
+ const n = jo(e, t), o = ne();
935
1169
  return {
936
1170
  anchor: n,
937
1171
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
938
1172
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
939
1173
  };
940
1174
  }
941
- function Wo(e, t) {
1175
+ function jo(e, t) {
942
1176
  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";
943
1177
  return `${i}-${l}`;
944
1178
  }
945
- function $o(e) {
946
- return e.classList.contains("pluno-pa-widget--scribble") ? Ao : Po;
1179
+ function Vo(e) {
1180
+ return e.classList.contains("pluno-pa-widget--scribble") ? Io : No;
947
1181
  }
948
- function Ft(e, t, n) {
949
- const o = lt(e), a = gn(), i = {
1182
+ function Ht(e, t, n) {
1183
+ const o = lt(e), a = mn(), i = {
950
1184
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
951
1185
  y: t.y + o.height - a.height
952
1186
  };
953
- return qo(i);
1187
+ return Yo(i);
954
1188
  }
955
- function qo(e) {
956
- const t = ne(), n = gn();
1189
+ function Yo(e) {
1190
+ const t = ne(), n = mn();
957
1191
  return {
958
- x: xe(e.x, z, Math.max(z, t.width - n.width - z)),
1192
+ x: xe(
1193
+ e.x,
1194
+ z,
1195
+ Math.max(
1196
+ z,
1197
+ t.width - n.width - z
1198
+ )
1199
+ ),
959
1200
  y: xe(
960
1201
  e.y,
961
1202
  rt,
962
- Math.max(rt, t.height - n.height - z)
1203
+ Math.max(
1204
+ rt,
1205
+ t.height - n.height - z
1206
+ )
963
1207
  )
964
1208
  };
965
1209
  }
@@ -970,16 +1214,16 @@ function Re(e, t) {
970
1214
  }
971
1215
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
972
1216
  }
973
- function jo(e, t) {
1217
+ function Ko(e, t) {
974
1218
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
975
1219
  }
976
- function Vo(e) {
1220
+ function Xo(e) {
977
1221
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
978
1222
  }
979
1223
  function ne() {
980
1224
  return {
981
- width: window.innerWidth || document.documentElement.clientWidth || pn + z * 2,
982
- height: window.innerHeight || document.documentElement.clientHeight || sn + z * 2
1225
+ width: window.innerWidth || document.documentElement.clientWidth || dn + z * 2,
1226
+ height: window.innerHeight || document.documentElement.clientHeight || cn + z * 2
983
1227
  };
984
1228
  }
985
1229
  function Qe(e) {
@@ -1003,14 +1247,18 @@ function Y(e, t, n) {
1003
1247
  message: t,
1004
1248
  details: n
1005
1249
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
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 }));
1250
+ i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(
1251
+ new CustomEvent(fo, { detail: a })
1252
+ );
1007
1253
  }
1008
- function Yo(e, t) {
1254
+ function Zo(e, t) {
1009
1255
  Y("web-sdk.widget.position", e, t);
1010
1256
  }
1011
1257
  function et(e, t, n) {
1012
1258
  const o = t.value.trim();
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 })), []);
1259
+ return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1260
+ attachments: n.length > 0 ? n : void 0
1261
+ }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1014
1262
  }
1015
1263
  function Se(e) {
1016
1264
  e.style.height = "0px";
@@ -1022,7 +1270,7 @@ function ke(e, t = () => !0) {
1022
1270
  t() && (e.scrollTop = e.scrollHeight);
1023
1271
  });
1024
1272
  }
1025
- function Ko(e) {
1273
+ function Jo(e) {
1026
1274
  const t = e.messages[e.messages.length - 1];
1027
1275
  return [
1028
1276
  e.messages.length,
@@ -1033,13 +1281,13 @@ function Ko(e) {
1033
1281
  e.lastError ?? ""
1034
1282
  ].join(":");
1035
1283
  }
1036
- function Xo(e) {
1284
+ function Qo(e) {
1037
1285
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1038
1286
  }
1039
- function Zo(e) {
1287
+ function ea(e) {
1040
1288
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1041
1289
  }
1042
- function Jo(e) {
1290
+ function ta(e) {
1043
1291
  const t = e.currentPage;
1044
1292
  if (typeof t?.url == "string" && t.url.trim())
1045
1293
  try {
@@ -1050,7 +1298,7 @@ function Jo(e) {
1050
1298
  }
1051
1299
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1052
1300
  }
1053
- function Qo(e, t) {
1301
+ function na(e, t) {
1054
1302
  const n = new Date(e).getTime();
1055
1303
  if (!Number.isFinite(n))
1056
1304
  return "now";
@@ -1066,26 +1314,47 @@ function Qo(e, t) {
1066
1314
  }
1067
1315
  return "now";
1068
1316
  }
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));
1317
+ function oa(e, t, n, o) {
1318
+ e.appendChild(ua()), e.appendChild(
1319
+ aa(t, n, o)
1320
+ ), e.appendChild(
1321
+ He(
1322
+ "pluno-pa-widget__close",
1323
+ "Close",
1324
+ ga(16),
1325
+ !0
1326
+ )
1327
+ ), e.appendChild(ia(n));
1071
1328
  }
1072
- function ta(e, t, n) {
1329
+ function aa(e, t, n) {
1073
1330
  const o = document.createElement("form");
1074
1331
  if (o.className = "pluno-pa-widget__launcher", n) {
1075
1332
  const i = document.createElement("button");
1076
1333
  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);
1077
1334
  }
1078
- o.appendChild(bn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
1335
+ o.appendChild(
1336
+ wn(
1337
+ "pluno-pa-widget__scribble-spirals--launcher",
1338
+ 10
1339
+ )
1340
+ ), o.appendChild(
1341
+ re(
1342
+ "pluno-pa-widget__character--launcher",
1343
+ t
1344
+ )
1345
+ );
1079
1346
  const a = document.createElement("input");
1080
1347
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1081
1348
  }
1082
- function na(e) {
1349
+ function ia(e) {
1083
1350
  const t = document.createElement("section");
1084
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(bn("pluno-pa-widget__scribble-spirals--panel", 16));
1351
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1352
+ wn("pluno-pa-widget__scribble-spirals--panel", 16)
1353
+ );
1085
1354
  const n = document.createElement("div");
1086
1355
  n.className = "pluno-pa-widget__timeline-wrap";
1087
1356
  const o = document.createElement("main");
1088
- o.className = "pluno-pa-widget__timeline", o.appendChild(ia(e));
1357
+ o.className = "pluno-pa-widget__timeline", o.appendChild(pa(e));
1089
1358
  const a = document.createElement("div");
1090
1359
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1091
1360
  const i = document.createElement("div");
@@ -1093,9 +1362,16 @@ function na(e) {
1093
1362
  const l = document.createElement("button");
1094
1363
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1095
1364
  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;
1365
+ return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1366
+ He(
1367
+ "pluno-pa-widget__history",
1368
+ "Recent chats",
1369
+ ma(),
1370
+ !0
1371
+ )
1372
+ ), n.appendChild(p), n.appendChild(la()), t.appendChild(n), t.appendChild(ra()), t;
1097
1373
  }
1098
- function oa() {
1374
+ function ra() {
1099
1375
  const e = document.createElement("form");
1100
1376
  e.className = "pluno-pa-widget__composer";
1101
1377
  const t = document.createElement("div");
@@ -1107,13 +1383,13 @@ function oa() {
1107
1383
  const a = document.createElement("div");
1108
1384
  a.className = "pluno-pa-widget__composer-inner";
1109
1385
  const i = document.createElement("input");
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);
1386
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = _o, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1111
1387
  const l = document.createElement("button");
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);
1388
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(fa()), l.appendChild(wa()), a.appendChild(l);
1113
1389
  const p = document.createElement("textarea");
1114
1390
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1115
1391
  const c = document.createElement("button");
1116
- c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(fn()), a.appendChild(c), e.appendChild(a);
1392
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(_n()), a.appendChild(c), e.appendChild(a);
1117
1393
  const u = document.createElement("div");
1118
1394
  u.className = "pluno-pa-widget__composer-meta";
1119
1395
  const s = document.createElement("a");
@@ -1121,44 +1397,61 @@ function oa() {
1121
1397
  const b = document.createElement("span");
1122
1398
  return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1123
1399
  }
1124
- function aa() {
1400
+ function la() {
1125
1401
  const e = document.createElement("section");
1126
1402
  e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1127
1403
  const t = document.createElement("div");
1128
1404
  t.className = "pluno-pa-widget__history-header";
1129
1405
  const n = document.createElement("strong");
1130
1406
  n.textContent = "Recent chats";
1131
- const o = Ge("pluno-pa-widget__history-close", "Close recent chats", ga(), !1);
1407
+ const o = He(
1408
+ "pluno-pa-widget__history-close",
1409
+ "Close recent chats",
1410
+ ba(),
1411
+ !1
1412
+ );
1132
1413
  t.append(n, o);
1133
1414
  const a = document.createElement("div");
1134
1415
  a.className = "pluno-pa-widget__history-list";
1135
1416
  const i = document.createElement("p");
1136
1417
  return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
1137
1418
  }
1138
- function ia(e) {
1419
+ function pa(e) {
1139
1420
  const t = document.createElement("div");
1140
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(hn()), t;
1421
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1422
+ re(
1423
+ "pluno-pa-widget__character--empty",
1424
+ e
1425
+ )
1426
+ ), t.appendChild(bn()), t;
1141
1427
  }
1142
- function hn() {
1428
+ function bn() {
1143
1429
  const e = document.createElement("div");
1144
1430
  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;
1145
1431
  }
1146
- function ra(e, t) {
1147
- e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1432
+ function sa(e, t) {
1433
+ e.replaceChildren(), e.setAttribute(
1434
+ "aria-label",
1435
+ `${t.toLocaleString("en-US")} users currently active`
1436
+ );
1148
1437
  const n = document.createElement("span");
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`));
1438
+ n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(
1439
+ document.createTextNode(
1440
+ `${t.toLocaleString("en-US")} users currently active`
1441
+ )
1442
+ );
1150
1443
  }
1151
1444
  function re(e, t) {
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);
1445
+ const n = `pluno-pa-character-${Ot}`;
1446
+ Ot += 1;
1447
+ const o = t.scribbleStyle ? ca(t.accentColor, n) : da(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1155
1448
  return o.setAttribute(
1156
1449
  "class",
1157
1450
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1158
1451
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1159
1452
  }
1160
- function la(e, t) {
1161
- const n = Gn(e), o = {
1453
+ function da(e, t) {
1454
+ const n = Wn(e), o = {
1162
1455
  boltFill: `${t}-boltFill`,
1163
1456
  boltEdge: `${t}-boltEdge`,
1164
1457
  boltGlow: `${t}-boltGlow`,
@@ -1169,7 +1462,7 @@ function la(e, t) {
1169
1462
  eyeShadow: `${t}-eyeShadow`,
1170
1463
  pupilGloss: `${t}-pupilGloss`,
1171
1464
  boltClip: `${t}-boltClip`
1172
- }, a = mn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1465
+ }, a = fn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1173
1466
  id: o.boltFill,
1174
1467
  x1: "420",
1175
1468
  y1: "180",
@@ -1231,7 +1524,15 @@ function la(e, t) {
1231
1524
  height: "116%",
1232
1525
  "color-interpolation-filters": "sRGB"
1233
1526
  });
1234
- m(x, "feGaussianBlur", { in: "SourceAlpha", stdDeviation: "8", result: "blur" }), m(x, "feOffset", { dx: "-7", dy: "-9", result: "topLeft" }), m(x, "feComposite", {
1527
+ m(x, "feGaussianBlur", {
1528
+ in: "SourceAlpha",
1529
+ stdDeviation: "8",
1530
+ result: "blur"
1531
+ }), m(x, "feOffset", {
1532
+ dx: "-7",
1533
+ dy: "-9",
1534
+ result: "topLeft"
1535
+ }), m(x, "feComposite", {
1235
1536
  in: "topLeft",
1236
1537
  in2: "SourceAlpha",
1237
1538
  operator: "arithmetic",
@@ -1243,7 +1544,11 @@ function la(e, t) {
1243
1544
  type: "matrix",
1244
1545
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1245
1546
  result: "innerLight"
1246
- }), m(x, "feBlend", { in: "SourceGraphic", in2: "innerLight", mode: "screen" });
1547
+ }), m(x, "feBlend", {
1548
+ in: "SourceGraphic",
1549
+ in2: "innerLight",
1550
+ mode: "screen"
1551
+ });
1247
1552
  const P = m(i, "filter", {
1248
1553
  id: o.eyeShadow,
1249
1554
  x: "-24%",
@@ -1276,8 +1581,13 @@ function la(e, t) {
1276
1581
  });
1277
1582
  const B = m(i, "clipPath", { id: o.boltClip });
1278
1583
  m(B, "path", { d: Ue });
1279
- const y = m(a, "g", { filter: $(o.softDropShadow) });
1280
- m(y, "path", { d: Ue, fill: $(o.boltEdge) });
1584
+ const y = m(a, "g", {
1585
+ filter: $(o.softDropShadow)
1586
+ });
1587
+ m(y, "path", {
1588
+ d: Ue,
1589
+ fill: $(o.boltEdge)
1590
+ });
1281
1591
  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";
1282
1592
  m(y, "path", {
1283
1593
  d: C,
@@ -1315,13 +1625,33 @@ function la(e, t) {
1315
1625
  opacity: "0.48"
1316
1626
  });
1317
1627
  const g = m(a, "g", { filter: $(o.eyeShadow) });
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;
1319
- }
1320
- function pa(e, t) {
1321
- const n = tn(e), o = {
1628
+ return Gt(
1629
+ g,
1630
+ "rotate(-2 528 463)",
1631
+ "528",
1632
+ "463",
1633
+ "533",
1634
+ "473",
1635
+ "557",
1636
+ "447",
1637
+ o
1638
+ ), Gt(
1639
+ g,
1640
+ "rotate(2 717 462)",
1641
+ "717",
1642
+ "462",
1643
+ "712",
1644
+ "473",
1645
+ "728",
1646
+ "447",
1647
+ o
1648
+ ), a;
1649
+ }
1650
+ function ca(e, t) {
1651
+ const n = on(e), o = {
1322
1652
  clip: `${t}-scribbleBoltClip`,
1323
1653
  wobble: `${t}-scribbleBoltWobble`
1324
- }, a = mn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1654
+ }, a = fn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1325
1655
  m(l, "path", { d: Ue });
1326
1656
  const p = m(i, "filter", {
1327
1657
  id: o.wobble,
@@ -1344,9 +1674,11 @@ function pa(e, t) {
1344
1674
  xChannelSelector: "R",
1345
1675
  yChannelSelector: "G"
1346
1676
  });
1347
- const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", { "clip-path": $(o.clip) });
1677
+ const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", {
1678
+ "clip-path": $(o.clip)
1679
+ });
1348
1680
  return m(u, "path", {
1349
- d: zn(),
1681
+ d: Gn(),
1350
1682
  fill: "none",
1351
1683
  stroke: n,
1352
1684
  "stroke-width": "56",
@@ -1360,26 +1692,55 @@ function pa(e, t) {
1360
1692
  stroke: Fe,
1361
1693
  "stroke-width": "18",
1362
1694
  "stroke-linejoin": "round"
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;
1695
+ }), Wt(
1696
+ c,
1697
+ "rotate(-2 528 463)",
1698
+ "528",
1699
+ "463",
1700
+ "533",
1701
+ "473",
1702
+ "557",
1703
+ "447"
1704
+ ), Wt(
1705
+ c,
1706
+ "rotate(2 717 462)",
1707
+ "717",
1708
+ "462",
1709
+ "712",
1710
+ "473",
1711
+ "728",
1712
+ "447"
1713
+ ), a;
1364
1714
  }
1365
- function mn() {
1715
+ function fn() {
1366
1716
  return v("svg", {
1367
- xmlns: dn,
1717
+ xmlns: un,
1368
1718
  viewBox: "0 0 1254 1254"
1369
1719
  });
1370
1720
  }
1371
- function zt(e, t, n, o, a, i, l, p, c) {
1721
+ function Gt(e, t, n, o, a, i, l, p, c) {
1372
1722
  const u = m(e, "g", { transform: t });
1373
- m(u, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: $(c.eyeWhite) }), m(u, "ellipse", {
1723
+ m(u, "ellipse", {
1724
+ cx: n,
1725
+ cy: o,
1726
+ rx: "73",
1727
+ ry: "80",
1728
+ fill: $(c.eyeWhite)
1729
+ }), m(u, "ellipse", {
1374
1730
  cx: a,
1375
1731
  cy: i,
1376
1732
  rx: "49",
1377
1733
  ry: "57",
1378
1734
  fill: $(c.pupil),
1379
1735
  filter: $(c.pupilGloss)
1380
- }), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
1736
+ }), m(u, "circle", {
1737
+ cx: l,
1738
+ cy: p,
1739
+ r: "18",
1740
+ fill: "#ffffff"
1741
+ });
1381
1742
  }
1382
- function Gt(e, t, n, o, a, i, l, p) {
1743
+ function Wt(e, t, n, o, a, i, l, p) {
1383
1744
  const c = m(e, "g", { transform: t });
1384
1745
  m(c, "ellipse", {
1385
1746
  cx: n,
@@ -1389,7 +1750,18 @@ function Gt(e, t, n, o, a, i, l, p) {
1389
1750
  fill: "#ffffff",
1390
1751
  stroke: Fe,
1391
1752
  "stroke-width": "13"
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" });
1753
+ }), m(c, "ellipse", {
1754
+ cx: a,
1755
+ cy: i,
1756
+ rx: "45",
1757
+ ry: "53",
1758
+ fill: Fe
1759
+ }), m(c, "circle", {
1760
+ cx: l,
1761
+ cy: p,
1762
+ r: "16",
1763
+ fill: "#ffffff"
1764
+ });
1393
1765
  }
1394
1766
  function m(e, t, n = {}) {
1395
1767
  const o = v(t, n);
@@ -1402,11 +1774,11 @@ function I(e, t, n, o) {
1402
1774
  function $(e) {
1403
1775
  return `url(#${e})`;
1404
1776
  }
1405
- function Ge(e, t, n, o) {
1777
+ function He(e, t, n, o) {
1406
1778
  const a = document.createElement("button");
1407
1779
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1408
1780
  }
1409
- function sa() {
1781
+ function ua() {
1410
1782
  const e = v("svg", {
1411
1783
  class: "pluno-pa-widget__scribble-defs",
1412
1784
  "aria-hidden": "true",
@@ -1414,43 +1786,55 @@ function sa() {
1414
1786
  width: "0",
1415
1787
  height: "0"
1416
1788
  }), t = v("defs");
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;
1418
- }
1419
- function bn(e, t) {
1420
- const n = v("svg", {
1789
+ return t.appendChild(tt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
1790
+ tt("pluno-pa-scribble-wobble-2", "5", "15")
1791
+ ), t.appendChild(
1792
+ tt("pluno-pa-scribble-wobble-3", "9", "19")
1793
+ ), e.appendChild(t), e;
1794
+ }
1795
+ function wn(e, t) {
1796
+ const n = t * Dt + Rt * 2, o = v("svg", {
1421
1797
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1422
- viewBox: `0 0 ${t * 26} 36`,
1423
- preserveAspectRatio: "none",
1798
+ viewBox: `0 0 ${n} ${To}`,
1799
+ preserveAspectRatio: "xMidYMid meet",
1424
1800
  "aria-hidden": "true",
1425
1801
  focusable: "false"
1426
1802
  });
1427
- for (let o = 0; o < t; o += 1) {
1428
- const a = Dt[o % Dt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
1429
- i.appendChild(
1803
+ for (let a = 0; a < t; a += 1) {
1804
+ const i = Mt[a % Mt.length], l = v("g", {
1805
+ transform: `translate(${Rt + a * Dt} 0)`
1806
+ });
1807
+ l.appendChild(
1430
1808
  v("ellipse", {
1431
- cx: a.ellipseCx,
1432
- cy: a.ellipseCy,
1433
- rx: a.ellipseRx,
1434
- ry: a.ellipseRy,
1809
+ cx: i.ellipseCx,
1810
+ cy: i.ellipseCy,
1811
+ rx: i.ellipseRx,
1812
+ ry: i.ellipseRy,
1435
1813
  fill: "none",
1436
1814
  stroke: "#2c2a1e",
1437
- "stroke-width": a.strokeWidth,
1815
+ "stroke-width": i.strokeWidth,
1438
1816
  opacity: "0.8"
1439
1817
  })
1440
- ), i.appendChild(
1818
+ ), l.appendChild(
1441
1819
  v("path", {
1442
- d: a.path,
1820
+ d: i.path,
1443
1821
  fill: "none",
1444
1822
  stroke: "#2c2a1e",
1445
- "stroke-width": a.pathStrokeWidth,
1823
+ "stroke-width": i.pathStrokeWidth,
1446
1824
  "stroke-linecap": "round"
1447
1825
  })
1448
- ), n.appendChild(i);
1826
+ ), o.appendChild(l);
1449
1827
  }
1450
- return n;
1828
+ return o;
1451
1829
  }
1452
1830
  function tt(e, t, n) {
1453
- const o = v("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1831
+ const o = v("filter", {
1832
+ id: e,
1833
+ x: "-8%",
1834
+ y: "-8%",
1835
+ width: "116%",
1836
+ height: "116%"
1837
+ });
1454
1838
  return o.appendChild(
1455
1839
  v("feTurbulence", {
1456
1840
  type: "fractalNoise",
@@ -1486,37 +1870,95 @@ function tt(e, t, n) {
1486
1870
  })
1487
1871
  ), o;
1488
1872
  }
1489
- function da(e) {
1490
- const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1873
+ function ga(e) {
1874
+ const t = Z(
1875
+ "0 0 24 24",
1876
+ e,
1877
+ e,
1878
+ "none",
1879
+ "currentColor",
1880
+ "2.25"
1881
+ );
1491
1882
  return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
1492
1883
  }
1493
- function ca() {
1494
- const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
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;
1884
+ function ha() {
1885
+ const e = Z(
1886
+ "0 0 24 24",
1887
+ 17,
1888
+ 17,
1889
+ "none",
1890
+ "currentColor",
1891
+ "2.25"
1892
+ );
1893
+ return e.appendChild(
1894
+ v("path", {
1895
+ d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
1896
+ })
1897
+ ), e.appendChild(
1898
+ v("path", {
1899
+ d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
1900
+ })
1901
+ ), e;
1496
1902
  }
1497
- function ua() {
1498
- const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1903
+ function ma() {
1904
+ const e = Z(
1905
+ "0 0 24 24",
1906
+ 17,
1907
+ 17,
1908
+ "none",
1909
+ "currentColor",
1910
+ "2.25"
1911
+ );
1499
1912
  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;
1500
1913
  }
1501
- function ga() {
1502
- const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
1914
+ function ba() {
1915
+ const e = Z(
1916
+ "0 0 24 24",
1917
+ 15,
1918
+ 15,
1919
+ "none",
1920
+ "currentColor",
1921
+ "2.4"
1922
+ );
1503
1923
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1504
1924
  }
1505
- function fn() {
1506
- const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
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;
1925
+ function _n() {
1926
+ const e = Z(
1927
+ "0 0 24 24",
1928
+ 14,
1929
+ 14,
1930
+ "none",
1931
+ "currentColor",
1932
+ "2.75"
1933
+ );
1934
+ return e.appendChild(
1935
+ v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
1936
+ ), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
1508
1937
  }
1509
- function ha() {
1510
- const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1511
- return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1938
+ function fa() {
1939
+ const e = Z(
1940
+ "0 0 24 24",
1941
+ 16,
1942
+ 16,
1943
+ "none",
1944
+ "currentColor",
1945
+ "2.4"
1946
+ );
1947
+ return e.setAttribute(
1948
+ "class",
1949
+ "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
1950
+ ), e.appendChild(
1512
1951
  v("path", {
1513
1952
  d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
1514
1953
  })
1515
1954
  ), e;
1516
1955
  }
1517
- function ma() {
1956
+ function wa() {
1518
1957
  const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1519
- return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1958
+ return e.setAttribute(
1959
+ "class",
1960
+ "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
1961
+ ), e.appendChild(
1520
1962
  v("path", {
1521
1963
  d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
1522
1964
  stroke: "currentColor",
@@ -1526,17 +1968,52 @@ function ma() {
1526
1968
  })
1527
1969
  ), e;
1528
1970
  }
1529
- function ba() {
1971
+ function _a() {
1530
1972
  const e = Z("0 0 24 24", 18, 18, "currentColor");
1531
- return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1973
+ return e.appendChild(
1974
+ v("rect", {
1975
+ x: "6",
1976
+ y: "6",
1977
+ width: "12",
1978
+ height: "12",
1979
+ rx: "2"
1980
+ })
1981
+ ), e;
1532
1982
  }
1533
- function fa() {
1534
- const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1983
+ function xa() {
1984
+ const e = Z(
1985
+ "0 0 24 24",
1986
+ 12,
1987
+ 12,
1988
+ "none",
1989
+ "currentColor",
1990
+ "2.4"
1991
+ );
1535
1992
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1536
1993
  }
1537
- function wa() {
1538
- const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
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;
1994
+ function ya() {
1995
+ const e = Z(
1996
+ "0 0 24 24",
1997
+ 13,
1998
+ 13,
1999
+ "none",
2000
+ "currentColor",
2001
+ "2.25"
2002
+ );
2003
+ return e.appendChild(
2004
+ v("rect", {
2005
+ width: "14",
2006
+ height: "14",
2007
+ x: "8",
2008
+ y: "8",
2009
+ rx: "2",
2010
+ ry: "2"
2011
+ })
2012
+ ), e.appendChild(
2013
+ v("path", {
2014
+ d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2015
+ })
2016
+ ), e;
1540
2017
  }
1541
2018
  function Z(e, t, n, o, a, i) {
1542
2019
  const l = {
@@ -1549,38 +2026,38 @@ function Z(e, t, n, o, a, i) {
1549
2026
  return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
1550
2027
  }
1551
2028
  function v(e, t = {}) {
1552
- const n = document.createElementNS(dn, e);
2029
+ const n = document.createElementNS(un, e);
1553
2030
  for (const [o, a] of Object.entries(t))
1554
2031
  n.setAttribute(o, a);
1555
2032
  return n;
1556
2033
  }
1557
- function Ht(e) {
2034
+ function $t(e) {
1558
2035
  for (const t of ["keydown", "keypress", "keyup"])
1559
2036
  e.addEventListener(t, (n) => {
1560
2037
  n.stopPropagation();
1561
2038
  });
1562
2039
  }
1563
- function _a(e, t, n) {
2040
+ function va(e, t, n) {
1564
2041
  e.replaceChildren(), e.hidden = t.length === 0;
1565
2042
  for (const [o, a] of t.entries()) {
1566
2043
  const i = document.createElement("div");
1567
- i.className = "pluno-pa-widget__attachment", i.appendChild(xa(a));
2044
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Ca(a));
1568
2045
  const l = document.createElement("span");
1569
2046
  l.textContent = a.name, i.appendChild(l);
1570
2047
  const p = document.createElement("button");
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);
2048
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(xa()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1572
2049
  }
1573
2050
  }
1574
- function xa(e) {
1575
- if (wn(e)) {
2051
+ function Ca(e) {
2052
+ if (xn(e)) {
1576
2053
  const n = document.createElement("img");
1577
2054
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1578
2055
  }
1579
2056
  const t = document.createElement("span");
1580
2057
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1581
2058
  }
1582
- function ya(e) {
1583
- if (wn(e)) {
2059
+ function Ea(e) {
2060
+ if (xn(e)) {
1584
2061
  const a = document.createElement("img");
1585
2062
  return a.src = e.dataUrl, a.alt = e.name, a;
1586
2063
  }
@@ -1591,51 +2068,58 @@ function ya(e) {
1591
2068
  const o = document.createElement("strong");
1592
2069
  return o.textContent = e.name, t.append(n, o), t;
1593
2070
  }
1594
- function wn(e) {
2071
+ function xn(e) {
1595
2072
  return e.mimeType.startsWith("image/");
1596
2073
  }
1597
- function va(e) {
2074
+ function Sa(e) {
1598
2075
  return e === "application/pdf" ? "document.pdf" : "image";
1599
2076
  }
1600
- async function Ca(e) {
2077
+ async function ka(e) {
1601
2078
  if (!e)
1602
2079
  return [];
1603
2080
  const t = Array.from(e);
1604
2081
  if (t.length > ze)
1605
- throw new Error(`Attach up to ${ze} files per message.`);
2082
+ throw new Error(
2083
+ `Attach up to ${ze} files per message.`
2084
+ );
1606
2085
  return Promise.all(
1607
2086
  t.map(async (n) => {
1608
- const o = Ea(n);
2087
+ const o = La(n);
1609
2088
  if (!o)
1610
- throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1611
- if (n.size > bo)
2089
+ throw new Error(
2090
+ "Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files."
2091
+ );
2092
+ if (n.size > wo)
1612
2093
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1613
2094
  if (o === "image/gif") {
1614
- const a = new Uint8Array(await Da(n));
1615
- if (ka(a))
2095
+ const a = new Uint8Array(await Ba(n));
2096
+ if (Aa(a))
1616
2097
  throw new Error("Pluno supports non-animated GIF images.");
1617
2098
  }
1618
2099
  return {
1619
- name: n.name || va(o),
2100
+ name: n.name || Sa(o),
1620
2101
  mimeType: o,
1621
2102
  sizeBytes: n.size,
1622
- dataUrl: Sa(await Ra(n), o)
2103
+ dataUrl: Pa(
2104
+ await Oa(n),
2105
+ o
2106
+ )
1623
2107
  };
1624
2108
  })
1625
2109
  );
1626
2110
  }
1627
- function Ea(e) {
1628
- if (ln.has(e.type))
2111
+ function La(e) {
2112
+ if (sn.has(e.type))
1629
2113
  return e.type;
1630
2114
  const t = e.name.toLowerCase();
1631
2115
  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;
1632
2116
  }
1633
- function Sa(e, t) {
2117
+ function Pa(e, t) {
1634
2118
  const n = `data:${t};base64,`;
1635
2119
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1636
2120
  }
1637
- function ka(e) {
1638
- if (e.length < 14 || !La(e))
2121
+ function Aa(e) {
2122
+ if (e.length < 14 || !Ta(e))
1639
2123
  return !1;
1640
2124
  const t = e[10];
1641
2125
  let n = 13;
@@ -1646,7 +2130,7 @@ function ka(e) {
1646
2130
  if (n += 1, a === 59)
1647
2131
  return !1;
1648
2132
  if (a === 33) {
1649
- n += 1, n = Wt(e, n);
2133
+ n += 1, n = qt(e, n);
1650
2134
  continue;
1651
2135
  }
1652
2136
  if (a !== 44)
@@ -1658,14 +2142,14 @@ function ka(e) {
1658
2142
  const i = e[n + 8];
1659
2143
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1660
2144
  return !1;
1661
- n += 1, n = Wt(e, n);
2145
+ n += 1, n = qt(e, n);
1662
2146
  }
1663
2147
  return !1;
1664
2148
  }
1665
- function La(e) {
2149
+ function Ta(e) {
1666
2150
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1667
2151
  }
1668
- function Wt(e, t) {
2152
+ function qt(e, t) {
1669
2153
  for (; t < e.length; ) {
1670
2154
  const n = e[t];
1671
2155
  if (t += 1, n === 0)
@@ -1682,31 +2166,45 @@ function nt(e, t, n = null) {
1682
2166
  e && (e.hidden = !0, e.replaceChildren());
1683
2167
  return;
1684
2168
  }
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));
2169
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || ct(n) ? e.appendChild(
2170
+ Na(t, n)
2171
+ ) : yn(t) && e.appendChild(Ia(t));
1686
2172
  }
1687
- function Pa(e, t) {
2173
+ function Na(e, t) {
1688
2174
  const n = document.createElement("div");
1689
2175
  n.className = "pluno-pa-widget__billing-action-card";
1690
2176
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1691
2177
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1692
2178
  const i = document.createElement("span");
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;
2179
+ 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(
2180
+ vn(
2181
+ e,
2182
+ "Upgrade plan",
2183
+ "pluno-pa-widget__billing-action-card-actions"
2184
+ )
2185
+ ), n;
1694
2186
  }
1695
- function Aa(e) {
2187
+ function Ia(e) {
1696
2188
  const t = document.createElement("div");
1697
2189
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1698
2190
  const n = document.createElement("strong");
1699
2191
  n.textContent = "Credits running low", t.appendChild(n);
1700
2192
  const o = document.createElement("span");
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;
2193
+ return o.textContent = Ra(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2194
+ vn(
2195
+ e,
2196
+ "Upgrade",
2197
+ "pluno-pa-widget__billing-action-card-actions"
2198
+ )
2199
+ ), t;
1702
2200
  }
1703
2201
  function pt(e, t) {
1704
- return e !== null && (X(e) || _n(e) || ct(t));
2202
+ return e !== null && (X(e) || yn(e) || ct(t));
1705
2203
  }
1706
- function $t(e, t, n) {
1707
- return pt(t, n) || Ta(t) ? !0 : !pt(e, n);
2204
+ function jt(e, t, n) {
2205
+ return pt(t, n) || Da(t) ? !0 : !pt(e, n);
1708
2206
  }
1709
- function Ta(e) {
2207
+ function Da(e) {
1710
2208
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
1711
2209
  }
1712
2210
  function X(e) {
@@ -1715,22 +2213,26 @@ function X(e) {
1715
2213
  function ct(e) {
1716
2214
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1717
2215
  }
1718
- function _n(e) {
2216
+ function yn(e) {
1719
2217
  return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1720
2218
  }
1721
- function Na(e) {
1722
- return e.creditsRemaining === null ? null : `${Ia(e.creditsRemaining)} credits left`;
2219
+ function Ra(e) {
2220
+ return e.creditsRemaining === null ? null : `${Ma(e.creditsRemaining)} credits left`;
1723
2221
  }
1724
- function Ia(e) {
2222
+ function Ma(e) {
1725
2223
  return new Intl.NumberFormat("en-US", {
1726
2224
  maximumFractionDigits: 0
1727
2225
  }).format(Math.ceil(e));
1728
2226
  }
1729
- function xn(e, t, n) {
2227
+ function vn(e, t, n) {
1730
2228
  const o = document.createElement("div");
1731
- return o.className = n, o.appendChild(qt(t, e.pricingUrl)), o.appendChild(qt("Earn credits", e.earnCreditsUrl)), o;
2229
+ return o.className = n, o.appendChild(
2230
+ Vt(t, e.pricingUrl)
2231
+ ), o.appendChild(
2232
+ Vt("Earn credits", e.earnCreditsUrl)
2233
+ ), o;
1732
2234
  }
1733
- function qt(e, t) {
2235
+ function Vt(e, t) {
1734
2236
  const n = document.createElement("button");
1735
2237
  if (n.type = "button", e === "Earn credits") {
1736
2238
  const o = document.createElement("span");
@@ -1741,7 +2243,7 @@ function qt(e, t) {
1741
2243
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1742
2244
  }), n;
1743
2245
  }
1744
- function Da(e) {
2246
+ function Ba(e) {
1745
2247
  return new Promise((t, n) => {
1746
2248
  const o = new FileReader();
1747
2249
  o.addEventListener("load", () => {
@@ -1755,7 +2257,7 @@ function Da(e) {
1755
2257
  }), o.readAsArrayBuffer(e);
1756
2258
  });
1757
2259
  }
1758
- function Ra(e) {
2260
+ function Oa(e) {
1759
2261
  return new Promise((t, n) => {
1760
2262
  const o = new FileReader();
1761
2263
  o.addEventListener("load", () => {
@@ -1769,20 +2271,27 @@ function Ra(e) {
1769
2271
  }), o.readAsDataURL(e);
1770
2272
  });
1771
2273
  }
1772
- function jt(e, t) {
1773
- return e.messages.filter((o) => !yn(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2274
+ function Yt(e, t) {
2275
+ return e.messages.filter(
2276
+ (o) => !Cn(o)
2277
+ ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1774
2278
  }
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);
2279
+ function Ua(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
2280
+ const B = [...i.messages], y = B.filter(
2281
+ (_) => !Cn(_)
2282
+ ), C = e.scrollTop;
2283
+ e.replaceChildren(), Sn(n, i.isThinking), a.hidden = !p, p && l !== null && sa(a, l);
1778
2284
  const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
1779
2285
  if (o(h), y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1780
2286
  const _ = document.createElement("div");
1781
2287
  _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1782
2288
  const L = document.createElement("div");
1783
2289
  L.className = "pluno-pa-widget__empty-hero";
1784
- const G = re("pluno-pa-widget__character--empty", x());
1785
- L.appendChild(G), _.appendChild(L), _.appendChild(hn());
2290
+ const H = re(
2291
+ "pluno-pa-widget__character--empty",
2292
+ x()
2293
+ );
2294
+ L.appendChild(H), _.appendChild(L), _.appendChild(bn());
1786
2295
  const R = document.createElement("div");
1787
2296
  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)
1788
2297
  for (const f of i.starterPrompts) {
@@ -1795,7 +2304,7 @@ function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1795
2304
  const f = document.createElement("button");
1796
2305
  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);
1797
2306
  } else
1798
- for (let f = 0; f < wo; f += 1) {
2307
+ for (let f = 0; f < xo; f += 1) {
1799
2308
  const A = document.createElement("button");
1800
2309
  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);
1801
2310
  }
@@ -1806,7 +2315,12 @@ function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1806
2315
  const le = () => {
1807
2316
  if (F.length === 0)
1808
2317
  return !1;
1809
- const _ = Wa(F, s, b, x());
2318
+ const _ = ja(
2319
+ F,
2320
+ s,
2321
+ b,
2322
+ x()
2323
+ );
1810
2324
  return e.appendChild(_), g = null, E = _, F = [], !0;
1811
2325
  };
1812
2326
  for (let _ = 0; _ < y.length; _ += 1) {
@@ -1817,15 +2331,15 @@ function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1817
2331
  }
1818
2332
  if (L.role === "system")
1819
2333
  continue;
1820
- const G = le(), R = Kt(L.content);
1821
- if (L.role === "assistant" && !G) {
2334
+ const H = le(), R = Zt(L.content);
2335
+ if (L.role === "assistant" && !H) {
1822
2336
  const T = st(x());
1823
2337
  e.appendChild(T), g = null, E = T;
1824
2338
  }
1825
2339
  const f = document.createElement("div");
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));
2340
+ f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Jt(f, R) : f.textContent = R, L.role === "user" && L.attachments?.length && f.appendChild(Fa(L.attachments));
1827
2341
  const A = document.createElement("div");
1828
- A.className = "pluno-pa-widget__message-actions", A.appendChild(Yt(R)), f.appendChild(A), e.appendChild(f), g = f, E = null;
2342
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(Xt(R)), f.appendChild(A), e.appendChild(f), g = f, E = null;
1829
2343
  }
1830
2344
  const ye = le();
1831
2345
  if (i.assistantDraft) {
@@ -1833,26 +2347,26 @@ function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1833
2347
  const R = st(x());
1834
2348
  e.appendChild(R), g = null, E = R;
1835
2349
  }
1836
- const _ = Kt(i.assistantDraft), L = document.createElement("div");
1837
- L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Xt(L, _);
1838
- const G = document.createElement("div");
1839
- G.className = "pluno-pa-widget__message-actions", G.appendChild(Yt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
2350
+ const _ = Zt(i.assistantDraft), L = document.createElement("div");
2351
+ L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Jt(L, _);
2352
+ const H = document.createElement("div");
2353
+ H.className = "pluno-pa-widget__message-actions", H.appendChild(Xt(_)), L.appendChild(H), e.appendChild(L), g = L, E = null;
1840
2354
  }
1841
2355
  if (i.isThinking && !i.assistantDraft)
1842
2356
  if (ye) {
1843
- const _ = vn();
2357
+ const _ = En();
1844
2358
  e.appendChild(_), g = null, E = _;
1845
2359
  } else {
1846
- const _ = $a(x());
2360
+ const _ = Va(x());
1847
2361
  e.appendChild(_), g = null, E = _;
1848
2362
  }
1849
2363
  if (i.lastError) {
1850
2364
  const _ = document.createElement("div");
1851
2365
  _.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
1852
2366
  }
1853
- const D = k && !i.isThinking ? qn(B) : null;
2367
+ const D = k && !i.isThinking ? Vn(B) : null;
1854
2368
  if (k && D && !k.dismissedCandidateIds.has(D.id)) {
1855
- const _ = Oa(D, {
2369
+ const _ = za(D, {
1856
2370
  isDrafting: k.draftingCandidateId === D.id,
1857
2371
  error: k.error,
1858
2372
  characterIconOptions: k.characterIconOptions,
@@ -1862,13 +2376,20 @@ function Ma(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1862
2376
  });
1863
2377
  e.appendChild(_), k.onSeen(D), g = null, E = _;
1864
2378
  }
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;
1866
- }
1867
- function Vt(e, t, n, o, a, i, l, p) {
1868
- e.replaceChildren(), Cn(t, !1), t.disabled = !0, n(!1);
2379
+ g?.classList.add(
2380
+ "pluno-pa-widget__message--bottom-reserve"
2381
+ ), E?.classList.add(
2382
+ "pluno-pa-widget__bottom-reserve-compact"
2383
+ ), e.appendChild(t), c ? ke(e, u) : e.scrollTop = C;
2384
+ }
2385
+ function Kt(e, t, n, o, a, i, l, p) {
2386
+ e.replaceChildren(), Sn(t, !1), t.disabled = !0, n(!1);
1869
2387
  const c = document.createElement("div");
1870
2388
  c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1871
- const u = re("pluno-pa-widget__character--empty", o());
2389
+ const u = re(
2390
+ "pluno-pa-widget__character--empty",
2391
+ o()
2392
+ );
1872
2393
  c.appendChild(u);
1873
2394
  const s = document.createElement("div");
1874
2395
  if (s.className = "pluno-pa-widget__empty", s.textContent = a, c.appendChild(s), l) {
@@ -1880,24 +2401,29 @@ function Vt(e, t, n, o, a, i, l, p) {
1880
2401
  }
1881
2402
  e.appendChild(c);
1882
2403
  }
1883
- function Ba(e) {
2404
+ function Fa(e) {
1884
2405
  const t = document.createElement("div");
1885
2406
  t.className = "pluno-pa-widget__message-attachments";
1886
2407
  for (const n of e)
1887
- t.appendChild(ya(n));
2408
+ t.appendChild(Ea(n));
1888
2409
  return t;
1889
2410
  }
1890
- function Yt(e) {
2411
+ function Xt(e) {
1891
2412
  const t = document.createElement("button");
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) => {
2413
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ya()), t.addEventListener("click", (n) => {
1893
2414
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1894
2415
  }), t;
1895
2416
  }
1896
- function Oa(e, t) {
2417
+ function za(e, t) {
1897
2418
  const n = document.createElement("article");
1898
2419
  n.className = "pluno-pa-widget__share-prompt";
1899
2420
  const o = document.createElement("div");
1900
- o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(re("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
2421
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2422
+ re(
2423
+ "pluno-pa-widget__share-prompt-icon",
2424
+ t.characterIconOptions
2425
+ )
2426
+ );
1901
2427
  const a = document.createElement("div");
1902
2428
  a.className = "pluno-pa-widget__share-prompt-copy";
1903
2429
  const i = document.createElement("strong");
@@ -1929,7 +2455,7 @@ function Oa(e, t) {
1929
2455
  }
1930
2456
  return o.appendChild(p), n.appendChild(o), n;
1931
2457
  }
1932
- function Ua(e, t) {
2458
+ function Ha(e, t) {
1933
2459
  const n = document.createElement("div");
1934
2460
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
1935
2461
  y.target === n && t.onClose();
@@ -1948,13 +2474,16 @@ function Ua(e, t) {
1948
2474
  u.className = "pluno-pa-widget__share-dialog-step-header";
1949
2475
  const s = document.createElement("strong");
1950
2476
  s.textContent = "1) Copy Screenshot", u.appendChild(s);
1951
- const b = Fa("Copy Screenshot", async () => {
1952
- try {
1953
- return await jn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1954
- } catch {
1955
- return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2477
+ const b = Ga(
2478
+ "Copy Screenshot",
2479
+ async () => {
2480
+ try {
2481
+ return await Yn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2482
+ } catch {
2483
+ return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2484
+ }
1956
2485
  }
1957
- });
2486
+ );
1958
2487
  if (u.appendChild(b), c.appendChild(u), e.screenshotDataUrl) {
1959
2488
  const y = document.createElement("div");
1960
2489
  y.className = "pluno-pa-widget__share-dialog-screenshot";
@@ -1970,9 +2499,9 @@ function Ua(e, t) {
1970
2499
  k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
1971
2500
  const B = document.createElement("footer");
1972
2501
  B.className = "pluno-pa-widget__share-dialog-platforms";
1973
- for (const y of za(e)) {
2502
+ for (const y of Wa(e)) {
1974
2503
  const C = document.createElement("a");
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);
2504
+ C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild($a(y.id)), B.appendChild(C);
1976
2505
  }
1977
2506
  if (x.appendChild(B), o.appendChild(x), t.socialPostRewardsUrl) {
1978
2507
  const y = document.createElement("div");
@@ -1980,17 +2509,17 @@ function Ua(e, t) {
1980
2509
  const C = document.createElement("strong");
1981
2510
  C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
1982
2511
  const h = document.createElement("a");
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);
2512
+ 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(qa()), y.appendChild(h), o.appendChild(y);
1984
2513
  }
1985
2514
  return n.appendChild(o), n;
1986
2515
  }
1987
- function Fa(e, t) {
2516
+ function Ga(e, t) {
1988
2517
  const n = document.createElement("button");
1989
2518
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1990
2519
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1991
2520
  }), n;
1992
2521
  }
1993
- function za(e) {
2522
+ function Wa(e) {
1994
2523
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1995
2524
  return [
1996
2525
  {
@@ -2010,28 +2539,57 @@ function za(e) {
2010
2539
  }
2011
2540
  ];
2012
2541
  }
2013
- function Ga(e) {
2542
+ function $a(e) {
2014
2543
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
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);
2544
+ 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(
2545
+ t,
2546
+ "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"
2547
+ ), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(
2548
+ t,
2549
+ "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"
2550
+ ), 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(
2551
+ t,
2552
+ "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"
2553
+ ), U(
2554
+ t,
2555
+ "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",
2556
+ "0.48"
2557
+ ), U(
2558
+ t,
2559
+ "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"
2560
+ ), U(
2561
+ t,
2562
+ "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"
2563
+ ), t);
2016
2564
  }
2017
2565
  function U(e, t, n) {
2018
2566
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
2019
2567
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
2020
2568
  }
2021
- function Ha() {
2569
+ function qa() {
2022
2570
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
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;
2571
+ 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(
2572
+ e,
2573
+ "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
2574
+ ), e;
2024
2575
  }
2025
- function yn(e) {
2026
- return e.role === "tool" && e.toolName === on;
2576
+ function Cn(e) {
2577
+ return e.role === "tool" && e.toolName === rn;
2027
2578
  }
2028
- function Kt(e) {
2579
+ function Zt(e) {
2029
2580
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2030
2581
  }
2031
- function Wa(e, t, n, o) {
2582
+ function ja(e, t, n, o) {
2032
2583
  const a = document.createElement("article");
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));
2034
- const i = document.createElement("details"), l = qa(e);
2584
+ a.className = "pluno-pa-widget__tool-group", a.title = new Date(
2585
+ e[e.length - 1].createdAt
2586
+ ).toLocaleString(), a.appendChild(
2587
+ re(
2588
+ "pluno-pa-widget__character--tool-group",
2589
+ o
2590
+ )
2591
+ );
2592
+ const i = document.createElement("details"), l = Ya(e);
2035
2593
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
2036
2594
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
2037
2595
  });
@@ -2053,13 +2611,18 @@ function Wa(e, t, n, o) {
2053
2611
  }
2054
2612
  function st(e) {
2055
2613
  const t = document.createElement("article");
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;
2614
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
2615
+ re(
2616
+ "pluno-pa-widget__character--tool-group",
2617
+ e
2618
+ )
2619
+ ), t;
2057
2620
  }
2058
- function $a(e) {
2621
+ function Va(e) {
2059
2622
  const t = st(e);
2060
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(vn()), t;
2623
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(En()), t;
2061
2624
  }
2062
- function vn() {
2625
+ function En() {
2063
2626
  const e = document.createElement("div");
2064
2627
  e.className = "pluno-pa-widget__status";
2065
2628
  const t = document.createElement("span");
@@ -2067,17 +2630,17 @@ function vn() {
2067
2630
  const n = document.createElement("span");
2068
2631
  return n.textContent = "Thinking...", e.appendChild(n), e;
2069
2632
  }
2070
- function qa(e) {
2633
+ function Ya(e) {
2071
2634
  return `tools:${e[0]?.id ?? ""}`;
2072
2635
  }
2073
2636
  function dt() {
2074
2637
  const e = document.createElement("span");
2075
2638
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2076
2639
  }
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());
2640
+ function Sn(e, t) {
2641
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? _a() : _n());
2079
2642
  }
2080
- function Xt(e, t) {
2643
+ function Jt(e, t) {
2081
2644
  const n = t.replace(/\r\n/g, `
2082
2645
  `).split(`
2083
2646
  `);
@@ -2136,7 +2699,9 @@ function Be(e, t) {
2136
2699
  let o = 0;
2137
2700
  for (const a of t.matchAll(n)) {
2138
2701
  const i = a.index ?? 0;
2139
- i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
2702
+ i > o && e.appendChild(
2703
+ document.createTextNode(t.slice(o, i))
2704
+ );
2140
2705
  const l = a[0];
2141
2706
  if (l.startsWith("`")) {
2142
2707
  const p = document.createElement("code");
@@ -2149,7 +2714,7 @@ function Be(e, t) {
2149
2714
  p.textContent = l.slice(1, -1), e.appendChild(p);
2150
2715
  } else {
2151
2716
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2152
- if (p && ja(p[2])) {
2717
+ if (p && Ka(p[2])) {
2153
2718
  const c = document.createElement("a");
2154
2719
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2155
2720
  } else
@@ -2159,7 +2724,7 @@ function Be(e, t) {
2159
2724
  }
2160
2725
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2161
2726
  }
2162
- function ja(e) {
2727
+ function Ka(e) {
2163
2728
  if (e.startsWith("/") || e.startsWith("#"))
2164
2729
  return !0;
2165
2730
  try {
@@ -2169,8 +2734,8 @@ function ja(e) {
2169
2734
  return !1;
2170
2735
  }
2171
2736
  }
2172
- function Zt(e, t) {
2173
- if (Va(e))
2737
+ function Qt(e, t) {
2738
+ if (Xa(e))
2174
2739
  return;
2175
2740
  const n = `
2176
2741
  :host {
@@ -3852,7 +4417,7 @@ function Zt(e, t) {
3852
4417
  position: absolute;
3853
4418
  top: -16px;
3854
4419
  left: 16px;
3855
- width: min(416px, calc(100% - 104px));
4420
+ width: min(416px, calc(100% - 30px));
3856
4421
  height: 36px;
3857
4422
  z-index: 3;
3858
4423
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -4143,7 +4708,7 @@ function Zt(e, t) {
4143
4708
  position: absolute;
4144
4709
  top: -11px;
4145
4710
  left: 12px;
4146
- right: 12px;
4711
+ width: min(166px, calc(100% - 12px));
4147
4712
  height: 22px;
4148
4713
  z-index: 1;
4149
4714
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -4156,28 +4721,28 @@ function Zt(e, t) {
4156
4721
  filter: url(#pluno-pa-scribble-wobble-2);
4157
4722
  }
4158
4723
  `;
4159
- if (Ya(e, n))
4724
+ if (Za(e, n))
4160
4725
  return;
4161
4726
  const o = e.ownerDocument.createElement("style");
4162
- o.id = cn, o.textContent = n, e.appendChild(o), En(e);
4727
+ o.id = gn, o.textContent = n, e.appendChild(o), kn(e);
4163
4728
  }
4164
- function Va(e) {
4165
- return e.getElementById(cn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(un) === "true";
4729
+ function Xa(e) {
4730
+ return e.getElementById(gn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(hn) === "true";
4166
4731
  }
4167
- function En(e) {
4168
- e.host instanceof HTMLElement && e.host.setAttribute(un, "true");
4732
+ function kn(e) {
4733
+ e.host instanceof HTMLElement && e.host.setAttribute(hn, "true");
4169
4734
  }
4170
- function Ya(e, t) {
4735
+ function Za(e, t) {
4171
4736
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
4172
4737
  return !1;
4173
4738
  try {
4174
4739
  const n = new CSSStyleSheet();
4175
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], En(e), !0;
4740
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], kn(e), !0;
4176
4741
  } catch {
4177
4742
  return !1;
4178
4743
  }
4179
4744
  }
4180
- async function Ka() {
4745
+ async function Ja() {
4181
4746
  return document.body ? document.body : await new Promise((e) => {
4182
4747
  const t = new MutationObserver(() => {
4183
4748
  document.body && (t.disconnect(), e(document.body));
@@ -4185,49 +4750,53 @@ async function Ka() {
4185
4750
  t.observe(document.documentElement, { childList: !0 });
4186
4751
  });
4187
4752
  }
4188
- function Sn(e) {
4753
+ function Ln(e) {
4189
4754
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
4190
4755
  }
4191
- function Xa(e) {
4756
+ function Qa(e) {
4192
4757
  try {
4193
- const t = window.localStorage.getItem(Sn(e));
4758
+ const t = window.localStorage.getItem(Ln(e));
4194
4759
  if (!t)
4195
- return Jt();
4760
+ return en();
4196
4761
  const n = JSON.parse(t);
4197
4762
  return {
4198
4763
  isOpen: n.isOpen === !0,
4199
4764
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
4200
- openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
4201
- launcherPosition: ei(n.launcherPosition) ? n.launcherPosition : null,
4202
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-an) : [],
4765
+ openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
4766
+ (o) => typeof o == "string"
4767
+ ) : [],
4768
+ launcherPosition: oi(n.launcherPosition) ? n.launcherPosition : null,
4769
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-ln) : [],
4203
4770
  sharePromptsDisabled: n.sharePromptsDisabled === !0
4204
4771
  };
4205
4772
  } catch {
4206
- return Jt();
4773
+ return en();
4207
4774
  }
4208
4775
  }
4209
- async function Za(e) {
4776
+ async function ei(e) {
4210
4777
  if (e.loadSharePromptsDisabled)
4211
4778
  return e.loadSharePromptsDisabled();
4212
4779
  try {
4213
- return window.localStorage.getItem(rn) === "true";
4780
+ return window.localStorage.getItem(pn) === "true";
4214
4781
  } catch {
4215
4782
  return !1;
4216
4783
  }
4217
4784
  }
4218
- function Ja(e, t) {
4785
+ function ti(e, t) {
4219
4786
  if (e.persistSharePromptsDisabled) {
4220
- Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
4221
- });
4787
+ Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
4788
+ () => {
4789
+ }
4790
+ );
4222
4791
  return;
4223
4792
  }
4224
4793
  try {
4225
- t && window.localStorage.setItem(rn, "true");
4794
+ t && window.localStorage.setItem(pn, "true");
4226
4795
  } catch {
4227
4796
  return;
4228
4797
  }
4229
4798
  }
4230
- function Jt() {
4799
+ function en() {
4231
4800
  return {
4232
4801
  isOpen: !1,
4233
4802
  composerValue: "",
@@ -4237,41 +4806,46 @@ function Jt() {
4237
4806
  sharePromptsDisabled: !1
4238
4807
  };
4239
4808
  }
4240
- function Qa(e, t) {
4809
+ function ni(e, t) {
4241
4810
  try {
4242
- window.localStorage.setItem(Sn(e), JSON.stringify(t));
4811
+ window.localStorage.setItem(
4812
+ Ln(e),
4813
+ JSON.stringify(t)
4814
+ );
4243
4815
  } catch {
4244
4816
  return;
4245
4817
  }
4246
4818
  }
4247
- function ei(e) {
4819
+ function oi(e) {
4248
4820
  if (!e || typeof e != "object")
4249
4821
  return !1;
4250
4822
  const t = e;
4251
4823
  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");
4252
4824
  }
4253
- const Qt = /* @__PURE__ */ new WeakSet();
4254
- function ti(e) {
4825
+ const tn = /* @__PURE__ */ new WeakSet();
4826
+ function ai(e) {
4255
4827
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
4256
4828
  }
4257
- function en(e) {
4829
+ function nn(e) {
4258
4830
  const t = e.pathname.split("/");
4259
4831
  return t[t.length - 1] ?? "";
4260
4832
  }
4261
- function ni(e, t) {
4833
+ function ii(e, t) {
4262
4834
  const n = new URL(e.src, document.baseURI);
4263
- return n.href === t.href || n.pathname === t.pathname ? !0 : en(n) === en(t);
4835
+ return n.href === t.href || n.pathname === t.pathname ? !0 : nn(n) === nn(t);
4264
4836
  }
4265
4837
  class te extends EventTarget {
4266
4838
  constructor(t, n) {
4267
- super(), this.channelId = n, this.url = t, this.addPreviewListener(so, () => {
4839
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(uo, () => {
4268
4840
  this.readyState = te.OPEN, this.dispatchEvent(new Event("open"));
4269
- }), this.addPreviewListener(co, (o) => {
4841
+ }), this.addPreviewListener(go, (o) => {
4270
4842
  const a = o;
4271
- this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
4272
- }), this.addPreviewListener(uo, () => {
4843
+ this.dispatchEvent(
4844
+ new MessageEvent("message", { data: a.detail?.data ?? "" })
4845
+ );
4846
+ }), this.addPreviewListener(ho, () => {
4273
4847
  this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4274
- }), this.addPreviewListener(go, (o) => {
4848
+ }), this.addPreviewListener(mo, (o) => {
4275
4849
  const a = o;
4276
4850
  this.readyState = te.CLOSED, this.dispatchEvent(
4277
4851
  new CloseEvent("close", {
@@ -4281,9 +4855,15 @@ class te extends EventTarget {
4281
4855
  })
4282
4856
  ), this.cleanup();
4283
4857
  }), window.dispatchEvent(
4284
- new CustomEvent(Oe(ro, this.channelId), {
4285
- detail: { socketId: this.socketId, url: t }
4286
- })
4858
+ new CustomEvent(
4859
+ Oe(
4860
+ po,
4861
+ this.channelId
4862
+ ),
4863
+ {
4864
+ detail: { socketId: this.socketId, url: t }
4865
+ }
4866
+ )
4287
4867
  );
4288
4868
  }
4289
4869
  channelId;
@@ -4297,26 +4877,41 @@ class te extends EventTarget {
4297
4877
  binaryType = "blob";
4298
4878
  bufferedAmount = 0;
4299
4879
  readyState = te.CONNECTING;
4300
- socketId = oi();
4880
+ socketId = ri();
4301
4881
  listeners = /* @__PURE__ */ new Map();
4302
4882
  send(t) {
4303
4883
  if (this.readyState !== te.OPEN)
4304
- throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
4884
+ throw new DOMException(
4885
+ "Pluno preview websocket is not open",
4886
+ "InvalidStateError"
4887
+ );
4305
4888
  window.dispatchEvent(
4306
- new CustomEvent(Oe(lo, this.channelId), {
4307
- detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
4308
- })
4889
+ new CustomEvent(
4890
+ Oe(so, this.channelId),
4891
+ {
4892
+ detail: {
4893
+ socketId: this.socketId,
4894
+ data: typeof t == "string" ? t : String(t)
4895
+ }
4896
+ }
4897
+ )
4309
4898
  );
4310
4899
  }
4311
4900
  close(t, n) {
4312
4901
  this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
4313
- new CustomEvent(Oe(po, this.channelId), {
4314
- detail: { socketId: this.socketId, code: t, reason: n }
4315
- })
4902
+ new CustomEvent(
4903
+ Oe(co, this.channelId),
4904
+ {
4905
+ detail: { socketId: this.socketId, code: t, reason: n }
4906
+ }
4907
+ )
4316
4908
  ), this.cleanup());
4317
4909
  }
4318
4910
  addPreviewListener(t, n) {
4319
- const o = Oe(t, this.channelId), a = (i) => {
4911
+ const o = Oe(
4912
+ t,
4913
+ this.channelId
4914
+ ), a = (i) => {
4320
4915
  i.detail?.socketId === this.socketId && n(i);
4321
4916
  };
4322
4917
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -4327,8 +4922,10 @@ class te extends EventTarget {
4327
4922
  this.listeners.clear();
4328
4923
  }
4329
4924
  }
4330
- function oi() {
4331
- const e = window.sessionStorage.getItem(Nt);
4925
+ function ri() {
4926
+ const e = window.sessionStorage.getItem(
4927
+ Nt
4928
+ );
4332
4929
  if (e)
4333
4930
  return e;
4334
4931
  const t = crypto.randomUUID();
@@ -4337,26 +4934,28 @@ function oi() {
4337
4934
  function Oe(e, t) {
4338
4935
  return `${e}:${t}`;
4339
4936
  }
4340
- function ai(e) {
4937
+ function li(e) {
4341
4938
  const t = document.currentScript;
4342
4939
  if (t instanceof HTMLScriptElement)
4343
4940
  return [t];
4344
4941
  const n = new URL(e, document.baseURI).href, o = new URL(n);
4345
- return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
4346
- (a) => a instanceof HTMLScriptElement && ti(a) && ni(a, o)
4942
+ return Array.from(
4943
+ document.querySelectorAll("script[type='module'][src]")
4944
+ ).filter(
4945
+ (a) => a instanceof HTMLScriptElement && ai(a) && ii(a, o)
4347
4946
  );
4348
4947
  }
4349
- function ii(e) {
4350
- for (const t of ai(e)) {
4351
- if (Qt.has(t) || t.dataset.plunoAutoMount === "false")
4948
+ function pi(e) {
4949
+ for (const t of li(e)) {
4950
+ if (tn.has(t) || t.dataset.plunoAutoMount === "false")
4352
4951
  continue;
4353
- Qt.add(t);
4952
+ tn.add(t);
4354
4953
  const n = t.dataset.plunoPreviewChannel;
4355
- Ro({
4954
+ Oo({
4356
4955
  token: t.dataset.plunoToken,
4357
4956
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
4358
4957
  backendUrl: t.dataset.plunoBackendUrl,
4359
- webSocketFactory: n ? Do(n) : void 0,
4958
+ webSocketFactory: n ? Bo(n) : void 0,
4360
4959
  launcherLabel: t.dataset.plunoLauncherLabel,
4361
4960
  accentColor: t.dataset.plunoAccentColor,
4362
4961
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -4368,8 +4967,8 @@ function ii(e) {
4368
4967
  });
4369
4968
  }
4370
4969
  }
4371
- ii(import.meta.url);
4970
+ pi(import.meta.url);
4372
4971
  export {
4373
- Do as createProductAgentPreviewBridgeWebSocketFactory,
4374
- Ro as mountPlunoProductAgentWidget
4972
+ Bo as createProductAgentPreviewBridgeWebSocketFactory,
4973
+ Oo as mountPlunoProductAgentWidget
4375
4974
  };