@pluno/product-agent-web 0.1.67 → 0.1.69

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,26 +1,26 @@
1
- import { PlunoProductAgent as qo, getProductAgentOriginAccessErrorMessage as jo } from "./product-agent-sdk.js";
2
- const Vo = "#7c3aed", pt = "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", st = "#2c2a1e", fn = [253, 250, 241], wn = 3.5;
3
- function Kn(e) {
4
- const t = Yn(e);
5
- if (bn(Ke(t), fn) >= wn)
1
+ import { PlunoProductAgent as Jo, getProductAgentOriginAccessErrorMessage as Qo } from "./product-agent-sdk.js";
2
+ const ei = "#7c3aed", st = "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", dt = "#2c2a1e", yn = [253, 250, 241], vn = 3.5;
3
+ function eo(e) {
4
+ const t = to(e);
5
+ if (Cn(Ye(t), yn) >= vn)
6
6
  return t;
7
- let o = Ke(t);
8
- const i = Ke(st);
9
- for (let r = 0; r < 6; r += 1)
10
- if (o = Xo(o, i, 0.22), bn(o, fn) >= wn)
11
- return Ft(o);
12
- return Ft(o);
13
- }
14
- function Ko() {
7
+ let o = Ye(t);
8
+ const i = Ye(dt);
9
+ for (let a = 0; a < 6; a += 1)
10
+ if (o = oi(o, i, 0.22), Cn(o, yn) >= vn)
11
+ return Gt(o);
12
+ return Gt(o);
13
+ }
14
+ function ti() {
15
15
  let n = "M 280 120", o = !1, i = 0;
16
- for (let r = 150; r <= 1170; r += 62) {
16
+ for (let a = 150; a <= 1170; a += 62) {
17
17
  const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
- n += ` L ${p} ${r}`, o = !o, i += 1;
18
+ n += ` L ${p} ${a}`, o = !o, i += 1;
19
19
  }
20
20
  return n;
21
21
  }
22
- function Yo(e) {
23
- const t = Yn(e), n = Ht(Ke(t));
22
+ function ni(e) {
23
+ const t = to(e), n = $t(Ye(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,34 +56,34 @@ function Yo(e) {
56
56
  shadow: ne(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Yn(e) {
59
+ function to(e) {
60
60
  const t = e.trim();
61
- return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Vo;
61
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ei;
62
62
  }
63
- function Ke(e) {
63
+ function Ye(e) {
64
64
  return [
65
65
  Number.parseInt(e.slice(1, 3), 16),
66
66
  Number.parseInt(e.slice(3, 5), 16),
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function Ft([e, t, n]) {
70
+ function Gt([e, t, n]) {
71
71
  const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
72
  return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function Ht([e, t, n]) {
74
+ function $t([e, t, n]) {
75
75
  const o = (i) => {
76
- const r = i / 255;
77
- return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
76
+ const a = i / 255;
77
+ return a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
80
80
  }
81
- function bn(e, t) {
82
- const n = Ht(e), o = Ht(t), [i, r] = n > o ? [n, o] : [o, n];
83
- return (i + 0.05) / (r + 0.05);
81
+ function Cn(e, t) {
82
+ const n = $t(e), o = $t(t), [i, a] = n > o ? [n, o] : [o, n];
83
+ return (i + 0.05) / (a + 0.05);
84
84
  }
85
- function Xo(e, t, n) {
86
- const o = Wt(n);
85
+ function oi(e, t, n) {
86
+ const o = qt(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
89
89
  e[1] + (t[1] - e[1]) * o,
@@ -91,43 +91,43 @@ function Xo(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function ne(e, t, n) {
94
- const [o, i, r] = Zo(Ke(e));
95
- return Ft(Jo(o, Wt(i + n), Wt(r + t)));
94
+ const [o, i, a] = ii(Ye(e));
95
+ return Gt(ai(o, qt(i + n), qt(a + t)));
96
96
  }
97
- function Zo([e, t, n]) {
98
- const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), d = (l + p) / 2;
97
+ function ii([e, t, n]) {
98
+ const o = e / 255, i = t / 255, a = n / 255, l = Math.max(o, i, a), p = Math.min(o, i, a), d = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, d];
101
101
  const c = l - p, u = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
- return [(l === o ? (i - r) / c + (i < r ? 6 : 0) : l === i ? (r - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
102
+ return [(l === o ? (i - a) / c + (i < a ? 6 : 0) : l === i ? (a - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
103
103
  }
104
- function Jo(e, t, n) {
104
+ function ai(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
107
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
108
108
  return [
109
- At(i, o, e + 1 / 3) * 255,
110
- At(i, o, e) * 255,
111
- At(i, o, e - 1 / 3) * 255
109
+ Nt(i, o, e + 1 / 3) * 255,
110
+ Nt(i, o, e) * 255,
111
+ Nt(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function At(e, t, n) {
114
+ function Nt(e, t, n) {
115
115
  let o = n;
116
116
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
117
117
  }
118
- function Wt(e) {
118
+ function qt(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const Xn = "suggest_share_on_socials";
122
- function Qo(e) {
121
+ const no = "suggest_share_on_socials";
122
+ function ri(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
124
  const n = e[t];
125
- if (n.role !== "tool" || n.toolName !== Xn)
125
+ if (n.role !== "tool" || n.toolName !== no)
126
126
  continue;
127
- const o = _n(e, t, "assistant");
127
+ const o = Sn(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const i = _n(e, o.index, "user");
130
+ const i = Sn(e, o.index, "user");
131
131
  return i ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: i.content,
@@ -136,13 +136,13 @@ function Qo(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function ei(e) {
140
- const t = await ti(e);
139
+ async function li(e) {
140
+ const t = await pi(e);
141
141
  if (!navigator.clipboard || typeof ClipboardItem > "u")
142
142
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
143
143
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
144
144
  }
145
- function _n(e, t, n) {
145
+ function Sn(e, t, n) {
146
146
  for (let o = t - 1; o >= 0; o -= 1) {
147
147
  const i = e[o];
148
148
  if (i.role === n && i.content.trim())
@@ -150,81 +150,81 @@ function _n(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function ti(e) {
153
+ async function pi(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const ni = "https://app.pluno.ai", oi = "/api/product-agent/embed/active-users", ii = 1800, ai = 15e3, ri = 250, li = 1e3, pi = 3e4;
157
- function si(e, t = {}) {
158
- let n = !1, o = null, i = null, r = null;
156
+ const si = "https://app.pluno.ai", di = "/api/product-agent/embed/active-users", ci = 1800, ui = 15e3, gi = 250, hi = 1e3, mi = 3e4;
157
+ function fi(e, t = {}) {
158
+ let n = !1, o = null, i = null, a = null;
159
159
  const l = () => {
160
- r !== null && (window.clearInterval(r), r = null);
160
+ a !== null && (window.clearInterval(a), a = null);
161
161
  }, p = (u) => {
162
162
  n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
163
  c();
164
- }, ui(u)));
164
+ }, _i(u)));
165
165
  }, d = (u) => {
166
166
  if (l(), o === null) {
167
167
  o = u, e(u);
168
168
  return;
169
169
  }
170
- const m = o, k = performance.now();
171
- r = window.setInterval(() => {
170
+ const m = o, E = performance.now();
171
+ a = window.setInterval(() => {
172
172
  if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const v = Math.min(1, (performance.now() - k) / ii);
177
- o = Math.round(m + (u - m) * gi(v)), e(o), v >= 1 && (o = u, e(u), l());
178
- }, ri);
176
+ const v = Math.min(1, (performance.now() - E) / ci);
177
+ o = Math.round(m + (u - m) * xi(v)), e(o), v >= 1 && (o = u, e(u), l());
178
+ }, gi);
179
179
  }, c = async () => {
180
180
  try {
181
- const u = await di(t);
181
+ const u = await wi(t);
182
182
  if (n)
183
183
  return;
184
184
  d(u.count), p(u.refreshAfterMs);
185
185
  } catch {
186
- p(ai);
186
+ p(ui);
187
187
  }
188
188
  };
189
189
  return c(), () => {
190
190
  n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function di(e) {
193
+ async function wi(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(oi, ci(e.backendUrl ?? ni)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(di, bi(e.backendUrl ?? si)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
200
  if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const o = await n.json(), i = xn(o.count), r = xn(o.refreshAfterMs ?? o.refresh_after_ms);
203
- if (i === null || r === null)
202
+ const o = await n.json(), i = En(o.count), a = En(o.refreshAfterMs ?? o.refresh_after_ms);
203
+ if (i === null || a === null)
204
204
  throw new Error("Invalid active users response");
205
- return { count: i, refreshAfterMs: r };
205
+ return { count: i, refreshAfterMs: a };
206
206
  }
207
- function xn(e) {
207
+ function En(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function ci(e) {
210
+ function bi(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function ui(e) {
214
- return Math.min(pi, Math.max(li, e));
213
+ function _i(e) {
214
+ return Math.min(mi, Math.max(hi, e));
215
215
  }
216
- function gi(e) {
216
+ function xi(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const Zn = 100, hi = 1e4, mi = 5e3, fi = "product-agent:sdk-preview-socket-connect", wi = "product-agent:sdk-preview-socket-send", bi = "product-agent:sdk-preview-socket-close", _i = "product-agent:sdk-preview-socket-open", xi = "product-agent:sdk-preview-socket-message", yi = "product-agent:sdk-preview-socket-error", vi = "product-agent:sdk-preview-socket-closed", yn = "product-agent:sdk-preview-socket-id", Ci = "data-pluno-sdk-preview-channel", Si = "product-agent:preview-diagnostic", Jn = "pluno.productAgent.sharePromptsDisabled", Ei = 3, vn = 'dialog[open], [aria-modal="true"], [role="dialog"]', ki = 400, Li = 5e3, Pi = 500, Cn = "Close the page's popup to chat", Ii = "No recent chats for this page yet.", oe = {
219
+ const oo = 100, yi = 1e4, vi = 5e3, Ci = "product-agent:sdk-preview-socket-connect", Si = "product-agent:sdk-preview-socket-send", Ei = "product-agent:sdk-preview-socket-close", ki = "product-agent:sdk-preview-socket-open", Li = "product-agent:sdk-preview-socket-message", Pi = "product-agent:sdk-preview-socket-error", Ii = "product-agent:sdk-preview-socket-closed", kn = "product-agent:sdk-preview-socket-id", Ti = "data-pluno-sdk-preview-channel", io = "data-pluno-auto-mounted", se = "__plunoProductAgentAutoMountOwner", Ai = 1e4, Ni = "Failed to load Pluno widget token", Ln = "Timed out loading Pluno widget token", Di = "pluno.productAgent.widgetClientId.", Dt = /* @__PURE__ */ new Set(), Ri = "product-agent:preview-diagnostic", ao = "pluno.productAgent.sharePromptsDisabled", zi = 3, Pn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Mi = 400, Oi = 5e3, Ui = 500, In = "Close the page's popup to chat", Bi = "No recent chats for this page yet.", oe = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
223
223
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", sans-serif',
224
- scribbleStyle: !1,
224
+ scribbleStyle: !0,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, Ai = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Sn = "pluno-pa-scribble-font", Qn = 190, eo = 41, En = 22, Ni = 1, Ti = 48, Jt = 420, Di = 520, zi = 0.24, Qt = 680, Ri = 800, Mi = 0.76, I = 8, Ce = 50, to = "http://www.w3.org/2000/svg", Gt = 26, $t = 8, Oi = 36, qt = 16, Bi = 4, kn = [
227
+ }, Fi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tn = "pluno-pa-scribble-font", ro = 190, lo = 41, An = 22, Hi = 16, Wi = 24, Gi = 1, $i = 48, tn = 420, qi = 520, ji = 0.24, nn = 680, Vi = 800, Ki = 0.76, I = 8, Se = 50, po = "http://www.w3.org/2000/svg", jt = 26, Vt = 8, Yi = 36, Kt = 16, Xi = 4, Nn = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,12 +261,12 @@ const Zn = 100, hi = 1e4, mi = 5e3, fi = "product-agent:sdk-preview-socket-conne
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
- ], Ui = 11, Fi = 13, jt = 4, no = 10, oo = 40, Hi = "movable-launcher-position-v2", io = "pluno-pa-widget-styles", ao = "data-pluno-pa-widget-styles";
265
- let Ln = 0;
266
- function Wi(e) {
267
- return (t) => new se(t, e);
264
+ ], Zi = 11, Ji = 13, Yt = 4, so = 10, co = 40, Qi = "movable-launcher-position-v2", uo = "pluno-pa-widget-styles", go = "data-pluno-pa-widget-styles";
265
+ let Dn = 0;
266
+ function ea(e) {
267
+ return (t) => new de(t, e);
268
268
  }
269
- async function Gi(e = {}) {
269
+ async function ta(e = {}) {
270
270
  const t = {
271
271
  launcherLabel: e.launcherLabel ?? oe.launcherLabel,
272
272
  accentColor: e.accentColor ?? oe.accentColor,
@@ -325,63 +325,52 @@ async function Gi(e = {}) {
325
325
  );
326
326
  const n = document.createElement("div");
327
327
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
328
- Ci,
328
+ Ti,
329
329
  t.sdkPreviewChannelId
330
330
  );
331
331
  const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
332
332
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
333
- let r = Pn(
333
+ let a = Rn(
334
334
  t.accentColor,
335
335
  t.scribbleStyle
336
336
  );
337
- ua(
337
+ Sa(
338
338
  i,
339
339
  t.launcherLabel,
340
- r,
340
+ a,
341
341
  t.movableLauncher,
342
342
  t.showLauncherMinimizeButton
343
343
  ), o.appendChild(i);
344
- const l = pr(t);
344
+ const l = yr(t);
345
345
  let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null, c = l.panelSize, u = null;
346
- i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), ve(
346
+ i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), Ce(
347
347
  i,
348
- Tt(
348
+ zt(
349
349
  i,
350
350
  p,
351
351
  t.position
352
352
  )
353
- )), $n(o, t.accentColor), In(i, r, {
353
+ )), Xn(o, t.accentColor), zn(i, a, {
354
354
  accentColor: t.accentColor,
355
355
  colorScheme: t.colorScheme,
356
356
  fontFamily: t.fontFamily,
357
357
  scribbleStyle: t.scribbleStyle
358
358
  });
359
- const m = await lr(), k = m.ownerDocument;
360
- m.appendChild(n), J(
361
- "web-sdk.widget",
362
- "Applied initial widget appearance",
363
- {
364
- accentColor: t.accentColor,
365
- colorScheme: t.colorScheme,
366
- fontFamily: t.fontFamily,
367
- cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
368
- }
369
- );
370
- const v = i.querySelector(
359
+ const m = await _r(), E = m.ownerDocument, v = i.querySelector(
371
360
  ".pluno-pa-widget__launcher"
372
- ), R = i.querySelector(
361
+ ), z = i.querySelector(
373
362
  ".pluno-pa-widget__launcher-drag-handle"
374
- ), _ = i.querySelector(
363
+ ), b = i.querySelector(
375
364
  ".pluno-pa-widget__launcher-input"
376
365
  ), g = i.querySelector(
377
366
  ".pluno-pa-widget__launcher-minimize"
378
- ), b = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
367
+ ), w = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
379
368
  ".pluno-pa-widget__scribble-spirals--panel"
380
369
  ), P = Array.from(
381
370
  i.querySelectorAll(".pluno-pa-widget__resize-handle")
382
- ), A = i.querySelector(
371
+ ), T = i.querySelector(
383
372
  ".pluno-pa-widget__close"
384
- ), L = i.querySelector(
373
+ ), k = i.querySelector(
385
374
  ".pluno-pa-widget__composer"
386
375
  ), F = i.querySelector(
387
376
  ".pluno-pa-widget__attachment-error"
@@ -391,143 +380,143 @@ async function Gi(e = {}) {
391
380
  ".pluno-pa-widget__attachments"
392
381
  ), Q = i.querySelector(
393
382
  ".pluno-pa-widget__attachment-input"
394
- ), Re = i.querySelector(
383
+ ), Me = i.querySelector(
395
384
  ".pluno-pa-widget__attach"
396
385
  ), x = i.querySelector(
397
386
  ".pluno-pa-widget__input"
398
- ), de = i.querySelector(
387
+ ), ce = i.querySelector(
399
388
  ".pluno-pa-widget__send"
400
- ), Ye = i.querySelector(
389
+ ), Xe = i.querySelector(
401
390
  ".pluno-pa-widget__top-actions"
402
391
  ), X = i.querySelector(
403
392
  ".pluno-pa-widget__history"
404
393
  ), C = i.querySelector(
405
394
  ".pluno-pa-widget__history-panel"
406
- ), T = i.querySelector(
395
+ ), N = i.querySelector(
407
396
  ".pluno-pa-widget__history-list"
408
- ), Se = i.querySelector(
397
+ ), Ee = i.querySelector(
409
398
  ".pluno-pa-widget__history-close"
410
399
  ), q = i.querySelector(
411
400
  ".pluno-pa-widget__history-status"
412
- ), z = i.querySelector(
401
+ ), R = i.querySelector(
413
402
  ".pluno-pa-widget__timeline-jump"
414
403
  ), D = i.querySelector(
415
404
  ".pluno-pa-widget__active-users-counter"
416
- ), N = i.querySelector(
405
+ ), A = i.querySelector(
417
406
  ".pluno-pa-widget__timeline"
418
- ), ht = i.querySelector(
407
+ ), mt = i.querySelector(
419
408
  ".pluno-pa-widget__timeline-bottom-sentinel"
420
- ), Me = i.querySelector(
409
+ ), Oe = i.querySelector(
421
410
  ".pluno-pa-widget__notify-suggestion"
422
- ), vo = i.querySelector(
411
+ ), Ao = i.querySelector(
423
412
  ".pluno-pa-widget__notify-suggestion-enable"
424
- ), Co = i.querySelector(
413
+ ), No = i.querySelector(
425
414
  ".pluno-pa-widget__notify-suggestion-later"
426
- ), So = i.querySelector(
415
+ ), Do = i.querySelector(
427
416
  ".pluno-pa-widget__notify-suggestion-never"
428
417
  );
429
- if (!v || !_ || !b || !A || !L || !F || !H || !$ || !Q || !Re || !x || !de || !Ye || !X || !C || !T || !Se || !q || !z || !D || !N || !ht)
418
+ if (!v || !b || !w || !T || !k || !F || !H || !$ || !Q || !Me || !x || !ce || !Xe || !X || !C || !N || !Ee || !q || !R || !D || !A || !mt)
430
419
  throw new Error("Failed to mount Pluno widget");
431
- if (t.movableLauncher && !R)
420
+ if (t.movableLauncher && !z)
432
421
  throw new Error("Failed to mount Pluno widget drag handle");
433
- Mn(_), Mn(x);
422
+ Wn(b), Wn(x);
434
423
  let W = [], le = null;
435
- const Ee = () => {
436
- Na(
424
+ const ke = () => {
425
+ Ga(
437
426
  $,
438
427
  W,
439
- (a) => {
428
+ (r) => {
440
429
  W = W.filter(
441
- (s, w) => w !== a
442
- ), Ee(), G(y.getState()), j();
430
+ (s, _) => _ !== r
431
+ ), ke(), G(y.getState()), j();
443
432
  }
444
433
  );
445
- }, Eo = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
434
+ }, Ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
446
435
  if (!t.tokenEndpoint)
447
436
  throw new Error("Pluno widget requires token or tokenEndpoint");
448
- const a = await fetch(t.tokenEndpoint, {
449
- method: "POST",
450
- credentials: "include",
451
- headers: { "content-type": "application/json" },
452
- body: JSON.stringify({
453
- origin: location.origin,
454
- url: location.href
455
- })
456
- });
457
- if (!a.ok) {
458
- const w = await a.text(), S = jo(w);
459
- throw S ? (console.error(S), new Error(S)) : new Error(`Failed to load Pluno token (${a.status})`);
460
- }
461
- const s = await a.json();
462
- if (!s.token)
463
- throw new Error("Pluno token endpoint did not return a token");
464
- return s.token;
465
- }), ko = window.fetch.bind(window);
437
+ return Io(t.tokenEndpoint);
438
+ }), zo = window.fetch.bind(window), ft = xr(t.clientId);
466
439
  let y;
467
- y = await qo.init({
468
- token: t.token,
469
- tokenProvider: Eo,
470
- backendUrl: t.backendUrl,
471
- metadata: () => ({
472
- ...t.metadata ?? {},
473
- ...!y.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
474
- }),
475
- initialStarterPrompts: t.initialStarterPrompts,
476
- clientId: t.clientId,
477
- restorePersistedState: t.restorePersistedState,
478
- expectedPersistedSessionId: t.expectedPersistedSessionId,
479
- webSocketFactory: t.webSocketFactory,
480
- prepareAttachmentUpload: t.prepareAttachmentUpload,
481
- autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
482
- });
483
- const mt = new Set(l.openToolGroupKeys), ke = new Set(
440
+ try {
441
+ const r = {
442
+ token: t.token,
443
+ tokenProvider: Ro,
444
+ backendUrl: t.backendUrl,
445
+ metadata: () => ({
446
+ ...t.metadata ?? {},
447
+ ...!y.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
448
+ }),
449
+ initialStarterPrompts: t.initialStarterPrompts,
450
+ clientId: ft.clientId,
451
+ restorePersistedState: t.restorePersistedState,
452
+ expectedPersistedSessionId: t.expectedPersistedSessionId,
453
+ webSocketFactory: t.webSocketFactory,
454
+ prepareAttachmentUpload: t.prepareAttachmentUpload,
455
+ autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0,
456
+ disableNetworkCapture: !!t.sdkPreviewChannelId
457
+ };
458
+ y = await Jo.init(r);
459
+ } catch (r) {
460
+ throw ft.release(), n.remove(), r;
461
+ }
462
+ m.appendChild(n), J(
463
+ "web-sdk.widget",
464
+ "Applied initial widget appearance",
465
+ {
466
+ accentColor: t.accentColor,
467
+ colorScheme: t.colorScheme,
468
+ fontFamily: t.fontFamily,
469
+ cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
470
+ }
471
+ );
472
+ const wt = new Set(l.openToolGroupKeys), Le = new Set(
484
473
  l.seenShareCandidateIds
485
- ), Xe = new Set(ke);
486
- let ft = l.sharePromptsDisabled || await sr(t), Z = null, Le = !1, fe = !1, we = {
474
+ ), Ze = new Set(Le);
475
+ let bt = l.sharePromptsDisabled || await vr(t), Z = null, Pe = !1, we = !1, be = {
487
476
  enabled: !0
488
- }, be = 0, nn = "", ce = !1, pe = !1, ue = [], wt = null, Oe = null;
489
- const ee = (a, s) => {
490
- we = { enabled: a, reason: s };
477
+ }, _e = 0, rn = "", ue = !1, pe = !1, ge = [], _t = null, Ue = null;
478
+ const ee = (r, s) => {
479
+ be = { enabled: r, reason: s };
491
480
  }, te = () => {
492
- z.hidden = !0;
493
- }, Lo = () => {
494
- z.hidden = !1;
495
- }, Po = (a = "jump") => {
496
- ee(!0, a), te(), Ve(N, () => we.enabled), be = N.scrollTop;
497
- }, _e = () => {
498
- if (X.hidden = t.loginRequired, C.hidden = !ce, X.setAttribute("aria-expanded", String(ce)), T.classList.toggle(
481
+ R.hidden = !0;
482
+ }, Mo = () => {
483
+ R.hidden = !1;
484
+ }, Oo = (r = "jump") => {
485
+ ee(!0, r), te(), Ke(A, () => be.enabled), _e = A.scrollTop;
486
+ }, xe = () => {
487
+ if (X.hidden = t.loginRequired, C.hidden = !ue, X.setAttribute("aria-expanded", String(ue)), N.classList.toggle(
499
488
  "pluno-pa-widget__history-list--center",
500
- pe && ue.length === 0
501
- ), T.replaceChildren(), pe && ue.length === 0) {
502
- const a = document.createElement("p");
503
- a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", T.appendChild(a);
489
+ pe && ge.length === 0
490
+ ), N.replaceChildren(), pe && ge.length === 0) {
491
+ const r = document.createElement("p");
492
+ r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", N.appendChild(r);
504
493
  }
505
- for (const a of ue) {
494
+ for (const r of ge) {
506
495
  const s = document.createElement("button");
507
496
  s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = pe;
508
- const w = document.createElement("span");
509
- w.className = "pluno-pa-widget__history-item-title", w.textContent = sa(a);
510
- const S = document.createElement("time");
511
- S.className = "pluno-pa-widget__history-time", S.dateTime = a.lastActiveAt, S.textContent = ca(
512
- a.lastActiveAt,
497
+ const _ = document.createElement("span");
498
+ _.className = "pluno-pa-widget__history-item-title", _.textContent = ya(r);
499
+ const L = document.createElement("time");
500
+ L.className = "pluno-pa-widget__history-time", L.dateTime = r.lastActiveAt, L.textContent = Ca(
501
+ r.lastActiveAt,
513
502
  Date.now()
514
503
  );
515
504
  const M = document.createElement("small");
516
- M.className = "pluno-pa-widget__history-path", M.textContent = da(a), s.append(w, S, M), s.addEventListener("click", () => {
517
- ce = !1, Oe = null, _e(), ee(!0, "newSession"), te(), y.loadSession(a.id), G(y.getState());
518
- }), T.appendChild(s);
505
+ M.className = "pluno-pa-widget__history-path", M.textContent = va(r), s.append(_, L, M), s.addEventListener("click", () => {
506
+ ue = !1, Ue = null, xe(), ee(!0, "newSession"), te(), y.loadSession(r.id), G(y.getState());
507
+ }), N.appendChild(s);
519
508
  }
520
- if (pe && ue.length > 0) {
521
- const a = document.createElement("p");
522
- a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", T.appendChild(a);
509
+ if (pe && ge.length > 0) {
510
+ const r = document.createElement("p");
511
+ r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", N.appendChild(r);
523
512
  }
524
- q.textContent = Oe ?? (!pe && ue.length === 0 ? "No recent chats for this page yet." : ""), q.hidden = q.textContent.length === 0;
525
- }, on = async (a) => {
513
+ q.textContent = Ue ?? (!pe && ge.length === 0 ? "No recent chats for this page yet." : ""), q.hidden = q.textContent.length === 0;
514
+ }, ln = async (r) => {
526
515
  if (!pe) {
527
- pe = !0, Oe = null, _e();
516
+ pe = !0, Ue = null, xe();
528
517
  try {
529
- const s = await y.listSessions({ cursor: a, limit: 20 });
530
- ue = a ? [...ue, ...s.sessions] : s.sessions, wt = s.nextCursor;
518
+ const s = await y.listSessions({ cursor: r, limit: 20 });
519
+ ge = r ? [...ge, ...s.sessions] : s.sessions, _t = s.nextCursor;
531
520
  } catch (s) {
532
521
  J(
533
522
  "web-sdk.widget",
@@ -535,68 +524,64 @@ async function Gi(e = {}) {
535
524
  {
536
525
  message: s instanceof Error ? s.message : String(s)
537
526
  }
538
- ), Oe = Ii;
527
+ ), Ue = Bi;
539
528
  } finally {
540
- pe = !1, _e();
529
+ pe = !1, xe();
541
530
  }
542
531
  }
543
- }, Io = () => {
544
- !wt || pe || T.scrollHeight - T.scrollTop - T.clientHeight <= 24 && on(wt);
545
- }, Ao = () => {
546
- Le || typeof document > "u" || ($n(o, t.accentColor), n.isConnected || k.body?.appendChild(n));
547
- }, an = new MutationObserver(Ao);
548
- an.observe(k.documentElement, {
532
+ }, Uo = () => {
533
+ !_t || pe || N.scrollHeight - N.scrollTop - N.clientHeight <= 24 && ln(_t);
534
+ }, pn = () => {
535
+ Pe || typeof document > "u" || (Xn(o, t.accentColor), n.isConnected || E.body?.appendChild(n));
536
+ }, sn = new MutationObserver(pn);
537
+ sn.observe(E.documentElement, {
549
538
  childList: !0,
550
539
  subtree: !0
551
- });
552
- const Be = (a = !0) => {
553
- const s = dt(i, a);
554
- return Vt(
540
+ }), pn();
541
+ const Be = (r = !0) => {
542
+ const s = ct(i, r);
543
+ return Xt(
555
544
  i,
556
- p ? ro(p, s) : Zi(
545
+ p ? ho(p, s) : sa(
557
546
  i,
558
547
  t.position,
559
548
  s
560
549
  ),
561
550
  s
562
551
  );
563
- }, B = () => {
564
- const a = ia(
565
- o,
566
- _,
567
- x
568
- );
569
- cr(t, {
552
+ }, U = () => {
553
+ const r = fa(o, b, x);
554
+ Sr(t, {
570
555
  isOpen: i.classList.contains("pluno-pa-widget--open"),
571
556
  composerValue: x.value,
572
- focusedInput: a,
573
- focusedInputAt: a ? Date.now() : null,
574
- openToolGroupKeys: [...mt],
557
+ focusedInput: r,
558
+ focusedInputAt: r ? Date.now() : null,
559
+ openToolGroupKeys: [...wt],
575
560
  launcherPosition: d ? p : null,
576
561
  panelSize: c,
577
- seenShareCandidateIds: [...ke].slice(
578
- -Zn
562
+ seenShareCandidateIds: [...Le].slice(
563
+ -oo
579
564
  ),
580
- sharePromptsDisabled: ft
565
+ sharePromptsDisabled: bt
581
566
  });
582
- }, Ze = (a) => {
583
- t.onDisplayStateChange?.(a);
584
- }, Ue = (a, s = !0) => {
585
- if (a === "shown") {
586
- i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Fe(!1), s && Ze("shown");
567
+ }, Je = (r) => {
568
+ t.onDisplayStateChange?.(r);
569
+ }, Fe = (r, s = !0) => {
570
+ if (r === "shown") {
571
+ i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && He(!1), s && Je("shown");
587
572
  return;
588
573
  }
589
- Z !== null && (window.clearTimeout(Z), Z = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, b.hidden = !0, A.hidden = !0, v.tabIndex = 0, x.value = "", ve(
574
+ Z !== null && (window.clearTimeout(Z), Z = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, w.hidden = !0, T.hidden = !0, v.tabIndex = 0, x.value = "", Ce(
590
575
  i,
591
- Tt(
576
+ zt(
592
577
  i,
593
578
  p,
594
579
  t.position
595
580
  )
596
- ), Dn(i), B(), s && Ze("minimized");
597
- }, xe = (a, s = {}) => {
598
- oa(a, {
599
- debugVersion: Hi,
581
+ ), Bn(i), U(), s && Je("minimized");
582
+ }, ye = (r, s = {}) => {
583
+ ma(r, {
584
+ debugVersion: Qi,
600
585
  launcherPosition: p,
601
586
  rootClasses: i.className,
602
587
  rootStyle: {
@@ -605,35 +590,35 @@ async function Gi(e = {}) {
605
590
  right: i.style.right,
606
591
  bottom: i.style.bottom
607
592
  },
608
- rootRect: zt(i),
609
- launcherRect: zt(v),
610
- panelRect: zt(b),
593
+ rootRect: Ot(i),
594
+ launcherRect: Ot(v),
595
+ panelRect: Ot(w),
611
596
  viewport: Y(),
612
- panelHidden: b.hidden,
613
- closeHidden: A.hidden,
597
+ panelHidden: w.hidden,
598
+ closeHidden: T.hidden,
614
599
  ...s
615
600
  });
616
- }, Fe = (a = !0) => {
601
+ }, He = (r = !0) => {
617
602
  if (!p)
618
- return ve(i, null), Be(a);
619
- const s = Be(a);
620
- return ve(i, s), xe("Applied stored closed launcher position", {
603
+ return Ce(i, null), Be(r);
604
+ const s = Be(r);
605
+ return Ce(i, s), ye("Applied stored closed launcher position", {
621
606
  visibleLauncherPosition: s
622
607
  }), s;
623
- }, bt = (a, s) => {
624
- if (!a || !s) {
625
- Dn(i);
608
+ }, xt = (r, s) => {
609
+ if (!r || !s) {
610
+ Bn(i);
626
611
  return;
627
612
  }
628
- na(i, {
629
- x: a.x - s.x,
630
- y: a.y - s.y
613
+ ha(i, {
614
+ x: r.x - s.x,
615
+ y: r.y - s.y
631
616
  });
632
- }, rn = () => {
617
+ }, dn = () => {
633
618
  if (i.classList.contains("pluno-pa-widget--minimized")) {
634
- ve(
619
+ Ce(
635
620
  i,
636
- Tt(
621
+ zt(
637
622
  i,
638
623
  p,
639
624
  t.position
@@ -641,234 +626,234 @@ async function Gi(e = {}) {
641
626
  );
642
627
  return;
643
628
  }
644
- const a = Fe();
629
+ const r = He();
645
630
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
646
- Nt(i, c);
631
+ Rt(i, c);
647
632
  const s = ze(c);
648
- Mt(h, s.width);
649
- const w = lt(
650
- u ?? Dt(
633
+ Bt(
634
+ h,
635
+ s.width
636
+ );
637
+ const _ = pt(
638
+ u ?? Mt(
651
639
  i,
652
- a,
640
+ r,
653
641
  t.position,
654
642
  c
655
643
  ),
656
644
  s
657
645
  );
658
- u && (u = w), bt(w, a), xe(
646
+ u && (u = _), xt(_, r), ye(
659
647
  "Applied open panel position after viewport resize",
660
- { openPanelPosition: w }
648
+ { openPanelPosition: _ }
661
649
  );
662
- } else p && xe(
650
+ } else p && ye(
663
651
  "Applied visible launcher position after viewport resize",
664
- { visibleLauncherPosition: a }
652
+ { visibleLauncherPosition: r }
665
653
  );
666
654
  };
667
- let ln = () => {
655
+ let cn = () => {
668
656
  };
669
- window.addEventListener("resize", rn), t.movableLauncher && R ? (Fe(), ln = Ki({
657
+ window.addEventListener("resize", dn), t.movableLauncher && z ? (He(), cn = ra({
670
658
  root: i,
671
659
  launcher: v,
672
- launcherDragHandle: R,
660
+ launcherDragHandle: z,
673
661
  getPosition: () => Be(),
674
- setPosition: (a) => {
675
- const s = a, w = dt(i), S = Vt(
662
+ setPosition: (r) => {
663
+ const s = r, _ = ct(i), L = Xt(
676
664
  i,
677
- a,
678
- w
665
+ r,
666
+ _
679
667
  );
680
- p = Qi(
681
- S,
682
- w
683
- ), ve(i, S), xe("Dragging closed launcher", {
668
+ p = ca(
669
+ L,
670
+ _
671
+ ), Ce(i, L), ye("Dragging closed launcher", {
684
672
  requestedPosition: s
685
673
  });
686
674
  },
687
675
  persist: () => {
688
- d = !0, B(), xe("Persisted closed launcher drag position");
676
+ d = !0, U(), ye("Persisted closed launcher drag position");
689
677
  }
690
- })) : ve(i, null), Nt(i, c);
691
- const No = () => {
692
- const a = ze(c), s = Be();
678
+ })) : Ce(i, null), Rt(i, c);
679
+ const Bo = () => {
680
+ const r = ze(c), s = Be();
693
681
  return {
694
- position: lt(
695
- u ?? Dt(
682
+ position: pt(
683
+ u ?? Mt(
696
684
  i,
697
685
  s,
698
686
  t.position,
699
687
  c
700
688
  ),
701
- a
689
+ r
702
690
  ),
703
- size: a
691
+ size: r
704
692
  };
705
- }, To = (a) => {
706
- c = ut(a.size), Nt(i, c), Mt(
693
+ }, Fo = (r) => {
694
+ c = gt(r.size), Rt(i, c), Bt(
707
695
  h,
708
696
  ze(c).width
709
- ), u = lt(
710
- a.position,
697
+ ), u = pt(
698
+ r.position,
711
699
  ze(c)
712
700
  );
713
701
  const s = Be();
714
- bt(u, s);
715
- }, Do = P.length > 0 ? Yi({
702
+ xt(u, s);
703
+ }, Ho = P.length > 0 ? la({
716
704
  root: i,
717
705
  handles: P,
718
- getBounds: No,
719
- setBounds: To,
720
- persist: B
706
+ getBounds: Bo,
707
+ setBounds: Fo,
708
+ persist: U
721
709
  }) : () => {
722
710
  };
723
- let _t = !1;
724
- const pn = async () => {
725
- if (!(!t.billingStatusLoader || _t)) {
726
- _t = !0;
711
+ let yt = !1;
712
+ const un = async () => {
713
+ if (!(!t.billingStatusLoader || yt)) {
714
+ yt = !0;
727
715
  try {
728
- const a = await t.billingStatusLoader();
729
- Bn(
716
+ const r = await t.billingStatusLoader();
717
+ $n(
730
718
  t.billingStatus,
731
- a,
719
+ r,
732
720
  y.getState().lastErrorCode
733
- ) && (t.billingStatus = a, Bt(
721
+ ) && (t.billingStatus = r, Ht(
734
722
  H,
735
723
  t.billingStatus,
736
724
  y.getState().lastErrorCode
737
725
  ), j());
738
726
  } finally {
739
- _t = !1;
727
+ yt = !1;
740
728
  }
741
729
  }
742
- }, ge = (a = "", s = !0) => {
743
- pn(), We && (We = !1, yt()), i.classList.contains("pluno-pa-widget--open") || (u = null), Z !== null && (window.clearTimeout(Z), Z = null), Ue("shown", !1), b.hidden = !1, A.hidden = !1, Mt(
730
+ }, he = (r = "", s = !0) => {
731
+ un(), Ge && (Ge = !1, Ct()), i.classList.contains("pluno-pa-widget--open") || (u = null), Z !== null && (window.clearTimeout(Z), Z = null), Fe("shown", !1), w.hidden = !1, T.hidden = !1, Bt(
744
732
  h,
745
733
  ze(c).width
746
734
  ), i.classList.remove("pluno-pa-widget--closing");
747
- const w = Fe(), S = Dt(
735
+ const _ = He(), L = Mt(
748
736
  i,
749
- w,
737
+ _,
750
738
  t.position,
751
739
  c
752
740
  );
753
- if (bt(S, w), xe("Opening launcher at clamped open panel position", {
754
- openPanelPosition: S,
755
- visibleLauncherPosition: w
741
+ if (xt(L, _), ye("Opening launcher at clamped open panel position", {
742
+ openPanelPosition: L,
743
+ visibleLauncherPosition: _
756
744
  }), ee(!0, "open"), te(), !s) {
757
- i.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (x.value = a, je(x)), Ve(N, () => we.enabled), be = N.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), B(), Ze("shown"), t.onPanelOpenChange?.(!0);
745
+ i.classList.add("pluno-pa-widget--open"), v.hidden = !0, r && (x.value = r, Ve(x)), Ke(A, () => be.enabled), _e = A.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), U(), Je("shown"), t.onPanelOpenChange?.(!0);
758
746
  return;
759
747
  }
760
748
  window.requestAnimationFrame(() => {
761
- i.classList.add("pluno-pa-widget--open"), a && (x.value = a, je(x)), Ve(N, () => we.enabled), be = N.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), B(), Ze("shown"), t.onPanelOpenChange?.(!0), Z = window.setTimeout(() => {
762
- v.hidden = !0, Ve(N, () => we.enabled), be = N.scrollTop;
749
+ i.classList.add("pluno-pa-widget--open"), r && (x.value = r, Ve(x)), Ke(A, () => be.enabled), _e = A.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), U(), Je("shown"), t.onPanelOpenChange?.(!0), Z = window.setTimeout(() => {
750
+ v.hidden = !0, Ke(A, () => be.enabled), _e = A.scrollTop;
763
751
  }, 220);
764
752
  });
765
- }, zo = () => {
766
- Z !== null && (window.clearTimeout(Z), Z = null), v.hidden = !1, p && (Fe(!1), xe("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), B(), t.onPanelOpenChange?.(!1), Z = window.setTimeout(() => {
767
- b.hidden = !0, A.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
753
+ }, Wo = () => {
754
+ Z !== null && (window.clearTimeout(Z), Z = null), v.hidden = !1, p && (He(!1), ye("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), U(), t.onPanelOpenChange?.(!1), Z = window.setTimeout(() => {
755
+ w.hidden = !0, T.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
768
756
  }, 220);
769
757
  };
770
- v.addEventListener("submit", (a) => {
771
- a.preventDefault(), ge(_.value), _.value = "";
772
- }), R?.addEventListener("click", (a) => {
773
- a.preventDefault(), a.stopPropagation();
774
- }), v.addEventListener("click", (a) => {
775
- a.target === _ && !R || (ge(_.value), _.value = "");
776
- }), _.addEventListener("focus", () => {
777
- ge(_.value), _.value = "";
778
- }), _.addEventListener("input", () => {
779
- if (!_.value)
758
+ v.addEventListener("submit", (r) => {
759
+ r.preventDefault(), he(b.value), b.value = "";
760
+ }), z?.addEventListener("click", (r) => {
761
+ r.preventDefault(), r.stopPropagation();
762
+ }), v.addEventListener("click", (r) => {
763
+ r.target === b && !z || (he(b.value), b.value = "");
764
+ }), b.addEventListener("focus", () => {
765
+ he(b.value), b.value = "";
766
+ }), b.addEventListener("input", () => {
767
+ if (!b.value)
780
768
  return;
781
- const a = _.value;
782
- ge(a), _.value = "";
769
+ const r = b.value;
770
+ he(r), b.value = "";
783
771
  });
784
- let xt = null, Je = null, ye = null;
785
- const sn = (a) => a === _ || a === x, Ro = (a) => {
786
- if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
772
+ let vt = null, Qe = null, ve = null;
773
+ const gn = (r) => r === b || r === x, Go = (r) => {
774
+ if (!(r instanceof Element) || r.getRootNode() === i.getRootNode())
787
775
  return null;
788
- let s = a;
776
+ let s = r;
789
777
  for (; s; ) {
790
- const w = s.closest(vn);
791
- if (w)
792
- return w;
793
- const S = s.getRootNode();
794
- s = S instanceof ShadowRoot ? S.host : null;
778
+ const _ = s.closest(Pn);
779
+ if (_)
780
+ return _;
781
+ const L = s.getRootNode();
782
+ s = L instanceof ShadowRoot ? L.host : null;
795
783
  }
796
784
  return null;
797
- }, Mo = (a) => {
798
- if (!a.isConnected || !a.matches(vn))
785
+ }, $o = (r) => {
786
+ if (!r.isConnected || !r.matches(Pn))
799
787
  return !1;
800
- if (!(a instanceof HTMLElement))
788
+ if (!(r instanceof HTMLElement))
801
789
  return !0;
802
- if (a.hidden)
790
+ if (r.hidden)
803
791
  return !1;
804
- if (typeof a.checkVisibility == "function")
805
- return a.checkVisibility();
806
- const s = window.getComputedStyle(a);
792
+ if (typeof r.checkVisibility == "function")
793
+ return r.checkVisibility();
794
+ const s = window.getComputedStyle(r);
807
795
  return s.display !== "none" && s.visibility !== "hidden";
808
- }, dn = (a) => {
809
- He !== a && (He = a, i.classList.toggle(
810
- "pluno-pa-widget--host-modal-conflict",
811
- a !== null
812
- ), et(), a !== null ? ye = window.setInterval(() => {
813
- const s = He;
814
- (!s || !Mo(s)) && dn(null);
815
- }, Pi) : ye !== null && (window.clearInterval(ye), ye = null, Je = null));
816
- }, Oo = () => {
817
- ye !== null && (window.clearInterval(ye), ye = null);
796
+ }, hn = (r) => {
797
+ We !== r && (We = r, i.classList.toggle("pluno-pa-widget--host-modal-conflict", r !== null), tt(), r !== null ? ve = window.setInterval(() => {
798
+ const s = We;
799
+ (!s || !$o(s)) && hn(null);
800
+ }, Ui) : ve !== null && (window.clearInterval(ve), ve = null, Qe = null));
801
+ }, qo = () => {
802
+ ve !== null && (window.clearInterval(ve), ve = null);
818
803
  };
819
- i.addEventListener("focusin", (a) => {
820
- sn(a.target) && (xt = Date.now(), B());
821
- }), i.addEventListener("focusout", (a) => {
822
- if (!sn(a.target) || He !== null)
804
+ i.addEventListener("focusin", (r) => {
805
+ gn(r.target) && (vt = Date.now(), U());
806
+ }), i.addEventListener("focusout", (r) => {
807
+ if (!gn(r.target) || We !== null)
823
808
  return;
824
- const s = xt;
825
- if (xt = null, s === null || Date.now() - s > ki)
809
+ const s = vt;
810
+ if (vt = null, s === null || Date.now() - s > Mi)
826
811
  return;
827
- const w = Ro(a.relatedTarget);
828
- if (!w)
812
+ const _ = Go(r.relatedTarget);
813
+ if (!_)
829
814
  return;
830
- const S = Date.now();
831
- if (Je !== null && S - Je <= Li) {
832
- dn(w);
815
+ const L = Date.now();
816
+ if (Qe !== null && L - Qe <= Oi) {
817
+ hn(_);
833
818
  return;
834
819
  }
835
- Je = S;
836
- }), v.addEventListener("keydown", (a) => {
837
- !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), ge());
838
- }), g?.addEventListener("pointerdown", (a) => {
839
- a.stopPropagation();
840
- }), g?.addEventListener("click", (a) => {
841
- a.preventDefault(), a.stopPropagation(), Ue("minimized");
842
- }), A.addEventListener("click", zo), N.addEventListener("scroll", () => {
843
- N.scrollTop < be - 1 && ee(!1, "userScroll"), be = N.scrollTop;
844
- }), z.addEventListener("click", () => {
845
- Po();
820
+ Qe = L;
821
+ }), v.addEventListener("keydown", (r) => {
822
+ !i.classList.contains("pluno-pa-widget--minimized") || r.key !== "Enter" && r.key !== " " || (r.preventDefault(), he());
823
+ }), g?.addEventListener("pointerdown", (r) => {
824
+ r.stopPropagation();
825
+ }), g?.addEventListener("click", (r) => {
826
+ r.preventDefault(), r.stopPropagation(), Fe("minimized");
827
+ }), T.addEventListener("click", Wo), A.addEventListener("scroll", () => {
828
+ A.scrollTop < _e - 1 && ee(!1, "userScroll"), _e = A.scrollTop;
829
+ }), R.addEventListener("click", () => {
830
+ Oo();
846
831
  });
847
- const cn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
848
- ([a]) => {
849
- a?.isIntersecting && (ee(!0, "bottom"), te());
832
+ const mn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
833
+ ([r]) => {
834
+ r?.isIntersecting && (ee(!0, "bottom"), te());
850
835
  },
851
- { root: N, threshold: 0 }
836
+ { root: A, threshold: 0 }
852
837
  );
853
- cn?.observe(ht);
854
- const Qe = () => t.loginRequired || t.signupRequired;
855
- let He = null, We = !1;
856
- const et = () => {
857
- const a = Qe(), s = He !== null;
858
- _.readOnly = a || s, x.readOnly = s, _.placeholder = s ? Cn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : We ? "New update" : t.launcherLabel, x.placeholder = s ? Cn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : oe.launcherLabel, L.hidden = a;
838
+ mn?.observe(mt);
839
+ const et = () => t.loginRequired || t.signupRequired;
840
+ let We = null, Ge = !1;
841
+ const tt = () => {
842
+ const r = et(), s = We !== null;
843
+ b.readOnly = r || s, x.readOnly = s, b.placeholder = s ? In : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Ge ? "New update" : t.launcherLabel, x.placeholder = s ? In : r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : oe.launcherLabel, k.hidden = r;
859
844
  }, j = () => {
860
- de.disabled = ae(t.billingStatus) || !y.getState().isThinking && x.value.trim().length === 0 && W.length === 0, Re.disabled = Qe() || ae(t.billingStatus);
845
+ ce.disabled = ae(t.billingStatus) || !y.getState().isThinking && x.value.trim().length === 0 && W.length === 0, Me.disabled = et() || ae(t.billingStatus);
861
846
  };
862
- et();
863
- const yt = () => {
864
- const a = y.getState().isThinking;
865
- i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
847
+ tt();
848
+ const Ct = () => {
849
+ const r = y.getState().isThinking;
850
+ i.classList.toggle("pluno-pa-widget--thinking", r), i.classList.toggle(
866
851
  "pluno-pa-widget--unread",
867
- !a && We
868
- ), et();
852
+ !r && Ge
853
+ ), tt();
869
854
  };
870
- yt(), L.addEventListener("submit", (a) => {
871
- if (a.preventDefault(), t.loginRequired) {
855
+ Ct(), k.addEventListener("submit", (r) => {
856
+ if (r.preventDefault(), t.loginRequired) {
872
857
  t.onLoginClick?.();
873
858
  return;
874
859
  }
@@ -876,64 +861,64 @@ async function Gi(e = {}) {
876
861
  t.onSignupClick?.();
877
862
  return;
878
863
  }
879
- ae(t.billingStatus) || (fe = !0, ee(!0, "send"), te(), W = Rt(
864
+ ae(t.billingStatus) || (we = !0, ee(!0, "send"), te(), W = Ut(
880
865
  y,
881
866
  x,
882
867
  W
883
- ), Ee(), j());
868
+ ), ke(), j());
884
869
  });
885
- let Ge = 0;
886
- const Bo = () => {
887
- Ge = 0, i.classList.remove("pluno-pa-widget--drag-over");
888
- }, vt = (a) => {
889
- le !== null && window.clearTimeout(le), F.textContent = a, F.hidden = !1, le = window.setTimeout(() => {
870
+ let $e = 0;
871
+ const jo = () => {
872
+ $e = 0, i.classList.remove("pluno-pa-widget--drag-over");
873
+ }, St = (r) => {
874
+ le !== null && window.clearTimeout(le), F.textContent = r, F.hidden = !1, le = window.setTimeout(() => {
890
875
  F.textContent = "", F.hidden = !0, le = null;
891
876
  }, 3e3);
892
- }, Uo = () => {
877
+ }, Vo = () => {
893
878
  le !== null && (window.clearTimeout(le), le = null), F.textContent = "", F.hidden = !0;
894
- }, Ct = async (a) => {
895
- if (a.length === 0)
879
+ }, Et = async (r) => {
880
+ if (r.length === 0)
896
881
  return;
897
- const s = za(y, a);
898
- W = [...W, ...s], Ee(), Uo(), j(), G(y.getState()), i.classList.contains("pluno-pa-widget--open") || ge();
882
+ const s = ja(y, r);
883
+ W = [...W, ...s], ke(), Vo(), j(), G(y.getState()), i.classList.contains("pluno-pa-widget--open") || he();
899
884
  };
900
- Re.addEventListener("click", () => {
885
+ Me.addEventListener("click", () => {
901
886
  t.loginRequired || ae(t.billingStatus) || Q.click();
902
887
  }), Q.addEventListener("change", () => {
903
- const a = Array.from(Q.files ?? []);
904
- Q.value = "", Ct(a).catch((s) => {
905
- vt(
888
+ const r = Array.from(Q.files ?? []);
889
+ Q.value = "", Et(r).catch((s) => {
890
+ St(
906
891
  s instanceof Error ? s.message : "Failed to attach file"
907
892
  ), J("web-sdk.widget", "Attachment failed", {
908
893
  message: s instanceof Error ? s.message : String(s)
909
894
  });
910
895
  });
911
- }), i.addEventListener("dragenter", (a) => {
912
- !it(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ge += 1, i.classList.add("pluno-pa-widget--drag-over"));
913
- }), i.addEventListener("dragover", (a) => {
914
- const s = a.dataTransfer;
915
- !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
916
- }), i.addEventListener("dragleave", (a) => {
917
- it(a.dataTransfer) && (a.stopPropagation(), Ge = Math.max(0, Ge - 1), Ge === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
918
- }), i.addEventListener("drop", (a) => {
919
- const s = a.dataTransfer;
920
- !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Bo(), Ct(s.files).catch((w) => {
921
- vt(
922
- w instanceof Error ? w.message : "Failed to attach file"
896
+ }), i.addEventListener("dragenter", (r) => {
897
+ !at(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), $e += 1, i.classList.add("pluno-pa-widget--drag-over"));
898
+ }), i.addEventListener("dragover", (r) => {
899
+ const s = r.dataTransfer;
900
+ !at(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), s.dropEffect = "copy");
901
+ }), i.addEventListener("dragleave", (r) => {
902
+ at(r.dataTransfer) && (r.stopPropagation(), $e = Math.max(0, $e - 1), $e === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
903
+ }), i.addEventListener("drop", (r) => {
904
+ const s = r.dataTransfer;
905
+ !at(s) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), jo(), Et(s.files).catch((_) => {
906
+ St(
907
+ _ instanceof Error ? _.message : "Failed to attach file"
923
908
  ), J("web-sdk.widget", "Attachment failed", {
924
- message: w instanceof Error ? w.message : String(w)
909
+ message: _ instanceof Error ? _.message : String(_)
925
910
  });
926
911
  }));
927
- }), i.addEventListener("paste", (a) => {
928
- const s = a.clipboardData, w = Array.from(s?.files ?? []);
929
- w.length === 0 || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ct(w).catch((S) => {
930
- vt(
931
- S instanceof Error ? S.message : "Failed to attach file"
912
+ }), i.addEventListener("paste", (r) => {
913
+ const s = r.clipboardData, _ = Array.from(s?.files ?? []);
914
+ _.length === 0 || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Et(_).catch((L) => {
915
+ St(
916
+ L instanceof Error ? L.message : "Failed to attach file"
932
917
  ), J("web-sdk.widget", "Attachment failed", {
933
- message: S instanceof Error ? S.message : String(S)
918
+ message: L instanceof Error ? L.message : String(L)
934
919
  });
935
920
  }));
936
- }), de.addEventListener("click", () => {
921
+ }), ce.addEventListener("click", () => {
937
922
  if (t.loginRequired) {
938
923
  t.onLoginClick?.();
939
924
  return;
@@ -942,91 +927,91 @@ async function Gi(e = {}) {
942
927
  y.stop();
943
928
  return;
944
929
  }
945
- fe = !0, ee(!0, "send"), te(), W = Rt(
930
+ we = !0, ee(!0, "send"), te(), W = Ut(
946
931
  y,
947
932
  x,
948
933
  W
949
- ), Ee(), j(), G(y.getState());
934
+ ), ke(), j(), G(y.getState());
950
935
  }), X.addEventListener("click", () => {
951
- ce = !ce, Oe = null, _e(), ce && ue.length === 0 && on(null);
952
- }), Se.addEventListener("click", () => {
953
- ce = !1, _e();
954
- }), T.addEventListener("scroll", Io), x.addEventListener("input", () => {
955
- je(x), B(), j(), Wo();
956
- }), x.addEventListener("keydown", (a) => {
957
- if (!(a.key !== "Enter" || a.shiftKey)) {
958
- if (a.preventDefault(), t.loginRequired) {
936
+ ue = !ue, Ue = null, xe(), ue && ge.length === 0 && ln(null);
937
+ }), Ee.addEventListener("click", () => {
938
+ ue = !1, xe();
939
+ }), N.addEventListener("scroll", Uo), x.addEventListener("input", () => {
940
+ Ve(x), U(), j(), Xo();
941
+ }), x.addEventListener("keydown", (r) => {
942
+ if (!(r.key !== "Enter" || r.shiftKey)) {
943
+ if (r.preventDefault(), t.loginRequired) {
959
944
  t.onLoginClick?.();
960
945
  return;
961
946
  }
962
- fe = !0, ee(!0, "send"), te(), W = Rt(
947
+ we = !0, ee(!0, "send"), te(), W = Ut(
963
948
  y,
964
949
  x,
965
950
  W
966
- ), Ee(), j(), G(y.getState());
967
- }
968
- }), i.addEventListener("click", (a) => {
969
- (a.target instanceof Element ? a.target : null)?.closest("a[href]") && B();
970
- }), l.composerValue && (x.value = l.composerValue, je(x)), t.initialDisplayState === "minimized" ? Ue("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && ge(x.value, !1), aa(l, i, _, x);
971
- const tt = () => r;
972
- let St = y.getState().appearance !== null, nt = null, $e = null, Pe = null, un = y.getState().isThinking, Ie = null;
973
- const qe = t.taskNotifications;
951
+ ), ke(), j(), G(y.getState());
952
+ }
953
+ }), i.addEventListener("click", (r) => {
954
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && U();
955
+ }), l.composerValue && (x.value = l.composerValue, Ve(x)), t.initialDisplayState === "minimized" ? Fe("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && he(x.value, !1), wa(l, i, b, x);
956
+ const nt = () => a;
957
+ let kt = y.getState().appearance !== null, ot = null, qe = null, Ie = null, fn = y.getState().isThinking, Te = null;
958
+ const je = t.taskNotifications;
974
959
  let Ae = null, Ne = !1;
975
- const gn = () => {
960
+ const wn = () => {
976
961
  Ae !== null && (window.clearTimeout(Ae), Ae = null);
977
- }, ot = () => {
978
- Me && (Me.hidden = !0);
979
- }, hn = () => y.getState().assistantDraft.trim().length > 0, Fo = async () => {
980
- if (!qe || !Me || Ne || Le || !y.getState().isThinking || hn())
962
+ }, it = () => {
963
+ Oe && (Oe.hidden = !0);
964
+ }, bn = () => y.getState().assistantDraft.trim().length > 0, Ko = async () => {
965
+ if (!je || !Oe || Ne || Pe || !y.getState().isThinking || bn())
981
966
  return;
982
- let a;
967
+ let r;
983
968
  try {
984
- a = await qe.getState();
969
+ r = await je.getState();
985
970
  } catch {
986
971
  return;
987
972
  }
988
- a.enabled || a.neverSuggest || !y.getState().isThinking || hn() || Ne || Le || (Me.hidden = !1);
973
+ r.enabled || r.neverSuggest || !y.getState().isThinking || bn() || Ne || Pe || (Oe.hidden = !1);
989
974
  };
990
- vo?.addEventListener("click", () => {
991
- Ne = !0, ot(), qe?.enable().catch(() => {
975
+ Ao?.addEventListener("click", () => {
976
+ Ne = !0, it(), je?.enable().catch(() => {
992
977
  });
993
- }), Co?.addEventListener("click", () => {
994
- Ne = !0, ot();
995
- }), So?.addEventListener("click", () => {
996
- Ne = !0, ot(), qe?.dismissForever().catch(() => {
978
+ }), No?.addEventListener("click", () => {
979
+ Ne = !0, it();
980
+ }), Do?.addEventListener("click", () => {
981
+ Ne = !0, it(), je?.dismissForever().catch(() => {
997
982
  });
998
983
  });
999
- let Te = null, mn = () => {
984
+ let De = null, _n = () => {
1000
985
  };
1001
- const Ho = !!t.socialPostDraftHandler, Et = /* @__PURE__ */ new Map(), kt = () => x.value.trim().length > 0 || W.length > 0, Wo = () => {
1002
- const a = Te !== null && Ut(y.getState(), kt());
1003
- D.hidden = !a, a && Te !== null && po(D, Te);
986
+ const Yo = !!t.socialPostDraftHandler, Lt = /* @__PURE__ */ new Map(), Pt = () => x.value.trim().length > 0 || W.length > 0, Xo = () => {
987
+ const r = De !== null && Wt(y.getState(), Pt());
988
+ D.hidden = !r, r && De !== null && fo(D, De);
1004
989
  };
1005
- let De = null;
1006
- const Go = () => {
1007
- fe = !0, ee(!0, "newSession"), te(), ce = !1, _e(), y.startNewSession(), mt.clear(), x.value = "", W = [], Ee(), je(x), B(), j(), x.focus(), G(y.getState());
1008
- }, Lt = (a) => {
1009
- if (!a) {
1010
- De?.remove(), De = null;
990
+ let Re = null;
991
+ const xn = (r = {}) => {
992
+ we = !0, ee(!0, "newSession"), te(), ue = !1, xe(), y.startNewSession(r), wt.clear(), x.value = "", W = [], ke(), Ve(x), U(), j(), x.focus(), G(y.getState());
993
+ }, It = (r) => {
994
+ if (!r) {
995
+ Re?.remove(), Re = null;
1011
996
  return;
1012
997
  }
1013
- De || (De = gt(
998
+ Re || (Re = ht(
1014
999
  "pluno-pa-widget__new-chat",
1015
1000
  "New chat",
1016
- Ca(),
1001
+ za(),
1017
1002
  !1
1018
- ), De.addEventListener("click", Go), Ye.insertBefore(De, X));
1019
- }, G = (a) => {
1020
- if (_e(), tn(a.lastErrorCode) ? Ie = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Ie = null), Bt(
1003
+ ), Re.addEventListener("click", () => xn()), Xe.insertBefore(Re, X));
1004
+ }, G = (r) => {
1005
+ if (xe(), an(r.lastErrorCode) ? Te = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Te = null), Ht(
1021
1006
  H,
1022
1007
  t.billingStatus,
1023
- Ie
1008
+ Te
1024
1009
  ), t.loginRequired) {
1025
- Et.clear(), Wn(
1026
- N,
1027
- de,
1028
- Lt,
1029
- tt,
1010
+ Lt.clear(), Kn(
1011
+ A,
1012
+ ce,
1013
+ It,
1014
+ nt,
1030
1015
  "Log in to use Pluno on this page.",
1031
1016
  t.loginButtonLabel,
1032
1017
  t.loginUrl,
@@ -1035,11 +1020,11 @@ async function Gi(e = {}) {
1035
1020
  return;
1036
1021
  }
1037
1022
  if (t.signupRequired) {
1038
- Et.clear(), Wn(
1039
- N,
1040
- de,
1041
- Lt,
1042
- tt,
1023
+ Lt.clear(), Kn(
1024
+ A,
1025
+ ce,
1026
+ It,
1027
+ nt,
1043
1028
  "Complete signup to unlock your free trial credits.",
1044
1029
  t.signupButtonLabel,
1045
1030
  t.signupUrl,
@@ -1047,67 +1032,67 @@ async function Gi(e = {}) {
1047
1032
  );
1048
1033
  return;
1049
1034
  }
1050
- const s = la(a), w = s !== nn;
1051
- nn = s;
1052
- const S = fe || we.enabled;
1053
- fe = !1, Ha(
1054
- N,
1055
- ht,
1056
- de,
1057
- Lt,
1058
- D,
1059
- a,
1060
- Te,
1061
- Te !== null && Ut(a, kt()),
1062
- S,
1063
- () => we.enabled,
1035
+ const s = _a(r), _ = s !== rn;
1036
+ rn = s;
1037
+ const L = we || be.enabled;
1038
+ we = !1, Qa(
1039
+ A,
1064
1040
  mt,
1065
- Et,
1066
- B,
1067
- tt,
1041
+ ce,
1042
+ It,
1043
+ D,
1044
+ r,
1045
+ De,
1046
+ De !== null && Wt(r, Pt()),
1047
+ L,
1048
+ () => be.enabled,
1049
+ wt,
1050
+ Lt,
1051
+ U,
1052
+ nt,
1068
1053
  (M) => {
1069
- fe = !0, ee(!0, "send"), te(), y.sendMessage(M);
1054
+ we = !0, ee(!0, "send"), te(), y.sendMessage(M);
1070
1055
  },
1071
- Ho && !ft ? {
1072
- dismissedCandidateIds: Xe,
1073
- draftingCandidateId: nt,
1074
- error: $e,
1075
- characterIconOptions: tt(),
1056
+ Yo && !bt ? {
1057
+ dismissedCandidateIds: Ze,
1058
+ draftingCandidateId: ot,
1059
+ error: qe,
1060
+ characterIconOptions: nt(),
1076
1061
  onSeen: (M) => {
1077
- ke.add(M.id), B();
1062
+ Le.add(M.id), U();
1078
1063
  },
1079
1064
  onDraft: (M) => {
1080
- $o(M);
1065
+ Zo(M);
1081
1066
  },
1082
1067
  onDismiss: (M) => {
1083
- ke.add(M.id), Xe.add(M.id), B(), $e = null, G(y.getState());
1068
+ Le.add(M.id), Ze.add(M.id), U(), qe = null, G(y.getState());
1084
1069
  },
1085
1070
  onDisable: (M) => {
1086
- ft = !0, ke.add(M.id), Xe.add(M.id), B(), dr(t, !0), $e = null, G(y.getState());
1071
+ bt = !0, Le.add(M.id), Ze.add(M.id), U(), Cr(t, !0), qe = null, G(y.getState());
1087
1072
  }
1088
1073
  } : void 0
1089
- ), S ? (be = N.scrollTop, te()) : w && pa(a) && Lo();
1074
+ ), L ? (_e = A.scrollTop, te()) : _ && xa(r) && Mo();
1090
1075
  };
1091
- return mn = si(
1092
- (a) => {
1093
- Te = a, !Le && Ut(y.getState(), kt()) && G(y.getState());
1076
+ return _n = fi(
1077
+ (r) => {
1078
+ De = r, !Pe && Wt(y.getState(), Pt()) && G(y.getState());
1094
1079
  },
1095
1080
  {
1096
1081
  backendUrl: t.backendUrl,
1097
- fetcher: ko,
1082
+ fetcher: zo,
1098
1083
  loader: t.activeUsersLoader
1099
1084
  }
1100
- ), y.on("state", (a) => {
1101
- const s = un && !a.isThinking;
1102
- un = a.isThinking, a.isThinking && !a.assistantDraft.trim() && qe && !Ne && Ae === null && Me?.hidden !== !1 && (Ae = window.setTimeout(() => {
1103
- Ae = null, Fo();
1104
- }, hi)), (!a.isThinking || a.assistantDraft.trim()) && (gn(), ot()), s && !i.classList.contains("pluno-pa-widget--open") && (We = !0), yt(), a.appearance ? (St = !0, J(
1085
+ ), y.on("state", (r) => {
1086
+ const s = fn && !r.isThinking;
1087
+ fn = r.isThinking, r.isThinking && !r.assistantDraft.trim() && je && !Ne && Ae === null && Oe?.hidden !== !1 && (Ae = window.setTimeout(() => {
1088
+ Ae = null, Ko();
1089
+ }, yi)), (!r.isThinking || r.assistantDraft.trim()) && (wn(), it()), s && !i.classList.contains("pluno-pa-widget--open") && (Ge = !0), Ct(), r.appearance ? (kt = !0, J(
1105
1090
  "web-sdk.widget",
1106
1091
  "Agent state supplied appearance",
1107
1092
  {
1108
- appearance: a.appearance
1093
+ appearance: r.appearance
1109
1094
  }
1110
- ), Pt(a.appearance, "agent.state.appearance")) : St && (St = !1, J(
1095
+ ), Tt(r.appearance, "agent.state.appearance")) : kt && (kt = !1, J(
1111
1096
  "web-sdk.widget",
1112
1097
  "Agent state cleared appearance; reverting to configured widget options",
1113
1098
  {
@@ -1115,101 +1100,103 @@ async function Gi(e = {}) {
1115
1100
  fallbackColorScheme: t.colorScheme,
1116
1101
  fallbackFontFamily: t.fontFamily
1117
1102
  }
1118
- ), Pt({}, "agent.state.appearance-cleared")), G(a), j(), s && pn();
1103
+ ), Tt({}, "agent.state.appearance-cleared")), G(r), j(), s && un();
1119
1104
  }), G(y.getState()), j(), {
1120
1105
  agent: y,
1121
- updateAppearance: (a) => {
1122
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Pt(a, "widgetHandle.updateAppearance");
1106
+ startNewChat: xn,
1107
+ host: n,
1108
+ updateAppearance: (r) => {
1109
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Tt(r, "widgetHandle.updateAppearance");
1123
1110
  },
1124
- updateBillingStatus: (a) => {
1125
- const s = a ?? null;
1126
- Bn(
1111
+ updateBillingStatus: (r) => {
1112
+ const s = r ?? null;
1113
+ $n(
1127
1114
  t.billingStatus,
1128
1115
  s,
1129
- Ie
1130
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Ie = null), Bt(
1116
+ Te
1117
+ ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Te = null), Ht(
1131
1118
  i.querySelector(".pluno-pa-widget__billing-status"),
1132
1119
  t.billingStatus,
1133
- Ie
1120
+ Te
1134
1121
  ), j());
1135
1122
  },
1136
- updateAuthGate: (a) => {
1137
- const s = Qe();
1138
- t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), et(), G(y.getState()), j(), s && !Qe() && y.connect().catch((w) => {
1123
+ updateAuthGate: (r) => {
1124
+ const s = et();
1125
+ 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), tt(), G(y.getState()), j(), s && !et() && y.connect().catch((_) => {
1139
1126
  J(
1140
1127
  "web-sdk.widget",
1141
1128
  "Failed to connect after auth gate cleared",
1142
1129
  {
1143
- message: w instanceof Error ? w.message : String(w)
1130
+ message: _ instanceof Error ? _.message : String(_)
1144
1131
  }
1145
1132
  );
1146
1133
  });
1147
1134
  },
1148
1135
  openPanel: () => {
1149
- ge(x.value, !1);
1136
+ he(x.value, !1);
1150
1137
  },
1151
- updateDisplayState: (a) => {
1152
- if (a === "shown") {
1153
- Ue("shown", !1);
1138
+ updateDisplayState: (r) => {
1139
+ if (r === "shown") {
1140
+ Fe("shown", !1);
1154
1141
  return;
1155
1142
  }
1156
- Ue("minimized", !1);
1143
+ Fe("minimized", !1);
1157
1144
  },
1158
1145
  destroy: () => {
1159
- Le || (B(), Le = !0, an.disconnect(), cn?.disconnect(), Oo(), window.removeEventListener("resize", rn), ln(), Do(), le !== null && window.clearTimeout(le), gn(), mn(), Pe?.remove(), y.destroy(), n.remove());
1146
+ Pe || (U(), Pe = !0, sn.disconnect(), mn?.disconnect(), qo(), window.removeEventListener("resize", dn), cn(), Ho(), le !== null && window.clearTimeout(le), wn(), _n(), Ie?.remove(), y.destroy(), ft.release(), n.remove());
1160
1147
  }
1161
1148
  };
1162
- async function $o(a) {
1163
- if (!nt) {
1164
- nt = a.id, $e = null, G(y.getState());
1149
+ async function Zo(r) {
1150
+ if (!ot) {
1151
+ ot = r.id, qe = null, G(y.getState());
1165
1152
  try {
1166
1153
  if (!t.socialPostDraftHandler)
1167
1154
  throw new Error("Social post drafting is not available here.");
1168
- const s = await t.socialPostDraftHandler(a);
1155
+ const s = await t.socialPostDraftHandler(r);
1169
1156
  if (!s.linkedinPost || !s.xPost)
1170
1157
  throw new Error("Pluno did not return a complete social post draft.");
1171
- ke.add(a.id), Xe.add(a.id), B(), Pe?.remove(), Pe = Ya(s, {
1158
+ Le.add(r.id), Ze.add(r.id), U(), Ie?.remove(), Ie = lr(s, {
1172
1159
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1173
1160
  onClose: () => {
1174
- Pe?.remove(), Pe = null;
1161
+ Ie?.remove(), Ie = null;
1175
1162
  }
1176
- }), i.appendChild(Pe);
1163
+ }), i.appendChild(Ie);
1177
1164
  } catch (s) {
1178
- $e = s instanceof Error ? s.message : "Could not draft social post.";
1165
+ qe = s instanceof Error ? s.message : "Could not draft social post.";
1179
1166
  } finally {
1180
- nt = null, G(y.getState());
1167
+ ot = null, G(y.getState());
1181
1168
  }
1182
1169
  }
1183
1170
  }
1184
- function Pt(a, s) {
1185
- const w = a.accentColor ?? t.accentColor, S = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, It = a.scribbleStyle ?? t.scribbleStyle;
1186
- r = Pn(
1187
- w,
1188
- It
1189
- ), In(i, r, {
1190
- accentColor: w,
1191
- colorScheme: S,
1171
+ function Tt(r, s) {
1172
+ const _ = r.accentColor ?? t.accentColor, L = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, At = r.scribbleStyle ?? t.scribbleStyle;
1173
+ a = Rn(
1174
+ _,
1175
+ At
1176
+ ), zn(i, a, {
1177
+ accentColor: _,
1178
+ colorScheme: L,
1192
1179
  fontFamily: M,
1193
- scribbleStyle: It
1180
+ scribbleStyle: At
1194
1181
  }), J("web-sdk.widget", "Updated widget appearance", {
1195
1182
  source: s,
1196
- inputAppearance: a,
1197
- appliedAccentColor: w,
1198
- appliedColorScheme: S,
1183
+ inputAppearance: r,
1184
+ appliedAccentColor: _,
1185
+ appliedColorScheme: L,
1199
1186
  appliedFontFamily: M,
1200
- appliedScribbleStyle: It,
1187
+ appliedScribbleStyle: At,
1201
1188
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1202
1189
  });
1203
1190
  }
1204
1191
  }
1205
- function Pn(e, t) {
1192
+ function Rn(e, t) {
1206
1193
  return { accentColor: e, scribbleStyle: t };
1207
1194
  }
1208
- function $i(e) {
1209
- const t = qi(e);
1210
- return t === null ? "#fafafa" : ji(t) > 0.5 ? "#18181b" : "#fafaf9";
1195
+ function na(e) {
1196
+ const t = oa(e);
1197
+ return t === null ? "#fafafa" : ia(t) > 0.5 ? "#18181b" : "#fafaf9";
1211
1198
  }
1212
- function qi(e) {
1199
+ function oa(e) {
1213
1200
  const t = e.trim();
1214
1201
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1215
1202
  Number.parseInt(t.slice(1, 3), 16),
@@ -1221,14 +1208,14 @@ function qi(e) {
1221
1208
  Number.parseInt(t[3] + t[3], 16)
1222
1209
  ] : null;
1223
1210
  }
1224
- function ji([e, t, n]) {
1211
+ function ia([e, t, n]) {
1225
1212
  const o = (i) => {
1226
- const r = i / 255;
1227
- return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1213
+ const a = i / 255;
1214
+ return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
1228
1215
  };
1229
1216
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1230
1217
  }
1231
- function In(e, t, n) {
1218
+ function zn(e, t, n) {
1232
1219
  e.classList.toggle(
1233
1220
  "pluno-pa-widget--dark",
1234
1221
  n.colorScheme === "dark"
@@ -1236,27 +1223,27 @@ function In(e, t, n) {
1236
1223
  "pluno-pa-widget--light",
1237
1224
  n.colorScheme !== "dark"
1238
1225
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1239
- const o = n.scribbleStyle ? Kn(n.accentColor) : n.accentColor;
1226
+ const o = n.scribbleStyle ? eo(n.accentColor) : n.accentColor;
1240
1227
  e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1241
1228
  "--pluno-pa-accent-contrast",
1242
- $i(o)
1243
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ai : n.fontFamily, n.scribbleStyle && Vi(e.ownerDocument);
1229
+ na(o)
1230
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Fi : n.fontFamily, n.scribbleStyle && aa(e.ownerDocument);
1244
1231
  const i = Array.from(
1245
1232
  e.querySelectorAll(".pluno-pa-widget__character")
1246
1233
  );
1247
- for (const r of i)
1248
- r.replaceWith(
1249
- me(
1250
- Array.from(r.classList).join(" "),
1234
+ for (const a of i)
1235
+ a.replaceWith(
1236
+ fe(
1237
+ Array.from(a.classList).join(" "),
1251
1238
  t
1252
1239
  )
1253
1240
  );
1254
1241
  }
1255
- function Vi(e) {
1256
- if (e.getElementById(Sn))
1242
+ function aa(e) {
1243
+ if (e.getElementById(Tn))
1257
1244
  return;
1258
1245
  const t = e.createElement("style");
1259
- t.id = Sn, t.textContent = `@font-face {
1246
+ t.id = Tn, t.textContent = `@font-face {
1260
1247
  font-family: "Architects Daughter";
1261
1248
  font-style: normal;
1262
1249
  font-weight: 400;
@@ -1264,28 +1251,28 @@ function Vi(e) {
1264
1251
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1265
1252
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1266
1253
  }
1267
- function Ki({
1254
+ function ra({
1268
1255
  root: e,
1269
1256
  launcher: t,
1270
1257
  launcherDragHandle: n,
1271
1258
  getPosition: o,
1272
1259
  setPosition: i,
1273
- persist: r
1260
+ persist: a
1274
1261
  }) {
1275
1262
  let l = null, p = null, d = null, c = !1, u = null;
1276
1263
  const m = () => {
1277
1264
  l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1278
- }, k = (h) => {
1265
+ }, E = (h) => {
1279
1266
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
1280
1267
  }, v = (h) => {
1281
1268
  if (l !== h.pointerId || !p || !d)
1282
1269
  return;
1283
1270
  h.preventDefault();
1284
- const P = h.clientX - p.x, A = h.clientY - p.y;
1285
- !c && Math.hypot(P, A) < jt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + A }));
1286
- }, R = (h) => {
1287
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, r()), m());
1288
- }, _ = (h) => {
1271
+ const P = h.clientX - p.x, T = h.clientY - p.y;
1272
+ !c && Math.hypot(P, T) < Yt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + T }));
1273
+ }, z = (h) => {
1274
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, a()), m());
1275
+ }, b = (h) => {
1289
1276
  l === h.pointerId && (h.preventDefault(), m());
1290
1277
  }, g = (h) => {
1291
1278
  if (!u)
@@ -1293,61 +1280,61 @@ function Ki({
1293
1280
  const P = Math.hypot(
1294
1281
  h.clientX - u.x,
1295
1282
  h.clientY - u.y
1296
- ) <= jt;
1283
+ ) <= Yt;
1297
1284
  u = null, P && (h.preventDefault(), h.stopPropagation());
1298
- }, b = (h) => {
1285
+ }, w = (h) => {
1299
1286
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1300
1287
  return;
1301
- const P = h.shiftKey ? oo : no, A = o();
1302
- let L = null;
1303
- h.key === "ArrowUp" ? L = { x: A.x, y: A.y - P } : h.key === "ArrowDown" ? L = { x: A.x, y: A.y + P } : h.key === "ArrowLeft" ? L = { x: A.x - P, y: A.y } : h.key === "ArrowRight" && (L = { x: A.x + P, y: A.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
1288
+ const P = h.shiftKey ? co : so, T = o();
1289
+ let k = null;
1290
+ h.key === "ArrowUp" ? k = { x: T.x, y: T.y - P } : h.key === "ArrowDown" ? k = { x: T.x, y: T.y + P } : h.key === "ArrowLeft" ? k = { x: T.x - P, y: T.y } : h.key === "ArrowRight" && (k = { x: T.x + P, y: T.y }), k && (h.preventDefault(), h.stopPropagation(), i(k), a());
1304
1291
  };
1305
- return t.addEventListener("pointerdown", k), t.addEventListener("pointermove", v), t.addEventListener("pointerup", R), t.addEventListener("pointercancel", _), t.addEventListener("click", g, !0), n.addEventListener("keydown", b), () => {
1306
- t.removeEventListener("pointerdown", k), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", R), t.removeEventListener("pointercancel", _), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", b);
1292
+ return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", v), t.addEventListener("pointerup", z), t.addEventListener("pointercancel", b), t.addEventListener("click", g, !0), n.addEventListener("keydown", w), () => {
1293
+ t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", z), t.removeEventListener("pointercancel", b), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", w);
1307
1294
  };
1308
1295
  }
1309
- function Yi({
1296
+ function la({
1310
1297
  root: e,
1311
1298
  handles: t,
1312
1299
  getBounds: n,
1313
1300
  setBounds: o,
1314
1301
  persist: i
1315
1302
  }) {
1316
- let r = null, l = null, p = null, d = null, c = !1;
1303
+ let a = null, l = null, p = null, d = null, c = !1;
1317
1304
  const u = () => {
1318
- r = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1305
+ a = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1319
1306
  }, m = (g) => {
1320
- const b = g.currentTarget, h = b.dataset.resizeDirection;
1321
- !e.classList.contains("pluno-pa-widget--open") || !An(h) || (g.preventDefault(), g.stopPropagation(), r = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, b.setPointerCapture?.(g.pointerId));
1322
- }, k = (g) => {
1323
- if (r !== g.pointerId || !l || !p || !d)
1307
+ const w = g.currentTarget, h = w.dataset.resizeDirection;
1308
+ !e.classList.contains("pluno-pa-widget--open") || !Mn(h) || (g.preventDefault(), g.stopPropagation(), a = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, w.setPointerCapture?.(g.pointerId));
1309
+ }, E = (g) => {
1310
+ if (a !== g.pointerId || !l || !p || !d)
1324
1311
  return;
1325
1312
  g.preventDefault(), g.stopPropagation();
1326
- const b = g.clientX - p.x, h = g.clientY - p.y;
1327
- !c && Math.hypot(b, h) < jt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1328
- Nn(d, l, b, h)
1313
+ const w = g.clientX - p.x, h = g.clientY - p.y;
1314
+ !c && Math.hypot(w, h) < Yt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1315
+ On(d, l, w, h)
1329
1316
  ));
1330
1317
  }, v = (g) => {
1331
- r === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1332
- }, R = (g) => {
1333
- r === g.pointerId && (g.preventDefault(), u());
1334
- }, _ = (g) => {
1335
- const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? oo : no, A = n();
1336
- let L = 0, F = 0;
1337
- An(h) && (g.key === "ArrowLeft" ? L = -P : g.key === "ArrowRight" ? L = P : g.key === "ArrowUp" ? F = -P : g.key === "ArrowDown" && (F = P), !(L === 0 && F === 0) && (g.preventDefault(), g.stopPropagation(), o(Nn(A, h, L, F)), i()));
1318
+ a === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1319
+ }, z = (g) => {
1320
+ a === g.pointerId && (g.preventDefault(), u());
1321
+ }, b = (g) => {
1322
+ const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? co : so, T = n();
1323
+ let k = 0, F = 0;
1324
+ Mn(h) && (g.key === "ArrowLeft" ? k = -P : g.key === "ArrowRight" ? k = P : g.key === "ArrowUp" ? F = -P : g.key === "ArrowDown" && (F = P), !(k === 0 && F === 0) && (g.preventDefault(), g.stopPropagation(), o(On(T, h, k, F)), i()));
1338
1325
  };
1339
1326
  for (const g of t)
1340
- g.addEventListener("pointerdown", m), g.addEventListener("pointermove", k), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", R), g.addEventListener("keydown", _);
1327
+ g.addEventListener("pointerdown", m), g.addEventListener("pointermove", E), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", z), g.addEventListener("keydown", b);
1341
1328
  return () => {
1342
1329
  for (const g of t)
1343
- g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", k), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", R), g.removeEventListener("keydown", _);
1330
+ g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", E), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", z), g.removeEventListener("keydown", b);
1344
1331
  };
1345
1332
  }
1346
- function An(e) {
1333
+ function Mn(e) {
1347
1334
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1348
1335
  }
1349
- function Nn(e, t, n, o) {
1350
- const i = Y(), r = Tn({
1336
+ function On(e, t, n, o) {
1337
+ const i = Y(), a = Un({
1351
1338
  leading: e.position.x,
1352
1339
  length: e.size.width,
1353
1340
  delta: n,
@@ -1356,54 +1343,50 @@ function Nn(e, t, n, o) {
1356
1343
  minLeading: I,
1357
1344
  maxTrailing: i.width - I,
1358
1345
  minLength: Math.min(
1359
- Jt,
1346
+ tn,
1360
1347
  i.width - I * 2
1361
1348
  )
1362
- }), l = Tn({
1349
+ }), l = Un({
1363
1350
  leading: e.position.y,
1364
1351
  length: e.size.height,
1365
1352
  delta: o,
1366
1353
  resizeLeading: t.startsWith("top") || t === "top",
1367
1354
  resizeTrailing: t.startsWith("bottom") || t === "bottom",
1368
- minLeading: Ce,
1355
+ minLeading: Se,
1369
1356
  maxTrailing: i.height - I,
1370
1357
  minLength: Math.min(
1371
- Qt,
1372
- i.height - Ce - I
1358
+ nn,
1359
+ i.height - Se - I
1373
1360
  )
1374
1361
  });
1375
1362
  return {
1376
- position: { x: r.leading, y: l.leading },
1377
- size: { width: r.length, height: l.length }
1363
+ position: { x: a.leading, y: l.leading },
1364
+ size: { width: a.length, height: l.length }
1378
1365
  };
1379
1366
  }
1380
- function Tn({
1367
+ function Un({
1381
1368
  leading: e,
1382
1369
  length: t,
1383
1370
  delta: n,
1384
1371
  resizeLeading: o,
1385
1372
  resizeTrailing: i,
1386
- minLeading: r,
1373
+ minLeading: a,
1387
1374
  maxTrailing: l,
1388
1375
  minLength: p
1389
1376
  }) {
1390
1377
  const d = e + t;
1391
1378
  if (o) {
1392
1379
  const c = e + n;
1393
- if (c >= r) {
1394
- const m = K(
1395
- c,
1396
- r,
1397
- d - p
1398
- );
1380
+ if (c >= a) {
1381
+ const m = K(c, a, d - p);
1399
1382
  return { leading: m, length: d - m };
1400
1383
  }
1401
1384
  const u = K(
1402
- d + r - c,
1385
+ d + a - c,
1403
1386
  d,
1404
1387
  l
1405
1388
  );
1406
- return { leading: r, length: u - r };
1389
+ return { leading: a, length: u - a };
1407
1390
  }
1408
1391
  if (i) {
1409
1392
  const c = d + n;
@@ -1417,54 +1400,57 @@ function Tn({
1417
1400
  }
1418
1401
  const u = K(
1419
1402
  e - (c - l),
1420
- r,
1403
+ a,
1421
1404
  e
1422
1405
  );
1423
1406
  return { leading: u, length: l - u };
1424
1407
  }
1425
1408
  return { leading: e, length: t };
1426
1409
  }
1427
- function dt(e, t = !0) {
1410
+ function ct(e, t = !0) {
1428
1411
  const n = Y();
1429
1412
  if (e.classList.contains("pluno-pa-widget--minimized"))
1430
- return { width: En, height: En };
1413
+ return e.classList.contains("pluno-pa-widget--scribble") ? {
1414
+ width: Hi,
1415
+ height: Wi
1416
+ } : { width: An, height: An };
1431
1417
  const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1432
1418
  return {
1433
- width: t && i && o.width > 0 ? o.width : Math.min(Qn, n.width - 36),
1434
- height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Ti : eo
1419
+ width: t && i && o.width > 0 ? o.width : Math.min(ro, n.width - 36),
1420
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? $i : lo
1435
1421
  };
1436
1422
  }
1437
- function Xi() {
1423
+ function pa() {
1438
1424
  const e = Y();
1439
1425
  return {
1440
1426
  width: Math.min(
1441
1427
  K(
1442
- e.width * zi,
1443
- Jt,
1444
- Di
1428
+ e.width * ji,
1429
+ tn,
1430
+ qi
1445
1431
  ),
1446
1432
  e.width - I * 2
1447
1433
  ),
1448
1434
  height: Math.min(
1449
1435
  K(
1450
- e.height * Mi,
1451
- Qt,
1452
- Ri
1436
+ e.height * Ki,
1437
+ nn,
1438
+ Vi
1453
1439
  ),
1454
- e.height - Ce - I
1440
+ e.height - Se - I
1455
1441
  )
1456
1442
  };
1457
1443
  }
1458
1444
  function ze(e = null) {
1459
- return e ? ut(e) : Xi();
1445
+ return e ? gt(e) : pa();
1460
1446
  }
1461
- function ut(e) {
1447
+ function gt(e) {
1462
1448
  const t = Y();
1463
1449
  return {
1464
1450
  width: K(
1465
1451
  e.width,
1466
1452
  Math.min(
1467
- Jt,
1453
+ tn,
1468
1454
  t.width - I * 2
1469
1455
  ),
1470
1456
  Math.max(
@@ -1475,54 +1461,54 @@ function ut(e) {
1475
1461
  height: K(
1476
1462
  e.height,
1477
1463
  Math.min(
1478
- Qt,
1479
- t.height - Ce - I
1464
+ nn,
1465
+ t.height - Se - I
1480
1466
  ),
1481
1467
  Math.max(
1482
1468
  I,
1483
- t.height - Ce - I
1469
+ t.height - Se - I
1484
1470
  )
1485
1471
  )
1486
1472
  };
1487
1473
  }
1488
- function Nt(e, t) {
1474
+ function Rt(e, t) {
1489
1475
  if (!t) {
1490
1476
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1491
1477
  return;
1492
1478
  }
1493
- const n = ut(t);
1479
+ const n = gt(t);
1494
1480
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1495
1481
  }
1496
- function Zi(e, t, n) {
1482
+ function sa(e, t, n) {
1497
1483
  const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1498
1484
  if (Number.isFinite(o) && Number.isFinite(i))
1499
1485
  return { x: o, y: i };
1500
- const r = e.getBoundingClientRect();
1501
- if (r.width > 0 || r.height > 0)
1502
- return { x: r.left, y: r.top };
1486
+ const a = e.getBoundingClientRect();
1487
+ if (a.width > 0 || a.height > 0)
1488
+ return { x: a.left, y: a.top };
1503
1489
  const l = Y();
1504
1490
  return {
1505
1491
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1506
1492
  y: l.height - 24 - n.height
1507
1493
  };
1508
1494
  }
1509
- function Tt(e, t, n) {
1510
- const o = dt(e, !1);
1511
- return t ? Vt(
1495
+ function zt(e, t, n) {
1496
+ const o = ct(e, !1);
1497
+ return t ? Xt(
1512
1498
  e,
1513
- ro(t, o),
1499
+ ho(t, o),
1514
1500
  o
1515
- ) : Ji(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Ni);
1501
+ ) : da(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Gi);
1516
1502
  }
1517
- function Ji(e, t, n) {
1503
+ function da(e, t, n) {
1518
1504
  const o = Y();
1519
1505
  return {
1520
1506
  x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1521
1507
  y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1522
1508
  };
1523
1509
  }
1524
- function Vt(e, t, n) {
1525
- const o = Y(), i = I + ta(e);
1510
+ function Xt(e, t, n) {
1511
+ const o = Y(), i = I + ga(e);
1526
1512
  return {
1527
1513
  x: K(
1528
1514
  t.x,
@@ -1542,36 +1528,36 @@ function Vt(e, t, n) {
1542
1528
  )
1543
1529
  };
1544
1530
  }
1545
- function ro(e, t) {
1531
+ function ho(e, t) {
1546
1532
  const n = Y();
1547
1533
  return {
1548
1534
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1549
1535
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1550
1536
  };
1551
1537
  }
1552
- function Qi(e, t) {
1553
- const n = ea(e, t), o = Y();
1538
+ function ca(e, t) {
1539
+ const n = ua(e, t), o = Y();
1554
1540
  return {
1555
1541
  anchor: n,
1556
1542
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1557
1543
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1558
1544
  };
1559
1545
  }
1560
- function ea(e, t) {
1561
- const n = Y(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1562
- return `${r}-${l}`;
1546
+ function ua(e, t) {
1547
+ const n = Y(), o = e.x + t.width / 2, a = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1548
+ return `${a}-${l}`;
1563
1549
  }
1564
- function ta(e) {
1565
- return e.classList.contains("pluno-pa-widget--scribble") ? Fi : Ui;
1550
+ function ga(e) {
1551
+ return e.classList.contains("pluno-pa-widget--scribble") ? Ji : Zi;
1566
1552
  }
1567
- function Dt(e, t, n, o = null) {
1568
- const i = dt(e), r = ze(o), l = {
1569
- x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1570
- y: t.y + i.height - r.height
1553
+ function Mt(e, t, n, o = null) {
1554
+ const i = ct(e), a = ze(o), l = {
1555
+ x: n === "bottom-left" ? t.x : t.x + i.width - a.width,
1556
+ y: t.y + i.height - a.height
1571
1557
  };
1572
- return lt(l, r);
1558
+ return pt(l, a);
1573
1559
  }
1574
- function lt(e, t) {
1560
+ function pt(e, t) {
1575
1561
  const n = Y();
1576
1562
  return {
1577
1563
  x: K(
@@ -1584,34 +1570,34 @@ function lt(e, t) {
1584
1570
  ),
1585
1571
  y: K(
1586
1572
  e.y,
1587
- Ce,
1573
+ Se,
1588
1574
  Math.max(
1589
- Ce,
1575
+ Se,
1590
1576
  n.height - t.height - I
1591
1577
  )
1592
1578
  )
1593
1579
  };
1594
1580
  }
1595
- function ve(e, t) {
1581
+ function Ce(e, t) {
1596
1582
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1597
1583
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1598
1584
  return;
1599
1585
  }
1600
1586
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1601
1587
  }
1602
- function na(e, t) {
1588
+ function ha(e, t) {
1603
1589
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1604
1590
  }
1605
- function Dn(e) {
1591
+ function Bn(e) {
1606
1592
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1607
1593
  }
1608
1594
  function Y() {
1609
1595
  return {
1610
- width: window.innerWidth || document.documentElement.clientWidth || Qn + I * 2,
1611
- height: window.innerHeight || document.documentElement.clientHeight || eo + I * 2
1596
+ width: window.innerWidth || document.documentElement.clientWidth || ro + I * 2,
1597
+ height: window.innerHeight || document.documentElement.clientHeight || lo + I * 2
1612
1598
  };
1613
1599
  }
1614
- function zt(e) {
1600
+ function Ot(e) {
1615
1601
  const t = e.getBoundingClientRect();
1616
1602
  return {
1617
1603
  x: Math.round(t.x),
@@ -1631,46 +1617,46 @@ function J(e, t, n) {
1631
1617
  source: e,
1632
1618
  message: t,
1633
1619
  details: n
1634
- }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1635
- r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1636
- new CustomEvent(Si, { detail: i })
1620
+ }, a = o.__plunoProductAgentDiagnostics__ ?? [];
1621
+ a.push(i), a.length > 120 && a.splice(0, a.length - 120), o.__plunoProductAgentDiagnostics__ = a, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...a], window.dispatchEvent(
1622
+ new CustomEvent(Ri, { detail: i })
1637
1623
  );
1638
1624
  }
1639
- function oa(e, t) {
1625
+ function ma(e, t) {
1640
1626
  J("web-sdk.widget.position", e, t);
1641
1627
  }
1642
- function Rt(e, t, n) {
1628
+ function Ut(e, t, n) {
1643
1629
  const o = t.value.trim();
1644
1630
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1645
- attachments: n.length > 0 ? n.map(ra) : void 0
1631
+ attachments: n.length > 0 ? n.map(ba) : void 0
1646
1632
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1647
1633
  }
1648
- function ia(e, t, n) {
1634
+ function fa(e, t, n) {
1649
1635
  const o = e.activeElement;
1650
1636
  return o === n ? "composer" : o === t ? "launcher" : null;
1651
1637
  }
1652
- function aa(e, t, n, o) {
1653
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > mi)
1638
+ function wa(e, t, n, o) {
1639
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > vi)
1654
1640
  return;
1655
1641
  const i = e.focusedInput === "composer" ? o : n;
1656
1642
  i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1657
1643
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1658
1644
  });
1659
1645
  }
1660
- function ra(e) {
1646
+ function ba(e) {
1661
1647
  return e;
1662
1648
  }
1663
- function je(e) {
1649
+ function Ve(e) {
1664
1650
  e.style.height = "0px";
1665
1651
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1666
1652
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1667
1653
  }
1668
- function Ve(e, t = () => !0) {
1654
+ function Ke(e, t = () => !0) {
1669
1655
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1670
1656
  t() && (e.scrollTop = e.scrollHeight);
1671
1657
  });
1672
1658
  }
1673
- function la(e) {
1659
+ function _a(e) {
1674
1660
  const t = e.messages[e.messages.length - 1];
1675
1661
  return [
1676
1662
  e.messages.length,
@@ -1681,13 +1667,13 @@ function la(e) {
1681
1667
  e.lastError ?? ""
1682
1668
  ].join(":");
1683
1669
  }
1684
- function pa(e) {
1670
+ function xa(e) {
1685
1671
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1686
1672
  }
1687
- function sa(e) {
1673
+ function ya(e) {
1688
1674
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1689
1675
  }
1690
- function da(e) {
1676
+ function va(e) {
1691
1677
  const t = e.currentPage;
1692
1678
  if (typeof t?.url == "string" && t.url.trim())
1693
1679
  try {
@@ -1698,7 +1684,7 @@ function da(e) {
1698
1684
  }
1699
1685
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1700
1686
  }
1701
- function ca(e, t) {
1687
+ function Ca(e, t) {
1702
1688
  const n = new Date(e).getTime();
1703
1689
  if (!Number.isFinite(n))
1704
1690
  return "now";
@@ -1707,103 +1693,103 @@ function ca(e, t) {
1707
1693
  ["hour", 36e5],
1708
1694
  ["min", 6e4]
1709
1695
  ];
1710
- for (const [r, l] of i)
1696
+ for (const [a, l] of i)
1711
1697
  if (o >= l) {
1712
1698
  const p = Math.max(1, Math.floor(o / l));
1713
- return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1699
+ return a === "min" ? `${p} min` : `${p} ${a}${p === 1 ? "" : "s"}`;
1714
1700
  }
1715
1701
  return "now";
1716
1702
  }
1717
- function ua(e, t, n, o, i) {
1718
- e.appendChild(ya()), e.appendChild(
1719
- ga(
1703
+ function Sa(e, t, n, o, i) {
1704
+ e.appendChild(Da()), e.appendChild(
1705
+ Ea(
1720
1706
  t,
1721
1707
  n,
1722
1708
  o,
1723
1709
  i
1724
1710
  )
1725
1711
  ), e.appendChild(
1726
- gt(
1712
+ ht(
1727
1713
  "pluno-pa-widget__close",
1728
1714
  "Close",
1729
- va(16),
1715
+ Ra(16),
1730
1716
  !0
1731
1717
  )
1732
- ), e.appendChild(ha(n));
1718
+ ), e.appendChild(ka(n));
1733
1719
  }
1734
- function ga(e, t, n, o) {
1720
+ function Ea(e, t, n, o) {
1735
1721
  const i = document.createElement("form");
1736
1722
  if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1737
1723
  const d = document.createElement("button");
1738
1724
  d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", i.appendChild(d);
1739
1725
  }
1740
1726
  i.appendChild(
1741
- co(
1727
+ bo(
1742
1728
  "pluno-pa-widget__scribble-spirals--launcher",
1743
1729
  10
1744
1730
  )
1745
1731
  ), i.appendChild(
1746
- me(
1732
+ fe(
1747
1733
  "pluno-pa-widget__character--launcher",
1748
1734
  t
1749
1735
  )
1750
1736
  );
1751
- const r = document.createElement("span");
1752
- r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
1737
+ const a = document.createElement("span");
1738
+ a.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(a);
1753
1739
  const l = document.createElement("input");
1754
1740
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1755
- const p = ct("Working...");
1741
+ const p = ut("Working...");
1756
1742
  if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1757
1743
  const d = document.createElement("button");
1758
1744
  d.type = "button", d.className = "pluno-pa-widget__launcher-minimize", d.textContent = "-", d.setAttribute("aria-label", "Minimize Pluno on this site"), d.title = "Minimize Pluno on this site", i.appendChild(d);
1759
1745
  }
1760
1746
  return i;
1761
1747
  }
1762
- function ha(e) {
1748
+ function ka(e) {
1763
1749
  const t = document.createElement("section");
1764
1750
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1765
- co("pluno-pa-widget__scribble-spirals--panel", 16)
1751
+ bo("pluno-pa-widget__scribble-spirals--panel", 16)
1766
1752
  );
1767
1753
  const n = document.createElement("div");
1768
1754
  n.className = "pluno-pa-widget__timeline-wrap";
1769
1755
  const o = document.createElement("main");
1770
- o.className = "pluno-pa-widget__timeline", o.appendChild(ba(e));
1756
+ o.className = "pluno-pa-widget__timeline", o.appendChild(Ta(e));
1771
1757
  const i = document.createElement("div");
1772
1758
  i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1773
- const r = document.createElement("div");
1774
- r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, n.appendChild(r);
1759
+ const a = document.createElement("div");
1760
+ a.className = "pluno-pa-widget__active-users-counter", a.hidden = !0, n.appendChild(a);
1775
1761
  const l = document.createElement("button");
1776
1762
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1777
1763
  const p = document.createElement("div");
1778
1764
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1779
- gt(
1765
+ ht(
1780
1766
  "pluno-pa-widget__history",
1781
- Kt(),
1782
- Sa(),
1767
+ Zt(),
1768
+ Ma(),
1783
1769
  !0
1784
1770
  )
1785
- ), n.appendChild(p), n.appendChild(wa()), t.appendChild(n), t.appendChild(ma()), t.appendChild(fa()), t.appendChild(he("left", "Resize Pluno from left")), t.appendChild(
1786
- he("right", "Resize Pluno from right")
1787
- ), t.appendChild(he("top", "Resize Pluno from top")), t.appendChild(
1788
- he("bottom", "Resize Pluno from bottom")
1771
+ ), n.appendChild(p), n.appendChild(Ia()), t.appendChild(n), t.appendChild(La()), t.appendChild(Pa()), t.appendChild(me("left", "Resize Pluno from left")), t.appendChild(
1772
+ me("right", "Resize Pluno from right")
1773
+ ), t.appendChild(me("top", "Resize Pluno from top")), t.appendChild(
1774
+ me("bottom", "Resize Pluno from bottom")
1789
1775
  ), t.appendChild(
1790
- he("top-left", "Resize Pluno from top left")
1776
+ me("top-left", "Resize Pluno from top left")
1791
1777
  ), t.appendChild(
1792
- he("top-right", "Resize Pluno from top right")
1778
+ me("top-right", "Resize Pluno from top right")
1793
1779
  ), t.appendChild(
1794
- he("bottom-left", "Resize Pluno from bottom left")
1780
+ me("bottom-left", "Resize Pluno from bottom left")
1795
1781
  ), t.appendChild(
1796
- he("bottom-right", "Resize Pluno from bottom right")
1782
+ me("bottom-right", "Resize Pluno from bottom right")
1797
1783
  ), t;
1798
1784
  }
1799
- function he(e, t) {
1785
+ function me(e, t) {
1800
1786
  const n = document.createElement("button");
1801
1787
  return n.type = "button", n.className = [
1802
1788
  "pluno-pa-widget__resize-handle",
1803
1789
  `pluno-pa-widget__resize-handle--${e}`
1804
1790
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1805
1791
  }
1806
- function ma() {
1792
+ function La() {
1807
1793
  const e = document.createElement("div");
1808
1794
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1809
1795
  const t = document.createElement("span");
@@ -1814,10 +1800,10 @@ function ma() {
1814
1800
  o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
1815
1801
  const i = document.createElement("button");
1816
1802
  i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
1817
- const r = document.createElement("button");
1818
- return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(o, i, r), e.append(t, n), e;
1803
+ const a = document.createElement("button");
1804
+ return a.type = "button", a.className = "pluno-pa-widget__notify-suggestion-never", a.textContent = "Never", n.append(o, i, a), e.append(t, n), e;
1819
1805
  }
1820
- function fa() {
1806
+ function Pa() {
1821
1807
  const e = document.createElement("form");
1822
1808
  e.className = "pluno-pa-widget__composer";
1823
1809
  const t = document.createElement("div");
@@ -1828,14 +1814,14 @@ function fa() {
1828
1814
  o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1829
1815
  const i = document.createElement("div");
1830
1816
  i.className = "pluno-pa-widget__composer-inner";
1831
- const r = document.createElement("input");
1832
- r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1817
+ const a = document.createElement("input");
1818
+ a.className = "pluno-pa-widget__attachment-input", a.type = "file", a.multiple = !0, a.tabIndex = -1, a.setAttribute("aria-hidden", "true"), i.appendChild(a);
1833
1819
  const l = document.createElement("button");
1834
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(ka()), l.appendChild(La()), i.appendChild(l);
1820
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Ua()), l.appendChild(Ba()), i.appendChild(l);
1835
1821
  const p = document.createElement("textarea");
1836
1822
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1837
1823
  const d = document.createElement("button");
1838
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(go()), i.appendChild(d), e.appendChild(i);
1824
+ d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(xo()), i.appendChild(d), e.appendChild(i);
1839
1825
  const c = document.createElement("div");
1840
1826
  c.className = "pluno-pa-widget__composer-meta";
1841
1827
  const u = document.createElement("a");
@@ -1843,42 +1829,42 @@ function fa() {
1843
1829
  const m = document.createElement("span");
1844
1830
  return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
1845
1831
  }
1846
- function Kt() {
1832
+ function Zt() {
1847
1833
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1848
1834
  }
1849
- function wa() {
1835
+ function Ia() {
1850
1836
  const e = document.createElement("section");
1851
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Kt());
1837
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Zt());
1852
1838
  const t = document.createElement("div");
1853
1839
  t.className = "pluno-pa-widget__history-header";
1854
1840
  const n = document.createElement("strong");
1855
- n.textContent = Kt();
1856
- const o = gt(
1841
+ n.textContent = Zt();
1842
+ const o = ht(
1857
1843
  "pluno-pa-widget__history-close",
1858
1844
  "Close recent chats",
1859
- Ea(),
1845
+ Oa(),
1860
1846
  !1
1861
1847
  );
1862
1848
  t.append(n, o);
1863
1849
  const i = document.createElement("div");
1864
1850
  i.className = "pluno-pa-widget__history-list";
1865
- const r = document.createElement("p");
1866
- return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1851
+ const a = document.createElement("p");
1852
+ return a.className = "pluno-pa-widget__history-status", a.hidden = !0, e.append(t, i, a), e;
1867
1853
  }
1868
- function ba(e) {
1854
+ function Ta(e) {
1869
1855
  const t = document.createElement("div");
1870
1856
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1871
- me(
1857
+ fe(
1872
1858
  "pluno-pa-widget__character--empty",
1873
1859
  e
1874
1860
  )
1875
- ), t.appendChild(lo()), t;
1861
+ ), t.appendChild(mo()), t;
1876
1862
  }
1877
- function lo() {
1863
+ function mo() {
1878
1864
  const e = document.createElement("div");
1879
1865
  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;
1880
1866
  }
1881
- function po(e, t) {
1867
+ function fo(e, t) {
1882
1868
  e.replaceChildren(), e.setAttribute(
1883
1869
  "aria-label",
1884
1870
  `${t.toLocaleString("en-US")} users currently active`
@@ -1890,17 +1876,17 @@ function po(e, t) {
1890
1876
  )
1891
1877
  );
1892
1878
  }
1893
- function me(e, t) {
1894
- const n = `pluno-pa-character-${Ln}`;
1895
- Ln += 1;
1896
- const o = t.scribbleStyle ? xa(t.accentColor, n) : _a(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1879
+ function fe(e, t) {
1880
+ const n = `pluno-pa-character-${Dn}`;
1881
+ Dn += 1;
1882
+ const o = t.scribbleStyle ? Na(t.accentColor, n) : Aa(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1897
1883
  return o.setAttribute(
1898
1884
  "class",
1899
1885
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1900
1886
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1901
1887
  }
1902
- function _a(e, t) {
1903
- const n = Yo(e), o = {
1888
+ function Aa(e, t) {
1889
+ const n = ni(e), o = {
1904
1890
  boltFill: `${t}-boltFill`,
1905
1891
  boltEdge: `${t}-boltEdge`,
1906
1892
  boltGlow: `${t}-boltGlow`,
@@ -1911,7 +1897,7 @@ function _a(e, t) {
1911
1897
  eyeShadow: `${t}-eyeShadow`,
1912
1898
  pupilGloss: `${t}-pupilGloss`,
1913
1899
  boltClip: `${t}-boltClip`
1914
- }, i = so(), r = f(i, "defs"), l = f(r, "linearGradient", {
1900
+ }, i = wo(), a = f(i, "defs"), l = f(a, "linearGradient", {
1915
1901
  id: o.boltFill,
1916
1902
  x1: "420",
1917
1903
  y1: "180",
@@ -1920,7 +1906,7 @@ function _a(e, t) {
1920
1906
  gradientUnits: "userSpaceOnUse"
1921
1907
  });
1922
1908
  O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
1923
- const p = f(r, "linearGradient", {
1909
+ const p = f(a, "linearGradient", {
1924
1910
  id: o.boltEdge,
1925
1911
  x1: "470",
1926
1912
  y1: "145",
@@ -1929,28 +1915,28 @@ function _a(e, t) {
1929
1915
  gradientUnits: "userSpaceOnUse"
1930
1916
  });
1931
1917
  O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
1932
- const d = f(r, "radialGradient", {
1918
+ const d = f(a, "radialGradient", {
1933
1919
  id: o.boltGlow,
1934
1920
  cx: "50%",
1935
1921
  cy: "22%",
1936
1922
  r: "82%"
1937
1923
  });
1938
1924
  O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
1939
- const c = f(r, "radialGradient", {
1925
+ const c = f(a, "radialGradient", {
1940
1926
  id: o.eyeWhite,
1941
1927
  cx: "35%",
1942
1928
  cy: "25%",
1943
1929
  r: "70%"
1944
1930
  });
1945
1931
  O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
1946
- const u = f(r, "radialGradient", {
1932
+ const u = f(a, "radialGradient", {
1947
1933
  id: o.pupil,
1948
1934
  cx: "42%",
1949
1935
  cy: "38%",
1950
1936
  r: "65%"
1951
1937
  });
1952
1938
  O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
1953
- const m = f(r, "filter", {
1939
+ const m = f(a, "filter", {
1954
1940
  id: o.softDropShadow,
1955
1941
  x: "-18%",
1956
1942
  y: "-12%",
@@ -1965,7 +1951,7 @@ function _a(e, t) {
1965
1951
  "flood-color": n.shadow,
1966
1952
  "flood-opacity": "0.24"
1967
1953
  });
1968
- const k = f(r, "filter", {
1954
+ const E = f(a, "filter", {
1969
1955
  id: o.innerDepth,
1970
1956
  x: "-8%",
1971
1957
  y: "-8%",
@@ -1973,32 +1959,32 @@ function _a(e, t) {
1973
1959
  height: "116%",
1974
1960
  "color-interpolation-filters": "sRGB"
1975
1961
  });
1976
- f(k, "feGaussianBlur", {
1962
+ f(E, "feGaussianBlur", {
1977
1963
  in: "SourceAlpha",
1978
1964
  stdDeviation: "8",
1979
1965
  result: "blur"
1980
- }), f(k, "feOffset", {
1966
+ }), f(E, "feOffset", {
1981
1967
  dx: "-7",
1982
1968
  dy: "-9",
1983
1969
  result: "topLeft"
1984
- }), f(k, "feComposite", {
1970
+ }), f(E, "feComposite", {
1985
1971
  in: "topLeft",
1986
1972
  in2: "SourceAlpha",
1987
1973
  operator: "arithmetic",
1988
1974
  k2: "-1",
1989
1975
  k3: "1",
1990
1976
  result: "innerShadow"
1991
- }), f(k, "feColorMatrix", {
1977
+ }), f(E, "feColorMatrix", {
1992
1978
  in: "innerShadow",
1993
1979
  type: "matrix",
1994
1980
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1995
1981
  result: "innerLight"
1996
- }), f(k, "feBlend", {
1982
+ }), f(E, "feBlend", {
1997
1983
  in: "SourceGraphic",
1998
1984
  in2: "innerLight",
1999
1985
  mode: "screen"
2000
1986
  });
2001
- const v = f(r, "filter", {
1987
+ const v = f(a, "filter", {
2002
1988
  id: o.eyeShadow,
2003
1989
  x: "-24%",
2004
1990
  y: "-20%",
@@ -2013,7 +1999,7 @@ function _a(e, t) {
2013
1999
  "flood-color": n.shadow,
2014
2000
  "flood-opacity": "0.3"
2015
2001
  });
2016
- const R = f(r, "filter", {
2002
+ const z = f(a, "filter", {
2017
2003
  id: o.pupilGloss,
2018
2004
  x: "-15%",
2019
2005
  y: "-15%",
@@ -2021,29 +2007,29 @@ function _a(e, t) {
2021
2007
  height: "130%",
2022
2008
  "color-interpolation-filters": "sRGB"
2023
2009
  });
2024
- f(R, "feDropShadow", {
2010
+ f(z, "feDropShadow", {
2025
2011
  dx: "0",
2026
2012
  dy: "3",
2027
2013
  stdDeviation: "3",
2028
2014
  "flood-color": "#000000",
2029
2015
  "flood-opacity": "0.22"
2030
2016
  });
2031
- const _ = f(r, "clipPath", { id: o.boltClip });
2032
- f(_, "path", { d: pt });
2017
+ const b = f(a, "clipPath", { id: o.boltClip });
2018
+ f(b, "path", { d: st });
2033
2019
  const g = f(i, "g", {
2034
2020
  filter: V(o.softDropShadow)
2035
2021
  });
2036
2022
  f(g, "path", {
2037
- d: pt,
2023
+ d: st,
2038
2024
  fill: V(o.boltEdge)
2039
2025
  });
2040
- const b = "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";
2026
+ const w = "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";
2041
2027
  f(g, "path", {
2042
- d: b,
2028
+ d: w,
2043
2029
  fill: V(o.boltFill),
2044
2030
  filter: V(o.innerDepth)
2045
2031
  }), f(g, "path", {
2046
- d: b,
2032
+ d: w,
2047
2033
  fill: V(o.boltGlow),
2048
2034
  opacity: "0.74"
2049
2035
  });
@@ -2074,7 +2060,7 @@ function _a(e, t) {
2074
2060
  opacity: "0.48"
2075
2061
  });
2076
2062
  const P = f(i, "g", { filter: V(o.eyeShadow) });
2077
- return zn(
2063
+ return Fn(
2078
2064
  P,
2079
2065
  "rotate(-2 528 463)",
2080
2066
  "528",
@@ -2084,7 +2070,7 @@ function _a(e, t) {
2084
2070
  "557",
2085
2071
  "447",
2086
2072
  o
2087
- ), zn(
2073
+ ), Fn(
2088
2074
  P,
2089
2075
  "rotate(2 717 462)",
2090
2076
  "717",
@@ -2096,13 +2082,13 @@ function _a(e, t) {
2096
2082
  o
2097
2083
  ), i;
2098
2084
  }
2099
- function xa(e, t) {
2100
- const n = Kn(e), o = {
2085
+ function Na(e, t) {
2086
+ const n = eo(e), o = {
2101
2087
  clip: `${t}-scribbleBoltClip`,
2102
2088
  wobble: `${t}-scribbleBoltWobble`
2103
- }, i = so(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2104
- f(l, "path", { d: pt });
2105
- const p = f(r, "filter", {
2089
+ }, i = wo(), a = f(i, "defs"), l = f(a, "clipPath", { id: o.clip });
2090
+ f(l, "path", { d: st });
2091
+ const p = f(a, "filter", {
2106
2092
  id: o.wobble,
2107
2093
  x: "-10%",
2108
2094
  y: "-10%",
@@ -2127,7 +2113,7 @@ function xa(e, t) {
2127
2113
  "clip-path": V(o.clip)
2128
2114
  });
2129
2115
  return f(c, "path", {
2130
- d: Ko(),
2116
+ d: ti(),
2131
2117
  fill: "none",
2132
2118
  stroke: n,
2133
2119
  "stroke-width": "56",
@@ -2136,12 +2122,12 @@ function xa(e, t) {
2136
2122
  opacity: "0.9",
2137
2123
  transform: "rotate(-14 627 600)"
2138
2124
  }), f(d, "path", {
2139
- d: pt,
2125
+ d: st,
2140
2126
  fill: "none",
2141
- stroke: st,
2127
+ stroke: dt,
2142
2128
  "stroke-width": "18",
2143
2129
  "stroke-linejoin": "round"
2144
- }), Rn(
2130
+ }), Hn(
2145
2131
  d,
2146
2132
  "rotate(-2 528 463)",
2147
2133
  "528",
@@ -2150,7 +2136,7 @@ function xa(e, t) {
2150
2136
  "473",
2151
2137
  "557",
2152
2138
  "447"
2153
- ), Rn(
2139
+ ), Hn(
2154
2140
  d,
2155
2141
  "rotate(2 717 462)",
2156
2142
  "717",
@@ -2161,13 +2147,13 @@ function xa(e, t) {
2161
2147
  "447"
2162
2148
  ), i;
2163
2149
  }
2164
- function so() {
2165
- return E("svg", {
2166
- xmlns: to,
2150
+ function wo() {
2151
+ return S("svg", {
2152
+ xmlns: po,
2167
2153
  viewBox: "0 0 1254 1254"
2168
2154
  });
2169
2155
  }
2170
- function zn(e, t, n, o, i, r, l, p, d) {
2156
+ function Fn(e, t, n, o, i, a, l, p, d) {
2171
2157
  const c = f(e, "g", { transform: t });
2172
2158
  f(c, "ellipse", {
2173
2159
  cx: n,
@@ -2177,7 +2163,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
2177
2163
  fill: V(d.eyeWhite)
2178
2164
  }), f(c, "ellipse", {
2179
2165
  cx: i,
2180
- cy: r,
2166
+ cy: a,
2181
2167
  rx: "49",
2182
2168
  ry: "57",
2183
2169
  fill: V(d.pupil),
@@ -2189,7 +2175,7 @@ function zn(e, t, n, o, i, r, l, p, d) {
2189
2175
  fill: "#ffffff"
2190
2176
  });
2191
2177
  }
2192
- function Rn(e, t, n, o, i, r, l, p) {
2178
+ function Hn(e, t, n, o, i, a, l, p) {
2193
2179
  const d = f(e, "g", { transform: t });
2194
2180
  f(d, "ellipse", {
2195
2181
  cx: n,
@@ -2197,14 +2183,14 @@ function Rn(e, t, n, o, i, r, l, p) {
2197
2183
  rx: "73",
2198
2184
  ry: "80",
2199
2185
  fill: "#ffffff",
2200
- stroke: st,
2186
+ stroke: dt,
2201
2187
  "stroke-width": "13"
2202
2188
  }), f(d, "ellipse", {
2203
2189
  cx: i,
2204
- cy: r,
2190
+ cy: a,
2205
2191
  rx: "45",
2206
2192
  ry: "53",
2207
- fill: st
2193
+ fill: dt
2208
2194
  }), f(d, "circle", {
2209
2195
  cx: l,
2210
2196
  cy: p,
@@ -2213,7 +2199,7 @@ function Rn(e, t, n, o, i, r, l, p) {
2213
2199
  });
2214
2200
  }
2215
2201
  function f(e, t, n = {}) {
2216
- const o = E(t, n);
2202
+ const o = S(t, n);
2217
2203
  return e.appendChild(o), o;
2218
2204
  }
2219
2205
  function O(e, t, n, o) {
@@ -2223,61 +2209,61 @@ function O(e, t, n, o) {
2223
2209
  function V(e) {
2224
2210
  return `url(#${e})`;
2225
2211
  }
2226
- function gt(e, t, n, o) {
2212
+ function ht(e, t, n, o) {
2227
2213
  const i = document.createElement("button");
2228
2214
  return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2229
2215
  }
2230
- function ya() {
2231
- const e = E("svg", {
2216
+ function Da() {
2217
+ const e = S("svg", {
2232
2218
  class: "pluno-pa-widget__scribble-defs",
2233
2219
  "aria-hidden": "true",
2234
2220
  focusable: "false",
2235
2221
  width: "0",
2236
2222
  height: "0"
2237
- }), t = E("defs");
2238
- return t.appendChild(Ot("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2239
- Ot("pluno-pa-scribble-wobble-2", "5", "15")
2223
+ }), t = S("defs");
2224
+ return t.appendChild(Ft("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2225
+ Ft("pluno-pa-scribble-wobble-2", "5", "15")
2240
2226
  ), t.appendChild(
2241
- Ot("pluno-pa-scribble-wobble-3", "9", "19")
2227
+ Ft("pluno-pa-scribble-wobble-3", "9", "19")
2242
2228
  ), e.appendChild(t), e;
2243
2229
  }
2244
- function co(e, t) {
2245
- const n = E("svg", {
2230
+ function bo(e, t) {
2231
+ const n = S("svg", {
2246
2232
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2247
2233
  preserveAspectRatio: "xMidYMid meet",
2248
2234
  "aria-hidden": "true",
2249
2235
  focusable: "false"
2250
2236
  });
2251
- return uo(n, t), n;
2237
+ return _o(n, t), n;
2252
2238
  }
2253
- function Mt(e, t) {
2239
+ function Bt(e, t) {
2254
2240
  if (!e)
2255
2241
  return;
2256
2242
  const n = Math.max(
2257
2243
  0,
2258
- t - qt * 2
2244
+ t - Kt * 2
2259
2245
  ), o = Math.max(
2260
- Bi,
2246
+ Xi,
2261
2247
  Math.floor(
2262
- (n - $t * 2) / Gt
2248
+ (n - Vt * 2) / jt
2263
2249
  )
2264
2250
  );
2265
- uo(e, o);
2251
+ _o(e, o);
2266
2252
  }
2267
- function uo(e, t) {
2253
+ function _o(e, t) {
2268
2254
  if (e.dataset.spiralCount === `${t}`)
2269
2255
  return;
2270
- const n = t * Gt + $t * 2;
2256
+ const n = t * jt + Vt * 2;
2271
2257
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2272
2258
  "viewBox",
2273
- `0 0 ${n} ${Oi}`
2259
+ `0 0 ${n} ${Yi}`
2274
2260
  ), e.replaceChildren();
2275
2261
  for (let o = 0; o < t; o += 1) {
2276
- const i = kn[o % kn.length], r = E("g", {
2277
- transform: `translate(${$t + o * Gt} 0)`
2262
+ const i = Nn[o % Nn.length], a = S("g", {
2263
+ transform: `translate(${Vt + o * jt} 0)`
2278
2264
  });
2279
- r.appendChild(
2280
- E("ellipse", {
2265
+ a.appendChild(
2266
+ S("ellipse", {
2281
2267
  cx: i.ellipseCx,
2282
2268
  cy: i.ellipseCy,
2283
2269
  rx: i.ellipseRx,
@@ -2287,19 +2273,19 @@ function uo(e, t) {
2287
2273
  "stroke-width": i.strokeWidth,
2288
2274
  opacity: "0.8"
2289
2275
  })
2290
- ), r.appendChild(
2291
- E("path", {
2276
+ ), a.appendChild(
2277
+ S("path", {
2292
2278
  d: i.path,
2293
2279
  fill: "none",
2294
2280
  stroke: "#2c2a1e",
2295
2281
  "stroke-width": i.pathStrokeWidth,
2296
2282
  "stroke-linecap": "round"
2297
2283
  })
2298
- ), e.appendChild(r);
2284
+ ), e.appendChild(a);
2299
2285
  }
2300
2286
  }
2301
- function Ot(e, t, n) {
2302
- const o = E("filter", {
2287
+ function Ft(e, t, n) {
2288
+ const o = S("filter", {
2303
2289
  id: e,
2304
2290
  x: "-8%",
2305
2291
  y: "-8%",
@@ -2307,7 +2293,7 @@ function Ot(e, t, n) {
2307
2293
  height: "116%"
2308
2294
  });
2309
2295
  return o.appendChild(
2310
- E("feTurbulence", {
2296
+ S("feTurbulence", {
2311
2297
  type: "fractalNoise",
2312
2298
  baseFrequency: "0.012 0.028",
2313
2299
  numOctaves: "3",
@@ -2315,7 +2301,7 @@ function Ot(e, t, n) {
2315
2301
  result: "stroke-noise"
2316
2302
  })
2317
2303
  ), o.appendChild(
2318
- E("feDisplacementMap", {
2304
+ S("feDisplacementMap", {
2319
2305
  in: "SourceGraphic",
2320
2306
  in2: "stroke-noise",
2321
2307
  scale: "3.5",
@@ -2324,7 +2310,7 @@ function Ot(e, t, n) {
2324
2310
  result: "warped"
2325
2311
  })
2326
2312
  ), o.appendChild(
2327
- E("feTurbulence", {
2313
+ S("feTurbulence", {
2328
2314
  type: "fractalNoise",
2329
2315
  baseFrequency: "0.7",
2330
2316
  numOctaves: "1",
@@ -2332,7 +2318,7 @@ function Ot(e, t, n) {
2332
2318
  result: "ink-noise"
2333
2319
  })
2334
2320
  ), o.appendChild(
2335
- E("feDisplacementMap", {
2321
+ S("feDisplacementMap", {
2336
2322
  in: "warped",
2337
2323
  in2: "ink-noise",
2338
2324
  scale: "0.9",
@@ -2341,7 +2327,7 @@ function Ot(e, t, n) {
2341
2327
  })
2342
2328
  ), o;
2343
2329
  }
2344
- function va(e) {
2330
+ function Ra(e) {
2345
2331
  const t = re(
2346
2332
  "0 0 24 24",
2347
2333
  e,
@@ -2350,9 +2336,9 @@ function va(e) {
2350
2336
  "currentColor",
2351
2337
  "2.25"
2352
2338
  );
2353
- return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
2339
+ return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
2354
2340
  }
2355
- function Ca() {
2341
+ function za() {
2356
2342
  const e = re(
2357
2343
  "0 0 24 24",
2358
2344
  17,
@@ -2362,16 +2348,16 @@ function Ca() {
2362
2348
  "2.25"
2363
2349
  );
2364
2350
  return e.appendChild(
2365
- E("path", {
2351
+ S("path", {
2366
2352
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
2367
2353
  })
2368
2354
  ), e.appendChild(
2369
- E("path", {
2355
+ S("path", {
2370
2356
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
2371
2357
  })
2372
2358
  ), e;
2373
2359
  }
2374
- function Sa() {
2360
+ function Ma() {
2375
2361
  const e = re(
2376
2362
  "0 0 24 24",
2377
2363
  17,
@@ -2380,9 +2366,9 @@ function Sa() {
2380
2366
  "currentColor",
2381
2367
  "2.25"
2382
2368
  );
2383
- return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
2369
+ return e.appendChild(S("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(S("path", { d: "M3 4v5h5" })), e.appendChild(S("path", { d: "M12 7v5l3 2" })), e;
2384
2370
  }
2385
- function Ea() {
2371
+ function Oa() {
2386
2372
  const e = re(
2387
2373
  "0 0 24 24",
2388
2374
  15,
@@ -2391,9 +2377,9 @@ function Ea() {
2391
2377
  "currentColor",
2392
2378
  "2.4"
2393
2379
  );
2394
- return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2380
+ return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
2395
2381
  }
2396
- function go() {
2382
+ function xo() {
2397
2383
  const e = re(
2398
2384
  "0 0 24 24",
2399
2385
  14,
@@ -2403,10 +2389,10 @@ function go() {
2403
2389
  "2.75"
2404
2390
  );
2405
2391
  return e.appendChild(
2406
- E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2407
- ), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
2392
+ S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2393
+ ), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
2408
2394
  }
2409
- function ka() {
2395
+ function Ua() {
2410
2396
  const e = re(
2411
2397
  "0 0 24 24",
2412
2398
  16,
@@ -2419,18 +2405,18 @@ function ka() {
2419
2405
  "class",
2420
2406
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
2421
2407
  ), e.appendChild(
2422
- E("path", {
2408
+ S("path", {
2423
2409
  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"
2424
2410
  })
2425
2411
  ), e;
2426
2412
  }
2427
- function La() {
2413
+ function Ba() {
2428
2414
  const e = re("0 0 24 24", 19, 19, "none", "currentColor");
2429
2415
  return e.setAttribute(
2430
2416
  "class",
2431
2417
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
2432
2418
  ), e.appendChild(
2433
- E("path", {
2419
+ S("path", {
2434
2420
  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",
2435
2421
  stroke: "currentColor",
2436
2422
  "stroke-width": "2",
@@ -2439,10 +2425,10 @@ function La() {
2439
2425
  })
2440
2426
  ), e;
2441
2427
  }
2442
- function Pa() {
2428
+ function Fa() {
2443
2429
  const e = re("0 0 24 24", 18, 18, "currentColor");
2444
2430
  return e.appendChild(
2445
- E("rect", {
2431
+ S("rect", {
2446
2432
  x: "6",
2447
2433
  y: "6",
2448
2434
  width: "12",
@@ -2451,7 +2437,7 @@ function Pa() {
2451
2437
  })
2452
2438
  ), e;
2453
2439
  }
2454
- function Ia() {
2440
+ function Ha() {
2455
2441
  const e = re(
2456
2442
  "0 0 24 24",
2457
2443
  12,
@@ -2460,9 +2446,9 @@ function Ia() {
2460
2446
  "currentColor",
2461
2447
  "2.4"
2462
2448
  );
2463
- return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2449
+ return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
2464
2450
  }
2465
- function Aa() {
2451
+ function Wa() {
2466
2452
  const e = re(
2467
2453
  "0 0 24 24",
2468
2454
  13,
@@ -2472,7 +2458,7 @@ function Aa() {
2472
2458
  "2.25"
2473
2459
  );
2474
2460
  return e.appendChild(
2475
- E("rect", {
2461
+ S("rect", {
2476
2462
  width: "14",
2477
2463
  height: "14",
2478
2464
  x: "8",
@@ -2481,12 +2467,12 @@ function Aa() {
2481
2467
  ry: "2"
2482
2468
  })
2483
2469
  ), e.appendChild(
2484
- E("path", {
2470
+ S("path", {
2485
2471
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2486
2472
  })
2487
2473
  ), e;
2488
2474
  }
2489
- function re(e, t, n, o, i, r) {
2475
+ function re(e, t, n, o, i, a) {
2490
2476
  const l = {
2491
2477
  viewBox: e,
2492
2478
  width: String(t),
@@ -2494,188 +2480,165 @@ function re(e, t, n, o, i, r) {
2494
2480
  fill: o,
2495
2481
  "aria-hidden": "true"
2496
2482
  };
2497
- return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
2483
+ return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), a && (l["stroke-width"] = a), S("svg", l);
2498
2484
  }
2499
- function E(e, t = {}) {
2500
- const n = document.createElementNS(to, e);
2485
+ function S(e, t = {}) {
2486
+ const n = document.createElementNS(po, e);
2501
2487
  for (const [o, i] of Object.entries(t))
2502
2488
  n.setAttribute(o, i);
2503
2489
  return n;
2504
2490
  }
2505
- function Mn(e) {
2491
+ function Wn(e) {
2506
2492
  for (const t of ["keydown", "keypress", "keyup"])
2507
2493
  e.addEventListener(t, (n) => {
2508
2494
  n.stopPropagation();
2509
2495
  });
2510
2496
  }
2511
- function Na(e, t, n) {
2497
+ function Ga(e, t, n) {
2512
2498
  e.replaceChildren(), e.hidden = t.length === 0;
2513
2499
  for (const [o, i] of t.entries()) {
2514
- const r = document.createElement("div");
2515
- r.className = "pluno-pa-widget__attachment", r.appendChild(Ta(i));
2500
+ const a = document.createElement("div");
2501
+ a.className = "pluno-pa-widget__attachment", a.appendChild($a(i));
2516
2502
  const l = document.createElement("span");
2517
- l.textContent = i.name, r.appendChild(l);
2503
+ l.textContent = i.name, a.appendChild(l);
2518
2504
  const p = document.createElement("button");
2519
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ia()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2505
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Ha()), p.addEventListener("click", () => n(o)), a.appendChild(p), e.appendChild(a);
2520
2506
  }
2521
2507
  }
2522
- function Ta(e) {
2523
- const t = en(e), n = ho(e);
2508
+ function $a(e) {
2509
+ const t = on(e), n = yo(e);
2524
2510
  if (t === "image" && n) {
2525
2511
  const o = document.createElement("img");
2526
- return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener(
2527
- "error",
2528
- () => o.replaceWith(ie(e))
2529
- ), o;
2512
+ return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o;
2530
2513
  }
2531
2514
  if (t === "video" && n) {
2532
2515
  const o = document.createElement("video");
2533
- return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener(
2534
- "error",
2535
- () => o.replaceWith(ie(e))
2536
- ), o.addEventListener(
2537
- "stalled",
2538
- () => o.replaceWith(ie(e))
2539
- ), o;
2516
+ return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o.addEventListener("stalled", () => o.replaceWith(ie(e))), o;
2540
2517
  }
2541
2518
  return ie(e);
2542
2519
  }
2543
- function Da(e) {
2544
- const t = en(e), n = ho(e);
2520
+ function qa(e) {
2521
+ const t = on(e), n = yo(e);
2545
2522
  if (t === "image" && n) {
2546
2523
  const o = document.createElement("img");
2547
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener(
2548
- "error",
2549
- () => o.replaceWith(ie(e, "message"))
2550
- ), o;
2524
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o;
2551
2525
  }
2552
2526
  if (t === "pdf" && n) {
2553
2527
  const o = document.createElement("object");
2554
- return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener(
2555
- "error",
2556
- () => o.replaceWith(
2557
- ie(e, "message")
2558
- )
2559
- ), o.appendChild(ie(e, "message")), o;
2528
+ return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.appendChild(ie(e, "message")), o;
2560
2529
  }
2561
2530
  if (t === "video" && n) {
2562
2531
  const o = document.createElement("video");
2563
- return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener(
2564
- "error",
2565
- () => o.replaceWith(ie(e, "message"))
2566
- ), o.addEventListener(
2567
- "stalled",
2568
- () => o.replaceWith(ie(e, "message"))
2569
- ), o;
2532
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(ie(e, "message"))), o;
2570
2533
  }
2571
2534
  return ie(e, "message");
2572
2535
  }
2573
2536
  function ie(e, t = "composer") {
2574
2537
  if (t === "composer") {
2575
- const r = document.createElement("span");
2576
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = On(e), r;
2538
+ const a = document.createElement("span");
2539
+ return a.className = "pluno-pa-widget__attachment-file", a.textContent = Gn(e), a;
2577
2540
  }
2578
2541
  const n = document.createElement("div");
2579
2542
  n.className = "pluno-pa-widget__message-attachment-file";
2580
2543
  const o = document.createElement("span");
2581
- o.textContent = On(e);
2544
+ o.textContent = Gn(e);
2582
2545
  const i = document.createElement("strong");
2583
2546
  return i.textContent = e.name, n.append(o, i), n;
2584
2547
  }
2585
- function en(e) {
2548
+ function on(e) {
2586
2549
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2587
2550
  }
2588
- function ho(e) {
2551
+ function yo(e) {
2589
2552
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2590
2553
  }
2591
- function On(e) {
2592
- const t = en(e);
2554
+ function Gn(e) {
2555
+ const t = on(e);
2593
2556
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2594
2557
  }
2595
- function za(e, t) {
2558
+ function ja(e, t) {
2596
2559
  return t ? Array.from(t).map((o) => ({
2597
2560
  ...e.createLocalAttachment(o),
2598
- previewUrl: Ra(o)
2561
+ previewUrl: Va(o)
2599
2562
  })) : [];
2600
2563
  }
2601
- function Ra(e) {
2564
+ function Va(e) {
2602
2565
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2603
2566
  }
2604
- function it(e) {
2567
+ function at(e) {
2605
2568
  return !!(e && Array.from(e.types).includes("Files"));
2606
2569
  }
2607
- function Bt(e, t, n = null) {
2608
- if (!e || !Yt(t, n)) {
2570
+ function Ht(e, t, n = null) {
2571
+ if (!e || !Jt(t, n)) {
2609
2572
  e && (e.hidden = !0, e.replaceChildren());
2610
2573
  return;
2611
2574
  }
2612
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || tn(n) ? e.appendChild(
2613
- Ma(t, n)
2614
- ) : mo(t) && e.appendChild(Oa(t));
2575
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || an(n) ? e.appendChild(
2576
+ Ka(t, n)
2577
+ ) : vo(t) && e.appendChild(Ya(t));
2615
2578
  }
2616
- function Ma(e, t) {
2579
+ function Ka(e, t) {
2617
2580
  const n = document.createElement("div");
2618
2581
  n.className = "pluno-pa-widget__billing-action-card";
2619
2582
  const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2620
2583
  i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2621
- const r = document.createElement("span");
2622
- return r.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
2623
- fo(
2584
+ const a = document.createElement("span");
2585
+ return a.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(a), n.appendChild(
2586
+ Co(
2624
2587
  e,
2625
2588
  "Upgrade plan",
2626
2589
  "pluno-pa-widget__billing-action-card-actions"
2627
2590
  )
2628
2591
  ), n;
2629
2592
  }
2630
- function Oa(e) {
2593
+ function Ya(e) {
2631
2594
  const t = document.createElement("div");
2632
2595
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2633
2596
  const n = document.createElement("strong");
2634
2597
  n.textContent = "Credits running low", t.appendChild(n);
2635
2598
  const o = document.createElement("span");
2636
- return o.textContent = Ua(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2637
- fo(
2599
+ return o.textContent = Za(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2600
+ Co(
2638
2601
  e,
2639
2602
  "Upgrade",
2640
2603
  "pluno-pa-widget__billing-action-card-actions"
2641
2604
  )
2642
2605
  ), t;
2643
2606
  }
2644
- function Yt(e, t) {
2645
- return e !== null && (ae(e) || mo(e) || tn(t));
2607
+ function Jt(e, t) {
2608
+ return e !== null && (ae(e) || vo(e) || an(t));
2646
2609
  }
2647
- function Bn(e, t, n) {
2648
- return Yt(t, n) || Ba(t) ? !0 : !Yt(e, n);
2610
+ function $n(e, t, n) {
2611
+ return Jt(t, n) || Xa(t) ? !0 : !Jt(e, n);
2649
2612
  }
2650
- function Ba(e) {
2613
+ function Xa(e) {
2651
2614
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
2652
2615
  }
2653
2616
  function ae(e) {
2654
2617
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2655
2618
  }
2656
- function tn(e) {
2619
+ function an(e) {
2657
2620
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2658
2621
  }
2659
- function mo(e) {
2622
+ function vo(e) {
2660
2623
  return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2661
2624
  }
2662
- function Ua(e) {
2663
- return e.creditsRemaining === null ? null : `${Fa(e.creditsRemaining)} credits left`;
2625
+ function Za(e) {
2626
+ return e.creditsRemaining === null ? null : `${Ja(e.creditsRemaining)} credits left`;
2664
2627
  }
2665
- function Fa(e) {
2628
+ function Ja(e) {
2666
2629
  return new Intl.NumberFormat("en-US", {
2667
2630
  maximumFractionDigits: 0
2668
2631
  }).format(Math.ceil(e));
2669
2632
  }
2670
- function fo(e, t, n) {
2633
+ function Co(e, t, n) {
2671
2634
  const o = document.createElement("div");
2672
2635
  return o.className = n, o.appendChild(
2673
- Un(t, e.pricingUrl)
2636
+ qn(t, e.pricingUrl)
2674
2637
  ), o.appendChild(
2675
- Un("Earn credits", e.earnCreditsUrl)
2638
+ qn("Earn credits", e.earnCreditsUrl)
2676
2639
  ), o;
2677
2640
  }
2678
- function Un(e, t) {
2641
+ function qn(e, t) {
2679
2642
  const n = document.createElement("button");
2680
2643
  if (n.type = "button", e === "Earn credits") {
2681
2644
  const o = document.createElement("span");
@@ -2686,137 +2649,123 @@ function Un(e, t) {
2686
2649
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2687
2650
  }), n;
2688
2651
  }
2689
- function Ut(e, t) {
2652
+ function Wt(e, t) {
2690
2653
  return e.messages.filter(
2691
- (o) => !wo(o)
2654
+ (o) => !So(o)
2692
2655
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2693
2656
  }
2694
- function Ha(e, t, n, o, i, r, l, p, d, c, u, m, k, v, R, _) {
2695
- const g = qa(r), b = g.filter(
2696
- (C) => !wo(C)
2697
- ), h = e.scrollTop, P = [], A = /* @__PURE__ */ new Set(), L = (C) => {
2657
+ function Qa(e, t, n, o, i, a, l, p, d, c, u, m, E, v, z, b) {
2658
+ const g = or(a), w = g.filter(
2659
+ (C) => !So(C)
2660
+ ), h = e.scrollTop, P = [], T = /* @__PURE__ */ new Set(), k = (C) => {
2698
2661
  P.push(C);
2699
2662
  };
2700
- _o(n, r.isThinking), i.hidden = !p, p && l !== null && po(i, l);
2701
- const F = b.length > 0 || !!r.assistantDraft || r.isThinking;
2702
- if (o(F), b.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2663
+ ko(n, a.isThinking), i.hidden = !p, p && l !== null && fo(i, l);
2664
+ const F = w.length > 0 || !!a.assistantDraft || a.isThinking;
2665
+ if (o(F), w.length === 0 && !a.assistantDraft && !a.lastError && !a.isThinking) {
2703
2666
  const C = document.createElement("div");
2704
2667
  C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2705
- const T = document.createElement("div");
2706
- T.className = "pluno-pa-widget__empty-hero";
2707
- const Se = me(
2668
+ const N = document.createElement("div");
2669
+ N.className = "pluno-pa-widget__empty-hero";
2670
+ const Ee = fe(
2708
2671
  "pluno-pa-widget__character--empty",
2709
2672
  v()
2710
2673
  );
2711
- T.appendChild(Se), C.appendChild(T), C.appendChild(lo());
2674
+ N.appendChild(Ee), C.appendChild(N), C.appendChild(mo());
2712
2675
  const q = document.createElement("div");
2713
- if (q.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && q.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2714
- for (const z of r.starterPrompts) {
2676
+ if (q.className = a.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", a.starterPrompts.length === 0 && !a.starterPromptsLoading && q.setAttribute("aria-hidden", "true"), a.starterPrompts.length > 0)
2677
+ for (const R of a.starterPrompts) {
2715
2678
  const D = document.createElement("button");
2716
- D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${z}"`, D.addEventListener("click", () => {
2717
- R(z);
2679
+ D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${R}"`, D.addEventListener("click", () => {
2680
+ z(R);
2718
2681
  }), q.appendChild(D);
2719
2682
  }
2720
- else if (r.starterPromptsLoading) {
2721
- const z = document.createElement("button");
2722
- z.type = "button", z.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", z.disabled = !0, z.tabIndex = -1, z.textContent = "Generating example tasks...", q.appendChild(z);
2683
+ else if (a.starterPromptsLoading) {
2684
+ const R = document.createElement("button");
2685
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", R.disabled = !0, R.tabIndex = -1, R.textContent = "Generating example tasks...", q.appendChild(R);
2723
2686
  } else
2724
- for (let z = 0; z < Ei; z += 1) {
2687
+ for (let R = 0; R < zi; R += 1) {
2725
2688
  const D = document.createElement("button");
2726
2689
  D.type = "button", D.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", D.disabled = !0, D.tabIndex = -1, D.textContent = "", q.appendChild(D);
2727
2690
  }
2728
- C.appendChild(q), m.clear(), L(C), L(t), Fn(e, P);
2691
+ C.appendChild(q), m.clear(), k(C), k(t), jn(e, P);
2729
2692
  return;
2730
2693
  }
2731
2694
  let H = null, $ = null, Q = [];
2732
- const Re = b.some(Xt), x = () => {
2695
+ const Me = w.some(Qt), x = () => {
2733
2696
  if (Q.length === 0)
2734
2697
  return !1;
2735
- const C = tr(
2698
+ const C = gr(
2736
2699
  Q,
2737
2700
  u,
2738
- k,
2701
+ E,
2739
2702
  v()
2740
2703
  );
2741
- return L(C), H = null, $ = C, Q = [], !0;
2704
+ return k(C), H = null, $ = C, Q = [], !0;
2742
2705
  };
2743
- for (let C = 0; C < b.length; C += 1) {
2744
- const T = b[C];
2745
- if (T.role === "tool") {
2746
- Q.push(T);
2706
+ for (let C = 0; C < w.length; C += 1) {
2707
+ const N = w[C];
2708
+ if (N.role === "tool") {
2709
+ Q.push(N);
2747
2710
  continue;
2748
2711
  }
2749
- if (Xt(T)) {
2712
+ if (Qt(N)) {
2750
2713
  if (x()) {
2751
- const N = ct();
2752
- L(N), H = null, $ = N;
2714
+ const A = ut();
2715
+ k(A), H = null, $ = A;
2753
2716
  } else {
2754
- const N = Gn(v());
2755
- L(N), H = null, $ = N;
2717
+ const A = Yn(v());
2718
+ k(A), H = null, $ = A;
2756
2719
  }
2757
2720
  continue;
2758
2721
  }
2759
- if (T.role === "system")
2722
+ if (N.role === "system")
2760
2723
  continue;
2761
- const Se = x(), q = er(T.content);
2762
- if (T.role === "assistant" && !Se) {
2763
- const D = bo(v());
2764
- L(D), H = null, $ = D;
2765
- }
2766
- const z = Wa(
2767
- T,
2768
- q,
2769
- m,
2770
- A
2771
- );
2772
- L(z), H = z, $ = null;
2724
+ const Ee = x(), q = ur(N.content);
2725
+ if (N.role === "assistant" && !Ee) {
2726
+ const D = Eo(v());
2727
+ k(D), H = null, $ = D;
2728
+ }
2729
+ const R = er(N, q, m, T);
2730
+ k(R), H = R, $ = null;
2773
2731
  }
2774
- const de = x(), Ye = b[b.length - 1]?.id === "assistant-draft";
2775
- if (r.isThinking && !Ye && !Re)
2776
- if (de) {
2777
- const C = ct();
2778
- L(C), H = null, $ = C;
2732
+ const ce = x(), Xe = w[w.length - 1]?.id === "assistant-draft";
2733
+ if (a.isThinking && !Xe && !Me)
2734
+ if (ce) {
2735
+ const C = ut();
2736
+ k(C), H = null, $ = C;
2779
2737
  } else {
2780
- const C = Gn(v());
2781
- L(C), H = null, $ = C;
2738
+ const C = Yn(v());
2739
+ k(C), H = null, $ = C;
2782
2740
  }
2783
- if (r.lastError) {
2741
+ if (a.lastError) {
2784
2742
  const C = document.createElement("div");
2785
- C.className = "pluno-pa-widget__error", C.textContent = r.lastError, L(C), H = C, $ = null;
2743
+ C.className = "pluno-pa-widget__error", C.textContent = a.lastError, k(C), H = C, $ = null;
2786
2744
  }
2787
- const X = _ && !r.isThinking ? Qo(g) : null;
2788
- if (_ && X && !_.dismissedCandidateIds.has(X.id)) {
2789
- const C = Ka(X, {
2790
- isDrafting: _.draftingCandidateId === X.id,
2791
- error: _.error,
2792
- characterIconOptions: _.characterIconOptions,
2793
- onDraft: _.onDraft,
2794
- onDismiss: _.onDismiss,
2795
- onDisable: _.onDisable
2745
+ const X = b && !a.isThinking ? ri(g) : null;
2746
+ if (b && X && !b.dismissedCandidateIds.has(X.id)) {
2747
+ const C = rr(X, {
2748
+ isDrafting: b.draftingCandidateId === X.id,
2749
+ error: b.error,
2750
+ characterIconOptions: b.characterIconOptions,
2751
+ onDraft: b.onDraft,
2752
+ onDismiss: b.onDismiss,
2753
+ onDisable: b.onDisable
2796
2754
  });
2797
- L(C), _.onSeen(X), H = null, $ = C;
2755
+ k(C), b.onSeen(X), H = null, $ = C;
2798
2756
  }
2799
- H?.classList.add(
2800
- "pluno-pa-widget__message--bottom-reserve"
2801
- ), $?.classList.add(
2802
- "pluno-pa-widget__bottom-reserve-compact"
2803
- ), L(t), $a(
2804
- m,
2805
- A
2806
- ), Fn(e, P), d ? Ve(e, c) : e.scrollTop = h;
2807
- }
2808
- function Wa(e, t, n, o) {
2809
- const i = Ga(e, t), r = i ? n.get(i) : void 0;
2810
- if (i && r)
2811
- return r.classList.remove(
2812
- "pluno-pa-widget__message--bottom-reserve"
2813
- ), o.add(i), r;
2757
+ H?.classList.add("pluno-pa-widget__message--bottom-reserve"), $?.classList.add("pluno-pa-widget__bottom-reserve-compact"), k(t), nr(m, T), jn(e, P), d ? Ke(e, c) : e.scrollTop = h;
2758
+ }
2759
+ function er(e, t, n, o) {
2760
+ const i = tr(e, t), a = i ? n.get(i) : void 0;
2761
+ if (i && a)
2762
+ return a.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), a;
2814
2763
  const l = document.createElement("div");
2815
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? or(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(ja(e.attachments));
2764
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? mr(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(ir(e.attachments));
2816
2765
  const p = document.createElement("div");
2817
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Va(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2766
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(ar(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2818
2767
  }
2819
- function Ga(e, t) {
2768
+ function tr(e, t) {
2820
2769
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2821
2770
  id: e.id,
2822
2771
  content: t,
@@ -2834,11 +2783,11 @@ function Ga(e, t) {
2834
2783
  })
2835
2784
  });
2836
2785
  }
2837
- function $a(e, t) {
2786
+ function nr(e, t) {
2838
2787
  for (const n of e.keys())
2839
2788
  t.has(n) || e.delete(n);
2840
2789
  }
2841
- function Fn(e, t) {
2790
+ function jn(e, t) {
2842
2791
  let n = e.firstChild;
2843
2792
  for (const o of t) {
2844
2793
  if (o === n) {
@@ -2852,7 +2801,7 @@ function Fn(e, t) {
2852
2801
  n = n.nextSibling, e.removeChild(o);
2853
2802
  }
2854
2803
  }
2855
- function qa(e) {
2804
+ function or(e) {
2856
2805
  if (!e.assistantDraft)
2857
2806
  return [...e.messages];
2858
2807
  const t = {
@@ -2867,12 +2816,12 @@ function qa(e) {
2867
2816
  if (!t.respondsToUserMessageId)
2868
2817
  return [...e.messages, t];
2869
2818
  const n = e.messages.findIndex(
2870
- (r) => r.role === "user" && r.id === t.respondsToUserMessageId
2819
+ (a) => a.role === "user" && a.id === t.respondsToUserMessageId
2871
2820
  );
2872
2821
  if (n === -1)
2873
2822
  return [...e.messages, t];
2874
2823
  const o = e.messages.findIndex(
2875
- (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Hn(r, t) && Xt(r)
2824
+ (a, l) => l > n && a.role !== "user" && a.respondsToUserMessageId === t.respondsToUserMessageId && Vn(a, t) && Qt(a)
2876
2825
  );
2877
2826
  if (o !== -1)
2878
2827
  return [
@@ -2881,7 +2830,7 @@ function qa(e) {
2881
2830
  ...e.messages.slice(o + 1)
2882
2831
  ];
2883
2832
  let i = n + 1;
2884
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Hn(e.messages[i], t); )
2833
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Vn(e.messages[i], t); )
2885
2834
  i += 1;
2886
2835
  return [
2887
2836
  ...e.messages.slice(0, i),
@@ -2889,17 +2838,17 @@ function qa(e) {
2889
2838
  ...e.messages.slice(i)
2890
2839
  ];
2891
2840
  }
2892
- function Xt(e) {
2841
+ function Qt(e) {
2893
2842
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2894
2843
  }
2895
- function Hn(e, t) {
2844
+ function Vn(e, t) {
2896
2845
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2897
2846
  }
2898
- function Wn(e, t, n, o, i, r, l, p) {
2899
- e.replaceChildren(), _o(t, !1), t.disabled = !0, n(!1);
2847
+ function Kn(e, t, n, o, i, a, l, p) {
2848
+ e.replaceChildren(), ko(t, !1), t.disabled = !0, n(!1);
2900
2849
  const d = document.createElement("div");
2901
2850
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2902
- const c = me(
2851
+ const c = fe(
2903
2852
  "pluno-pa-widget__character--empty",
2904
2853
  o()
2905
2854
  );
@@ -2907,40 +2856,40 @@ function Wn(e, t, n, o, i, r, l, p) {
2907
2856
  const u = document.createElement("div");
2908
2857
  if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
2909
2858
  const m = document.createElement("a");
2910
- m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = r, d.appendChild(m);
2859
+ m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = a, d.appendChild(m);
2911
2860
  } else {
2912
2861
  const m = document.createElement("button");
2913
- m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = r, m.addEventListener("click", () => p?.()), d.appendChild(m);
2862
+ m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = a, m.addEventListener("click", () => p?.()), d.appendChild(m);
2914
2863
  }
2915
2864
  e.appendChild(d);
2916
2865
  }
2917
- function ja(e) {
2866
+ function ir(e) {
2918
2867
  const t = document.createElement("div");
2919
2868
  t.className = "pluno-pa-widget__message-attachments";
2920
2869
  for (const n of e)
2921
- t.appendChild(Da(n));
2870
+ t.appendChild(qa(n));
2922
2871
  return t;
2923
2872
  }
2924
- function Va(e) {
2873
+ function ar(e) {
2925
2874
  const t = document.createElement("button");
2926
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Aa()), t.addEventListener("click", (n) => {
2875
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Wa()), t.addEventListener("click", (n) => {
2927
2876
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2928
2877
  }), t;
2929
2878
  }
2930
- function Ka(e, t) {
2879
+ function rr(e, t) {
2931
2880
  const n = document.createElement("article");
2932
2881
  n.className = "pluno-pa-widget__share-prompt";
2933
2882
  const o = document.createElement("div");
2934
2883
  o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2935
- me(
2884
+ fe(
2936
2885
  "pluno-pa-widget__share-prompt-icon",
2937
2886
  t.characterIconOptions
2938
2887
  )
2939
2888
  );
2940
2889
  const i = document.createElement("div");
2941
2890
  i.className = "pluno-pa-widget__share-prompt-copy";
2942
- const r = document.createElement("strong");
2943
- r.textContent = "Share this win?", i.appendChild(r);
2891
+ const a = document.createElement("strong");
2892
+ a.textContent = "Share this win?", i.appendChild(a);
2944
2893
  const l = document.createElement("span");
2945
2894
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
2946
2895
  const u = document.createElement("span");
@@ -2954,7 +2903,7 @@ function Ka(e, t) {
2954
2903
  const c = document.createElement("button");
2955
2904
  if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
2956
2905
  t.onDraft(e);
2957
- }), t.isDrafting ? (c.appendChild(Zt()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
2906
+ }), t.isDrafting ? (c.appendChild(en()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
2958
2907
  p.appendChild(d);
2959
2908
  else {
2960
2909
  const u = document.createElement("button");
@@ -2968,15 +2917,15 @@ function Ka(e, t) {
2968
2917
  }
2969
2918
  return o.appendChild(p), n.appendChild(o), n;
2970
2919
  }
2971
- function Ya(e, t) {
2920
+ function lr(e, t) {
2972
2921
  const n = document.createElement("div");
2973
2922
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
2974
2923
  g.target === n && t.onClose();
2975
2924
  });
2976
2925
  const o = document.createElement("section");
2977
2926
  o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
2978
- const i = document.createElement("header"), r = document.createElement("strong");
2979
- r.textContent = "Share this win", i.appendChild(r);
2927
+ const i = document.createElement("header"), a = document.createElement("strong");
2928
+ a.textContent = "Share this win", i.appendChild(a);
2980
2929
  const l = document.createElement("button");
2981
2930
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2982
2931
  const p = document.createElement("p");
@@ -2987,11 +2936,11 @@ function Ya(e, t) {
2987
2936
  c.className = "pluno-pa-widget__share-dialog-step-header";
2988
2937
  const u = document.createElement("strong");
2989
2938
  u.textContent = "1) Copy Screenshot", c.appendChild(u);
2990
- const m = Xa(
2939
+ const m = pr(
2991
2940
  "Copy Screenshot",
2992
2941
  async () => {
2993
2942
  try {
2994
- return await ei(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2943
+ return await li(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2995
2944
  } catch {
2996
2945
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2997
2946
  }
@@ -3000,39 +2949,39 @@ function Ya(e, t) {
3000
2949
  if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
3001
2950
  const g = document.createElement("div");
3002
2951
  g.className = "pluno-pa-widget__share-dialog-screenshot";
3003
- const b = document.createElement("img");
3004
- b.src = e.screenshotDataUrl, b.alt = "Product page with Pluno open", g.appendChild(b), d.appendChild(g);
2952
+ const w = document.createElement("img");
2953
+ w.src = e.screenshotDataUrl, w.alt = "Product page with Pluno open", g.appendChild(w), d.appendChild(g);
3005
2954
  }
3006
2955
  o.appendChild(d), o.appendChild(p);
3007
- const k = document.createElement("div");
3008
- k.className = "pluno-pa-widget__share-dialog-step";
2956
+ const E = document.createElement("div");
2957
+ E.className = "pluno-pa-widget__share-dialog-step";
3009
2958
  const v = document.createElement("strong");
3010
- v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", k.appendChild(v);
3011
- const R = document.createElement("p");
3012
- R.className = "pluno-pa-widget__share-dialog-hint", R.textContent = "Post draft opens prefilled on supported platforms.", k.appendChild(R);
3013
- const _ = document.createElement("footer");
3014
- _.className = "pluno-pa-widget__share-dialog-platforms";
3015
- for (const g of Za(e)) {
3016
- const b = document.createElement("a");
3017
- b.href = g.href, b.target = "_blank", b.rel = "noopener noreferrer", b.title = g.label, b.setAttribute("aria-label", `Open ${g.label}`), b.appendChild(Ja(g.id)), _.appendChild(b);
2959
+ v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", E.appendChild(v);
2960
+ const z = document.createElement("p");
2961
+ z.className = "pluno-pa-widget__share-dialog-hint", z.textContent = "Post draft opens prefilled on supported platforms.", E.appendChild(z);
2962
+ const b = document.createElement("footer");
2963
+ b.className = "pluno-pa-widget__share-dialog-platforms";
2964
+ for (const g of sr(e)) {
2965
+ const w = document.createElement("a");
2966
+ w.href = g.href, w.target = "_blank", w.rel = "noopener noreferrer", w.title = g.label, w.setAttribute("aria-label", `Open ${g.label}`), w.appendChild(dr(g.id)), b.appendChild(w);
3018
2967
  }
3019
- if (k.appendChild(_), o.appendChild(k), t.socialPostRewardsUrl) {
2968
+ if (E.appendChild(b), o.appendChild(E), t.socialPostRewardsUrl) {
3020
2969
  const g = document.createElement("div");
3021
2970
  g.className = "pluno-pa-widget__share-dialog-step";
3022
- const b = document.createElement("strong");
3023
- b.className = "pluno-pa-widget__share-dialog-step-title", b.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(b);
2971
+ const w = document.createElement("strong");
2972
+ w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(w);
3024
2973
  const h = document.createElement("a");
3025
- h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Qa()), g.appendChild(h), o.appendChild(g);
2974
+ 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(cr()), g.appendChild(h), o.appendChild(g);
3026
2975
  }
3027
2976
  return n.appendChild(o), n;
3028
2977
  }
3029
- function Xa(e, t) {
2978
+ function pr(e, t) {
3030
2979
  const n = document.createElement("button");
3031
2980
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
3032
2981
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
3033
2982
  }), n;
3034
2983
  }
3035
- function Za(e) {
2984
+ function sr(e) {
3036
2985
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
3037
2986
  return [
3038
2987
  {
@@ -3052,90 +3001,90 @@ function Za(e) {
3052
3001
  }
3053
3002
  ];
3054
3003
  }
3055
- function Ja(e) {
3004
+ function dr(e) {
3056
3005
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3057
- return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (U(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), U(
3006
+ 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" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(
3058
3007
  t,
3059
3008
  "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"
3060
- ), U(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), U(
3009
+ ), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(
3061
3010
  t,
3062
3011
  "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"
3063
- ), U(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (U(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), U(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), U(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (U(
3012
+ ), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(
3064
3013
  t,
3065
3014
  "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"
3066
- ), U(
3015
+ ), B(
3067
3016
  t,
3068
3017
  "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",
3069
3018
  "0.48"
3070
- ), U(
3019
+ ), B(
3071
3020
  t,
3072
3021
  "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"
3073
- ), U(
3022
+ ), B(
3074
3023
  t,
3075
3024
  "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"
3076
3025
  ), t);
3077
3026
  }
3078
- function U(e, t, n) {
3027
+ function B(e, t, n) {
3079
3028
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3080
3029
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
3081
3030
  }
3082
- function Qa() {
3031
+ function cr() {
3083
3032
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3084
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), U(e, "M14 5h5v5"), U(e, "M19 5l-8 8"), U(
3033
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(
3085
3034
  e,
3086
3035
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
3087
3036
  ), e;
3088
3037
  }
3089
- function wo(e) {
3090
- return e.role === "tool" && e.toolName === Xn;
3038
+ function So(e) {
3039
+ return e.role === "tool" && e.toolName === no;
3091
3040
  }
3092
- function er(e) {
3041
+ function ur(e) {
3093
3042
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3094
3043
  }
3095
- function tr(e, t, n, o) {
3044
+ function gr(e, t, n, o) {
3096
3045
  const i = document.createElement("article");
3097
3046
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
3098
3047
  e[e.length - 1].createdAt
3099
3048
  ).toLocaleString(), i.appendChild(
3100
- me(
3049
+ fe(
3101
3050
  "pluno-pa-widget__character--tool-group",
3102
3051
  o
3103
3052
  )
3104
3053
  );
3105
- const r = document.createElement("details"), l = nr(e);
3106
- r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
3107
- i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
3054
+ const a = document.createElement("details"), l = hr(e);
3055
+ a.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.addEventListener("toggle", () => {
3056
+ i.classList.toggle("pluno-pa-widget__tool-group--open", a.open), a.open ? t.add(l) : t.delete(l), n();
3108
3057
  });
3109
3058
  const p = document.createElement("summary");
3110
- p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(Zt());
3059
+ p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(en());
3111
3060
  const c = document.createElement("span");
3112
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), r.appendChild(p), e.length > 0) {
3061
+ if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), a.appendChild(p), e.length > 0) {
3113
3062
  const u = document.createElement("div");
3114
3063
  u.className = "pluno-pa-widget__tool-lines";
3115
3064
  for (const m of e) {
3116
- const k = document.createElement("div");
3117
- k.className = "pluno-pa-widget__tool-line", m.loading && k.appendChild(Zt());
3065
+ const E = document.createElement("div");
3066
+ E.className = "pluno-pa-widget__tool-line", m.loading && E.appendChild(en());
3118
3067
  const v = document.createElement("span");
3119
- v.textContent = m.content || "Run tool", k.appendChild(v), u.appendChild(k);
3068
+ v.textContent = m.content || "Run tool", E.appendChild(v), u.appendChild(E);
3120
3069
  }
3121
- r.appendChild(u);
3070
+ a.appendChild(u);
3122
3071
  }
3123
- return i.appendChild(r), i;
3072
+ return i.appendChild(a), i;
3124
3073
  }
3125
- function bo(e) {
3074
+ function Eo(e) {
3126
3075
  const t = document.createElement("article");
3127
3076
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3128
- me(
3077
+ fe(
3129
3078
  "pluno-pa-widget__character--tool-group",
3130
3079
  e
3131
3080
  )
3132
3081
  ), t;
3133
3082
  }
3134
- function Gn(e) {
3135
- const t = bo(e);
3136
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ct()), t;
3083
+ function Yn(e) {
3084
+ const t = Eo(e);
3085
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ut()), t;
3137
3086
  }
3138
- function ct(e = "Thinking...") {
3087
+ function ut(e = "Thinking...") {
3139
3088
  const t = document.createElement("div");
3140
3089
  t.className = "pluno-pa-widget__status";
3141
3090
  const n = document.createElement("span");
@@ -3143,17 +3092,17 @@ function ct(e = "Thinking...") {
3143
3092
  const o = document.createElement("span");
3144
3093
  return o.textContent = e, t.appendChild(o), t;
3145
3094
  }
3146
- function nr(e) {
3095
+ function hr(e) {
3147
3096
  return `tools:${e[0]?.id ?? ""}`;
3148
3097
  }
3149
- function Zt() {
3098
+ function en() {
3150
3099
  const e = document.createElement("span");
3151
3100
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3152
3101
  }
3153
- function _o(e, t) {
3154
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Pa() : go());
3102
+ function ko(e, t) {
3103
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Fa() : xo());
3155
3104
  }
3156
- function or(e, t) {
3105
+ function mr(e, t) {
3157
3106
  const n = t.replace(/\r\n/g, `
3158
3107
  `).split(`
3159
3108
  `);
@@ -3177,14 +3126,14 @@ function or(e, t) {
3177
3126
  const l = i.match(/^(#{1,3})\s+(.+)$/);
3178
3127
  if (l) {
3179
3128
  const c = document.createElement(`h${l[1].length + 2}`);
3180
- at(c, l[2]), e.appendChild(c), o += 1;
3129
+ rt(c, l[2]), e.appendChild(c), o += 1;
3181
3130
  continue;
3182
3131
  }
3183
3132
  if (/^\s*[-*+]\s+/.test(i)) {
3184
3133
  const c = document.createElement("ul");
3185
3134
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3186
3135
  const u = document.createElement("li");
3187
- at(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
3136
+ rt(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
3188
3137
  }
3189
3138
  e.appendChild(c);
3190
3139
  continue;
@@ -3193,7 +3142,7 @@ function or(e, t) {
3193
3142
  const c = document.createElement("ol");
3194
3143
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3195
3144
  const u = document.createElement("li");
3196
- at(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
3145
+ rt(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
3197
3146
  }
3198
3147
  e.appendChild(c);
3199
3148
  continue;
@@ -3203,17 +3152,17 @@ function or(e, t) {
3203
3152
  p.push(n[o]), o += 1;
3204
3153
  const d = document.createElement("p");
3205
3154
  p.forEach((c, u) => {
3206
- u > 0 && d.appendChild(document.createElement("br")), at(d, c);
3155
+ u > 0 && d.appendChild(document.createElement("br")), rt(d, c);
3207
3156
  }), e.appendChild(d);
3208
3157
  }
3209
3158
  }
3210
- function at(e, t) {
3159
+ function rt(e, t) {
3211
3160
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3212
3161
  let o = 0;
3213
3162
  for (const i of t.matchAll(n)) {
3214
- const r = i.index ?? 0;
3215
- r > o && e.appendChild(
3216
- document.createTextNode(t.slice(o, r))
3163
+ const a = i.index ?? 0;
3164
+ a > o && e.appendChild(
3165
+ document.createTextNode(t.slice(o, a))
3217
3166
  );
3218
3167
  const l = i[0];
3219
3168
  if (l.startsWith("`")) {
@@ -3227,17 +3176,17 @@ function at(e, t) {
3227
3176
  p.textContent = l.slice(1, -1), e.appendChild(p);
3228
3177
  } else {
3229
3178
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3230
- if (p && ir(p[2])) {
3179
+ if (p && fr(p[2])) {
3231
3180
  const d = document.createElement("a");
3232
3181
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
3233
3182
  } else
3234
3183
  e.appendChild(document.createTextNode(l));
3235
3184
  }
3236
- o = r + l.length;
3185
+ o = a + l.length;
3237
3186
  }
3238
3187
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
3239
3188
  }
3240
- function ir(e) {
3189
+ function fr(e) {
3241
3190
  if (e.startsWith("/") || e.startsWith("#"))
3242
3191
  return !0;
3243
3192
  try {
@@ -3247,8 +3196,8 @@ function ir(e) {
3247
3196
  return !1;
3248
3197
  }
3249
3198
  }
3250
- function $n(e, t) {
3251
- if (ar(e))
3199
+ function Xn(e, t) {
3200
+ if (wr(e))
3252
3201
  return;
3253
3202
  const n = `
3254
3203
  :host {
@@ -3291,9 +3240,6 @@ function $n(e, t) {
3291
3240
  --pluno-pa-faint: #8e8e95;
3292
3241
  --pluno-pa-divider: rgba(24, 24, 27, 0.08);
3293
3242
  --pluno-pa-launcher-hairline: rgba(24, 24, 27, 0.06);
3294
- --pluno-pa-minimized-launcher-paper: #fffdf6;
3295
- --pluno-pa-minimized-launcher-ink: #2c2a1e;
3296
- --pluno-pa-scribble-grid-line: rgba(96, 138, 188, 0.22);
3297
3243
  --pluno-pa-launcher-width: min(190px, calc(100vw - 36px));
3298
3244
  --pluno-pa-launcher-height: 41px;
3299
3245
  --pluno-pa-panel-width: min(clamp(420px, 24vw, 520px), calc(100vw - 16px));
@@ -3517,15 +3463,12 @@ function $n(e, t) {
3517
3463
  .pluno-pa-widget--thinking:not(.pluno-pa-widget--open):not(.pluno-pa-widget--minimized):not(.pluno-pa-widget--host-modal-conflict) .pluno-pa-widget__launcher-input {
3518
3464
  display: none;
3519
3465
  }
3520
- .pluno-pa-widget.pluno-pa-widget--minimized {
3466
+ .pluno-pa-widget--minimized {
3521
3467
  --pluno-pa-launcher-width: 22px;
3522
3468
  --pluno-pa-launcher-height: 22px;
3523
3469
  pointer-events: none;
3524
3470
  }
3525
- .pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
3526
- /* The scribble circle gives the bolt a recognizable silhouette on host
3527
- pages whose background colors are outside the widget's control. */
3528
- isolation: isolate;
3471
+ .pluno-pa-widget--minimized .pluno-pa-widget__launcher {
3529
3472
  border: 0;
3530
3473
  border-radius: 999px;
3531
3474
  background: transparent;
@@ -3539,31 +3482,16 @@ function $n(e, t) {
3539
3482
  overflow: visible;
3540
3483
  pointer-events: auto;
3541
3484
  }
3542
- .pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before {
3543
- content: "";
3544
- position: absolute;
3545
- inset: 0;
3546
- z-index: -1;
3547
- border: 1.5px solid var(--pluno-pa-minimized-launcher-ink);
3548
- border-radius: inherit;
3549
- background-color: var(--pluno-pa-minimized-launcher-paper);
3550
- background-image:
3551
- linear-gradient(var(--pluno-pa-scribble-grid-line) 1px, transparent 1px),
3552
- linear-gradient(90deg, var(--pluno-pa-scribble-grid-line) 1px, transparent 1px);
3553
- background-size: 12px 12px;
3554
- pointer-events: none;
3555
- }
3556
3485
  .pluno-pa-widget--minimized .pluno-pa-widget__launcher-input,
3557
3486
  .pluno-pa-widget--minimized .pluno-pa-widget__launcher-drag-handle,
3558
3487
  .pluno-pa-widget--minimized .pluno-pa-widget__launcher-minimize,
3559
3488
  .pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals--launcher {
3560
3489
  display: none;
3561
3490
  }
3562
- .pluno-pa-widget.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
3563
- left: 3px;
3564
- width: 16px;
3565
- height: 16px;
3566
- margin-top: 0;
3491
+ .pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
3492
+ left: 1px;
3493
+ width: 20px;
3494
+ height: 20px;
3567
3495
  }
3568
3496
  .pluno-pa-widget--bottom-left .pluno-pa-widget__launcher {
3569
3497
  left: 0;
@@ -5189,8 +5117,8 @@ function $n(e, t) {
5189
5117
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5190
5118
  position: absolute;
5191
5119
  top: -16px;
5192
- left: ${qt}px;
5193
- width: calc(100% - ${qt * 2}px);
5120
+ left: ${Kt}px;
5121
+ width: calc(100% - ${Kt * 2}px);
5194
5122
  height: 36px;
5195
5123
  z-index: 3;
5196
5124
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5280,6 +5208,20 @@ function $n(e, t) {
5280
5208
  .pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
5281
5209
  border-radius: var(--pluno-pa-scribble-wobble);
5282
5210
  }
5211
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized {
5212
+ --pluno-pa-launcher-width: 16px;
5213
+ --pluno-pa-launcher-height: 24px;
5214
+ }
5215
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
5216
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
5217
+ content: none;
5218
+ }
5219
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__character--launcher {
5220
+ left: -3px;
5221
+ width: 22px;
5222
+ height: 22px;
5223
+ margin-top: 0;
5224
+ }
5283
5225
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-minimize {
5284
5226
  color: var(--pluno-pa-text);
5285
5227
  font-size: 18px;
@@ -5415,6 +5357,21 @@ function $n(e, t) {
5415
5357
  opacity: 0.6;
5416
5358
  transform: rotate(5deg);
5417
5359
  }
5360
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher {
5361
+ border: 0;
5362
+ width: var(--pluno-pa-launcher-width);
5363
+ min-width: 0;
5364
+ height: var(--pluno-pa-launcher-height);
5365
+ min-height: 0;
5366
+ padding: 0;
5367
+ }
5368
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::before,
5369
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__launcher::after {
5370
+ content: none;
5371
+ }
5372
+ .pluno-pa-widget--scribble.pluno-pa-widget--minimized .pluno-pa-widget__scribble-spirals {
5373
+ display: none;
5374
+ }
5418
5375
  .pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
5419
5376
  .pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
5420
5377
  background: transparent;
@@ -5509,28 +5466,28 @@ function $n(e, t) {
5509
5466
  filter: url(#pluno-pa-scribble-wobble-2);
5510
5467
  }
5511
5468
  `;
5512
- if (rr(e, n))
5469
+ if (br(e, n))
5513
5470
  return;
5514
5471
  const o = e.ownerDocument.createElement("style");
5515
- o.id = io, o.textContent = n, e.appendChild(o), xo(e);
5472
+ o.id = uo, o.textContent = n, e.appendChild(o), Lo(e);
5516
5473
  }
5517
- function ar(e) {
5518
- return e.getElementById(io) !== null || e.host instanceof HTMLElement && e.host.getAttribute(ao) === "true";
5474
+ function wr(e) {
5475
+ return e.getElementById(uo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(go) === "true";
5519
5476
  }
5520
- function xo(e) {
5521
- e.host instanceof HTMLElement && e.host.setAttribute(ao, "true");
5477
+ function Lo(e) {
5478
+ e.host instanceof HTMLElement && e.host.setAttribute(go, "true");
5522
5479
  }
5523
- function rr(e, t) {
5480
+ function br(e, t) {
5524
5481
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5525
5482
  return !1;
5526
5483
  try {
5527
5484
  const n = new CSSStyleSheet();
5528
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], xo(e), !0;
5485
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Lo(e), !0;
5529
5486
  } catch {
5530
5487
  return !1;
5531
5488
  }
5532
5489
  }
5533
- async function lr() {
5490
+ async function _r() {
5534
5491
  return document.body ? document.body : await new Promise((e) => {
5535
5492
  const t = new MutationObserver(() => {
5536
5493
  document.body && (t.disconnect(), e(document.body));
@@ -5538,14 +5495,36 @@ async function lr() {
5538
5495
  t.observe(document.documentElement, { childList: !0 });
5539
5496
  });
5540
5497
  }
5541
- function yo(e) {
5498
+ function Po(e) {
5542
5499
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5543
5500
  }
5544
- function pr(e) {
5501
+ function xr(e) {
5502
+ if (e)
5503
+ return { clientId: e, release: () => {
5504
+ } };
5505
+ let t = 0;
5506
+ for (; Dt.has(t); )
5507
+ t += 1;
5508
+ Dt.add(t);
5509
+ const n = `${Di}${t}`;
5510
+ let o = crypto.randomUUID();
5545
5511
  try {
5546
- const t = window.localStorage.getItem(yo(e));
5512
+ o = window.sessionStorage.getItem(n) ?? o, window.sessionStorage.setItem(n, o);
5513
+ } catch {
5514
+ }
5515
+ let i = !1;
5516
+ return {
5517
+ clientId: o,
5518
+ release: () => {
5519
+ i || (i = !0, Dt.delete(t));
5520
+ }
5521
+ };
5522
+ }
5523
+ function yr(e) {
5524
+ try {
5525
+ const t = window.localStorage.getItem(Po(e));
5547
5526
  if (!t)
5548
- return qn();
5527
+ return Zn();
5549
5528
  const n = JSON.parse(t);
5550
5529
  return {
5551
5530
  isOpen: n.isOpen === !0,
@@ -5555,25 +5534,25 @@ function pr(e) {
5555
5534
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5556
5535
  (o) => typeof o == "string"
5557
5536
  ) : [],
5558
- launcherPosition: ur(n.launcherPosition) ? n.launcherPosition : null,
5559
- panelSize: gr(n.panelSize) ? ut(n.panelSize) : null,
5560
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Zn) : [],
5537
+ launcherPosition: Er(n.launcherPosition) ? n.launcherPosition : null,
5538
+ panelSize: kr(n.panelSize) ? gt(n.panelSize) : null,
5539
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-oo) : [],
5561
5540
  sharePromptsDisabled: n.sharePromptsDisabled === !0
5562
5541
  };
5563
5542
  } catch {
5564
- return qn();
5543
+ return Zn();
5565
5544
  }
5566
5545
  }
5567
- async function sr(e) {
5546
+ async function vr(e) {
5568
5547
  if (e.loadSharePromptsDisabled)
5569
5548
  return e.loadSharePromptsDisabled();
5570
5549
  try {
5571
- return window.localStorage.getItem(Jn) === "true";
5550
+ return window.localStorage.getItem(ao) === "true";
5572
5551
  } catch {
5573
5552
  return !1;
5574
5553
  }
5575
5554
  }
5576
- function dr(e, t) {
5555
+ function Cr(e, t) {
5577
5556
  if (e.persistSharePromptsDisabled) {
5578
5557
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5579
5558
  () => {
@@ -5582,12 +5561,12 @@ function dr(e, t) {
5582
5561
  return;
5583
5562
  }
5584
5563
  try {
5585
- t && window.localStorage.setItem(Jn, "true");
5564
+ t && window.localStorage.setItem(ao, "true");
5586
5565
  } catch {
5587
5566
  return;
5588
5567
  }
5589
5568
  }
5590
- function qn() {
5569
+ function Zn() {
5591
5570
  return {
5592
5571
  isOpen: !1,
5593
5572
  composerValue: "",
@@ -5600,54 +5579,99 @@ function qn() {
5600
5579
  sharePromptsDisabled: !1
5601
5580
  };
5602
5581
  }
5603
- function cr(e, t) {
5582
+ function Sr(e, t) {
5604
5583
  try {
5605
5584
  window.localStorage.setItem(
5606
- yo(e),
5585
+ Po(e),
5607
5586
  JSON.stringify(t)
5608
5587
  );
5609
5588
  } catch {
5610
5589
  return;
5611
5590
  }
5612
5591
  }
5613
- function ur(e) {
5592
+ function Er(e) {
5614
5593
  if (!e || typeof e != "object")
5615
5594
  return !1;
5616
5595
  const t = e;
5617
5596
  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");
5618
5597
  }
5619
- function gr(e) {
5598
+ function kr(e) {
5620
5599
  if (!e || typeof e != "object")
5621
5600
  return !1;
5622
5601
  const t = e;
5623
5602
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5624
5603
  }
5625
- const jn = /* @__PURE__ */ new WeakSet();
5626
- function hr(e) {
5604
+ async function Io(e, t) {
5605
+ const n = await fetch(e, {
5606
+ method: "POST",
5607
+ credentials: "include",
5608
+ headers: { "content-type": "application/json" },
5609
+ body: JSON.stringify({
5610
+ origin: location.origin,
5611
+ url: location.href
5612
+ }),
5613
+ ...t ? { signal: t } : {}
5614
+ });
5615
+ if (!n.ok) {
5616
+ const i = await n.text(), a = Qo(i);
5617
+ throw a ? (console.error(a), new Error(a)) : new Error(`Failed to load Pluno token (${n.status})`);
5618
+ }
5619
+ const o = await n.json();
5620
+ if (!o.token)
5621
+ throw new Error("Pluno token endpoint did not return a token");
5622
+ return o.token;
5623
+ }
5624
+ function Lr(e) {
5625
+ return async () => {
5626
+ const t = new AbortController();
5627
+ let n = !1;
5628
+ const o = new Promise((i, a) => {
5629
+ const l = window.setTimeout(() => {
5630
+ n = !0, t.abort(), a(new Error(Ln));
5631
+ }, Ai);
5632
+ t.signal.addEventListener(
5633
+ "abort",
5634
+ () => window.clearTimeout(l),
5635
+ { once: !0 }
5636
+ );
5637
+ });
5638
+ try {
5639
+ const i = await Promise.race([
5640
+ Io(e, t.signal),
5641
+ o
5642
+ ]);
5643
+ return t.abort(), i;
5644
+ } catch (i) {
5645
+ throw t.abort(), n ? new Error(Ln) : i instanceof Error && i.message.startsWith("Pluno widget blocked on ") ? i : new Error(Ni);
5646
+ }
5647
+ };
5648
+ }
5649
+ const Jn = /* @__PURE__ */ new WeakSet();
5650
+ function Pr(e) {
5627
5651
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5628
5652
  }
5629
- function Vn(e) {
5653
+ function Qn(e) {
5630
5654
  const t = e.pathname.split("/");
5631
5655
  return t[t.length - 1] ?? "";
5632
5656
  }
5633
- function mr(e, t) {
5657
+ function Ir(e, t) {
5634
5658
  const n = new URL(e.src, document.baseURI);
5635
- return n.href === t.href || n.pathname === t.pathname ? !0 : Vn(n) === Vn(t);
5659
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Qn(n) === Qn(t);
5636
5660
  }
5637
- class se extends EventTarget {
5661
+ class de extends EventTarget {
5638
5662
  constructor(t, n) {
5639
- super(), this.channelId = n, this.url = t, this.addPreviewListener(_i, () => {
5640
- this.readyState = se.OPEN, this.dispatchEvent(new Event("open"));
5641
- }), this.addPreviewListener(xi, (o) => {
5663
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(ki, () => {
5664
+ this.readyState = de.OPEN, this.dispatchEvent(new Event("open"));
5665
+ }), this.addPreviewListener(Li, (o) => {
5642
5666
  const i = o;
5643
5667
  this.dispatchEvent(
5644
5668
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5645
5669
  );
5646
- }), this.addPreviewListener(yi, () => {
5647
- this.readyState = se.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5648
- }), this.addPreviewListener(vi, (o) => {
5670
+ }), this.addPreviewListener(Pi, () => {
5671
+ this.readyState = de.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5672
+ }), this.addPreviewListener(Ii, (o) => {
5649
5673
  const i = o;
5650
- this.readyState = se.CLOSED, this.dispatchEvent(
5674
+ this.readyState = de.CLOSED, this.dispatchEvent(
5651
5675
  new CloseEvent("close", {
5652
5676
  code: i.detail?.code ?? 1e3,
5653
5677
  reason: i.detail?.reason ?? "",
@@ -5656,8 +5680,8 @@ class se extends EventTarget {
5656
5680
  ), this.cleanup();
5657
5681
  }), window.dispatchEvent(
5658
5682
  new CustomEvent(
5659
- rt(
5660
- fi,
5683
+ lt(
5684
+ Ci,
5661
5685
  this.channelId
5662
5686
  ),
5663
5687
  {
@@ -5676,18 +5700,18 @@ class se extends EventTarget {
5676
5700
  extensions = "";
5677
5701
  binaryType = "blob";
5678
5702
  bufferedAmount = 0;
5679
- readyState = se.CONNECTING;
5680
- socketId = fr();
5703
+ readyState = de.CONNECTING;
5704
+ socketId = Tr();
5681
5705
  listeners = /* @__PURE__ */ new Map();
5682
5706
  send(t) {
5683
- if (this.readyState !== se.OPEN)
5707
+ if (this.readyState !== de.OPEN)
5684
5708
  throw new DOMException(
5685
5709
  "Pluno preview websocket is not open",
5686
5710
  "InvalidStateError"
5687
5711
  );
5688
5712
  window.dispatchEvent(
5689
5713
  new CustomEvent(
5690
- rt(wi, this.channelId),
5714
+ lt(Si, this.channelId),
5691
5715
  {
5692
5716
  detail: {
5693
5717
  socketId: this.socketId,
@@ -5698,9 +5722,9 @@ class se extends EventTarget {
5698
5722
  );
5699
5723
  }
5700
5724
  close(t, n) {
5701
- this.readyState !== se.CLOSED && (this.readyState = se.CLOSING, window.dispatchEvent(
5725
+ this.readyState !== de.CLOSED && (this.readyState = de.CLOSING, window.dispatchEvent(
5702
5726
  new CustomEvent(
5703
- rt(bi, this.channelId),
5727
+ lt(Ei, this.channelId),
5704
5728
  {
5705
5729
  detail: { socketId: this.socketId, code: t, reason: n }
5706
5730
  }
@@ -5708,11 +5732,11 @@ class se extends EventTarget {
5708
5732
  ), this.cleanup());
5709
5733
  }
5710
5734
  addPreviewListener(t, n) {
5711
- const o = rt(
5735
+ const o = lt(
5712
5736
  t,
5713
5737
  this.channelId
5714
- ), i = (r) => {
5715
- r.detail?.socketId === this.socketId && n(r);
5738
+ ), i = (a) => {
5739
+ a.detail?.socketId === this.socketId && n(a);
5716
5740
  };
5717
5741
  this.listeners.set(o, i), window.addEventListener(o, i);
5718
5742
  }
@@ -5722,19 +5746,19 @@ class se extends EventTarget {
5722
5746
  this.listeners.clear();
5723
5747
  }
5724
5748
  }
5725
- function fr() {
5749
+ function Tr() {
5726
5750
  const e = window.sessionStorage.getItem(
5727
- yn
5751
+ kn
5728
5752
  );
5729
5753
  if (e)
5730
5754
  return e;
5731
5755
  const t = crypto.randomUUID();
5732
- return window.sessionStorage.setItem(yn, t), t;
5756
+ return window.sessionStorage.setItem(kn, t), t;
5733
5757
  }
5734
- function rt(e, t) {
5758
+ function lt(e, t) {
5735
5759
  return `${e}:${t}`;
5736
5760
  }
5737
- function wr(e) {
5761
+ function Ar(e) {
5738
5762
  const t = document.currentScript;
5739
5763
  if (t instanceof HTMLScriptElement)
5740
5764
  return [t];
@@ -5742,33 +5766,64 @@ function wr(e) {
5742
5766
  return Array.from(
5743
5767
  document.querySelectorAll("script[type='module'][src]")
5744
5768
  ).filter(
5745
- (i) => i instanceof HTMLScriptElement && hr(i) && mr(i, o)
5769
+ (i) => i instanceof HTMLScriptElement && Pr(i) && Ir(i, o)
5746
5770
  );
5747
5771
  }
5748
- function br(e) {
5749
- for (const t of wr(e)) {
5750
- if (jn.has(t) || t.dataset.plunoAutoMount === "false")
5751
- continue;
5752
- jn.add(t);
5753
- const n = t.dataset.plunoPreviewChannel;
5754
- Gi({
5755
- token: t.dataset.plunoToken,
5756
- tokenEndpoint: t.dataset.plunoTokenEndpoint,
5757
- backendUrl: t.dataset.plunoBackendUrl,
5758
- webSocketFactory: n ? Wi(n) : void 0,
5759
- launcherLabel: t.dataset.plunoLauncherLabel,
5760
- accentColor: t.dataset.plunoAccentColor,
5761
- colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5762
- fontFamily: t.dataset.plunoFontFamily,
5763
- scribbleStyle: t.dataset.plunoScribbleStyle === "true",
5764
- position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5765
- }).catch((o) => {
5766
- console.error("Failed to mount Pluno widget", o);
5767
- });
5772
+ function Nr(e) {
5773
+ for (const t of Ar(e))
5774
+ Jn.has(t) || t.dataset.plunoAutoMount === "false" || (Jn.add(t), To(t).catch((n) => {
5775
+ console.error("Failed to mount Pluno widget", n);
5776
+ }));
5777
+ }
5778
+ function To(e) {
5779
+ const t = window, n = t[se];
5780
+ if (n) {
5781
+ if (n.host === null)
5782
+ return n.mountPromise.catch(() => {
5783
+ const p = t[se];
5784
+ return p ? p.mountPromise : To(e);
5785
+ });
5786
+ if (Dr(n.host))
5787
+ return n.mountPromise;
5788
+ n.destroy?.(), delete t[se];
5768
5789
  }
5790
+ const o = e.dataset.plunoPreviewChannel, i = e.dataset.plunoTokenEndpoint;
5791
+ let a;
5792
+ const l = ta({
5793
+ token: e.dataset.plunoToken,
5794
+ tokenProvider: !e.dataset.plunoToken && !o && i ? Lr(i) : void 0,
5795
+ tokenEndpoint: i,
5796
+ backendUrl: e.dataset.plunoBackendUrl,
5797
+ webSocketFactory: o ? ea(o) : void 0,
5798
+ launcherLabel: e.dataset.plunoLauncherLabel,
5799
+ accentColor: e.dataset.plunoAccentColor,
5800
+ colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5801
+ fontFamily: e.dataset.plunoFontFamily,
5802
+ scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
5803
+ position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5804
+ }).then((p) => {
5805
+ if (t[se] !== a) {
5806
+ p.destroy();
5807
+ return;
5808
+ }
5809
+ const d = p.host;
5810
+ d.setAttribute(io, "true"), a.host = d, a.destroy = () => {
5811
+ t[se] === a && delete t[se], a.host = null, a.destroy = null, p.destroy();
5812
+ };
5813
+ }).catch((p) => {
5814
+ throw t[se] === a && delete t[se], p;
5815
+ });
5816
+ return a = {
5817
+ mountPromise: l,
5818
+ host: null,
5819
+ destroy: null
5820
+ }, t[se] = a, l;
5821
+ }
5822
+ function Dr(e) {
5823
+ return e.isConnected && e.getAttribute(io) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
5769
5824
  }
5770
- br(import.meta.url);
5825
+ Nr(import.meta.url);
5771
5826
  export {
5772
- Wi as createProductAgentPreviewBridgeWebSocketFactory,
5773
- Gi as mountPlunoProductAgentWidget
5827
+ ea as createProductAgentPreviewBridgeWebSocketFactory,
5828
+ ta as mountPlunoProductAgentWidget
5774
5829
  };