@pluno/product-agent-web 0.1.37 → 0.1.38

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.
@@ -75,13 +75,13 @@ function un(e) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- const pe = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
78
+ const se = "#2c2a1e", lt = [253, 250, 241], pt = 3.5;
79
79
  function It(e) {
80
80
  const t = Dt(e);
81
81
  if (st(fe(t), lt) >= pt)
82
82
  return t;
83
83
  let o = fe(t);
84
- const a = fe(pe);
84
+ const a = fe(se);
85
85
  for (let i = 0; i < 6; i += 1)
86
86
  if (o = fn(o, a, 0.22), st(o, lt) >= pt)
87
87
  return Ue(o);
@@ -103,15 +103,15 @@ function gn(e) {
103
103
  <g clip-path="url(#scribbleBoltClip)">
104
104
  <path d="${hn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
105
105
  </g>
106
- <path d="${n}" fill="none" stroke="${pe}" stroke-width="18" stroke-linejoin="round"/>
106
+ <path d="${n}" fill="none" stroke="${se}" stroke-width="18" stroke-linejoin="round"/>
107
107
  <g transform="rotate(-2 528 463)">
108
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
109
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${pe}"/>
108
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
109
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${se}"/>
110
110
  <circle cx="557" cy="447" r="16" fill="#ffffff"/>
111
111
  </g>
112
112
  <g transform="rotate(2 717 462)">
113
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${pe}" stroke-width="13"/>
114
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${pe}"/>
113
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
114
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${se}"/>
115
115
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
116
116
  </g>
117
117
  </g>
@@ -150,16 +150,16 @@ function mn(e) {
150
150
  inner: "#4b4b4b",
151
151
  shadow: "#000000"
152
152
  } : {
153
- top: z(t, 0.28, -0.03),
154
- middle: z(t, 0.08, 0.04),
155
- bottom: z(t, -0.1, 0.02),
156
- edgeStart: z(t, 0.08, 0.08),
157
- edgeMiddle: z(t, -0.08, 0.08),
158
- edgeEnd: z(t, -0.18, 0.05),
159
- glow: z(t, 0.32, -0.12),
160
- highlight: z(t, 0.38, -0.18),
161
- inner: z(t, 0.24, -0.1),
162
- shadow: z(t, -0.25, -0.08)
153
+ top: $(t, 0.28, -0.03),
154
+ middle: $(t, 0.08, 0.04),
155
+ bottom: $(t, -0.1, 0.02),
156
+ edgeStart: $(t, 0.08, 0.08),
157
+ edgeMiddle: $(t, -0.08, 0.08),
158
+ edgeEnd: $(t, -0.18, 0.05),
159
+ glow: $(t, 0.32, -0.12),
160
+ highlight: $(t, 0.38, -0.18),
161
+ inner: $(t, 0.24, -0.1),
162
+ shadow: $(t, -0.25, -0.08)
163
163
  };
164
164
  }
165
165
  function Dt(e) {
@@ -189,16 +189,16 @@ function st(e, t) {
189
189
  return (a + 0.05) / (i + 0.05);
190
190
  }
191
191
  function fn(e, t, n) {
192
- const o = Ge(n);
192
+ const o = $e(n);
193
193
  return [
194
194
  e[0] + (t[0] - e[0]) * o,
195
195
  e[1] + (t[1] - e[1]) * o,
196
196
  e[2] + (t[2] - e[2]) * o
197
197
  ];
198
198
  }
199
- function z(e, t, n) {
199
+ function $(e, t, n) {
200
200
  const [o, a, i] = bn(fe(e));
201
- return Ue(wn(o, Ge(a + n), Ge(i + t)));
201
+ return Ue(wn(o, $e(a + n), $e(i + t)));
202
202
  }
203
203
  function bn([e, t, n]) {
204
204
  const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
@@ -221,7 +221,7 @@ function Re(e, t, n) {
221
221
  let o = n;
222
222
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
223
223
  }
224
- function Ge(e) {
224
+ function $e(e) {
225
225
  return Math.max(0, Math.min(1, e));
226
226
  }
227
227
  const Rt = "suggest_share_on_socials";
@@ -279,8 +279,8 @@ function An(e, t = {}) {
279
279
  l();
280
280
  return;
281
281
  }
282
- const L = Math.min(1, (performance.now() - x) / En);
283
- o = Math.round(w + (p - w) * Dn(L)), e(o), L >= 1 && (o = p, e(p), l());
282
+ const P = Math.min(1, (performance.now() - x) / En);
283
+ o = Math.round(w + (p - w) * Dn(P)), e(o), P >= 1 && (o = p, e(p), l());
284
284
  }, kn);
285
285
  }, d = async () => {
286
286
  try {
@@ -322,7 +322,7 @@ function In(e) {
322
322
  function Dn(e) {
323
323
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
324
324
  }
325
- const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-agent:sdk-preview-socket-send", On = "product-agent:sdk-preview-socket-close", Bn = "product-agent:sdk-preview-socket-open", Fn = "product-agent:sdk-preview-socket-message", Un = "product-agent:sdk-preview-socket-error", zn = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Ot = "pluno.productAgent.sharePromptsDisabled", Ee = 10, $n = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Bt).join(","), Hn = 3, j = {
325
+ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-agent:sdk-preview-socket-send", On = "product-agent:sdk-preview-socket-close", Bn = "product-agent:sdk-preview-socket-open", Fn = "product-agent:sdk-preview-socket-message", Un = "product-agent:sdk-preview-socket-error", zn = "product-agent:sdk-preview-socket-closed", ut = "product-agent:sdk-preview-socket-id", $n = "product-agent:preview-diagnostic", Ot = "pluno.productAgent.sharePromptsDisabled", Ee = 10, Wn = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Gn = Array.from(Bt).join(","), Hn = 3, V = {
326
326
  launcherLabel: "Ask for anything...",
327
327
  accentColor: "#7c3aed",
328
328
  colorScheme: "light",
@@ -330,7 +330,7 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-a
330
330
  scribbleStyle: !1,
331
331
  position: "bottom-right",
332
332
  movableLauncher: !1
333
- }, jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ft = 190, Ut = 41, Vn = 48, qn = 420, Kn = 520, Yn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, B = 8, $e = 50, Qn = "http://www.w3.org/2000/svg", ht = [
333
+ }, jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ft = 190, Ut = 41, Vn = 48, qn = 420, Yn = 520, Kn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, B = 8, We = 50, Qn = "http://www.w3.org/2000/svg", ht = [
334
334
  {
335
335
  ellipseCx: "17.5",
336
336
  ellipseCy: "24.5",
@@ -367,19 +367,19 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Mn = "product-a
367
367
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
368
368
  pathStrokeWidth: "2.45"
369
369
  }
370
- ], eo = 11, to = 13, mt = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", zt = "pluno-pa-widget-styles", Gt = "data-pluno-pa-widget-styles";
370
+ ], eo = 11, to = 13, mt = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", zt = "pluno-pa-widget-styles", $t = "data-pluno-pa-widget-styles";
371
371
  function io(e) {
372
- return (t) => new V(t, e);
372
+ return (t) => new q(t, e);
373
373
  }
374
374
  async function ro(e = {}) {
375
375
  const t = {
376
- launcherLabel: e.launcherLabel ?? j.launcherLabel,
377
- accentColor: e.accentColor ?? j.accentColor,
378
- colorScheme: e.colorScheme ?? j.colorScheme,
379
- fontFamily: e.fontFamily ?? j.fontFamily,
380
- scribbleStyle: e.scribbleStyle ?? j.scribbleStyle,
381
- position: e.position ?? j.position,
382
- movableLauncher: e.movableLauncher ?? j.movableLauncher,
376
+ launcherLabel: e.launcherLabel ?? V.launcherLabel,
377
+ accentColor: e.accentColor ?? V.accentColor,
378
+ colorScheme: e.colorScheme ?? V.colorScheme,
379
+ fontFamily: e.fontFamily ?? V.fontFamily,
380
+ scribbleStyle: e.scribbleStyle ?? V.scribbleStyle,
381
+ position: e.position ?? V.position,
382
+ movableLauncher: e.movableLauncher ?? V.movableLauncher,
383
383
  token: e.token,
384
384
  tokenProvider: e.tokenProvider,
385
385
  tokenEndpoint: e.tokenEndpoint,
@@ -401,7 +401,7 @@ async function ro(e = {}) {
401
401
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
402
402
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
403
403
  };
404
- Y("web-sdk.widget", "Mounting widget with merged options", {
404
+ X("web-sdk.widget", "Mounting widget with merged options", {
405
405
  accentColor: t.accentColor,
406
406
  colorScheme: t.colorScheme,
407
407
  fontFamily: t.fontFamily,
@@ -417,29 +417,29 @@ async function ro(e = {}) {
417
417
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
418
418
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
419
419
  let i = ft(t.accentColor, t.scribbleStyle);
420
- vo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
421
- const l = await ua(), s = l.ownerDocument;
420
+ Eo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
421
+ const l = await ma(), s = l.ownerDocument;
422
422
  l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Pt(o, t.accentColor), bt(a, i, {
423
423
  accentColor: t.accentColor,
424
424
  colorScheme: t.colorScheme,
425
425
  fontFamily: t.fontFamily,
426
426
  scribbleStyle: t.scribbleStyle
427
- }), Y("web-sdk.widget", "Applied initial widget appearance", {
427
+ }), X("web-sdk.widget", "Applied initial widget appearance", {
428
428
  accentColor: t.accentColor,
429
429
  colorScheme: t.colorScheme,
430
430
  fontFamily: t.fontFamily,
431
431
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
432
432
  });
433
- const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), L = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
434
- if (!u || !p || !w || !x || !L || !C || !M || !v || !y || !h || !g || !_ || !N || !Z || !ce || !S || !f)
433
+ const u = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), w = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), P = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), M = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), J = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), S = a.querySelector(".pluno-pa-widget__timeline"), f = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
434
+ if (!u || !p || !w || !x || !P || !C || !M || !v || !y || !h || !g || !_ || !N || !J || !ce || !S || !f)
435
435
  throw new Error("Failed to mount Pluno widget");
436
436
  if (t.movableLauncher && !d)
437
437
  throw new Error("Failed to mount Pluno widget drag handle");
438
438
  xt(p), xt(g);
439
439
  let m = [], T = null;
440
- const k = () => {
441
- Mo(v, m, (r) => {
442
- m = m.filter((c, A) => A !== r), k(), O(b.getState()), U();
440
+ const L = () => {
441
+ Fo(v, m, (r) => {
442
+ m = m.filter((c, k) => k !== r), L(), O(b.getState()), U();
443
443
  });
444
444
  }, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
445
445
  if (!t.tokenEndpoint)
@@ -456,7 +456,7 @@ async function ro(e = {}) {
456
456
  if (!c.token)
457
457
  throw new Error("Pluno token endpoint did not return a token");
458
458
  return c.token;
459
- }), P = window.fetch.bind(window);
459
+ }), A = window.fetch.bind(window);
460
460
  let b;
461
461
  b = await dn.init({
462
462
  token: t.token,
@@ -473,42 +473,42 @@ async function ro(e = {}) {
473
473
  webSocketFactory: t.webSocketFactory,
474
474
  autoConnect: t.loginRequired ? !1 : void 0
475
475
  });
476
- const J = ga(t), Se = new Set(J.openToolGroupKeys), ie = new Set(J.seenShareCandidateIds), be = new Set(ie);
477
- let ke = J.sharePromptsDisabled || await ha(t), $ = t.movableLauncher ? J.launcherPosition : null, Ke = $ !== null, q = null, Le = !1, Q = !1, ee = {
476
+ const Q = fa(t), Se = new Set(Q.openToolGroupKeys), re = new Set(Q.seenShareCandidateIds), be = new Set(re);
477
+ let ke = Q.sharePromptsDisabled || await ba(t), G = t.movableLauncher ? Q.launcherPosition : null, Ye = G !== null, K = null, Le = !1, ee = !1, te = {
478
478
  enabled: !0
479
- }, te = 0, Ye = "";
480
- const W = (r, c) => {
481
- ee = { enabled: r, reason: c };
482
- }, H = () => {
483
- Z.hidden = !0;
479
+ }, ne = 0, Ke = "";
480
+ const H = (r, c) => {
481
+ te = { enabled: r, reason: c };
482
+ }, j = () => {
483
+ J.hidden = !0;
484
484
  }, tn = () => {
485
- Z.hidden = !1;
485
+ J.hidden = !1;
486
486
  }, nn = (r = "jump") => {
487
- W(!0, r), H(), me(S, () => ee.enabled), te = S.scrollTop;
487
+ H(!0, r), j(), me(S, () => te.enabled), ne = S.scrollTop;
488
488
  }, on = () => {
489
489
  Le || typeof document > "u" || (Pt(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
490
490
  }, Xe = new MutationObserver(on);
491
491
  Xe.observe(s.documentElement, { childList: !0, subtree: !0 });
492
492
  const Pe = (r = !0) => {
493
- const c = We(a, r);
493
+ const c = Ge(a, r);
494
494
  return wt(
495
495
  a,
496
- $ ?? go(a, t.position, c),
496
+ G ? ho(G, c) : go(a, t.position, c),
497
497
  c
498
498
  );
499
499
  }, F = () => {
500
- fa(t, {
500
+ _a(t, {
501
501
  isOpen: a.classList.contains("pluno-pa-widget--open"),
502
502
  composerValue: g.value,
503
503
  openToolGroupKeys: [...Se],
504
- launcherPosition: Ke ? $ : null,
505
- seenShareCandidateIds: [...ie].slice(-Mt),
504
+ launcherPosition: Ye ? G : null,
505
+ seenShareCandidateIds: [...re].slice(-Mt),
506
506
  sharePromptsDisabled: ke
507
507
  });
508
- }, ne = (r, c = {}) => {
509
- wo(r, {
508
+ }, oe = (r, c = {}) => {
509
+ vo(r, {
510
510
  debugVersion: ao,
511
- launcherPosition: $,
511
+ launcherPosition: G,
512
512
  rootClasses: a.className,
513
513
  rootStyle: {
514
514
  left: a.style.left,
@@ -519,22 +519,22 @@ async function ro(e = {}) {
519
519
  rootRect: Me(a),
520
520
  launcherRect: Me(u),
521
521
  panelRect: Me(w),
522
- viewport: de(),
522
+ viewport: Y(),
523
523
  panelHidden: w.hidden,
524
524
  closeHidden: x.hidden,
525
525
  ...c
526
526
  });
527
527
  }, we = (r = !0) => {
528
- if (!$)
528
+ if (!G)
529
529
  return xe(a, null), Pe(r);
530
530
  const c = Pe(r);
531
- return xe(a, c), ne("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
531
+ return xe(a, c), oe("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
532
532
  }, Ze = (r, c) => {
533
533
  if (!r || !c) {
534
- bo(a);
534
+ xo(a);
535
535
  return;
536
536
  }
537
- fo(a, {
537
+ _o(a, {
538
538
  x: r.x - c.x,
539
539
  y: r.y - c.y
540
540
  });
@@ -542,8 +542,8 @@ async function ro(e = {}) {
542
542
  const r = we();
543
543
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
544
544
  const c = _t(a, r, t.position);
545
- Ze(c, r), ne("Applied open panel position after viewport resize", { openPanelPosition: c });
546
- } else $ && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
545
+ Ze(c, r), oe("Applied open panel position after viewport resize", { openPanelPosition: c });
546
+ } else G && oe("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
547
547
  };
548
548
  let Qe = () => {
549
549
  };
@@ -553,11 +553,11 @@ async function ro(e = {}) {
553
553
  launcherDragHandle: d,
554
554
  getPosition: () => Pe(),
555
555
  setPosition: (r) => {
556
- const c = r;
557
- $ = wt(a, r, We(a)), xe(a, $), ne("Dragging closed launcher", { requestedPosition: c });
556
+ const c = r, k = Ge(a), z = wt(a, r, k);
557
+ G = mo(z, k), xe(a, z), oe("Dragging closed launcher", { requestedPosition: c });
558
558
  },
559
559
  persist: () => {
560
- Ke = !0, F(), ne("Persisted closed launcher drag position");
560
+ Ye = !0, F(), oe("Persisted closed launcher drag position");
561
561
  }
562
562
  })) : xe(a, null);
563
563
  let Ae = !1;
@@ -571,57 +571,57 @@ async function ro(e = {}) {
571
571
  Ae = !1;
572
572
  }
573
573
  }
574
- }, oe = (r = "", c = !0) => {
575
- et(), q !== null && (window.clearTimeout(q), q = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
576
- const A = we(), K = _t(a, A, t.position);
577
- if (Ze(K, A), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: A }), W(!0, "open"), H(), !c) {
578
- a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
574
+ }, ae = (r = "", c = !0) => {
575
+ et(), K !== null && (window.clearTimeout(K), K = null), w.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
576
+ const k = we(), z = _t(a, k, t.position);
577
+ if (Ze(z, k), oe("Opening launcher at clamped open panel position", { openPanelPosition: z, visibleLauncherPosition: k }), H(!0, "open"), j(), !c) {
578
+ a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (g.value = r, he(g)), me(S, () => te.enabled), ne = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
579
579
  return;
580
580
  }
581
581
  window.requestAnimationFrame(() => {
582
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => ee.enabled), te = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
583
- u.hidden = !0, me(S, () => ee.enabled), te = S.scrollTop;
582
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(S, () => te.enabled), ne = S.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), K = window.setTimeout(() => {
583
+ u.hidden = !0, me(S, () => te.enabled), ne = S.scrollTop;
584
584
  }, 220);
585
585
  });
586
586
  }, an = () => {
587
- q !== null && (window.clearTimeout(q), q = null), u.hidden = !1, $ && (we(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
587
+ K !== null && (window.clearTimeout(K), K = null), u.hidden = !1, G && (we(!1), oe("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), K = window.setTimeout(() => {
588
588
  w.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
589
589
  }, 220);
590
590
  };
591
591
  u.addEventListener("submit", (r) => {
592
- r.preventDefault(), oe(p.value), p.value = "";
592
+ r.preventDefault(), ae(p.value), p.value = "";
593
593
  }), d?.addEventListener("click", (r) => {
594
594
  r.preventDefault(), r.stopPropagation();
595
595
  }), u.addEventListener("click", (r) => {
596
- r.target === p && !d || (oe(p.value), p.value = "");
596
+ r.target === p && !d || (ae(p.value), p.value = "");
597
597
  }), p.addEventListener("focus", () => {
598
- oe(p.value), p.value = "";
598
+ ae(p.value), p.value = "";
599
599
  }), p.addEventListener("input", () => {
600
600
  if (!p.value)
601
601
  return;
602
602
  const r = p.value;
603
- oe(r), p.value = "";
603
+ ae(r), p.value = "";
604
604
  }), x.addEventListener("click", an), S.addEventListener("scroll", () => {
605
- S.scrollTop < te - 1 && W(!1, "userScroll"), te = S.scrollTop;
606
- }), Z.addEventListener("click", () => {
605
+ S.scrollTop < ne - 1 && H(!1, "userScroll"), ne = S.scrollTop;
606
+ }), J.addEventListener("click", () => {
607
607
  nn();
608
608
  });
609
609
  const tt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
610
610
  ([r]) => {
611
- r?.isIntersecting && (W(!0, "bottom"), H());
611
+ r?.isIntersecting && (H(!0, "bottom"), j());
612
612
  },
613
613
  { root: S, threshold: 0 }
614
614
  );
615
615
  tt?.observe(f);
616
616
  const U = () => {
617
- _.disabled = G(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || G(t.billingStatus);
617
+ _.disabled = W(t.billingStatus) || !b.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || W(t.billingStatus);
618
618
  };
619
- t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, L.hidden = !0), L.addEventListener("submit", (r) => {
619
+ t.loginRequired && (p.readOnly = !0, p.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, P.hidden = !0), P.addEventListener("submit", (r) => {
620
620
  if (r.preventDefault(), t.loginRequired) {
621
621
  t.onLoginClick?.();
622
622
  return;
623
623
  }
624
- G(t.billingStatus) || (Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U());
624
+ W(t.billingStatus) || (ee = !0, H(!0, "send"), j(), m = Oe(b, g, m), L(), U());
625
625
  });
626
626
  let ue = 0;
627
627
  const rn = () => {
@@ -635,17 +635,17 @@ async function ro(e = {}) {
635
635
  }, ot = async (r) => {
636
636
  if (r.length === 0)
637
637
  return;
638
- const c = await Uo(r);
638
+ const c = await Wo(r);
639
639
  if (m.length + c.length > Ee)
640
640
  throw new Error(`Attach up to ${Ee} files per message.`);
641
- m = [...m, ...c], k(), ln(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
641
+ m = [...m, ...c], L(), ln(), U(), O(b.getState()), a.classList.contains("pluno-pa-widget--open") || ae();
642
642
  };
643
643
  h.addEventListener("click", () => {
644
- t.loginRequired || G(t.billingStatus) || y.click();
644
+ t.loginRequired || W(t.billingStatus) || y.click();
645
645
  }), y.addEventListener("change", () => {
646
646
  const r = Array.from(y.files ?? []);
647
647
  y.value = "", ot(r).catch((c) => {
648
- nt(c instanceof Error ? c.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
648
+ nt(c instanceof Error ? c.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
649
649
  message: c instanceof Error ? c.message : String(c)
650
650
  });
651
651
  });
@@ -658,9 +658,9 @@ async function ro(e = {}) {
658
658
  ve(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
659
659
  }), a.addEventListener("drop", (r) => {
660
660
  const c = r.dataTransfer;
661
- !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), rn(), ot(c.files).catch((A) => {
662
- nt(A instanceof Error ? A.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
663
- message: A instanceof Error ? A.message : String(A)
661
+ !ve(c) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), rn(), ot(c.files).catch((k) => {
662
+ nt(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
663
+ message: k instanceof Error ? k.message : String(k)
664
664
  });
665
665
  }));
666
666
  }), _.addEventListener("click", () => {
@@ -672,9 +672,9 @@ async function ro(e = {}) {
672
672
  b.stop();
673
673
  return;
674
674
  }
675
- Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
675
+ ee = !0, H(!0, "send"), j(), m = Oe(b, g, m), L(), U(), O(b.getState());
676
676
  }), N.addEventListener("click", () => {
677
- Q = !0, W(!0, "newSession"), H(), b.startNewSession(), Se.clear(), g.value = "", m = [], k(), he(g), F(), U(), g.focus(), O(b.getState());
677
+ ee = !0, H(!0, "newSession"), j(), b.startNewSession(), Se.clear(), g.value = "", m = [], L(), he(g), F(), U(), g.focus(), O(b.getState());
678
678
  }), g.addEventListener("input", () => {
679
679
  he(g), F(), U(), O(b.getState());
680
680
  }), g.addEventListener("keydown", (r) => {
@@ -683,23 +683,23 @@ async function ro(e = {}) {
683
683
  t.onLoginClick?.();
684
684
  return;
685
685
  }
686
- Q = !0, W(!0, "send"), H(), m = Oe(b, g, m), k(), U(), O(b.getState());
686
+ ee = !0, H(!0, "send"), j(), m = Oe(b, g, m), L(), U(), O(b.getState());
687
687
  }
688
688
  }), a.addEventListener("click", (r) => {
689
689
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
690
- }), J.composerValue && (g.value = J.composerValue, he(g)), J.isOpen && oe(g.value, !1);
690
+ }), Q.composerValue && (g.value = Q.composerValue, he(g)), Q.isOpen && ae(g.value, !1);
691
691
  const at = () => i;
692
- let Te = b.getState().appearance !== null, _e = null, ge = null, re = null, it = b.getState().isThinking, le = null, Ne = null, rt = () => {
692
+ let Te = b.getState().appearance !== null, _e = null, ge = null, le = null, it = b.getState().isThinking, pe = null, Ne = null, rt = () => {
693
693
  };
694
694
  const pn = !!t.socialPostDraftHandler, O = (r) => {
695
- if (qe(r.lastErrorCode) ? le = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(M, t.billingStatus, le), t.loginRequired) {
696
- Jo(S, _, N, at, t.loginButtonLabel, t.onLoginClick);
695
+ if (qe(r.lastErrorCode) ? pe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Fe(M, t.billingStatus, pe), t.loginRequired) {
696
+ ta(S, _, N, at, t.loginButtonLabel, t.onLoginClick);
697
697
  return;
698
698
  }
699
- const c = _o(r), A = c !== Ye;
700
- Ye = c;
701
- const K = Q || ee.enabled;
702
- Q = !1, Zo(
699
+ const c = yo(r), k = c !== Ke;
700
+ Ke = c;
701
+ const z = ee || te.enabled;
702
+ ee = !1, ea(
703
703
  S,
704
704
  f,
705
705
  _,
@@ -708,40 +708,40 @@ async function ro(e = {}) {
708
708
  r,
709
709
  Ne,
710
710
  Ne !== null && Et(r, g.value.trim().length > 0 || m.length > 0),
711
- K,
712
- () => ee.enabled,
711
+ z,
712
+ () => te.enabled,
713
713
  Se,
714
714
  F,
715
715
  at,
716
716
  (R) => {
717
- Q = !0, W(!0, "send"), H(), b.sendMessage(R);
717
+ ee = !0, H(!0, "send"), j(), b.sendMessage(R);
718
718
  },
719
719
  pn && !ke ? {
720
720
  dismissedCandidateIds: be,
721
721
  draftingCandidateId: _e,
722
722
  error: ge,
723
723
  onSeen: (R) => {
724
- ie.add(R.id), F();
724
+ re.add(R.id), F();
725
725
  },
726
726
  onDraft: (R) => {
727
727
  sn(R);
728
728
  },
729
729
  onDismiss: (R) => {
730
- ie.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
730
+ re.add(R.id), be.add(R.id), F(), ge = null, O(b.getState());
731
731
  },
732
732
  onDisable: (R) => {
733
- ke = !0, ie.add(R.id), be.add(R.id), F(), ma(t, !0), ge = null, O(b.getState());
733
+ ke = !0, re.add(R.id), be.add(R.id), F(), wa(t, !0), ge = null, O(b.getState());
734
734
  }
735
735
  } : void 0
736
- ), K ? (te = S.scrollTop, H()) : A && xo(r) && tn();
736
+ ), z ? (ne = S.scrollTop, j()) : k && Co(r) && tn();
737
737
  };
738
738
  return rt = An((r) => {
739
739
  Ne = r, !Le && Et(b.getState(), g.value.trim().length > 0 || m.length > 0) && O(b.getState());
740
- }, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), b.on("state", (r) => {
740
+ }, { backendUrl: t.backendUrl, fetcher: A, loader: t.activeUsersLoader }), b.on("state", (r) => {
741
741
  const c = it && !r.isThinking;
742
- it = r.isThinking, r.appearance ? (Te = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
742
+ it = r.isThinking, r.appearance ? (Te = !0, X("web-sdk.widget", "Agent state supplied appearance", {
743
743
  appearance: r.appearance
744
- }), Ie(r.appearance, "agent.state.appearance")) : Te && (Te = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
744
+ }), Ie(r.appearance, "agent.state.appearance")) : Te && (Te = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
745
745
  fallbackAccentColor: t.accentColor,
746
746
  fallbackColorScheme: t.colorScheme,
747
747
  fallbackFontFamily: t.fontFamily
@@ -753,17 +753,17 @@ async function ro(e = {}) {
753
753
  },
754
754
  updateBillingStatus: (r) => {
755
755
  const c = r ?? null;
756
- yt(t.billingStatus, c, le) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (le = null), Fe(
756
+ yt(t.billingStatus, c, pe) && (t.billingStatus = c, t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), Fe(
757
757
  a.querySelector(".pluno-pa-widget__billing-status"),
758
758
  t.billingStatus,
759
- le
759
+ pe
760
760
  ), U());
761
761
  },
762
762
  openPanel: () => {
763
- oe(g.value, !1);
763
+ ae(g.value, !1);
764
764
  },
765
765
  destroy: () => {
766
- Le = !0, Xe.disconnect(), tt?.disconnect(), window.removeEventListener("resize", Je), Qe(), T !== null && window.clearTimeout(T), rt(), re?.remove(), b.destroy(), n.remove();
766
+ Le = !0, Xe.disconnect(), tt?.disconnect(), window.removeEventListener("resize", Je), Qe(), T !== null && window.clearTimeout(T), rt(), le?.remove(), b.destroy(), n.remove();
767
767
  }
768
768
  };
769
769
  async function sn(r) {
@@ -775,12 +775,12 @@ async function ro(e = {}) {
775
775
  const c = await t.socialPostDraftHandler(r);
776
776
  if (!c.linkedinPost || !c.xPost)
777
777
  throw new Error("Pluno did not return a complete social post draft.");
778
- ie.add(r.id), be.add(r.id), F(), re?.remove(), re = ta(c, {
778
+ re.add(r.id), be.add(r.id), F(), le?.remove(), le = aa(c, {
779
779
  socialPostRewardsUrl: t.socialPostRewardsUrl,
780
780
  onClose: () => {
781
- re?.remove(), re = null;
781
+ le?.remove(), le = null;
782
782
  }
783
- }), a.appendChild(re);
783
+ }), a.appendChild(le);
784
784
  } catch (c) {
785
785
  ge = c instanceof Error ? c.message : "Could not draft social post.";
786
786
  } finally {
@@ -789,17 +789,17 @@ async function ro(e = {}) {
789
789
  }
790
790
  }
791
791
  function Ie(r, c) {
792
- const A = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, De = r.scribbleStyle ?? t.scribbleStyle;
793
- i = ft(A, De), bt(a, i, {
794
- accentColor: A,
795
- colorScheme: K,
792
+ const k = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, R = r.fontFamily ?? t.fontFamily, De = r.scribbleStyle ?? t.scribbleStyle;
793
+ i = ft(k, De), bt(a, i, {
794
+ accentColor: k,
795
+ colorScheme: z,
796
796
  fontFamily: R,
797
797
  scribbleStyle: De
798
- }), Y("web-sdk.widget", "Updated widget appearance", {
798
+ }), X("web-sdk.widget", "Updated widget appearance", {
799
799
  source: c,
800
800
  inputAppearance: r,
801
- appliedAccentColor: A,
802
- appliedColorScheme: K,
801
+ appliedAccentColor: k,
802
+ appliedColorScheme: z,
803
803
  appliedFontFamily: R,
804
804
  appliedScribbleStyle: De,
805
805
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
@@ -838,7 +838,7 @@ function bt(e, t, n) {
838
838
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", lo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? jn : n.fontFamily, n.scribbleStyle && co(e.ownerDocument);
839
839
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
840
840
  for (const i of a)
841
- i.replaceWith(ae(Array.from(i.classList).join(" "), t));
841
+ i.replaceWith(ie(Array.from(i.classList).join(" "), t));
842
842
  }
843
843
  function co(e) {
844
844
  if (e.getElementById(gt))
@@ -865,7 +865,7 @@ function uo({
865
865
  l = null, s = null, u = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
866
866
  }, x = (h) => {
867
867
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, u = o(), d = !1, t.setPointerCapture?.(h.pointerId));
868
- }, L = (h) => {
868
+ }, P = (h) => {
869
869
  if (l !== h.pointerId || !s || !u)
870
870
  return;
871
871
  h.preventDefault();
@@ -887,27 +887,27 @@ function uo({
887
887
  let N = null;
888
888
  h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
889
889
  };
890
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", L), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
891
- t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", L), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
890
+ return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", P), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", M), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
891
+ t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", M), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
892
892
  };
893
893
  }
894
- function We(e, t = !0) {
895
- const n = de(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
894
+ function Ge(e, t = !0) {
895
+ const n = Y(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
896
896
  return {
897
897
  width: t && a && o.width > 0 ? o.width : Math.min(Ft, n.width - 36),
898
898
  height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vn : Ut
899
899
  };
900
900
  }
901
- function $t() {
902
- const e = de();
901
+ function Wt() {
902
+ const e = Y();
903
903
  return {
904
904
  width: Math.min(
905
- se(e.width * Yn, qn, Kn),
905
+ de(e.width * Kn, qn, Yn),
906
906
  e.width - B * 2
907
907
  ),
908
908
  height: Math.min(
909
- se(e.height * Jn, Xn, Zn),
910
- e.height - $e - B
909
+ de(e.height * Jn, Xn, Zn),
910
+ e.height - We - B
911
911
  )
912
912
  };
913
913
  }
@@ -918,37 +918,56 @@ function go(e, t, n) {
918
918
  const i = e.getBoundingClientRect();
919
919
  if (i.width > 0 || i.height > 0)
920
920
  return { x: i.left, y: i.top };
921
- const l = de();
921
+ const l = Y();
922
922
  return {
923
923
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
924
924
  y: l.height - 24 - n.height
925
925
  };
926
926
  }
927
927
  function wt(e, t, n) {
928
- const o = de(), a = B + ho(e);
928
+ const o = Y(), a = B + bo(e);
929
+ return {
930
+ x: de(t.x, B, Math.max(B, o.width - n.width - B)),
931
+ y: de(t.y, a, Math.max(a, o.height - n.height - B))
932
+ };
933
+ }
934
+ function ho(e, t) {
935
+ const n = Y();
929
936
  return {
930
- x: se(t.x, B, Math.max(B, o.width - n.width - B)),
931
- y: se(t.y, a, Math.max(a, o.height - n.height - B))
937
+ x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
938
+ y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
932
939
  };
933
940
  }
934
- function ho(e) {
941
+ function mo(e, t) {
942
+ const n = fo(e, t), o = Y();
943
+ return {
944
+ anchor: n,
945
+ x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
946
+ y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
947
+ };
948
+ }
949
+ function fo(e, t) {
950
+ const n = Y(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
951
+ return `${i}-${l}`;
952
+ }
953
+ function bo(e) {
935
954
  return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
936
955
  }
937
956
  function _t(e, t, n) {
938
- const o = We(e), a = $t(), i = {
957
+ const o = Ge(e), a = Wt(), i = {
939
958
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
940
959
  y: t.y + o.height - a.height
941
960
  };
942
- return mo(i);
961
+ return wo(i);
943
962
  }
944
- function mo(e) {
945
- const t = de(), n = $t();
963
+ function wo(e) {
964
+ const t = Y(), n = Wt();
946
965
  return {
947
- x: se(e.x, B, Math.max(B, t.width - n.width - B)),
948
- y: se(
966
+ x: de(e.x, B, Math.max(B, t.width - n.width - B)),
967
+ y: de(
949
968
  e.y,
950
- $e,
951
- Math.max($e, t.height - n.height - B)
969
+ We,
970
+ Math.max(We, t.height - n.height - B)
952
971
  )
953
972
  };
954
973
  }
@@ -959,13 +978,13 @@ function xe(e, t) {
959
978
  }
960
979
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
961
980
  }
962
- function fo(e, t) {
981
+ function _o(e, t) {
963
982
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
964
983
  }
965
- function bo(e) {
984
+ function xo(e) {
966
985
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
967
986
  }
968
- function de() {
987
+ function Y() {
969
988
  return {
970
989
  width: window.innerWidth || document.documentElement.clientWidth || Ft + B * 2,
971
990
  height: window.innerHeight || document.documentElement.clientHeight || Ut + B * 2
@@ -980,10 +999,10 @@ function Me(e) {
980
999
  height: Math.round(t.height)
981
1000
  };
982
1001
  }
983
- function se(e, t, n) {
1002
+ function de(e, t, n) {
984
1003
  return Math.min(Math.max(e, t), n);
985
1004
  }
986
- function Y(e, t, n) {
1005
+ function X(e, t, n) {
987
1006
  if (typeof window > "u")
988
1007
  return;
989
1008
  const o = window, a = {
@@ -992,10 +1011,10 @@ function Y(e, t, n) {
992
1011
  message: t,
993
1012
  details: n
994
1013
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
995
- 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(Gn, { detail: a }));
1014
+ 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($n, { detail: a }));
996
1015
  }
997
- function wo(e, t) {
998
- Y("web-sdk.widget.position", e, t);
1016
+ function vo(e, t) {
1017
+ X("web-sdk.widget.position", e, t);
999
1018
  }
1000
1019
  function Oe(e, t, n) {
1001
1020
  const o = t.value.trim();
@@ -1011,7 +1030,7 @@ function me(e, t = () => !0) {
1011
1030
  t() && (e.scrollTop = e.scrollHeight);
1012
1031
  });
1013
1032
  }
1014
- function _o(e) {
1033
+ function yo(e) {
1015
1034
  const t = e.messages[e.messages.length - 1];
1016
1035
  return [
1017
1036
  e.messages.length,
@@ -1022,37 +1041,37 @@ function _o(e) {
1022
1041
  e.lastError ?? ""
1023
1042
  ].join(":");
1024
1043
  }
1025
- function xo(e) {
1044
+ function Co(e) {
1026
1045
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1027
1046
  }
1028
- function vo(e, t, n, o) {
1029
- e.appendChild(Lo()), e.appendChild(yo(t, n, o)), e.appendChild(Ht("pluno-pa-widget__close", "Close", Po(16), !0)), e.appendChild(Co(n));
1047
+ function Eo(e, t, n, o) {
1048
+ e.appendChild(To()), e.appendChild(So(t, n, o)), e.appendChild(Ht("pluno-pa-widget__close", "Close", No(16), !0)), e.appendChild(ko(n));
1030
1049
  }
1031
- function yo(e, t, n) {
1050
+ function So(e, t, n) {
1032
1051
  const o = document.createElement("form");
1033
1052
  if (o.className = "pluno-pa-widget__launcher", n) {
1034
1053
  const i = document.createElement("button");
1035
1054
  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);
1036
1055
  }
1037
- o.appendChild(jt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ae("pluno-pa-widget__character--launcher", t));
1056
+ o.appendChild(jt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ie("pluno-pa-widget__character--launcher", t));
1038
1057
  const a = document.createElement("input");
1039
1058
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1040
1059
  }
1041
- function Co(e) {
1060
+ function ko(e) {
1042
1061
  const t = document.createElement("section");
1043
1062
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(jt("pluno-pa-widget__scribble-spirals--panel", 16));
1044
1063
  const n = document.createElement("div");
1045
1064
  n.className = "pluno-pa-widget__timeline-wrap";
1046
1065
  const o = document.createElement("main");
1047
- o.className = "pluno-pa-widget__timeline", o.appendChild(So(e));
1066
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Po(e));
1048
1067
  const a = document.createElement("div");
1049
1068
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1050
1069
  const i = document.createElement("div");
1051
1070
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1052
1071
  const l = document.createElement("button");
1053
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ht("pluno-pa-widget__new-chat", "New chat", Ao(), !0)), t.appendChild(n), t.appendChild(Eo()), t;
1072
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ht("pluno-pa-widget__new-chat", "New chat", Io(), !0)), t.appendChild(n), t.appendChild(Lo()), t;
1054
1073
  }
1055
- function Eo() {
1074
+ function Lo() {
1056
1075
  const e = document.createElement("form");
1057
1076
  e.className = "pluno-pa-widget__composer";
1058
1077
  const t = document.createElement("div");
@@ -1064,9 +1083,9 @@ function Eo() {
1064
1083
  const a = document.createElement("div");
1065
1084
  a.className = "pluno-pa-widget__composer-inner";
1066
1085
  const i = document.createElement("input");
1067
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Wn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1086
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Gn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1068
1087
  const l = document.createElement("button");
1069
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(To()), l.appendChild(No()), a.appendChild(l);
1088
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Do()), l.appendChild(Ro()), a.appendChild(l);
1070
1089
  const s = document.createElement("textarea");
1071
1090
  s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
1072
1091
  const u = document.createElement("button");
@@ -1078,20 +1097,20 @@ function Eo() {
1078
1097
  const w = document.createElement("span");
1079
1098
  return w.className = "pluno-pa-widget__ai-disclaimer", w.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(w), e.appendChild(d), e;
1080
1099
  }
1081
- function So(e) {
1100
+ function Po(e) {
1082
1101
  const t = document.createElement("div");
1083
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(ae("pluno-pa-widget__character--empty", e)), t.appendChild(Wt()), t;
1102
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(ie("pluno-pa-widget__character--empty", e)), t.appendChild(Gt()), t;
1084
1103
  }
1085
- function Wt() {
1104
+ function Gt() {
1086
1105
  const e = document.createElement("div");
1087
1106
  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;
1088
1107
  }
1089
- function ko(e, t) {
1108
+ function Ao(e, t) {
1090
1109
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1091
1110
  const n = document.createElement("span");
1092
1111
  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`));
1093
1112
  }
1094
- function ae(e, t) {
1113
+ function ie(e, t) {
1095
1114
  const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0), a = e.split(/\s+/).filter(Boolean);
1096
1115
  return o.setAttribute(
1097
1116
  "class",
@@ -1102,7 +1121,7 @@ function Ht(e, t, n, o) {
1102
1121
  const a = document.createElement("button");
1103
1122
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1104
1123
  }
1105
- function Lo() {
1124
+ function To() {
1106
1125
  const e = E("svg", {
1107
1126
  class: "pluno-pa-widget__scribble-defs",
1108
1127
  "aria-hidden": "true",
@@ -1182,28 +1201,28 @@ function Be(e, t, n) {
1182
1201
  })
1183
1202
  ), o;
1184
1203
  }
1185
- function Po(e) {
1186
- const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
1204
+ function No(e) {
1205
+ const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1187
1206
  return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
1188
1207
  }
1189
- function Ao() {
1190
- const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1208
+ function Io() {
1209
+ const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1191
1210
  return e.appendChild(E("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(E("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1192
1211
  }
1193
1212
  function Vt() {
1194
- const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1213
+ const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1195
1214
  return e.appendChild(E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
1196
1215
  }
1197
- function To() {
1198
- const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1216
+ function Do() {
1217
+ const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1199
1218
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1200
1219
  E("path", {
1201
1220
  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"
1202
1221
  })
1203
1222
  ), e;
1204
1223
  }
1205
- function No() {
1206
- const e = X("0 0 24 24", 19, 19, "none", "currentColor");
1224
+ function Ro() {
1225
+ const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1207
1226
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1208
1227
  E("path", {
1209
1228
  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",
@@ -1214,19 +1233,19 @@ function No() {
1214
1233
  })
1215
1234
  ), e;
1216
1235
  }
1217
- function Io() {
1218
- const e = X("0 0 24 24", 18, 18, "currentColor");
1236
+ function Mo() {
1237
+ const e = Z("0 0 24 24", 18, 18, "currentColor");
1219
1238
  return e.appendChild(E("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1220
1239
  }
1221
- function Do() {
1222
- const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1240
+ function Oo() {
1241
+ const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1223
1242
  return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
1224
1243
  }
1225
- function Ro() {
1226
- const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1244
+ function Bo() {
1245
+ const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1227
1246
  return e.appendChild(E("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(E("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1228
1247
  }
1229
- function X(e, t, n, o, a, i) {
1248
+ function Z(e, t, n, o, a, i) {
1230
1249
  const l = {
1231
1250
  viewBox: e,
1232
1251
  width: String(t),
@@ -1248,18 +1267,18 @@ function xt(e) {
1248
1267
  n.stopPropagation();
1249
1268
  });
1250
1269
  }
1251
- function Mo(e, t, n) {
1270
+ function Fo(e, t, n) {
1252
1271
  e.replaceChildren(), e.hidden = t.length === 0;
1253
1272
  for (const [o, a] of t.entries()) {
1254
1273
  const i = document.createElement("div");
1255
- i.className = "pluno-pa-widget__attachment", i.appendChild(Oo(a));
1274
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Uo(a));
1256
1275
  const l = document.createElement("span");
1257
1276
  l.textContent = a.name, i.appendChild(l);
1258
1277
  const s = document.createElement("button");
1259
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Do()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1278
+ s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Oo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1260
1279
  }
1261
1280
  }
1262
- function Oo(e) {
1281
+ function Uo(e) {
1263
1282
  if (qt(e)) {
1264
1283
  const n = document.createElement("img");
1265
1284
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
@@ -1267,7 +1286,7 @@ function Oo(e) {
1267
1286
  const t = document.createElement("span");
1268
1287
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1269
1288
  }
1270
- function Bo(e) {
1289
+ function zo(e) {
1271
1290
  if (qt(e)) {
1272
1291
  const a = document.createElement("img");
1273
1292
  return a.src = e.dataUrl, a.alt = e.name, a;
@@ -1282,10 +1301,10 @@ function Bo(e) {
1282
1301
  function qt(e) {
1283
1302
  return e.mimeType.startsWith("image/");
1284
1303
  }
1285
- function Fo(e) {
1304
+ function $o(e) {
1286
1305
  return e === "application/pdf" ? "document.pdf" : "image";
1287
1306
  }
1288
- async function Uo(e) {
1307
+ async function Wo(e) {
1289
1308
  if (!e)
1290
1309
  return [];
1291
1310
  const t = Array.from(e);
@@ -1293,37 +1312,37 @@ async function Uo(e) {
1293
1312
  throw new Error(`Attach up to ${Ee} files per message.`);
1294
1313
  return Promise.all(
1295
1314
  t.map(async (n) => {
1296
- const o = zo(n);
1315
+ const o = Go(n);
1297
1316
  if (!o)
1298
1317
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1299
- if (n.size > $n)
1318
+ if (n.size > Wn)
1300
1319
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1301
1320
  if (o === "image/gif") {
1302
- const a = new Uint8Array(await Yo(n));
1303
- if ($o(a))
1321
+ const a = new Uint8Array(await Jo(n));
1322
+ if (jo(a))
1304
1323
  throw new Error("Pluno supports non-animated GIF images.");
1305
1324
  }
1306
1325
  return {
1307
- name: n.name || Fo(o),
1326
+ name: n.name || $o(o),
1308
1327
  mimeType: o,
1309
1328
  sizeBytes: n.size,
1310
- dataUrl: Go(await Xo(n), o)
1329
+ dataUrl: Ho(await Qo(n), o)
1311
1330
  };
1312
1331
  })
1313
1332
  );
1314
1333
  }
1315
- function zo(e) {
1334
+ function Go(e) {
1316
1335
  if (Bt.has(e.type))
1317
1336
  return e.type;
1318
1337
  const t = e.name.toLowerCase();
1319
1338
  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;
1320
1339
  }
1321
- function Go(e, t) {
1340
+ function Ho(e, t) {
1322
1341
  const n = `data:${t};base64,`;
1323
1342
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1324
1343
  }
1325
- function $o(e) {
1326
- if (e.length < 14 || !Wo(e))
1344
+ function jo(e) {
1345
+ if (e.length < 14 || !Vo(e))
1327
1346
  return !1;
1328
1347
  const t = e[10];
1329
1348
  let n = 13;
@@ -1350,7 +1369,7 @@ function $o(e) {
1350
1369
  }
1351
1370
  return !1;
1352
1371
  }
1353
- function Wo(e) {
1372
+ function Vo(e) {
1354
1373
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1355
1374
  }
1356
1375
  function vt(e, t) {
@@ -1370,51 +1389,51 @@ function Fe(e, t, n = null) {
1370
1389
  e && (e.hidden = !0, e.replaceChildren());
1371
1390
  return;
1372
1391
  }
1373
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", G(t) || qe(n) ? e.appendChild(Ho(t, n)) : Kt(t) && e.appendChild(jo(t));
1392
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) || qe(n) ? e.appendChild(qo(t, n)) : Yt(t) && e.appendChild(Yo(t));
1374
1393
  }
1375
- function Ho(e, t) {
1394
+ function qo(e, t) {
1376
1395
  const n = document.createElement("div");
1377
1396
  n.className = "pluno-pa-widget__billing-action-card";
1378
1397
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1379
1398
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1380
1399
  const i = document.createElement("span");
1381
- 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(Yt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1400
+ 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(Kt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1382
1401
  }
1383
- function jo(e) {
1402
+ function Yo(e) {
1384
1403
  const t = document.createElement("div");
1385
1404
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1386
1405
  const n = document.createElement("strong");
1387
1406
  n.textContent = "Credits running low", t.appendChild(n);
1388
1407
  const o = document.createElement("span");
1389
- return o.textContent = qo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Yt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1408
+ return o.textContent = Xo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Kt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1390
1409
  }
1391
1410
  function He(e, t) {
1392
- return e !== null && (G(e) || Kt(e) || qe(t));
1411
+ return e !== null && (W(e) || Yt(e) || qe(t));
1393
1412
  }
1394
1413
  function yt(e, t, n) {
1395
- return He(t, n) || Vo(t) ? !0 : !He(e, n);
1414
+ return He(t, n) || Ko(t) ? !0 : !He(e, n);
1396
1415
  }
1397
- function Vo(e) {
1398
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || G(e));
1416
+ function Ko(e) {
1417
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || W(e));
1399
1418
  }
1400
- function G(e) {
1419
+ function W(e) {
1401
1420
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1402
1421
  }
1403
1422
  function qe(e) {
1404
1423
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1405
1424
  }
1406
- function Kt(e) {
1407
- return !G(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1425
+ function Yt(e) {
1426
+ return !W(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1408
1427
  }
1409
- function qo(e) {
1410
- return e.creditsRemaining === null ? null : `${Ko(e.creditsRemaining)} credits left`;
1428
+ function Xo(e) {
1429
+ return e.creditsRemaining === null ? null : `${Zo(e.creditsRemaining)} credits left`;
1411
1430
  }
1412
- function Ko(e) {
1431
+ function Zo(e) {
1413
1432
  return new Intl.NumberFormat("en-US", {
1414
1433
  maximumFractionDigits: 0
1415
1434
  }).format(Math.ceil(e));
1416
1435
  }
1417
- function Yt(e, t, n) {
1436
+ function Kt(e, t, n) {
1418
1437
  const o = document.createElement("div");
1419
1438
  return o.className = n, o.appendChild(Ct(t, e.pricingUrl)), o.appendChild(Ct("Earn credits", e.earnCreditsUrl)), o;
1420
1439
  }
@@ -1429,7 +1448,7 @@ function Ct(e, t) {
1429
1448
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1430
1449
  }), n;
1431
1450
  }
1432
- function Yo(e) {
1451
+ function Jo(e) {
1433
1452
  return new Promise((t, n) => {
1434
1453
  const o = new FileReader();
1435
1454
  o.addEventListener("load", () => {
@@ -1443,7 +1462,7 @@ function Yo(e) {
1443
1462
  }), o.readAsArrayBuffer(e);
1444
1463
  });
1445
1464
  }
1446
- function Xo(e) {
1465
+ function Qo(e) {
1447
1466
  return new Promise((t, n) => {
1448
1467
  const o = new FileReader();
1449
1468
  o.addEventListener("load", () => {
@@ -1460,38 +1479,38 @@ function Xo(e) {
1460
1479
  function Et(e, t) {
1461
1480
  return e.messages.filter((o) => !Xt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1462
1481
  }
1463
- function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1482
+ function ea(e, t, n, o, a, i, l, s, u, d, p, w, x, P, C) {
1464
1483
  const M = [...i.messages], v = M.filter((f) => !Xt(f)), y = e.scrollTop;
1465
- e.replaceChildren(), Jt(n, i.isThinking), a.hidden = !s, s && l !== null && ko(a, l);
1484
+ e.replaceChildren(), Jt(n, i.isThinking), a.hidden = !s, s && l !== null && Ao(a, l);
1466
1485
  const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1467
1486
  if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1468
1487
  const f = document.createElement("div");
1469
1488
  f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1470
1489
  const m = document.createElement("div");
1471
1490
  m.className = "pluno-pa-widget__empty-hero";
1472
- const T = ae("pluno-pa-widget__character--empty", x());
1473
- m.appendChild(T), f.appendChild(m), f.appendChild(Wt());
1474
- const k = document.createElement("div");
1475
- if (k.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 && k.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1491
+ const T = ie("pluno-pa-widget__character--empty", x());
1492
+ m.appendChild(T), f.appendChild(m), f.appendChild(Gt());
1493
+ const L = document.createElement("div");
1494
+ if (L.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 && L.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1476
1495
  for (const I of i.starterPrompts) {
1477
- const P = document.createElement("button");
1478
- P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
1479
- L(I);
1480
- }), k.appendChild(P);
1496
+ const A = document.createElement("button");
1497
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${I}"`, A.addEventListener("click", () => {
1498
+ P(I);
1499
+ }), L.appendChild(A);
1481
1500
  }
1482
1501
  else
1483
1502
  for (let I = 0; I < Hn; I += 1) {
1484
- const P = document.createElement("button");
1485
- P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = "&nbsp;", k.appendChild(P);
1503
+ const A = document.createElement("button");
1504
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.innerHTML = "&nbsp;", L.appendChild(A);
1486
1505
  }
1487
- f.appendChild(k), e.appendChild(f), e.appendChild(t);
1506
+ f.appendChild(L), e.appendChild(f), e.appendChild(t);
1488
1507
  return;
1489
1508
  }
1490
1509
  let g = null, _ = null, N = [];
1491
- const Z = () => {
1510
+ const J = () => {
1492
1511
  if (N.length === 0)
1493
1512
  return !1;
1494
- const f = ra(N, p, w, x());
1513
+ const f = sa(N, p, w, x());
1495
1514
  return e.appendChild(f), g = null, _ = f, N = [], !0;
1496
1515
  };
1497
1516
  for (let f = 0; f < v.length; f += 1) {
@@ -1502,21 +1521,21 @@ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1502
1521
  }
1503
1522
  if (m.role === "system")
1504
1523
  continue;
1505
- const T = Z(), k = kt(m.content);
1524
+ const T = J(), L = kt(m.content);
1506
1525
  if (m.role === "assistant" && !T) {
1507
1526
  const b = je(x());
1508
1527
  e.appendChild(b), g = null, _ = b;
1509
1528
  }
1510
1529
  const I = document.createElement("div");
1511
- I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? Lt(I, k) : I.textContent = k, m.role === "user" && m.attachments?.length && I.appendChild(Qo(m.attachments));
1512
- const P = document.createElement("div");
1513
- P.className = "pluno-pa-widget__message-actions", P.appendChild(St(k)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
1530
+ I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? Lt(I, L) : I.textContent = L, m.role === "user" && m.attachments?.length && I.appendChild(na(m.attachments));
1531
+ const A = document.createElement("div");
1532
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(St(L)), I.appendChild(A), e.appendChild(I), g = I, _ = null;
1514
1533
  }
1515
- const ce = Z();
1534
+ const ce = J();
1516
1535
  if (i.assistantDraft) {
1517
1536
  if (!ce) {
1518
- const k = je(x());
1519
- e.appendChild(k), g = null, _ = k;
1537
+ const L = je(x());
1538
+ e.appendChild(L), g = null, _ = L;
1520
1539
  }
1521
1540
  const f = kt(i.assistantDraft), m = document.createElement("div");
1522
1541
  m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Lt(m, f);
@@ -1528,7 +1547,7 @@ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1528
1547
  const f = Zt();
1529
1548
  e.appendChild(f), g = null, _ = f;
1530
1549
  } else {
1531
- const f = la(x());
1550
+ const f = da(x());
1532
1551
  e.appendChild(f), g = null, _ = f;
1533
1552
  }
1534
1553
  if (i.lastError) {
@@ -1537,7 +1556,7 @@ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1537
1556
  }
1538
1557
  const S = C && !i.isThinking ? _n(M) : null;
1539
1558
  if (C && S && !C.dismissedCandidateIds.has(S.id)) {
1540
- const f = ea(S, {
1559
+ const f = oa(S, {
1541
1560
  isDrafting: C.draftingCandidateId === S.id,
1542
1561
  error: C.error,
1543
1562
  onDraft: C.onDraft,
@@ -1548,31 +1567,31 @@ function Zo(e, t, n, o, a, i, l, s, u, d, p, w, x, L, C) {
1548
1567
  }
1549
1568
  g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), u ? me(e, d) : e.scrollTop = y;
1550
1569
  }
1551
- function Jo(e, t, n, o, a, i) {
1570
+ function ta(e, t, n, o, a, i) {
1552
1571
  e.replaceChildren(), Jt(t, !1), t.disabled = !0, n.hidden = !0;
1553
1572
  const l = document.createElement("div");
1554
1573
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1555
- const s = ae("pluno-pa-widget__character--empty", o());
1574
+ const s = ie("pluno-pa-widget__character--empty", o());
1556
1575
  l.appendChild(s);
1557
1576
  const u = document.createElement("div");
1558
1577
  u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1559
1578
  const d = document.createElement("button");
1560
1579
  d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1561
1580
  }
1562
- function Qo(e) {
1581
+ function na(e) {
1563
1582
  const t = document.createElement("div");
1564
1583
  t.className = "pluno-pa-widget__message-attachments";
1565
1584
  for (const n of e)
1566
- t.appendChild(Bo(n));
1585
+ t.appendChild(zo(n));
1567
1586
  return t;
1568
1587
  }
1569
1588
  function St(e) {
1570
1589
  const t = document.createElement("button");
1571
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ro()), t.addEventListener("click", (n) => {
1590
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Bo()), t.addEventListener("click", (n) => {
1572
1591
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1573
1592
  }), t;
1574
1593
  }
1575
- function ea(e, t) {
1594
+ function oa(e, t) {
1576
1595
  const n = document.createElement("article");
1577
1596
  n.className = "pluno-pa-widget__share-prompt";
1578
1597
  const o = document.createElement("div");
@@ -1608,7 +1627,7 @@ function ea(e, t) {
1608
1627
  }
1609
1628
  return o.appendChild(s), n.appendChild(o), n;
1610
1629
  }
1611
- function ta(e, t) {
1630
+ function aa(e, t) {
1612
1631
  const n = document.createElement("div");
1613
1632
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1614
1633
  v.target === n && t.onClose();
@@ -1627,7 +1646,7 @@ function ta(e, t) {
1627
1646
  d.className = "pluno-pa-widget__share-dialog-step-header";
1628
1647
  const p = document.createElement("strong");
1629
1648
  p.textContent = "1) Copy Screenshot", d.appendChild(p);
1630
- const w = na("Copy Screenshot", async () => {
1649
+ const w = ia("Copy Screenshot", async () => {
1631
1650
  try {
1632
1651
  return await xn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1633
1652
  } catch {
@@ -1643,15 +1662,15 @@ function ta(e, t) {
1643
1662
  o.appendChild(u), o.appendChild(s);
1644
1663
  const x = document.createElement("div");
1645
1664
  x.className = "pluno-pa-widget__share-dialog-step";
1646
- const L = document.createElement("strong");
1647
- L.className = "pluno-pa-widget__share-dialog-step-title", L.textContent = "2) Share on", x.appendChild(L);
1665
+ const P = document.createElement("strong");
1666
+ P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
1648
1667
  const C = document.createElement("p");
1649
1668
  C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
1650
1669
  const M = document.createElement("footer");
1651
1670
  M.className = "pluno-pa-widget__share-dialog-platforms";
1652
- for (const v of oa(e)) {
1671
+ for (const v of ra(e)) {
1653
1672
  const y = document.createElement("a");
1654
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(aa(v.id)), M.appendChild(y);
1673
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(la(v.id)), M.appendChild(y);
1655
1674
  }
1656
1675
  if (x.appendChild(M), o.appendChild(x), t.socialPostRewardsUrl) {
1657
1676
  const v = document.createElement("div");
@@ -1659,17 +1678,17 @@ function ta(e, t) {
1659
1678
  const y = document.createElement("strong");
1660
1679
  y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1661
1680
  const h = document.createElement("a");
1662
- 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(ia()), v.appendChild(h), o.appendChild(v);
1681
+ 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(pa()), v.appendChild(h), o.appendChild(v);
1663
1682
  }
1664
1683
  return n.appendChild(o), n;
1665
1684
  }
1666
- function na(e, t) {
1685
+ function ia(e, t) {
1667
1686
  const n = document.createElement("button");
1668
1687
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1669
1688
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1670
1689
  }), n;
1671
1690
  }
1672
- function oa(e) {
1691
+ function ra(e) {
1673
1692
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1674
1693
  return [
1675
1694
  {
@@ -1689,7 +1708,7 @@ function oa(e) {
1689
1708
  }
1690
1709
  ];
1691
1710
  }
1692
- function aa(e) {
1711
+ function la(e) {
1693
1712
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1694
1713
  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" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(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"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(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"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(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"), D(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"), D(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"), D(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);
1695
1714
  }
@@ -1697,7 +1716,7 @@ function D(e, t, n) {
1697
1716
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1698
1717
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1699
1718
  }
1700
- function ia() {
1719
+ function pa() {
1701
1720
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1702
1721
  return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1703
1722
  }
@@ -1707,10 +1726,10 @@ function Xt(e) {
1707
1726
  function kt(e) {
1708
1727
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1709
1728
  }
1710
- function ra(e, t, n, o) {
1729
+ function sa(e, t, n, o) {
1711
1730
  const a = document.createElement("article");
1712
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ae("pluno-pa-widget__character--tool-group", o));
1713
- const i = document.createElement("details"), l = pa(e);
1731
+ a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ie("pluno-pa-widget__character--tool-group", o));
1732
+ const i = document.createElement("details"), l = ca(e);
1714
1733
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1715
1734
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1716
1735
  });
@@ -1723,8 +1742,8 @@ function ra(e, t, n, o) {
1723
1742
  for (const w of e) {
1724
1743
  const x = document.createElement("div");
1725
1744
  x.className = "pluno-pa-widget__tool-line", w.loading && x.appendChild(Ve());
1726
- const L = document.createElement("span");
1727
- L.textContent = w.content || "Run tool", x.appendChild(L), p.appendChild(x);
1745
+ const P = document.createElement("span");
1746
+ P.textContent = w.content || "Run tool", x.appendChild(P), p.appendChild(x);
1728
1747
  }
1729
1748
  i.appendChild(p);
1730
1749
  }
@@ -1732,9 +1751,9 @@ function ra(e, t, n, o) {
1732
1751
  }
1733
1752
  function je(e) {
1734
1753
  const t = document.createElement("article");
1735
- return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ae("pluno-pa-widget__character--tool-group", e)), t;
1754
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ie("pluno-pa-widget__character--tool-group", e)), t;
1736
1755
  }
1737
- function la(e) {
1756
+ function da(e) {
1738
1757
  const t = je(e);
1739
1758
  return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Zt()), t;
1740
1759
  }
@@ -1746,7 +1765,7 @@ function Zt() {
1746
1765
  const n = document.createElement("span");
1747
1766
  return n.textContent = "Thinking...", e.appendChild(n), e;
1748
1767
  }
1749
- function pa(e) {
1768
+ function ca(e) {
1750
1769
  return `tools:${e[0]?.id ?? ""}`;
1751
1770
  }
1752
1771
  function Ve() {
@@ -1754,7 +1773,7 @@ function Ve() {
1754
1773
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1755
1774
  }
1756
1775
  function Jt(e, t) {
1757
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Io() : Vt());
1776
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Mo() : Vt());
1758
1777
  }
1759
1778
  function Lt(e, t) {
1760
1779
  const n = t.replace(/\r\n/g, `
@@ -1828,7 +1847,7 @@ function ye(e, t) {
1828
1847
  s.textContent = l.slice(1, -1), e.appendChild(s);
1829
1848
  } else {
1830
1849
  const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1831
- if (s && sa(s[2])) {
1850
+ if (s && ua(s[2])) {
1832
1851
  const u = document.createElement("a");
1833
1852
  u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], e.appendChild(u);
1834
1853
  } else
@@ -1838,7 +1857,7 @@ function ye(e, t) {
1838
1857
  }
1839
1858
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1840
1859
  }
1841
- function sa(e) {
1860
+ function ua(e) {
1842
1861
  if (e.startsWith("/") || e.startsWith("#"))
1843
1862
  return !0;
1844
1863
  try {
@@ -1849,7 +1868,7 @@ function sa(e) {
1849
1868
  }
1850
1869
  }
1851
1870
  function Pt(e, t) {
1852
- if (da(e))
1871
+ if (ga(e))
1853
1872
  return;
1854
1873
  const n = `
1855
1874
  :host {
@@ -1902,7 +1921,7 @@ function Pt(e, t) {
1902
1921
  --pluno-pa-accent-contrast: #fafafa;
1903
1922
  position: fixed;
1904
1923
  z-index: 2147483645;
1905
- font-family: ${j.fontFamily};
1924
+ font-family: ${V.fontFamily};
1906
1925
  font-size: 14px;
1907
1926
  color: var(--pluno-pa-text);
1908
1927
  width: var(--pluno-pa-launcher-width);
@@ -2646,7 +2665,7 @@ function Pt(e, t) {
2646
2665
  place-items: center;
2647
2666
  padding: 18px;
2648
2667
  background: rgba(24, 24, 27, 0.28);
2649
- font-family: var(--pluno-pa-font, ${j.fontFamily});
2668
+ font-family: var(--pluno-pa-font, ${V.fontFamily});
2650
2669
  color: var(--pluno-pa-text);
2651
2670
  }
2652
2671
  .pluno-pa-widget__share-dialog {
@@ -3660,18 +3679,18 @@ function Pt(e, t) {
3660
3679
  filter: url(#pluno-pa-scribble-wobble-2);
3661
3680
  }
3662
3681
  `;
3663
- if (ca(e, n))
3682
+ if (ha(e, n))
3664
3683
  return;
3665
3684
  const o = e.ownerDocument.createElement("style");
3666
3685
  o.id = zt, o.textContent = n, e.appendChild(o), Qt(e);
3667
3686
  }
3668
- function da(e) {
3669
- return e.getElementById(zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gt) === "true";
3687
+ function ga(e) {
3688
+ return e.getElementById(zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute($t) === "true";
3670
3689
  }
3671
3690
  function Qt(e) {
3672
- e.host instanceof HTMLElement && e.host.setAttribute(Gt, "true");
3691
+ e.host instanceof HTMLElement && e.host.setAttribute($t, "true");
3673
3692
  }
3674
- function ca(e, t) {
3693
+ function ha(e, t) {
3675
3694
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3676
3695
  return !1;
3677
3696
  try {
@@ -3681,7 +3700,7 @@ function ca(e, t) {
3681
3700
  return !1;
3682
3701
  }
3683
3702
  }
3684
- async function ua() {
3703
+ async function ma() {
3685
3704
  return document.body ? document.body : await new Promise((e) => {
3686
3705
  const t = new MutationObserver(() => {
3687
3706
  document.body && (t.disconnect(), e(document.body));
@@ -3692,7 +3711,7 @@ async function ua() {
3692
3711
  function en(e) {
3693
3712
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3694
3713
  }
3695
- function ga(e) {
3714
+ function fa(e) {
3696
3715
  try {
3697
3716
  const t = window.localStorage.getItem(en(e));
3698
3717
  if (!t)
@@ -3702,7 +3721,7 @@ function ga(e) {
3702
3721
  isOpen: n.isOpen === !0,
3703
3722
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3704
3723
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3705
- launcherPosition: ba(n.launcherPosition) ? n.launcherPosition : null,
3724
+ launcherPosition: xa(n.launcherPosition) ? n.launcherPosition : null,
3706
3725
  seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
3707
3726
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3708
3727
  };
@@ -3710,7 +3729,7 @@ function ga(e) {
3710
3729
  return At();
3711
3730
  }
3712
3731
  }
3713
- async function ha(e) {
3732
+ async function ba(e) {
3714
3733
  if (e.loadSharePromptsDisabled)
3715
3734
  return e.loadSharePromptsDisabled();
3716
3735
  try {
@@ -3719,7 +3738,7 @@ async function ha(e) {
3719
3738
  return !1;
3720
3739
  }
3721
3740
  }
3722
- function ma(e, t) {
3741
+ function wa(e, t) {
3723
3742
  if (e.persistSharePromptsDisabled) {
3724
3743
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3725
3744
  });
@@ -3741,43 +3760,43 @@ function At() {
3741
3760
  sharePromptsDisabled: !1
3742
3761
  };
3743
3762
  }
3744
- function fa(e, t) {
3763
+ function _a(e, t) {
3745
3764
  try {
3746
3765
  window.localStorage.setItem(en(e), JSON.stringify(t));
3747
3766
  } catch {
3748
3767
  return;
3749
3768
  }
3750
3769
  }
3751
- function ba(e) {
3770
+ function xa(e) {
3752
3771
  if (!e || typeof e != "object")
3753
3772
  return !1;
3754
3773
  const t = e;
3755
- return Number.isFinite(t.x) && Number.isFinite(t.y);
3774
+ 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");
3756
3775
  }
3757
3776
  const Tt = /* @__PURE__ */ new WeakSet();
3758
- function wa(e) {
3777
+ function va(e) {
3759
3778
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3760
3779
  }
3761
3780
  function Nt(e) {
3762
3781
  const t = e.pathname.split("/");
3763
3782
  return t[t.length - 1] ?? "";
3764
3783
  }
3765
- function _a(e, t) {
3784
+ function ya(e, t) {
3766
3785
  const n = new URL(e.src, document.baseURI);
3767
3786
  return n.href === t.href || n.pathname === t.pathname ? !0 : Nt(n) === Nt(t);
3768
3787
  }
3769
- class V extends EventTarget {
3788
+ class q extends EventTarget {
3770
3789
  constructor(t, n) {
3771
3790
  super(), this.channelId = n, this.url = t, this.addPreviewListener(Bn, () => {
3772
- this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
3791
+ this.readyState = q.OPEN, this.dispatchEvent(new Event("open"));
3773
3792
  }), this.addPreviewListener(Fn, (o) => {
3774
3793
  const a = o;
3775
3794
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3776
3795
  }), this.addPreviewListener(Un, () => {
3777
- this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3796
+ this.readyState = q.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3778
3797
  }), this.addPreviewListener(zn, (o) => {
3779
3798
  const a = o;
3780
- this.readyState = V.CLOSED, this.dispatchEvent(
3799
+ this.readyState = q.CLOSED, this.dispatchEvent(
3781
3800
  new CloseEvent("close", {
3782
3801
  code: a.detail?.code ?? 1e3,
3783
3802
  reason: a.detail?.reason ?? "",
@@ -3800,11 +3819,11 @@ class V extends EventTarget {
3800
3819
  extensions = "";
3801
3820
  binaryType = "blob";
3802
3821
  bufferedAmount = 0;
3803
- readyState = V.CONNECTING;
3804
- socketId = xa();
3822
+ readyState = q.CONNECTING;
3823
+ socketId = Ca();
3805
3824
  listeners = /* @__PURE__ */ new Map();
3806
3825
  send(t) {
3807
- if (this.readyState !== V.OPEN)
3826
+ if (this.readyState !== q.OPEN)
3808
3827
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3809
3828
  window.dispatchEvent(
3810
3829
  new CustomEvent(Ce(Mn, this.channelId), {
@@ -3813,7 +3832,7 @@ class V extends EventTarget {
3813
3832
  );
3814
3833
  }
3815
3834
  close(t, n) {
3816
- this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
3835
+ this.readyState !== q.CLOSED && (this.readyState = q.CLOSING, window.dispatchEvent(
3817
3836
  new CustomEvent(Ce(On, this.channelId), {
3818
3837
  detail: { socketId: this.socketId, code: t, reason: n }
3819
3838
  })
@@ -3831,7 +3850,7 @@ class V extends EventTarget {
3831
3850
  this.listeners.clear();
3832
3851
  }
3833
3852
  }
3834
- function xa() {
3853
+ function Ca() {
3835
3854
  const e = window.sessionStorage.getItem(ut);
3836
3855
  if (e)
3837
3856
  return e;
@@ -3841,17 +3860,17 @@ function xa() {
3841
3860
  function Ce(e, t) {
3842
3861
  return `${e}:${t}`;
3843
3862
  }
3844
- function va(e) {
3863
+ function Ea(e) {
3845
3864
  const t = document.currentScript;
3846
3865
  if (t instanceof HTMLScriptElement)
3847
3866
  return [t];
3848
3867
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3849
3868
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3850
- (a) => a instanceof HTMLScriptElement && wa(a) && _a(a, o)
3869
+ (a) => a instanceof HTMLScriptElement && va(a) && ya(a, o)
3851
3870
  );
3852
3871
  }
3853
- function ya(e) {
3854
- for (const t of va(e)) {
3872
+ function Sa(e) {
3873
+ for (const t of Ea(e)) {
3855
3874
  if (Tt.has(t) || t.dataset.plunoAutoMount === "false")
3856
3875
  continue;
3857
3876
  Tt.add(t);
@@ -3872,7 +3891,7 @@ function ya(e) {
3872
3891
  });
3873
3892
  }
3874
3893
  }
3875
- ya(import.meta.url);
3894
+ Sa(import.meta.url);
3876
3895
  export {
3877
3896
  io as createProductAgentPreviewBridgeWebSocketFactory,
3878
3897
  ro as mountPlunoProductAgentWidget