@pluno/product-agent-web 0.1.44 → 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  import { PlunoProductAgent as Mn } from "./product-agent-sdk.js";
2
- const Bn = "#7c3aed", Be = "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", Oe = "#2c2a1e", Et = [253, 250, 241], St = 3.5;
2
+ const Bn = "#7c3aed", Oe = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", Ue = "#2c2a1e", Et = [253, 250, 241], St = 3.5;
3
3
  function Qt(e) {
4
4
  const t = en(e);
5
5
  if (kt(ke(t), Et) >= St)
6
6
  return t;
7
7
  let o = ke(t);
8
- const a = ke(Oe);
8
+ const a = ke(Ue);
9
9
  for (let i = 0; i < 6; i += 1)
10
10
  if (o = Fn(o, a, 0.22), kt(o, Et) >= St)
11
11
  return tt(o);
@@ -216,7 +216,7 @@ function to(e) {
216
216
  function no(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-agent:sdk-preview-socket-send", io = "product-agent:sdk-preview-socket-close", ro = "product-agent:sdk-preview-socket-open", lo = "product-agent:sdk-preview-socket-message", po = "product-agent:sdk-preview-socket-error", so = "product-agent:sdk-preview-socket-closed", At = "product-agent:sdk-preview-socket-id", co = "product-agent:preview-diagnostic", on = "pluno.productAgent.sharePromptsDisabled", Ue = 10, uo = 10 * 1024 * 1024, an = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), go = Array.from(an).join(","), ho = 3, mo = "No recent chats for this page yet.", K = {
219
+ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-agent:sdk-preview-socket-send", io = "product-agent:sdk-preview-socket-close", ro = "product-agent:sdk-preview-socket-open", lo = "product-agent:sdk-preview-socket-message", po = "product-agent:sdk-preview-socket-error", so = "product-agent:sdk-preview-socket-closed", At = "product-agent:sdk-preview-socket-id", co = "data-pluno-sdk-preview-channel", uo = "product-agent:preview-diagnostic", on = "pluno.productAgent.sharePromptsDisabled", Fe = 10, go = 10 * 1024 * 1024, an = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), ho = Array.from(an).join(","), mo = 3, bo = "No recent chats for this page yet.", K = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-a
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, bo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tt = "pluno-pa-scribble-font", rn = 190, ln = 41, fo = 48, wo = 420, _o = 520, xo = 0.24, yo = 680, vo = 800, Co = 0.76, z = 8, at = 50, pn = "http://www.w3.org/2000/svg", Nt = [
227
+ }, fo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tt = "pluno-pa-scribble-font", rn = 190, ln = 41, wo = 48, _o = 420, xo = 520, yo = 0.24, vo = 680, Co = 800, Eo = 0.76, z = 8, at = 50, pn = "http://www.w3.org/2000/svg", Nt = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,12 +261,12 @@ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-a
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], Eo = 11, So = 13, It = 4, ko = 10, Lo = 40, Po = "movable-launcher-position-v2", sn = "pluno-pa-widget-styles", dn = "data-pluno-pa-widget-styles";
264
+ ], So = 11, ko = 13, It = 4, Lo = 10, Po = 40, Ao = "movable-launcher-position-v2", sn = "pluno-pa-widget-styles", dn = "data-pluno-pa-widget-styles";
265
265
  let Dt = 0;
266
- function Ao(e) {
266
+ function To(e) {
267
267
  return (t) => new te(t, e);
268
268
  }
269
- async function To(e = {}) {
269
+ async function No(e = {}) {
270
270
  const t = {
271
271
  launcherLabel: e.launcherLabel ?? K.launcherLabel,
272
272
  accentColor: e.accentColor ?? K.accentColor,
@@ -299,7 +299,8 @@ async function To(e = {}) {
299
299
  activeUsersLoader: e.activeUsersLoader,
300
300
  socialPostRewardsUrl: e.socialPostRewardsUrl,
301
301
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
302
- persistSharePromptsDisabled: e.persistSharePromptsDisabled
302
+ persistSharePromptsDisabled: e.persistSharePromptsDisabled,
303
+ sdkPreviewChannelId: e.sdkPreviewChannelId
303
304
  };
304
305
  Y("web-sdk.widget", "Mounting widget with merged options", {
305
306
  accentColor: t.accentColor,
@@ -313,12 +314,12 @@ async function To(e = {}) {
313
314
  initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
314
315
  });
315
316
  const n = document.createElement("div");
316
- n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
317
+ n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(co, t.sdkPreviewChannelId);
317
318
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
318
319
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
319
320
  let i = Rt(t.accentColor, t.scribbleStyle);
320
- Xo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
321
- const l = await qa(), p = l.ownerDocument;
321
+ Zo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
322
+ const l = await ja(), p = l.ownerDocument;
322
323
  l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Kt(o, t.accentColor), Mt(a, i, {
323
324
  accentColor: t.accentColor,
324
325
  colorScheme: t.colorScheme,
@@ -338,7 +339,7 @@ async function To(e = {}) {
338
339
  zt(s), zt(g);
339
340
  let T = [], J = null;
340
341
  const me = () => {
341
- ma(y, T, (r) => {
342
+ ba(y, T, (r) => {
342
343
  T = T.filter((d, S) => S !== r), me(), U(w.getState()), W();
343
344
  });
344
345
  }, En = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
@@ -373,8 +374,8 @@ async function To(e = {}) {
373
374
  webSocketFactory: t.webSocketFactory,
374
375
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
375
376
  });
376
- const pe = ja(t), ze = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Le = new Set(be);
377
- let Ge = pe.sharePromptsDisabled || await Va(t), Q = t.movableLauncher ? pe.launcherPosition : null, dt = Q !== null, oe = null, He = !1, se = !1, de = {
377
+ const pe = Va(t), Ge = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Le = new Set(be);
378
+ let He = pe.sharePromptsDisabled || await Ya(t), Q = t.movableLauncher ? pe.launcherPosition : null, dt = Q !== null, oe = null, Pe = !1, se = !1, de = {
378
379
  enabled: !0
379
380
  }, ce = 0, ct = "", ae = !1, ee = !1, ie = [], We = null, ye = null;
380
381
  const q = (r, d) => {
@@ -397,11 +398,11 @@ async function To(e = {}) {
397
398
  const d = document.createElement("button");
398
399
  d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
399
400
  const S = document.createElement("span");
400
- S.className = "pluno-pa-widget__history-item-title", S.textContent = Vo(r);
401
+ S.className = "pluno-pa-widget__history-item-title", S.textContent = Yo(r);
401
402
  const B = document.createElement("time");
402
- B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = Ko(r.lastActiveAt, Date.now());
403
+ B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = Xo(r.lastActiveAt, Date.now());
403
404
  const N = document.createElement("small");
404
- N.className = "pluno-pa-widget__history-path", N.textContent = Yo(r), d.append(S, B, N), d.addEventListener("click", () => {
405
+ N.className = "pluno-pa-widget__history-path", N.textContent = Ko(r), d.append(S, B, N), d.addEventListener("click", () => {
405
406
  ae = !1, ye = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), U(w.getState());
406
407
  }), R.appendChild(d);
407
408
  }
@@ -419,7 +420,7 @@ async function To(e = {}) {
419
420
  } catch (d) {
420
421
  Y("web-sdk.widget", "Failed to load session history", {
421
422
  message: d instanceof Error ? d.message : String(d)
422
- }), ye = mo;
423
+ }), ye = bo;
423
424
  } finally {
424
425
  ee = !1, ue();
425
426
  }
@@ -427,28 +428,28 @@ async function To(e = {}) {
427
428
  }, Pn = () => {
428
429
  !We || ee || R.scrollHeight - R.scrollTop - R.clientHeight <= 24 && ut(We);
429
430
  }, An = () => {
430
- He || typeof document > "u" || (Kt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
431
+ Pe || typeof document > "u" || (Kt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
431
432
  }, gt = new MutationObserver(An);
432
433
  gt.observe(p.documentElement, { childList: !0, subtree: !0 });
433
434
  const $e = (r = !0) => {
434
435
  const d = it(a, r);
435
436
  return Bt(
436
437
  a,
437
- Q ? Oo(Q, d) : Bo(a, t.position, d),
438
+ Q ? Uo(Q, d) : Oo(a, t.position, d),
438
439
  d
439
440
  );
440
441
  }, H = () => {
441
- Ka(t, {
442
+ Xa(t, {
442
443
  isOpen: a.classList.contains("pluno-pa-widget--open"),
443
444
  composerValue: g.value,
444
- openToolGroupKeys: [...ze],
445
+ openToolGroupKeys: [...Ge],
445
446
  launcherPosition: dt ? Q : null,
446
447
  seenShareCandidateIds: [...be].slice(-nn),
447
- sharePromptsDisabled: Ge
448
+ sharePromptsDisabled: He
448
449
  });
449
450
  }, ge = (r, d = {}) => {
450
- $o(r, {
451
- debugVersion: Po,
451
+ qo(r, {
452
+ debugVersion: Ao,
452
453
  launcherPosition: Q,
453
454
  rootClasses: a.className,
454
455
  rootStyle: {
@@ -465,22 +466,22 @@ async function To(e = {}) {
465
466
  closeHidden: x.hidden,
466
467
  ...d
467
468
  });
468
- }, Pe = (r = !0) => {
469
+ }, Ae = (r = !0) => {
469
470
  if (!Q)
470
- return Ie(a, null), $e(r);
471
+ return De(a, null), $e(r);
471
472
  const d = $e(r);
472
- return Ie(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
473
+ return De(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
473
474
  }, ht = (r, d) => {
474
475
  if (!r || !d) {
475
- Wo(a);
476
+ $o(a);
476
477
  return;
477
478
  }
478
- Ho(a, {
479
+ Wo(a, {
479
480
  x: r.x - d.x,
480
481
  y: r.y - d.y
481
482
  });
482
483
  }, mt = () => {
483
- const r = Pe();
484
+ const r = Ae();
484
485
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
485
486
  const d = Ot(a, r, t.position);
486
487
  ht(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
@@ -488,19 +489,19 @@ async function To(e = {}) {
488
489
  };
489
490
  let bt = () => {
490
491
  };
491
- window.addEventListener("resize", mt), t.movableLauncher && u ? (Pe(), bt = Mo({
492
+ window.addEventListener("resize", mt), t.movableLauncher && u ? (Ae(), bt = Bo({
492
493
  root: a,
493
494
  launcher: c,
494
495
  launcherDragHandle: u,
495
496
  getPosition: () => $e(),
496
497
  setPosition: (r) => {
497
498
  const d = r, S = it(a), B = Bt(a, r, S);
498
- Q = Uo(B, S), Ie(a, B), ge("Dragging closed launcher", { requestedPosition: d });
499
+ Q = Fo(B, S), De(a, B), ge("Dragging closed launcher", { requestedPosition: d });
499
500
  },
500
501
  persist: () => {
501
502
  dt = !0, H(), ge("Persisted closed launcher drag position");
502
503
  }
503
- })) : Ie(a, null);
504
+ })) : De(a, null);
504
505
  let qe = !1;
505
506
  const ft = async () => {
506
507
  if (!(!t.billingStatusLoader || qe)) {
@@ -514,7 +515,7 @@ async function To(e = {}) {
514
515
  }
515
516
  }, he = (r = "", d = !0) => {
516
517
  ft(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
517
- const S = Pe(), B = Ot(a, S, t.position);
518
+ const S = Ae(), B = Ot(a, S, t.position);
518
519
  if (ht(B, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: B, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
519
520
  a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, Ee(g)), Se(f, () => de.enabled), ce = f.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), H();
520
521
  return;
@@ -525,7 +526,7 @@ async function To(e = {}) {
525
526
  }, 220);
526
527
  });
527
528
  }, Tn = () => {
528
- oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Pe(!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(() => {
529
+ oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Ae(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
529
530
  b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
530
531
  }, 220);
531
532
  };
@@ -554,11 +555,11 @@ async function To(e = {}) {
554
555
  { root: f, threshold: 0 }
555
556
  );
556
557
  wt?.observe(A);
557
- const Ae = () => t.loginRequired || t.signupRequired, _t = () => {
558
- const r = Ae();
558
+ const Te = () => t.loginRequired || t.signupRequired, _t = () => {
559
+ const r = Te();
559
560
  s.readOnly = r, s.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : K.launcherLabel, P.hidden = r;
560
561
  }, W = () => {
561
- E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Ae() || X(t.billingStatus);
562
+ E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Te() || X(t.billingStatus);
562
563
  };
563
564
  _t(), P.addEventListener("submit", (r) => {
564
565
  if (r.preventDefault(), t.loginRequired) {
@@ -583,9 +584,9 @@ async function To(e = {}) {
583
584
  }, yt = async (r) => {
584
585
  if (r.length === 0)
585
586
  return;
586
- const d = await _a(r);
587
- if (T.length + d.length > Ue)
588
- throw new Error(`Attach up to ${Ue} files per message.`);
587
+ const d = await xa(r);
588
+ if (T.length + d.length > Fe)
589
+ throw new Error(`Attach up to ${Fe} files per message.`);
589
590
  T = [...T, ...d], me(), In(), W(), U(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
590
591
  };
591
592
  h.addEventListener("click", () => {
@@ -598,15 +599,15 @@ async function To(e = {}) {
598
599
  });
599
600
  });
600
601
  }), a.addEventListener("dragenter", (r) => {
601
- !De(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ve += 1, a.classList.add("pluno-pa-widget--drag-over"));
602
+ !Re(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ve += 1, a.classList.add("pluno-pa-widget--drag-over"));
602
603
  }), a.addEventListener("dragover", (r) => {
603
604
  const d = r.dataTransfer;
604
- !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
605
+ !Re(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
605
606
  }), a.addEventListener("dragleave", (r) => {
606
- De(r.dataTransfer) && (r.stopPropagation(), ve = Math.max(0, ve - 1), ve === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
607
+ Re(r.dataTransfer) && (r.stopPropagation(), ve = Math.max(0, ve - 1), ve === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
607
608
  }), a.addEventListener("drop", (r) => {
608
609
  const d = r.dataTransfer;
609
- !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Nn(), yt(d.files).catch((S) => {
610
+ !Re(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Nn(), yt(d.files).catch((S) => {
610
611
  xt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
611
612
  message: S instanceof Error ? S.message : String(S)
612
613
  });
@@ -622,7 +623,7 @@ async function To(e = {}) {
622
623
  }
623
624
  se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
624
625
  }), I.addEventListener("click", () => {
625
- se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), ze.clear(), g.value = "", T = [], me(), Ee(g), H(), W(), g.focus(), U(w.getState());
626
+ se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), Ge.clear(), g.value = "", T = [], me(), Ee(g), H(), W(), g.focus(), U(w.getState());
626
627
  }), le.addEventListener("click", () => {
627
628
  ae = !ae, ye = null, ue(), ae && ie.length === 0 && ut(null);
628
629
  }), _.addEventListener("click", () => {
@@ -640,8 +641,8 @@ async function To(e = {}) {
640
641
  }), a.addEventListener("click", (r) => {
641
642
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
642
643
  }), pe.composerValue && (g.value = pe.composerValue, Ee(g)), pe.isOpen && he(g.value, !1);
643
- const Te = () => i;
644
- let je = w.getState().appearance !== null, Ne = null, Ce = null, fe = null, vt = w.getState().isThinking, we = null, Ve = null, Ct = () => {
644
+ const Ne = () => i;
645
+ let je = w.getState().appearance !== null, Ie = null, Ce = null, fe = null, vt = w.getState().isThinking, we = null, Ve = null, Ct = () => {
645
646
  };
646
647
  const Dn = !!t.socialPostDraftHandler, U = (r) => {
647
648
  if (ue(), st(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(O, t.billingStatus, we), t.loginRequired) {
@@ -649,7 +650,7 @@ async function To(e = {}) {
649
650
  f,
650
651
  E,
651
652
  I,
652
- Te,
653
+ Ne,
653
654
  "Log in to use Pluno on this page.",
654
655
  t.loginButtonLabel,
655
656
  t.loginUrl,
@@ -662,7 +663,7 @@ async function To(e = {}) {
662
663
  f,
663
664
  E,
664
665
  I,
665
- Te,
666
+ Ne,
666
667
  "Complete signup to unlock your free trial credits.",
667
668
  t.signupButtonLabel,
668
669
  t.signupUrl,
@@ -670,10 +671,10 @@ async function To(e = {}) {
670
671
  );
671
672
  return;
672
673
  }
673
- const d = qo(r), S = d !== ct;
674
+ const d = jo(r), S = d !== ct;
674
675
  ct = d;
675
676
  const B = se || de.enabled;
676
- se = !1, Na(
677
+ se = !1, Ia(
677
678
  f,
678
679
  A,
679
680
  E,
@@ -684,17 +685,17 @@ async function To(e = {}) {
684
685
  Ve !== null && $t(r, g.value.trim().length > 0 || T.length > 0),
685
686
  B,
686
687
  () => de.enabled,
687
- ze,
688
+ Ge,
688
689
  H,
689
- Te,
690
+ Ne,
690
691
  (N) => {
691
692
  se = !0, q(!0, "send"), j(), w.sendMessage(N);
692
693
  },
693
- Dn && !Ge ? {
694
+ Dn && !He ? {
694
695
  dismissedCandidateIds: Le,
695
- draftingCandidateId: Ne,
696
+ draftingCandidateId: Ie,
696
697
  error: Ce,
697
- characterIconOptions: Te(),
698
+ characterIconOptions: Ne(),
698
699
  onSeen: (N) => {
699
700
  be.add(N.id), H();
700
701
  },
@@ -705,13 +706,13 @@ async function To(e = {}) {
705
706
  be.add(N.id), Le.add(N.id), H(), Ce = null, U(w.getState());
706
707
  },
707
708
  onDisable: (N) => {
708
- Ge = !0, be.add(N.id), Le.add(N.id), H(), Ya(t, !0), Ce = null, U(w.getState());
709
+ He = !0, be.add(N.id), Le.add(N.id), H(), Ka(t, !0), Ce = null, U(w.getState());
709
710
  }
710
711
  } : void 0
711
- ), B ? (ce = f.scrollTop, j()) : S && jo(r) && kn();
712
+ ), B ? (ce = f.scrollTop, j()) : S && Vo(r) && kn();
712
713
  };
713
714
  return Ct = Jn((r) => {
714
- Ve = r, !He && $t(w.getState(), g.value.trim().length > 0 || T.length > 0) && U(w.getState());
715
+ Ve = r, !Pe && $t(w.getState(), g.value.trim().length > 0 || T.length > 0) && U(w.getState());
715
716
  }, { backendUrl: t.backendUrl, fetcher: Sn, loader: t.activeUsersLoader }), w.on("state", (r) => {
716
717
  const d = vt && !r.isThinking;
717
718
  vt = r.isThinking, r.appearance ? (je = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
@@ -735,8 +736,8 @@ async function To(e = {}) {
735
736
  ), W());
736
737
  },
737
738
  updateAuthGate: (r) => {
738
- const d = Ae();
739
- t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), _t(), U(w.getState()), W(), d && !Ae() && w.connect().catch((S) => {
739
+ const d = Te();
740
+ t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), _t(), U(w.getState()), W(), d && !Te() && w.connect().catch((S) => {
740
741
  Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
741
742
  message: S instanceof Error ? S.message : String(S)
742
743
  });
@@ -746,19 +747,19 @@ async function To(e = {}) {
746
747
  he(g.value, !1);
747
748
  },
748
749
  destroy: () => {
749
- He = !0, gt.disconnect(), wt?.disconnect(), window.removeEventListener("resize", mt), bt(), J !== null && window.clearTimeout(J), Ct(), fe?.remove(), w.destroy(), n.remove();
750
+ Pe || (Pe = !0, gt.disconnect(), wt?.disconnect(), window.removeEventListener("resize", mt), bt(), J !== null && window.clearTimeout(J), Ct(), fe?.remove(), w.destroy(), n.remove());
750
751
  }
751
752
  };
752
753
  async function Rn(r) {
753
- if (!Ne) {
754
- Ne = r.id, Ce = null, U(w.getState());
754
+ if (!Ie) {
755
+ Ie = r.id, Ce = null, U(w.getState());
755
756
  try {
756
757
  if (!t.socialPostDraftHandler)
757
758
  throw new Error("Social post drafting is not available here.");
758
759
  const d = await t.socialPostDraftHandler(r);
759
760
  if (!d.linkedinPost || !d.xPost)
760
761
  throw new Error("Pluno did not return a complete social post draft.");
761
- be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ra(d, {
762
+ be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ma(d, {
762
763
  socialPostRewardsUrl: t.socialPostRewardsUrl,
763
764
  onClose: () => {
764
765
  fe?.remove(), fe = null;
@@ -767,7 +768,7 @@ async function To(e = {}) {
767
768
  } catch (d) {
768
769
  Ce = d instanceof Error ? d.message : "Could not draft social post.";
769
770
  } finally {
770
- Ne = null, U(w.getState());
771
+ Ie = null, U(w.getState());
771
772
  }
772
773
  }
773
774
  }
@@ -792,11 +793,11 @@ async function To(e = {}) {
792
793
  function Rt(e, t) {
793
794
  return { accentColor: e, scribbleStyle: t };
794
795
  }
795
- function No(e) {
796
- const t = Io(e);
797
- return t === null ? "#fafafa" : Do(t) > 0.5 ? "#18181b" : "#fafaf9";
798
- }
799
796
  function Io(e) {
797
+ const t = Do(e);
798
+ return t === null ? "#fafafa" : Ro(t) > 0.5 ? "#18181b" : "#fafaf9";
799
+ }
800
+ function Do(e) {
800
801
  const t = e.trim();
801
802
  return /^#[0-9a-f]{6}$/i.test(t) ? [
802
803
  Number.parseInt(t.slice(1, 3), 16),
@@ -808,7 +809,7 @@ function Io(e) {
808
809
  Number.parseInt(t[3] + t[3], 16)
809
810
  ] : null;
810
811
  }
811
- function Do([e, t, n]) {
812
+ function Ro([e, t, n]) {
812
813
  const o = (a) => {
813
814
  const i = a / 255;
814
815
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
@@ -818,12 +819,12 @@ function Do([e, t, n]) {
818
819
  function Mt(e, t, n) {
819
820
  e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
820
821
  const o = n.scribbleStyle ? Qt(n.accentColor) : n.accentColor;
821
- e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", No(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? bo : n.fontFamily, n.scribbleStyle && Ro(e.ownerDocument);
822
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", Io(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? fo : n.fontFamily, n.scribbleStyle && Mo(e.ownerDocument);
822
823
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
823
824
  for (const i of a)
824
825
  i.replaceWith(re(Array.from(i.classList).join(" "), t));
825
826
  }
826
- function Ro(e) {
827
+ function Mo(e) {
827
828
  if (e.getElementById(Tt))
828
829
  return;
829
830
  const t = e.createElement("style");
@@ -835,7 +836,7 @@ function Ro(e) {
835
836
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
836
837
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
837
838
  }
838
- function Mo({
839
+ function Bo({
839
840
  root: e,
840
841
  launcher: t,
841
842
  launcherDragHandle: n,
@@ -866,7 +867,7 @@ function Mo({
866
867
  }, C = (h) => {
867
868
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
868
869
  return;
869
- const g = h.shiftKey ? Lo : ko, E = o();
870
+ const g = h.shiftKey ? Po : Lo, E = o();
870
871
  let I = null;
871
872
  h.key === "ArrowUp" ? I = { x: E.x, y: E.y - g } : h.key === "ArrowDown" ? I = { x: E.x, y: E.y + g } : h.key === "ArrowLeft" ? I = { x: E.x - g, y: E.y } : h.key === "ArrowRight" && (I = { x: E.x + g, y: E.y }), I && (h.preventDefault(), h.stopPropagation(), a(I), i());
872
873
  };
@@ -878,23 +879,23 @@ function it(e, t = !0) {
878
879
  const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
879
880
  return {
880
881
  width: t && a && o.width > 0 ? o.width : Math.min(rn, n.width - 36),
881
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? fo : ln
882
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? wo : ln
882
883
  };
883
884
  }
884
885
  function cn() {
885
886
  const e = ne();
886
887
  return {
887
888
  width: Math.min(
888
- _e(e.width * xo, wo, _o),
889
+ _e(e.width * yo, _o, xo),
889
890
  e.width - z * 2
890
891
  ),
891
892
  height: Math.min(
892
- _e(e.height * Co, yo, vo),
893
+ _e(e.height * Eo, vo, Co),
893
894
  e.height - at - z
894
895
  )
895
896
  };
896
897
  }
897
- function Bo(e, t, n) {
898
+ function Oo(e, t, n) {
898
899
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
899
900
  if (Number.isFinite(o) && Number.isFinite(a))
900
901
  return { x: o, y: a };
@@ -908,42 +909,42 @@ function Bo(e, t, n) {
908
909
  };
909
910
  }
910
911
  function Bt(e, t, n) {
911
- const o = ne(), a = z + zo(e);
912
+ const o = ne(), a = z + Go(e);
912
913
  return {
913
914
  x: _e(t.x, z, Math.max(z, o.width - n.width - z)),
914
915
  y: _e(t.y, a, Math.max(a, o.height - n.height - z))
915
916
  };
916
917
  }
917
- function Oo(e, t) {
918
+ function Uo(e, t) {
918
919
  const n = ne();
919
920
  return {
920
921
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
921
922
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
922
923
  };
923
924
  }
924
- function Uo(e, t) {
925
- const n = Fo(e, t), o = ne();
925
+ function Fo(e, t) {
926
+ const n = zo(e, t), o = ne();
926
927
  return {
927
928
  anchor: n,
928
929
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
929
930
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
930
931
  };
931
932
  }
932
- function Fo(e, t) {
933
+ function zo(e, t) {
933
934
  const n = ne(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
934
935
  return `${i}-${l}`;
935
936
  }
936
- function zo(e) {
937
- return e.classList.contains("pluno-pa-widget--scribble") ? So : Eo;
937
+ function Go(e) {
938
+ return e.classList.contains("pluno-pa-widget--scribble") ? ko : So;
938
939
  }
939
940
  function Ot(e, t, n) {
940
941
  const o = it(e), a = cn(), i = {
941
942
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
942
943
  y: t.y + o.height - a.height
943
944
  };
944
- return Go(i);
945
+ return Ho(i);
945
946
  }
946
- function Go(e) {
947
+ function Ho(e) {
947
948
  const t = ne(), n = cn();
948
949
  return {
949
950
  x: _e(e.x, z, Math.max(z, t.width - n.width - z)),
@@ -954,17 +955,17 @@ function Go(e) {
954
955
  )
955
956
  };
956
957
  }
957
- function Ie(e, t) {
958
+ function De(e, t) {
958
959
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
959
960
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
960
961
  return;
961
962
  }
962
963
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
963
964
  }
964
- function Ho(e, t) {
965
+ function Wo(e, t) {
965
966
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
966
967
  }
967
- function Wo(e) {
968
+ function $o(e) {
968
969
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
969
970
  }
970
971
  function ne() {
@@ -994,9 +995,9 @@ function Y(e, t, n) {
994
995
  message: t,
995
996
  details: n
996
997
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
997
- 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(co, { detail: a }));
998
+ i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(uo, { detail: a }));
998
999
  }
999
- function $o(e, t) {
1000
+ function qo(e, t) {
1000
1001
  Y("web-sdk.widget.position", e, t);
1001
1002
  }
1002
1003
  function Je(e, t, n) {
@@ -1013,7 +1014,7 @@ function Se(e, t = () => !0) {
1013
1014
  t() && (e.scrollTop = e.scrollHeight);
1014
1015
  });
1015
1016
  }
1016
- function qo(e) {
1017
+ function jo(e) {
1017
1018
  const t = e.messages[e.messages.length - 1];
1018
1019
  return [
1019
1020
  e.messages.length,
@@ -1024,13 +1025,13 @@ function qo(e) {
1024
1025
  e.lastError ?? ""
1025
1026
  ].join(":");
1026
1027
  }
1027
- function jo(e) {
1028
+ function Vo(e) {
1028
1029
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1029
1030
  }
1030
- function Vo(e) {
1031
+ function Yo(e) {
1031
1032
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1032
1033
  }
1033
- function Yo(e) {
1034
+ function Ko(e) {
1034
1035
  const t = e.currentPage;
1035
1036
  if (typeof t?.url == "string" && t.url.trim())
1036
1037
  try {
@@ -1041,7 +1042,7 @@ function Yo(e) {
1041
1042
  }
1042
1043
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1043
1044
  }
1044
- function Ko(e, t) {
1045
+ function Xo(e, t) {
1045
1046
  const n = new Date(e).getTime();
1046
1047
  if (!Number.isFinite(n))
1047
1048
  return "now";
@@ -1057,10 +1058,10 @@ function Ko(e, t) {
1057
1058
  }
1058
1059
  return "now";
1059
1060
  }
1060
- function Xo(e, t, n, o) {
1061
- e.appendChild(ia()), e.appendChild(Zo(t, n, o)), e.appendChild(Fe("pluno-pa-widget__close", "Close", ra(16), !0)), e.appendChild(Jo(n));
1061
+ function Zo(e, t, n, o) {
1062
+ e.appendChild(ra()), e.appendChild(Jo(t, n, o)), e.appendChild(ze("pluno-pa-widget__close", "Close", la(16), !0)), e.appendChild(Qo(n));
1062
1063
  }
1063
- function Zo(e, t, n) {
1064
+ function Jo(e, t, n) {
1064
1065
  const o = document.createElement("form");
1065
1066
  if (o.className = "pluno-pa-widget__launcher", n) {
1066
1067
  const i = document.createElement("button");
@@ -1070,21 +1071,21 @@ function Zo(e, t, n) {
1070
1071
  const a = document.createElement("input");
1071
1072
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1072
1073
  }
1073
- function Jo(e) {
1074
+ function Qo(e) {
1074
1075
  const t = document.createElement("section");
1075
1076
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(hn("pluno-pa-widget__scribble-spirals--panel", 16));
1076
1077
  const n = document.createElement("div");
1077
1078
  n.className = "pluno-pa-widget__timeline-wrap";
1078
1079
  const o = document.createElement("main");
1079
- o.className = "pluno-pa-widget__timeline", o.appendChild(ta(e));
1080
+ o.className = "pluno-pa-widget__timeline", o.appendChild(na(e));
1080
1081
  const a = document.createElement("div");
1081
1082
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1082
1083
  const i = document.createElement("div");
1083
1084
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1084
1085
  const l = document.createElement("button");
1085
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Fe("pluno-pa-widget__history", "Recent chats", pa(), !0)), n.appendChild(Fe("pluno-pa-widget__new-chat", "New chat", la(), !0)), n.appendChild(ea()), t.appendChild(n), t.appendChild(Qo()), t;
1086
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(ze("pluno-pa-widget__history", "Recent chats", sa(), !0)), n.appendChild(ze("pluno-pa-widget__new-chat", "New chat", pa(), !0)), n.appendChild(ta()), t.appendChild(n), t.appendChild(ea()), t;
1086
1087
  }
1087
- function Qo() {
1088
+ function ea() {
1088
1089
  const e = document.createElement("form");
1089
1090
  e.className = "pluno-pa-widget__composer";
1090
1091
  const t = document.createElement("div");
@@ -1096,9 +1097,9 @@ function Qo() {
1096
1097
  const a = document.createElement("div");
1097
1098
  a.className = "pluno-pa-widget__composer-inner";
1098
1099
  const i = document.createElement("input");
1099
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = go, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1100
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = ho, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1100
1101
  const l = document.createElement("button");
1101
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(da()), l.appendChild(ca()), a.appendChild(l);
1102
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ca()), l.appendChild(ua()), a.appendChild(l);
1102
1103
  const p = document.createElement("textarea");
1103
1104
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1104
1105
  const c = document.createElement("button");
@@ -1110,21 +1111,21 @@ function Qo() {
1110
1111
  const b = document.createElement("span");
1111
1112
  return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1112
1113
  }
1113
- function ea() {
1114
+ function ta() {
1114
1115
  const e = document.createElement("section");
1115
1116
  e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1116
1117
  const t = document.createElement("div");
1117
1118
  t.className = "pluno-pa-widget__history-header";
1118
1119
  const n = document.createElement("strong");
1119
1120
  n.textContent = "Recent chats";
1120
- const o = Fe("pluno-pa-widget__history-close", "Close recent chats", sa(), !1);
1121
+ const o = ze("pluno-pa-widget__history-close", "Close recent chats", da(), !1);
1121
1122
  t.append(n, o);
1122
1123
  const a = document.createElement("div");
1123
1124
  a.className = "pluno-pa-widget__history-list";
1124
1125
  const i = document.createElement("p");
1125
1126
  return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
1126
1127
  }
1127
- function ta(e) {
1128
+ function na(e) {
1128
1129
  const t = document.createElement("div");
1129
1130
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(un()), t;
1130
1131
  }
@@ -1132,7 +1133,7 @@ function un() {
1132
1133
  const e = document.createElement("div");
1133
1134
  return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
1134
1135
  }
1135
- function na(e, t) {
1136
+ function oa(e, t) {
1136
1137
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1137
1138
  const n = document.createElement("span");
1138
1139
  n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
@@ -1140,13 +1141,13 @@ function na(e, t) {
1140
1141
  function re(e, t) {
1141
1142
  const n = `pluno-pa-character-${Dt}`;
1142
1143
  Dt += 1;
1143
- const o = t.scribbleStyle ? aa(t.accentColor, n) : oa(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1144
+ const o = t.scribbleStyle ? ia(t.accentColor, n) : aa(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1144
1145
  return o.setAttribute(
1145
1146
  "class",
1146
1147
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1147
1148
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1148
1149
  }
1149
- function oa(e, t) {
1150
+ function aa(e, t) {
1150
1151
  const n = Un(e), o = {
1151
1152
  boltFill: `${t}-boltFill`,
1152
1153
  boltEdge: `${t}-boltEdge`,
@@ -1264,9 +1265,9 @@ function oa(e, t) {
1264
1265
  "flood-opacity": "0.22"
1265
1266
  });
1266
1267
  const O = m(i, "clipPath", { id: o.boltClip });
1267
- m(O, "path", { d: Be });
1268
+ m(O, "path", { d: Oe });
1268
1269
  const y = m(a, "g", { filter: $(o.softDropShadow) });
1269
- m(y, "path", { d: Be, fill: $(o.boltEdge) });
1270
+ m(y, "path", { d: Oe, fill: $(o.boltEdge) });
1270
1271
  const C = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1271
1272
  m(y, "path", {
1272
1273
  d: C,
@@ -1306,12 +1307,12 @@ function oa(e, t) {
1306
1307
  const g = m(a, "g", { filter: $(o.eyeShadow) });
1307
1308
  return Ut(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Ut(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
1308
1309
  }
1309
- function aa(e, t) {
1310
+ function ia(e, t) {
1310
1311
  const n = Qt(e), o = {
1311
1312
  clip: `${t}-scribbleBoltClip`,
1312
1313
  wobble: `${t}-scribbleBoltWobble`
1313
1314
  }, a = gn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1314
- m(l, "path", { d: Be });
1315
+ m(l, "path", { d: Oe });
1315
1316
  const p = m(i, "filter", {
1316
1317
  id: o.wobble,
1317
1318
  x: "-10%",
@@ -1344,9 +1345,9 @@ function aa(e, t) {
1344
1345
  opacity: "0.9",
1345
1346
  transform: "rotate(-14 627 600)"
1346
1347
  }), m(c, "path", {
1347
- d: Be,
1348
+ d: Oe,
1348
1349
  fill: "none",
1349
- stroke: Oe,
1350
+ stroke: Ue,
1350
1351
  "stroke-width": "18",
1351
1352
  "stroke-linejoin": "round"
1352
1353
  }), Ft(c, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), Ft(c, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
@@ -1376,9 +1377,9 @@ function Ft(e, t, n, o, a, i, l, p) {
1376
1377
  rx: "73",
1377
1378
  ry: "80",
1378
1379
  fill: "#ffffff",
1379
- stroke: Oe,
1380
+ stroke: Ue,
1380
1381
  "stroke-width": "13"
1381
- }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Oe }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1382
+ }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Ue }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1382
1383
  }
1383
1384
  function m(e, t, n = {}) {
1384
1385
  const o = v(t, n);
@@ -1391,11 +1392,11 @@ function D(e, t, n, o) {
1391
1392
  function $(e) {
1392
1393
  return `url(#${e})`;
1393
1394
  }
1394
- function Fe(e, t, n, o) {
1395
+ function ze(e, t, n, o) {
1395
1396
  const a = document.createElement("button");
1396
1397
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1397
1398
  }
1398
- function ia() {
1399
+ function ra() {
1399
1400
  const e = v("svg", {
1400
1401
  class: "pluno-pa-widget__scribble-defs",
1401
1402
  "aria-hidden": "true",
@@ -1475,19 +1476,19 @@ function Qe(e, t, n) {
1475
1476
  })
1476
1477
  ), o;
1477
1478
  }
1478
- function ra(e) {
1479
+ function la(e) {
1479
1480
  const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1480
1481
  return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
1481
1482
  }
1482
- function la() {
1483
+ function pa() {
1483
1484
  const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1484
1485
  return e.appendChild(v("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(v("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1485
1486
  }
1486
- function pa() {
1487
+ function sa() {
1487
1488
  const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1488
1489
  return e.appendChild(v("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(v("path", { d: "M3 4v5h5" })), e.appendChild(v("path", { d: "M12 7v5l3 2" })), e;
1489
1490
  }
1490
- function sa() {
1491
+ function da() {
1491
1492
  const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
1492
1493
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1493
1494
  }
@@ -1495,7 +1496,7 @@ function mn() {
1495
1496
  const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1496
1497
  return e.appendChild(v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
1497
1498
  }
1498
- function da() {
1499
+ function ca() {
1499
1500
  const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1500
1501
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1501
1502
  v("path", {
@@ -1503,7 +1504,7 @@ function da() {
1503
1504
  })
1504
1505
  ), e;
1505
1506
  }
1506
- function ca() {
1507
+ function ua() {
1507
1508
  const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1508
1509
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1509
1510
  v("path", {
@@ -1515,15 +1516,15 @@ function ca() {
1515
1516
  })
1516
1517
  ), e;
1517
1518
  }
1518
- function ua() {
1519
+ function ga() {
1519
1520
  const e = Z("0 0 24 24", 18, 18, "currentColor");
1520
1521
  return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1521
1522
  }
1522
- function ga() {
1523
+ function ha() {
1523
1524
  const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1524
1525
  return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1525
1526
  }
1526
- function ha() {
1527
+ function ma() {
1527
1528
  const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1528
1529
  return e.appendChild(v("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(v("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1529
1530
  }
@@ -1549,18 +1550,18 @@ function zt(e) {
1549
1550
  n.stopPropagation();
1550
1551
  });
1551
1552
  }
1552
- function ma(e, t, n) {
1553
+ function ba(e, t, n) {
1553
1554
  e.replaceChildren(), e.hidden = t.length === 0;
1554
1555
  for (const [o, a] of t.entries()) {
1555
1556
  const i = document.createElement("div");
1556
- i.className = "pluno-pa-widget__attachment", i.appendChild(ba(a));
1557
+ i.className = "pluno-pa-widget__attachment", i.appendChild(fa(a));
1557
1558
  const l = document.createElement("span");
1558
1559
  l.textContent = a.name, i.appendChild(l);
1559
1560
  const p = document.createElement("button");
1560
- p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(ga()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1561
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(ha()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1561
1562
  }
1562
1563
  }
1563
- function ba(e) {
1564
+ function fa(e) {
1564
1565
  if (bn(e)) {
1565
1566
  const n = document.createElement("img");
1566
1567
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
@@ -1568,7 +1569,7 @@ function ba(e) {
1568
1569
  const t = document.createElement("span");
1569
1570
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1570
1571
  }
1571
- function fa(e) {
1572
+ function wa(e) {
1572
1573
  if (bn(e)) {
1573
1574
  const a = document.createElement("img");
1574
1575
  return a.src = e.dataUrl, a.alt = e.name, a;
@@ -1583,48 +1584,48 @@ function fa(e) {
1583
1584
  function bn(e) {
1584
1585
  return e.mimeType.startsWith("image/");
1585
1586
  }
1586
- function wa(e) {
1587
+ function _a(e) {
1587
1588
  return e === "application/pdf" ? "document.pdf" : "image";
1588
1589
  }
1589
- async function _a(e) {
1590
+ async function xa(e) {
1590
1591
  if (!e)
1591
1592
  return [];
1592
1593
  const t = Array.from(e);
1593
- if (t.length > Ue)
1594
- throw new Error(`Attach up to ${Ue} files per message.`);
1594
+ if (t.length > Fe)
1595
+ throw new Error(`Attach up to ${Fe} files per message.`);
1595
1596
  return Promise.all(
1596
1597
  t.map(async (n) => {
1597
- const o = xa(n);
1598
+ const o = ya(n);
1598
1599
  if (!o)
1599
1600
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1600
- if (n.size > uo)
1601
+ if (n.size > go)
1601
1602
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1602
1603
  if (o === "image/gif") {
1603
- const a = new Uint8Array(await Aa(n));
1604
- if (va(a))
1604
+ const a = new Uint8Array(await Ta(n));
1605
+ if (Ca(a))
1605
1606
  throw new Error("Pluno supports non-animated GIF images.");
1606
1607
  }
1607
1608
  return {
1608
- name: n.name || wa(o),
1609
+ name: n.name || _a(o),
1609
1610
  mimeType: o,
1610
1611
  sizeBytes: n.size,
1611
- dataUrl: ya(await Ta(n), o)
1612
+ dataUrl: va(await Na(n), o)
1612
1613
  };
1613
1614
  })
1614
1615
  );
1615
1616
  }
1616
- function xa(e) {
1617
+ function ya(e) {
1617
1618
  if (an.has(e.type))
1618
1619
  return e.type;
1619
1620
  const t = e.name.toLowerCase();
1620
1621
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
1621
1622
  }
1622
- function ya(e, t) {
1623
+ function va(e, t) {
1623
1624
  const n = `data:${t};base64,`;
1624
1625
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1625
1626
  }
1626
- function va(e) {
1627
- if (e.length < 14 || !Ca(e))
1627
+ function Ca(e) {
1628
+ if (e.length < 14 || !Ea(e))
1628
1629
  return !1;
1629
1630
  const t = e[10];
1630
1631
  let n = 13;
@@ -1651,7 +1652,7 @@ function va(e) {
1651
1652
  }
1652
1653
  return !1;
1653
1654
  }
1654
- function Ca(e) {
1655
+ function Ea(e) {
1655
1656
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1656
1657
  }
1657
1658
  function Gt(e, t) {
@@ -1663,7 +1664,7 @@ function Gt(e, t) {
1663
1664
  }
1664
1665
  return t;
1665
1666
  }
1666
- function De(e) {
1667
+ function Re(e) {
1667
1668
  return !!(e && Array.from(e.types).includes("Files"));
1668
1669
  }
1669
1670
  function et(e, t, n = null) {
@@ -1671,9 +1672,9 @@ function et(e, t, n = null) {
1671
1672
  e && (e.hidden = !0, e.replaceChildren());
1672
1673
  return;
1673
1674
  }
1674
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || st(n) ? e.appendChild(Ea(t, n)) : fn(t) && e.appendChild(Sa(t));
1675
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || st(n) ? e.appendChild(Sa(t, n)) : fn(t) && e.appendChild(ka(t));
1675
1676
  }
1676
- function Ea(e, t) {
1677
+ function Sa(e, t) {
1677
1678
  const n = document.createElement("div");
1678
1679
  n.className = "pluno-pa-widget__billing-action-card";
1679
1680
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
@@ -1681,21 +1682,21 @@ function Ea(e, t) {
1681
1682
  const i = document.createElement("span");
1682
1683
  return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(wn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1683
1684
  }
1684
- function Sa(e) {
1685
+ function ka(e) {
1685
1686
  const t = document.createElement("div");
1686
1687
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1687
1688
  const n = document.createElement("strong");
1688
1689
  n.textContent = "Credits running low", t.appendChild(n);
1689
1690
  const o = document.createElement("span");
1690
- return o.textContent = La(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(wn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1691
+ return o.textContent = Pa(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(wn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1691
1692
  }
1692
1693
  function rt(e, t) {
1693
1694
  return e !== null && (X(e) || fn(e) || st(t));
1694
1695
  }
1695
1696
  function Ht(e, t, n) {
1696
- return rt(t, n) || ka(t) ? !0 : !rt(e, n);
1697
+ return rt(t, n) || La(t) ? !0 : !rt(e, n);
1697
1698
  }
1698
- function ka(e) {
1699
+ function La(e) {
1699
1700
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
1700
1701
  }
1701
1702
  function X(e) {
@@ -1707,10 +1708,10 @@ function st(e) {
1707
1708
  function fn(e) {
1708
1709
  return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1709
1710
  }
1710
- function La(e) {
1711
- return e.creditsRemaining === null ? null : `${Pa(e.creditsRemaining)} credits left`;
1712
- }
1713
1711
  function Pa(e) {
1712
+ return e.creditsRemaining === null ? null : `${Aa(e.creditsRemaining)} credits left`;
1713
+ }
1714
+ function Aa(e) {
1714
1715
  return new Intl.NumberFormat("en-US", {
1715
1716
  maximumFractionDigits: 0
1716
1717
  }).format(Math.ceil(e));
@@ -1730,7 +1731,7 @@ function Wt(e, t) {
1730
1731
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1731
1732
  }), n;
1732
1733
  }
1733
- function Aa(e) {
1734
+ function Ta(e) {
1734
1735
  return new Promise((t, n) => {
1735
1736
  const o = new FileReader();
1736
1737
  o.addEventListener("load", () => {
@@ -1744,7 +1745,7 @@ function Aa(e) {
1744
1745
  }), o.readAsArrayBuffer(e);
1745
1746
  });
1746
1747
  }
1747
- function Ta(e) {
1748
+ function Na(e) {
1748
1749
  return new Promise((t, n) => {
1749
1750
  const o = new FileReader();
1750
1751
  o.addEventListener("load", () => {
@@ -1761,9 +1762,9 @@ function Ta(e) {
1761
1762
  function $t(e, t) {
1762
1763
  return e.messages.filter((o) => !_n(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1763
1764
  }
1764
- function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1765
+ function Ia(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1765
1766
  const O = [...i.messages], y = O.filter((_) => !_n(_)), C = e.scrollTop;
1766
- e.replaceChildren(), yn(n, i.isThinking), a.hidden = !p, p && l !== null && na(a, l);
1767
+ e.replaceChildren(), yn(n, i.isThinking), a.hidden = !p, p && l !== null && oa(a, l);
1767
1768
  const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
1768
1769
  if (o.hidden = !h, y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1769
1770
  const _ = document.createElement("div");
@@ -1784,7 +1785,7 @@ function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1784
1785
  const f = document.createElement("button");
1785
1786
  f.type = "button", f.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", f.disabled = !0, f.tabIndex = -1, f.textContent = "Generating example tasks...", M.appendChild(f);
1786
1787
  } else
1787
- for (let f = 0; f < ho; f += 1) {
1788
+ for (let f = 0; f < mo; f += 1) {
1788
1789
  const A = document.createElement("button");
1789
1790
  A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.textContent = "", M.appendChild(A);
1790
1791
  }
@@ -1795,7 +1796,7 @@ function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1795
1796
  const le = () => {
1796
1797
  if (I.length === 0)
1797
1798
  return !1;
1798
- const _ = Fa(I, s, b, x());
1799
+ const _ = za(I, s, b, x());
1799
1800
  return e.appendChild(_), g = null, E = _, I = [], !0;
1800
1801
  };
1801
1802
  for (let _ = 0; _ < y.length; _ += 1) {
@@ -1812,7 +1813,7 @@ function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1812
1813
  e.appendChild(T), g = null, E = T;
1813
1814
  }
1814
1815
  const f = document.createElement("div");
1815
- f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Yt(f, M) : f.textContent = M, L.role === "user" && L.attachments?.length && f.appendChild(Ia(L.attachments));
1816
+ f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Yt(f, M) : f.textContent = M, L.role === "user" && L.attachments?.length && f.appendChild(Da(L.attachments));
1816
1817
  const A = document.createElement("div");
1817
1818
  A.className = "pluno-pa-widget__message-actions", A.appendChild(jt(M)), f.appendChild(A), e.appendChild(f), g = f, E = null;
1818
1819
  }
@@ -1832,7 +1833,7 @@ function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1832
1833
  const _ = xn();
1833
1834
  e.appendChild(_), g = null, E = _;
1834
1835
  } else {
1835
- const _ = za(x());
1836
+ const _ = Ga(x());
1836
1837
  e.appendChild(_), g = null, E = _;
1837
1838
  }
1838
1839
  if (i.lastError) {
@@ -1841,7 +1842,7 @@ function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1841
1842
  }
1842
1843
  const R = k && !i.isThinking ? Hn(O) : null;
1843
1844
  if (k && R && !k.dismissedCandidateIds.has(R.id)) {
1844
- const _ = Da(R, {
1845
+ const _ = Ra(R, {
1845
1846
  isDrafting: k.draftingCandidateId === R.id,
1846
1847
  error: k.error,
1847
1848
  characterIconOptions: k.characterIconOptions,
@@ -1869,20 +1870,20 @@ function qt(e, t, n, o, a, i, l, p) {
1869
1870
  }
1870
1871
  e.appendChild(c);
1871
1872
  }
1872
- function Ia(e) {
1873
+ function Da(e) {
1873
1874
  const t = document.createElement("div");
1874
1875
  t.className = "pluno-pa-widget__message-attachments";
1875
1876
  for (const n of e)
1876
- t.appendChild(fa(n));
1877
+ t.appendChild(wa(n));
1877
1878
  return t;
1878
1879
  }
1879
1880
  function jt(e) {
1880
1881
  const t = document.createElement("button");
1881
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ha()), t.addEventListener("click", (n) => {
1882
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ma()), t.addEventListener("click", (n) => {
1882
1883
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1883
1884
  }), t;
1884
1885
  }
1885
- function Da(e, t) {
1886
+ function Ra(e, t) {
1886
1887
  const n = document.createElement("article");
1887
1888
  n.className = "pluno-pa-widget__share-prompt";
1888
1889
  const o = document.createElement("div");
@@ -1918,7 +1919,7 @@ function Da(e, t) {
1918
1919
  }
1919
1920
  return o.appendChild(p), n.appendChild(o), n;
1920
1921
  }
1921
- function Ra(e, t) {
1922
+ function Ma(e, t) {
1922
1923
  const n = document.createElement("div");
1923
1924
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
1924
1925
  y.target === n && t.onClose();
@@ -1937,7 +1938,7 @@ function Ra(e, t) {
1937
1938
  u.className = "pluno-pa-widget__share-dialog-step-header";
1938
1939
  const s = document.createElement("strong");
1939
1940
  s.textContent = "1) Copy Screenshot", u.appendChild(s);
1940
- const b = Ma("Copy Screenshot", async () => {
1941
+ const b = Ba("Copy Screenshot", async () => {
1941
1942
  try {
1942
1943
  return await Wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1943
1944
  } catch {
@@ -1959,9 +1960,9 @@ function Ra(e, t) {
1959
1960
  k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
1960
1961
  const O = document.createElement("footer");
1961
1962
  O.className = "pluno-pa-widget__share-dialog-platforms";
1962
- for (const y of Ba(e)) {
1963
+ for (const y of Oa(e)) {
1963
1964
  const C = document.createElement("a");
1964
- C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Oa(y.id)), O.appendChild(C);
1965
+ C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Ua(y.id)), O.appendChild(C);
1965
1966
  }
1966
1967
  if (x.appendChild(O), o.appendChild(x), t.socialPostRewardsUrl) {
1967
1968
  const y = document.createElement("div");
@@ -1969,17 +1970,17 @@ function Ra(e, t) {
1969
1970
  const C = document.createElement("strong");
1970
1971
  C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
1971
1972
  const h = document.createElement("a");
1972
- 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(Ua()), y.appendChild(h), o.appendChild(y);
1973
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Fa()), y.appendChild(h), o.appendChild(y);
1973
1974
  }
1974
1975
  return n.appendChild(o), n;
1975
1976
  }
1976
- function Ma(e, t) {
1977
+ function Ba(e, t) {
1977
1978
  const n = document.createElement("button");
1978
1979
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1979
1980
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1980
1981
  }), n;
1981
1982
  }
1982
- function Ba(e) {
1983
+ function Oa(e) {
1983
1984
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1984
1985
  return [
1985
1986
  {
@@ -1999,7 +2000,7 @@ function Ba(e) {
1999
2000
  }
2000
2001
  ];
2001
2002
  }
2002
- function Oa(e) {
2003
+ function Ua(e) {
2003
2004
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2004
2005
  return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (F(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), F(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), F(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), F(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), F(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (F(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), F(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), F(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (F(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), F(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), F(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), F(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
2005
2006
  }
@@ -2007,7 +2008,7 @@ function F(e, t, n) {
2007
2008
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
2008
2009
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
2009
2010
  }
2010
- function Ua() {
2011
+ function Fa() {
2011
2012
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2012
2013
  return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), F(e, "M14 5h5v5"), F(e, "M19 5l-8 8"), F(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
2013
2014
  }
@@ -2017,10 +2018,10 @@ function _n(e) {
2017
2018
  function Vt(e) {
2018
2019
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2019
2020
  }
2020
- function Fa(e, t, n, o) {
2021
+ function za(e, t, n, o) {
2021
2022
  const a = document.createElement("article");
2022
2023
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(re("pluno-pa-widget__character--tool-group", o));
2023
- const i = document.createElement("details"), l = Ga(e);
2024
+ const i = document.createElement("details"), l = Ha(e);
2024
2025
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
2025
2026
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
2026
2027
  });
@@ -2044,7 +2045,7 @@ function lt(e) {
2044
2045
  const t = document.createElement("article");
2045
2046
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(re("pluno-pa-widget__character--tool-group", e)), t;
2046
2047
  }
2047
- function za(e) {
2048
+ function Ga(e) {
2048
2049
  const t = lt(e);
2049
2050
  return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(xn()), t;
2050
2051
  }
@@ -2056,7 +2057,7 @@ function xn() {
2056
2057
  const n = document.createElement("span");
2057
2058
  return n.textContent = "Thinking...", e.appendChild(n), e;
2058
2059
  }
2059
- function Ga(e) {
2060
+ function Ha(e) {
2060
2061
  return `tools:${e[0]?.id ?? ""}`;
2061
2062
  }
2062
2063
  function pt() {
@@ -2064,7 +2065,7 @@ function pt() {
2064
2065
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2065
2066
  }
2066
2067
  function yn(e, t) {
2067
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ua() : mn());
2068
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ga() : mn());
2068
2069
  }
2069
2070
  function Yt(e, t) {
2070
2071
  const n = t.replace(/\r\n/g, `
@@ -2090,14 +2091,14 @@ function Yt(e, t) {
2090
2091
  const l = a.match(/^(#{1,3})\s+(.+)$/);
2091
2092
  if (l) {
2092
2093
  const u = document.createElement(`h${l[1].length + 2}`);
2093
- Re(u, l[2]), e.appendChild(u), o += 1;
2094
+ Me(u, l[2]), e.appendChild(u), o += 1;
2094
2095
  continue;
2095
2096
  }
2096
2097
  if (/^\s*[-*+]\s+/.test(a)) {
2097
2098
  const u = document.createElement("ul");
2098
2099
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
2099
2100
  const s = document.createElement("li");
2100
- Re(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2101
+ Me(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2101
2102
  }
2102
2103
  e.appendChild(u);
2103
2104
  continue;
@@ -2106,7 +2107,7 @@ function Yt(e, t) {
2106
2107
  const u = document.createElement("ol");
2107
2108
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
2108
2109
  const s = document.createElement("li");
2109
- Re(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2110
+ Me(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2110
2111
  }
2111
2112
  e.appendChild(u);
2112
2113
  continue;
@@ -2116,11 +2117,11 @@ function Yt(e, t) {
2116
2117
  p.push(n[o]), o += 1;
2117
2118
  const c = document.createElement("p");
2118
2119
  p.forEach((u, s) => {
2119
- s > 0 && c.appendChild(document.createElement("br")), Re(c, u);
2120
+ s > 0 && c.appendChild(document.createElement("br")), Me(c, u);
2120
2121
  }), e.appendChild(c);
2121
2122
  }
2122
2123
  }
2123
- function Re(e, t) {
2124
+ function Me(e, t) {
2124
2125
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2125
2126
  let o = 0;
2126
2127
  for (const a of t.matchAll(n)) {
@@ -2138,7 +2139,7 @@ function Re(e, t) {
2138
2139
  p.textContent = l.slice(1, -1), e.appendChild(p);
2139
2140
  } else {
2140
2141
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2141
- if (p && Ha(p[2])) {
2142
+ if (p && Wa(p[2])) {
2142
2143
  const c = document.createElement("a");
2143
2144
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2144
2145
  } else
@@ -2148,7 +2149,7 @@ function Re(e, t) {
2148
2149
  }
2149
2150
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2150
2151
  }
2151
- function Ha(e) {
2152
+ function Wa(e) {
2152
2153
  if (e.startsWith("/") || e.startsWith("#"))
2153
2154
  return !0;
2154
2155
  try {
@@ -2159,7 +2160,7 @@ function Ha(e) {
2159
2160
  }
2160
2161
  }
2161
2162
  function Kt(e, t) {
2162
- if (Wa(e))
2163
+ if ($a(e))
2163
2164
  return;
2164
2165
  const n = `
2165
2166
  :host {
@@ -4139,18 +4140,18 @@ function Kt(e, t) {
4139
4140
  filter: url(#pluno-pa-scribble-wobble-2);
4140
4141
  }
4141
4142
  `;
4142
- if ($a(e, n))
4143
+ if (qa(e, n))
4143
4144
  return;
4144
4145
  const o = e.ownerDocument.createElement("style");
4145
4146
  o.id = sn, o.textContent = n, e.appendChild(o), vn(e);
4146
4147
  }
4147
- function Wa(e) {
4148
+ function $a(e) {
4148
4149
  return e.getElementById(sn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(dn) === "true";
4149
4150
  }
4150
4151
  function vn(e) {
4151
4152
  e.host instanceof HTMLElement && e.host.setAttribute(dn, "true");
4152
4153
  }
4153
- function $a(e, t) {
4154
+ function qa(e, t) {
4154
4155
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
4155
4156
  return !1;
4156
4157
  try {
@@ -4160,7 +4161,7 @@ function $a(e, t) {
4160
4161
  return !1;
4161
4162
  }
4162
4163
  }
4163
- async function qa() {
4164
+ async function ja() {
4164
4165
  return document.body ? document.body : await new Promise((e) => {
4165
4166
  const t = new MutationObserver(() => {
4166
4167
  document.body && (t.disconnect(), e(document.body));
@@ -4171,7 +4172,7 @@ async function qa() {
4171
4172
  function Cn(e) {
4172
4173
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
4173
4174
  }
4174
- function ja(e) {
4175
+ function Va(e) {
4175
4176
  try {
4176
4177
  const t = window.localStorage.getItem(Cn(e));
4177
4178
  if (!t)
@@ -4181,7 +4182,7 @@ function ja(e) {
4181
4182
  isOpen: n.isOpen === !0,
4182
4183
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
4183
4184
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
4184
- launcherPosition: Xa(n.launcherPosition) ? n.launcherPosition : null,
4185
+ launcherPosition: Za(n.launcherPosition) ? n.launcherPosition : null,
4185
4186
  seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nn) : [],
4186
4187
  sharePromptsDisabled: n.sharePromptsDisabled === !0
4187
4188
  };
@@ -4189,7 +4190,7 @@ function ja(e) {
4189
4190
  return Xt();
4190
4191
  }
4191
4192
  }
4192
- async function Va(e) {
4193
+ async function Ya(e) {
4193
4194
  if (e.loadSharePromptsDisabled)
4194
4195
  return e.loadSharePromptsDisabled();
4195
4196
  try {
@@ -4198,7 +4199,7 @@ async function Va(e) {
4198
4199
  return !1;
4199
4200
  }
4200
4201
  }
4201
- function Ya(e, t) {
4202
+ function Ka(e, t) {
4202
4203
  if (e.persistSharePromptsDisabled) {
4203
4204
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
4204
4205
  });
@@ -4220,28 +4221,28 @@ function Xt() {
4220
4221
  sharePromptsDisabled: !1
4221
4222
  };
4222
4223
  }
4223
- function Ka(e, t) {
4224
+ function Xa(e, t) {
4224
4225
  try {
4225
4226
  window.localStorage.setItem(Cn(e), JSON.stringify(t));
4226
4227
  } catch {
4227
4228
  return;
4228
4229
  }
4229
4230
  }
4230
- function Xa(e) {
4231
+ function Za(e) {
4231
4232
  if (!e || typeof e != "object")
4232
4233
  return !1;
4233
4234
  const t = e;
4234
4235
  return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
4235
4236
  }
4236
4237
  const Zt = /* @__PURE__ */ new WeakSet();
4237
- function Za(e) {
4238
+ function Ja(e) {
4238
4239
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
4239
4240
  }
4240
4241
  function Jt(e) {
4241
4242
  const t = e.pathname.split("/");
4242
4243
  return t[t.length - 1] ?? "";
4243
4244
  }
4244
- function Ja(e, t) {
4245
+ function Qa(e, t) {
4245
4246
  const n = new URL(e.src, document.baseURI);
4246
4247
  return n.href === t.href || n.pathname === t.pathname ? !0 : Jt(n) === Jt(t);
4247
4248
  }
@@ -4264,7 +4265,7 @@ class te extends EventTarget {
4264
4265
  })
4265
4266
  ), this.cleanup();
4266
4267
  }), window.dispatchEvent(
4267
- new CustomEvent(Me(oo, this.channelId), {
4268
+ new CustomEvent(Be(oo, this.channelId), {
4268
4269
  detail: { socketId: this.socketId, url: t }
4269
4270
  })
4270
4271
  );
@@ -4280,26 +4281,26 @@ class te extends EventTarget {
4280
4281
  binaryType = "blob";
4281
4282
  bufferedAmount = 0;
4282
4283
  readyState = te.CONNECTING;
4283
- socketId = Qa();
4284
+ socketId = ei();
4284
4285
  listeners = /* @__PURE__ */ new Map();
4285
4286
  send(t) {
4286
4287
  if (this.readyState !== te.OPEN)
4287
4288
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
4288
4289
  window.dispatchEvent(
4289
- new CustomEvent(Me(ao, this.channelId), {
4290
+ new CustomEvent(Be(ao, this.channelId), {
4290
4291
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
4291
4292
  })
4292
4293
  );
4293
4294
  }
4294
4295
  close(t, n) {
4295
4296
  this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
4296
- new CustomEvent(Me(io, this.channelId), {
4297
+ new CustomEvent(Be(io, this.channelId), {
4297
4298
  detail: { socketId: this.socketId, code: t, reason: n }
4298
4299
  })
4299
4300
  ), this.cleanup());
4300
4301
  }
4301
4302
  addPreviewListener(t, n) {
4302
- const o = Me(t, this.channelId), a = (i) => {
4303
+ const o = Be(t, this.channelId), a = (i) => {
4303
4304
  i.detail?.socketId === this.socketId && n(i);
4304
4305
  };
4305
4306
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -4310,36 +4311,36 @@ class te extends EventTarget {
4310
4311
  this.listeners.clear();
4311
4312
  }
4312
4313
  }
4313
- function Qa() {
4314
+ function ei() {
4314
4315
  const e = window.sessionStorage.getItem(At);
4315
4316
  if (e)
4316
4317
  return e;
4317
4318
  const t = crypto.randomUUID();
4318
4319
  return window.sessionStorage.setItem(At, t), t;
4319
4320
  }
4320
- function Me(e, t) {
4321
+ function Be(e, t) {
4321
4322
  return `${e}:${t}`;
4322
4323
  }
4323
- function ei(e) {
4324
+ function ti(e) {
4324
4325
  const t = document.currentScript;
4325
4326
  if (t instanceof HTMLScriptElement)
4326
4327
  return [t];
4327
4328
  const n = new URL(e, document.baseURI).href, o = new URL(n);
4328
4329
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
4329
- (a) => a instanceof HTMLScriptElement && Za(a) && Ja(a, o)
4330
+ (a) => a instanceof HTMLScriptElement && Ja(a) && Qa(a, o)
4330
4331
  );
4331
4332
  }
4332
- function ti(e) {
4333
- for (const t of ei(e)) {
4333
+ function ni(e) {
4334
+ for (const t of ti(e)) {
4334
4335
  if (Zt.has(t) || t.dataset.plunoAutoMount === "false")
4335
4336
  continue;
4336
4337
  Zt.add(t);
4337
4338
  const n = t.dataset.plunoPreviewChannel;
4338
- To({
4339
+ No({
4339
4340
  token: t.dataset.plunoToken,
4340
4341
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
4341
4342
  backendUrl: t.dataset.plunoBackendUrl,
4342
- webSocketFactory: n ? Ao(n) : void 0,
4343
+ webSocketFactory: n ? To(n) : void 0,
4343
4344
  launcherLabel: t.dataset.plunoLauncherLabel,
4344
4345
  accentColor: t.dataset.plunoAccentColor,
4345
4346
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -4351,8 +4352,8 @@ function ti(e) {
4351
4352
  });
4352
4353
  }
4353
4354
  }
4354
- ti(import.meta.url);
4355
+ ni(import.meta.url);
4355
4356
  export {
4356
- Ao as createProductAgentPreviewBridgeWebSocketFactory,
4357
- To as mountPlunoProductAgentWidget
4357
+ To as createProductAgentPreviewBridgeWebSocketFactory,
4358
+ No as mountPlunoProductAgentWidget
4358
4359
  };