@pluno/product-agent-web 0.1.45 → 0.1.47

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