@pluno/product-agent-web 0.1.41 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,26 @@
1
- import { PlunoProductAgent as yn } from "./product-agent-sdk.js";
2
- const Cn = "#7c3aed", Ae = "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", Pe = "#2c2a1e", gt = [253, 250, 241], ht = 3.5;
3
- function Wt(e) {
4
- const t = Ht(e);
5
- if (mt(we(t), gt) >= ht)
1
+ import { PlunoProductAgent as Mn } from "./product-agent-sdk.js";
2
+ const Bn = "#7c3aed", Be = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", Oe = "#2c2a1e", Et = [253, 250, 241], St = 3.5;
3
+ function Qt(e) {
4
+ const t = en(e);
5
+ if (kt(ke(t), Et) >= St)
6
6
  return t;
7
- let o = we(t);
8
- const a = we(Pe);
7
+ let o = ke(t);
8
+ const a = ke(Oe);
9
9
  for (let i = 0; i < 6; i += 1)
10
- if (o = kn(o, a, 0.22), mt(o, gt) >= ht)
11
- return qe(o);
12
- return qe(o);
10
+ if (o = Fn(o, a, 0.22), kt(o, Et) >= St)
11
+ return tt(o);
12
+ return tt(o);
13
13
  }
14
- function En() {
14
+ function On() {
15
15
  let n = "M 280 120", o = !1, a = 0;
16
16
  for (let i = 150; i <= 1170; i += 62) {
17
- const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
18
- n += ` L ${s} ${i}`, o = !o, a += 1;
17
+ const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
+ n += ` L ${p} ${i}`, o = !o, a += 1;
19
19
  }
20
20
  return n;
21
21
  }
22
- function Sn(e) {
23
- const t = Ht(e), n = je(we(t));
22
+ function Un(e) {
23
+ const t = en(e), n = nt(ke(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -44,90 +44,90 @@ function Sn(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: $(t, 0.28, -0.03),
48
- middle: $(t, 0.08, 0.04),
49
- bottom: $(t, -0.1, 0.02),
50
- edgeStart: $(t, 0.08, 0.08),
51
- edgeMiddle: $(t, -0.08, 0.08),
52
- edgeEnd: $(t, -0.18, 0.05),
53
- glow: $(t, 0.32, -0.12),
54
- highlight: $(t, 0.38, -0.18),
55
- inner: $(t, 0.24, -0.1),
56
- shadow: $(t, -0.25, -0.08)
47
+ top: V(t, 0.28, -0.03),
48
+ middle: V(t, 0.08, 0.04),
49
+ bottom: V(t, -0.1, 0.02),
50
+ edgeStart: V(t, 0.08, 0.08),
51
+ edgeMiddle: V(t, -0.08, 0.08),
52
+ edgeEnd: V(t, -0.18, 0.05),
53
+ glow: V(t, 0.32, -0.12),
54
+ highlight: V(t, 0.38, -0.18),
55
+ inner: V(t, 0.24, -0.1),
56
+ shadow: V(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Ht(e) {
59
+ function en(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()}` : Cn;
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;
62
62
  }
63
- function we(e) {
63
+ function ke(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 qe([e, t, n]) {
70
+ function tt([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 je([e, t, n]) {
74
+ function nt([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 mt(e, t) {
82
- const n = je(e), o = je(t), [a, i] = n > o ? [n, o] : [o, n];
81
+ function kt(e, t) {
82
+ const n = nt(e), o = nt(t), [a, i] = n > o ? [n, o] : [o, n];
83
83
  return (a + 0.05) / (i + 0.05);
84
84
  }
85
- function kn(e, t, n) {
86
- const o = Ve(n);
85
+ function Fn(e, t, n) {
86
+ const o = ot(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * o,
89
89
  e[1] + (t[1] - e[1]) * o,
90
90
  e[2] + (t[2] - e[2]) * o
91
91
  ];
92
92
  }
93
- function $(e, t, n) {
94
- const [o, a, i] = Ln(we(e));
95
- return qe(An(o, Ve(a + n), Ve(i + t)));
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)));
96
96
  }
97
- function Ln([e, t, n]) {
98
- const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), d = (l + s) / 2;
99
- if (l === s)
100
- return [0, 0, d];
101
- const c = l - s, p = d > 0.5 ? c / (2 - l - s) : c / (l + s);
102
- return [(l === o ? (a - i) / c + (a < i ? 6 : 0) : l === a ? (i - o) / c + 2 : (o - a) / c + 4) / 6, p, d];
97
+ function zn([e, t, n]) {
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
+ if (l === p)
100
+ return [0, 0, c];
101
+ const u = l - p, s = c > 0.5 ? u / (2 - l - p) : u / (l + p);
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 An(e, t, n) {
104
+ function Gn(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
- ze(a, o, e + 1 / 3) * 255,
110
- ze(a, o, e) * 255,
111
- ze(a, o, e - 1 / 3) * 255
109
+ Xe(a, o, e + 1 / 3) * 255,
110
+ Xe(a, o, e) * 255,
111
+ Xe(a, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function ze(e, t, n) {
114
+ function Xe(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 Ve(e) {
118
+ function ot(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const $t = "suggest_share_on_socials";
122
- function Pn(e) {
121
+ const tn = "suggest_share_on_socials";
122
+ function Hn(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 !== $t)
125
+ if (n.role !== "tool" || n.toolName !== tn)
126
126
  continue;
127
- const o = bt(e, t, "assistant");
127
+ const o = Lt(e, t, "assistant");
128
128
  if (!o)
129
129
  return null;
130
- const a = bt(e, o.index, "user");
130
+ const a = Lt(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 Pn(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Tn(e) {
140
- const t = await Nn(e);
139
+ async function Wn(e) {
140
+ const t = await $n(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 bt(e, t, n) {
145
+ function Lt(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,21 +150,21 @@ function bt(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Nn(e) {
153
+ async function $n(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const In = "https://app.pluno.ai", Dn = "/api/product-agent/embed/active-users", Rn = 1800, Mn = 15e3, Bn = 250, On = 1e3, Un = 3e4;
157
- function Fn(e, t = {}) {
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 = {}) {
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
- }, s = (p) => {
161
+ }, p = (s) => {
162
162
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
163
- c();
164
- }, Wn(p)));
165
- }, d = (p) => {
163
+ u();
164
+ }, to(s)));
165
+ }, c = (s) => {
166
166
  if (l(), o === null) {
167
- o = p, e(p);
167
+ o = s, e(s);
168
168
  return;
169
169
  }
170
170
  const b = o, x = performance.now();
@@ -173,50 +173,50 @@ function Fn(e, t = {}) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const A = Math.min(1, (performance.now() - x) / Rn);
177
- o = Math.round(b + (p - b) * Hn(A)), e(o), A >= 1 && (o = p, e(p), l());
178
- }, Bn);
179
- }, c = async () => {
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);
179
+ }, u = async () => {
180
180
  try {
181
- const p = await zn(t);
181
+ const s = await Qn(t);
182
182
  if (n)
183
183
  return;
184
- d(p.count), s(p.refreshAfterMs);
184
+ c(s.count), p(s.refreshAfterMs);
185
185
  } catch {
186
- s(Mn);
186
+ p(Yn);
187
187
  }
188
188
  };
189
- return c(), () => {
189
+ return u(), () => {
190
190
  n = !0, a !== null && window.clearTimeout(a), l();
191
191
  };
192
192
  }
193
- async function zn(e) {
193
+ async function Qn(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(Dn, Gn(e.backendUrl ?? In)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(jn, eo(e.backendUrl ?? qn)).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 = ft(o.count), i = ft(o.refreshAfterMs ?? o.refresh_after_ms);
202
+ const o = await n.json(), a = Pt(o.count), i = Pt(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 ft(e) {
207
+ function Pt(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Gn(e) {
210
+ function eo(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function Wn(e) {
214
- return Math.min(Un, Math.max(On, e));
213
+ function to(e) {
214
+ return Math.min(Zn, Math.max(Xn, e));
215
215
  }
216
- function Hn(e) {
216
+ function no(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-agent:sdk-preview-socket-send", jn = "product-agent:sdk-preview-socket-close", Vn = "product-agent:sdk-preview-socket-open", Yn = "product-agent:sdk-preview-socket-message", Kn = "product-agent:sdk-preview-socket-error", Xn = "product-agent:sdk-preview-socket-closed", wt = "product-agent:sdk-preview-socket-id", Zn = "product-agent:preview-diagnostic", jt = "pluno.productAgent.sharePromptsDisabled", Te = 10, Jn = 10 * 1024 * 1024, Vt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Qn = Array.from(Vt).join(","), eo = 3, q = {
219
+ const nn = 100, oo = "product-agent:sdk-preview-socket-connect", ao = "product-agent:sdk-preview-socket-send", io = "product-agent:sdk-preview-socket-close", ro = "product-agent:sdk-preview-socket-open", lo = "product-agent:sdk-preview-socket-message", po = "product-agent:sdk-preview-socket-error", so = "product-agent:sdk-preview-socket-closed", At = "product-agent:sdk-preview-socket-id", co = "product-agent:preview-diagnostic", on = "pluno.productAgent.sharePromptsDisabled", Ue = 10, uo = 10 * 1024 * 1024, an = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), go = Array.from(an).join(","), ho = 3, mo = "No recent chats for this page yet.", K = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-a
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, to = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', _t = "pluno-pa-scribble-font", Yt = 190, Kt = 41, no = 48, oo = 420, ao = 520, io = 0.24, ro = 680, lo = 800, po = 0.76, F = 8, Ye = 50, Xt = "http://www.w3.org/2000/svg", xt = [
227
+ }, bo = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Tt = "pluno-pa-scribble-font", rn = 190, ln = 41, fo = 48, wo = 420, _o = 520, xo = 0.24, yo = 680, vo = 800, Co = 0.76, z = 8, at = 50, pn = "http://www.w3.org/2000/svg", Nt = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const qt = 100, $n = "product-agent:sdk-preview-socket-connect", qn = "product-a
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], so = 11, co = 13, vt = 4, uo = 10, go = 40, ho = "movable-launcher-position-v2", Zt = "pluno-pa-widget-styles", Jt = "data-pluno-pa-widget-styles";
265
- let yt = 0;
266
- function mo(e) {
267
- return (t) => new Z(t, e);
264
+ ], Eo = 11, So = 13, It = 4, ko = 10, Lo = 40, Po = "movable-launcher-position-v2", sn = "pluno-pa-widget-styles", dn = "data-pluno-pa-widget-styles";
265
+ let Dt = 0;
266
+ function Ao(e) {
267
+ return (t) => new te(t, e);
268
268
  }
269
- async function bo(e = {}) {
269
+ async function To(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? q.launcherLabel,
272
- accentColor: e.accentColor ?? q.accentColor,
273
- colorScheme: e.colorScheme ?? q.colorScheme,
274
- fontFamily: e.fontFamily ?? q.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? q.scribbleStyle,
276
- position: e.position ?? q.position,
277
- movableLauncher: e.movableLauncher ?? q.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? K.launcherLabel,
272
+ accentColor: e.accentColor ?? K.accentColor,
273
+ colorScheme: e.colorScheme ?? K.colorScheme,
274
+ fontFamily: e.fontFamily ?? K.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? K.scribbleStyle,
276
+ position: e.position ?? K.position,
277
+ movableLauncher: e.movableLauncher ?? K.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -301,7 +301,7 @@ async function bo(e = {}) {
301
301
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
302
302
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
303
303
  };
304
- X("web-sdk.widget", "Mounting widget with merged options", {
304
+ Y("web-sdk.widget", "Mounting widget with merged options", {
305
305
  accentColor: t.accentColor,
306
306
  colorScheme: t.colorScheme,
307
307
  fontFamily: t.fontFamily,
@@ -316,32 +316,32 @@ async function bo(e = {}) {
316
316
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
317
317
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
318
318
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
319
- let i = Ct(t.accentColor, t.scribbleStyle);
320
- Do(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
321
- const l = await Sa(), s = l.ownerDocument;
322
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Ut(o, t.accentColor), Et(a, i, {
319
+ let i = Rt(t.accentColor, t.scribbleStyle);
320
+ Xo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
321
+ const l = await qa(), p = l.ownerDocument;
322
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Kt(o, t.accentColor), Mt(a, i, {
323
323
  accentColor: t.accentColor,
324
324
  colorScheme: t.colorScheme,
325
325
  fontFamily: t.fontFamily,
326
326
  scribbleStyle: t.scribbleStyle
327
- }), X("web-sdk.widget", "Applied initial widget appearance", {
327
+ }), Y("web-sdk.widget", "Applied initial widget appearance", {
328
328
  accentColor: t.accentColor,
329
329
  colorScheme: t.colorScheme,
330
330
  fontFamily: t.fontFamily,
331
331
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
332
332
  });
333
- const d = a.querySelector(".pluno-pa-widget__launcher"), c = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), A = a.querySelector(".pluno-pa-widget__composer"), E = a.querySelector(".pluno-pa-widget__attachment-error"), R = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), C = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), ne = a.querySelector(".pluno-pa-widget__timeline-jump"), ge = a.querySelector(".pluno-pa-widget__active-users-counter"), L = a.querySelector(".pluno-pa-widget__timeline"), w = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
334
- if (!d || !p || !b || !x || !A || !E || !R || !v || !y || !h || !g || !C || !N || !ne || !ge || !L || !w)
333
+ 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");
334
+ if (!c || !s || !b || !x || !P || !k || !O || !y || !C || !h || !g || !E || !I || !le || !xe || !R || !_ || !L || !G || !M || !f || !A)
335
335
  throw new Error("Failed to mount Pluno widget");
336
- if (t.movableLauncher && !c)
336
+ if (t.movableLauncher && !u)
337
337
  throw new Error("Failed to mount Pluno widget drag handle");
338
- Pt(p), Pt(g);
339
- let f = [], I = null;
340
- const P = () => {
341
- Ko(v, f, (r) => {
342
- f = f.filter((u, k) => k !== r), P(), O(_.getState()), G();
338
+ zt(s), zt(g);
339
+ let T = [], J = null;
340
+ const me = () => {
341
+ ma(y, T, (r) => {
342
+ T = T.filter((d, S) => S !== r), me(), U(w.getState()), W();
343
343
  });
344
- }, M = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
344
+ }, En = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
345
345
  if (!t.tokenEndpoint)
346
346
  throw new Error("Pluno widget requires token or tokenEndpoint");
347
347
  const r = await fetch(t.tokenEndpoint, {
@@ -352,19 +352,19 @@ async function bo(e = {}) {
352
352
  });
353
353
  if (!r.ok)
354
354
  throw new Error("Failed to load Pluno token");
355
- const u = await r.json();
356
- if (!u.token)
355
+ const d = await r.json();
356
+ if (!d.token)
357
357
  throw new Error("Pluno token endpoint did not return a token");
358
- return u.token;
359
- }), T = window.fetch.bind(window);
360
- let _;
361
- _ = await yn.init({
358
+ return d.token;
359
+ }), Sn = window.fetch.bind(window);
360
+ let w;
361
+ w = await Mn.init({
362
362
  token: t.token,
363
- tokenProvider: M,
363
+ tokenProvider: En,
364
364
  backendUrl: t.backendUrl,
365
365
  metadata: () => ({
366
366
  ...t.metadata ?? {},
367
- ...!_.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
367
+ ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
368
368
  }),
369
369
  initialStarterPrompts: t.initialStarterPrompts,
370
370
  clientId: t.clientId,
@@ -373,42 +373,83 @@ async function bo(e = {}) {
373
373
  webSocketFactory: t.webSocketFactory,
374
374
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
375
375
  });
376
- const oe = ka(t), Ne = new Set(oe.openToolGroupKeys), se = new Set(oe.seenShareCandidateIds), _e = new Set(se);
377
- let Ie = oe.sharePromptsDisabled || await La(t), V = t.movableLauncher ? oe.launcherPosition : null, et = V !== null, Q = null, De = !1, ae = !1, ie = {
376
+ const pe = ja(t), ze = new Set(pe.openToolGroupKeys), be = new Set(pe.seenShareCandidateIds), Le = new Set(be);
377
+ let Ge = pe.sharePromptsDisabled || await Va(t), Q = t.movableLauncher ? pe.launcherPosition : null, dt = Q !== null, oe = null, He = !1, se = !1, de = {
378
378
  enabled: !0
379
- }, re = 0, tt = "";
380
- const Y = (r, u) => {
381
- ie = { enabled: r, reason: u };
382
- }, K = () => {
383
- ne.hidden = !0;
384
- }, hn = () => {
385
- ne.hidden = !1;
386
- }, mn = (r = "jump") => {
387
- Y(!0, r), K(), fe(L, () => ie.enabled), re = L.scrollTop;
388
- }, bn = () => {
389
- De || typeof document > "u" || (Ut(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
390
- }, nt = new MutationObserver(bn);
391
- nt.observe(s.documentElement, { childList: !0, subtree: !0 });
392
- const Re = (r = !0) => {
393
- const u = Ke(a, r);
394
- return St(
379
+ }, ce = 0, ct = "", ae = !1, ee = !1, ie = [], We = null, ye = null;
380
+ const q = (r, d) => {
381
+ de = { enabled: r, reason: d };
382
+ }, j = () => {
383
+ G.hidden = !0;
384
+ }, kn = () => {
385
+ G.hidden = !1;
386
+ }, Ln = (r = "jump") => {
387
+ q(!0, r), j(), Se(f, () => de.enabled), ce = f.scrollTop;
388
+ }, ue = () => {
389
+ if (le.hidden = t.loginRequired, xe.hidden = !ae, le.setAttribute("aria-expanded", String(ae)), R.classList.toggle(
390
+ "pluno-pa-widget__history-list--center",
391
+ ee && ie.length === 0
392
+ ), R.replaceChildren(), ee && ie.length === 0) {
393
+ const r = document.createElement("p");
394
+ r.className = "pluno-pa-widget__history-loading", r.textContent = "Loading...", R.appendChild(r);
395
+ }
396
+ for (const r of ie) {
397
+ const d = document.createElement("button");
398
+ d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = ee;
399
+ const S = document.createElement("span");
400
+ S.className = "pluno-pa-widget__history-item-title", S.textContent = Vo(r);
401
+ const B = document.createElement("time");
402
+ B.className = "pluno-pa-widget__history-time", B.dateTime = r.lastActiveAt, B.textContent = Ko(r.lastActiveAt, Date.now());
403
+ const N = document.createElement("small");
404
+ N.className = "pluno-pa-widget__history-path", N.textContent = Yo(r), d.append(S, B, N), d.addEventListener("click", () => {
405
+ ae = !1, ye = null, ue(), q(!0, "newSession"), j(), w.loadSession(r.id), U(w.getState());
406
+ }), R.appendChild(d);
407
+ }
408
+ if (ee && ie.length > 0) {
409
+ const r = document.createElement("p");
410
+ r.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", r.textContent = "Loading...", R.appendChild(r);
411
+ }
412
+ L.textContent = ye ?? (!ee && ie.length === 0 ? "No recent chats for this page yet." : ""), L.hidden = L.textContent.length === 0;
413
+ }, ut = async (r) => {
414
+ if (!ee) {
415
+ ee = !0, ye = null, ue();
416
+ try {
417
+ const d = await w.listSessions({ cursor: r, limit: 20 });
418
+ ie = r ? [...ie, ...d.sessions] : d.sessions, We = d.nextCursor;
419
+ } catch (d) {
420
+ Y("web-sdk.widget", "Failed to load session history", {
421
+ message: d instanceof Error ? d.message : String(d)
422
+ }), ye = mo;
423
+ } finally {
424
+ ee = !1, ue();
425
+ }
426
+ }
427
+ }, Pn = () => {
428
+ !We || ee || R.scrollHeight - R.scrollTop - R.clientHeight <= 24 && ut(We);
429
+ }, An = () => {
430
+ He || typeof document > "u" || (Kt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
431
+ }, gt = new MutationObserver(An);
432
+ gt.observe(p.documentElement, { childList: !0, subtree: !0 });
433
+ const $e = (r = !0) => {
434
+ const d = it(a, r);
435
+ return Bt(
395
436
  a,
396
- V ? Co(V, u) : yo(a, t.position, u),
397
- u
437
+ Q ? Oo(Q, d) : Bo(a, t.position, d),
438
+ d
398
439
  );
399
- }, z = () => {
400
- Pa(t, {
440
+ }, H = () => {
441
+ Ka(t, {
401
442
  isOpen: a.classList.contains("pluno-pa-widget--open"),
402
443
  composerValue: g.value,
403
- openToolGroupKeys: [...Ne],
404
- launcherPosition: et ? V : null,
405
- seenShareCandidateIds: [...se].slice(-qt),
406
- sharePromptsDisabled: Ie
444
+ openToolGroupKeys: [...ze],
445
+ launcherPosition: dt ? Q : null,
446
+ seenShareCandidateIds: [...be].slice(-nn),
447
+ sharePromptsDisabled: Ge
407
448
  });
408
- }, le = (r, u = {}) => {
409
- To(r, {
410
- debugVersion: ho,
411
- launcherPosition: V,
449
+ }, ge = (r, d = {}) => {
450
+ $o(r, {
451
+ debugVersion: Po,
452
+ launcherPosition: Q,
412
453
  rootClasses: a.className,
413
454
  rootStyle: {
414
455
  left: a.style.left,
@@ -416,110 +457,110 @@ async function bo(e = {}) {
416
457
  right: a.style.right,
417
458
  bottom: a.style.bottom
418
459
  },
419
- rootRect: Ge(a),
420
- launcherRect: Ge(d),
421
- panelRect: Ge(b),
422
- viewport: J(),
460
+ rootRect: Ze(a),
461
+ launcherRect: Ze(c),
462
+ panelRect: Ze(b),
463
+ viewport: ne(),
423
464
  panelHidden: b.hidden,
424
465
  closeHidden: x.hidden,
425
- ...u
466
+ ...d
426
467
  });
427
- }, xe = (r = !0) => {
428
- if (!V)
429
- return Ee(a, null), Re(r);
430
- const u = Re(r);
431
- return Ee(a, u), le("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
432
- }, ot = (r, u) => {
433
- if (!r || !u) {
434
- Po(a);
468
+ }, Pe = (r = !0) => {
469
+ if (!Q)
470
+ return Ie(a, null), $e(r);
471
+ const d = $e(r);
472
+ return Ie(a, d), ge("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
473
+ }, ht = (r, d) => {
474
+ if (!r || !d) {
475
+ Wo(a);
435
476
  return;
436
477
  }
437
- Ao(a, {
438
- x: r.x - u.x,
439
- y: r.y - u.y
478
+ Ho(a, {
479
+ x: r.x - d.x,
480
+ y: r.y - d.y
440
481
  });
441
- }, at = () => {
442
- const r = xe();
482
+ }, mt = () => {
483
+ const r = Pe();
443
484
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
444
- const u = kt(a, r, t.position);
445
- ot(u, r), le("Applied open panel position after viewport resize", { openPanelPosition: u });
446
- } else V && le("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
485
+ const d = Ot(a, r, t.position);
486
+ ht(d, r), ge("Applied open panel position after viewport resize", { openPanelPosition: d });
487
+ } else Q && ge("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
447
488
  };
448
- let it = () => {
489
+ let bt = () => {
449
490
  };
450
- window.addEventListener("resize", at), t.movableLauncher && c ? (xe(), it = vo({
491
+ window.addEventListener("resize", mt), t.movableLauncher && u ? (Pe(), bt = Mo({
451
492
  root: a,
452
- launcher: d,
453
- launcherDragHandle: c,
454
- getPosition: () => Re(),
493
+ launcher: c,
494
+ launcherDragHandle: u,
495
+ getPosition: () => $e(),
455
496
  setPosition: (r) => {
456
- const u = r, k = Ke(a), H = St(a, r, k);
457
- V = Eo(H, k), Ee(a, H), le("Dragging closed launcher", { requestedPosition: u });
497
+ const d = r, S = it(a), B = Bt(a, r, S);
498
+ Q = Uo(B, S), Ie(a, B), ge("Dragging closed launcher", { requestedPosition: d });
458
499
  },
459
500
  persist: () => {
460
- et = !0, z(), le("Persisted closed launcher drag position");
501
+ dt = !0, H(), ge("Persisted closed launcher drag position");
461
502
  }
462
- })) : Ee(a, null);
463
- let Me = !1;
464
- const rt = async () => {
465
- if (!(!t.billingStatusLoader || Me)) {
466
- Me = !0;
503
+ })) : Ie(a, null);
504
+ let qe = !1;
505
+ const ft = async () => {
506
+ if (!(!t.billingStatusLoader || qe)) {
507
+ qe = !0;
467
508
  try {
468
509
  const r = await t.billingStatusLoader();
469
- Nt(t.billingStatus, r, _.getState().lastErrorCode) && (t.billingStatus = r, $e(R, t.billingStatus, _.getState().lastErrorCode), G());
510
+ Ht(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, et(O, t.billingStatus, w.getState().lastErrorCode), W());
470
511
  } finally {
471
- Me = !1;
512
+ qe = !1;
472
513
  }
473
514
  }
474
- }, pe = (r = "", u = !0) => {
475
- rt(), Q !== null && (window.clearTimeout(Q), Q = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
476
- const k = xe(), H = kt(a, k, t.position);
477
- if (ot(H, k), le("Opening launcher at clamped open panel position", { openPanelPosition: H, visibleLauncherPosition: k }), Y(!0, "open"), K(), !u) {
478
- a.classList.add("pluno-pa-widget--open"), d.hidden = !0, r && (g.value = r, be(g)), fe(L, () => ie.enabled), re = L.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), z();
515
+ }, he = (r = "", d = !0) => {
516
+ ft(), oe !== null && (window.clearTimeout(oe), oe = null), b.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
517
+ const S = Pe(), B = Ot(a, S, t.position);
518
+ if (ht(B, S), ge("Opening launcher at clamped open panel position", { openPanelPosition: B, visibleLauncherPosition: S }), q(!0, "open"), j(), !d) {
519
+ 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();
479
520
  return;
480
521
  }
481
522
  window.requestAnimationFrame(() => {
482
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, be(g)), fe(L, () => ie.enabled), re = L.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), z(), Q = window.setTimeout(() => {
483
- d.hidden = !0, fe(L, () => ie.enabled), re = L.scrollTop;
523
+ 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(() => {
524
+ c.hidden = !0, Se(f, () => de.enabled), ce = f.scrollTop;
484
525
  }, 220);
485
526
  });
486
- }, fn = () => {
487
- Q !== null && (window.clearTimeout(Q), Q = null), d.hidden = !1, V && (xe(!1), le("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), z(), Q = window.setTimeout(() => {
527
+ }, Tn = () => {
528
+ oe !== null && (window.clearTimeout(oe), oe = null), c.hidden = !1, Q && (Pe(!1), ge("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), H(), oe = window.setTimeout(() => {
488
529
  b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
489
530
  }, 220);
490
531
  };
491
- d.addEventListener("submit", (r) => {
492
- r.preventDefault(), pe(p.value), p.value = "";
493
- }), c?.addEventListener("click", (r) => {
532
+ c.addEventListener("submit", (r) => {
533
+ r.preventDefault(), he(s.value), s.value = "";
534
+ }), u?.addEventListener("click", (r) => {
494
535
  r.preventDefault(), r.stopPropagation();
495
- }), d.addEventListener("click", (r) => {
496
- r.target === p && !c || (pe(p.value), p.value = "");
497
- }), p.addEventListener("focus", () => {
498
- pe(p.value), p.value = "";
499
- }), p.addEventListener("input", () => {
500
- if (!p.value)
536
+ }), c.addEventListener("click", (r) => {
537
+ r.target === s && !u || (he(s.value), s.value = "");
538
+ }), s.addEventListener("focus", () => {
539
+ he(s.value), s.value = "";
540
+ }), s.addEventListener("input", () => {
541
+ if (!s.value)
501
542
  return;
502
- const r = p.value;
503
- pe(r), p.value = "";
504
- }), x.addEventListener("click", fn), L.addEventListener("scroll", () => {
505
- L.scrollTop < re - 1 && Y(!1, "userScroll"), re = L.scrollTop;
506
- }), ne.addEventListener("click", () => {
507
- mn();
543
+ const r = s.value;
544
+ he(r), s.value = "";
545
+ }), x.addEventListener("click", Tn), f.addEventListener("scroll", () => {
546
+ f.scrollTop < ce - 1 && q(!1, "userScroll"), ce = f.scrollTop;
547
+ }), G.addEventListener("click", () => {
548
+ Ln();
508
549
  });
509
- const lt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
550
+ const wt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
510
551
  ([r]) => {
511
- r?.isIntersecting && (Y(!0, "bottom"), K());
552
+ r?.isIntersecting && (q(!0, "bottom"), j());
512
553
  },
513
- { root: L, threshold: 0 }
554
+ { root: f, threshold: 0 }
514
555
  );
515
- lt?.observe(w);
516
- const ve = () => t.loginRequired || t.signupRequired, pt = () => {
517
- const r = ve();
518
- p.readOnly = r, p.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : q.launcherLabel, A.hidden = r;
519
- }, G = () => {
520
- C.disabled = j(t.billingStatus) || !_.getState().isThinking && g.value.trim().length === 0 && f.length === 0, h.disabled = ve() || j(t.billingStatus);
556
+ wt?.observe(A);
557
+ const Ae = () => t.loginRequired || t.signupRequired, _t = () => {
558
+ const r = Ae();
559
+ s.readOnly = r, s.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : K.launcherLabel, P.hidden = r;
560
+ }, W = () => {
561
+ E.disabled = X(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && T.length === 0, h.disabled = Ae() || X(t.billingStatus);
521
562
  };
522
- pt(), A.addEventListener("submit", (r) => {
563
+ _t(), P.addEventListener("submit", (r) => {
523
564
  if (r.preventDefault(), t.loginRequired) {
524
565
  t.onLoginClick?.();
525
566
  return;
@@ -528,83 +569,87 @@ async function bo(e = {}) {
528
569
  t.onSignupClick?.();
529
570
  return;
530
571
  }
531
- j(t.billingStatus) || (ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G());
572
+ X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W());
532
573
  });
533
- let he = 0;
534
- const wn = () => {
535
- he = 0, a.classList.remove("pluno-pa-widget--drag-over");
536
- }, st = (r) => {
537
- I !== null && window.clearTimeout(I), E.textContent = r, E.hidden = !1, I = window.setTimeout(() => {
538
- E.textContent = "", E.hidden = !0, I = null;
574
+ let ve = 0;
575
+ const Nn = () => {
576
+ ve = 0, a.classList.remove("pluno-pa-widget--drag-over");
577
+ }, xt = (r) => {
578
+ J !== null && window.clearTimeout(J), k.textContent = r, k.hidden = !1, J = window.setTimeout(() => {
579
+ k.textContent = "", k.hidden = !0, J = null;
539
580
  }, 3e3);
540
- }, _n = () => {
541
- I !== null && (window.clearTimeout(I), I = null), E.textContent = "", E.hidden = !0;
542
- }, dt = async (r) => {
581
+ }, In = () => {
582
+ J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
583
+ }, yt = async (r) => {
543
584
  if (r.length === 0)
544
585
  return;
545
- const u = await Qo(r);
546
- if (f.length + u.length > Te)
547
- throw new Error(`Attach up to ${Te} files per message.`);
548
- f = [...f, ...u], P(), _n(), G(), O(_.getState()), a.classList.contains("pluno-pa-widget--open") || pe();
586
+ const d = await _a(r);
587
+ if (T.length + d.length > Ue)
588
+ throw new Error(`Attach up to ${Ue} files per message.`);
589
+ T = [...T, ...d], me(), In(), W(), U(w.getState()), a.classList.contains("pluno-pa-widget--open") || he();
549
590
  };
550
591
  h.addEventListener("click", () => {
551
- t.loginRequired || j(t.billingStatus) || y.click();
552
- }), y.addEventListener("change", () => {
553
- const r = Array.from(y.files ?? []);
554
- y.value = "", dt(r).catch((u) => {
555
- st(u instanceof Error ? u.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
556
- message: u instanceof Error ? u.message : String(u)
592
+ t.loginRequired || X(t.billingStatus) || C.click();
593
+ }), C.addEventListener("change", () => {
594
+ const r = Array.from(C.files ?? []);
595
+ C.value = "", yt(r).catch((d) => {
596
+ xt(d instanceof Error ? d.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
597
+ message: d instanceof Error ? d.message : String(d)
557
598
  });
558
599
  });
559
600
  }), a.addEventListener("dragenter", (r) => {
560
- !Se(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), he += 1, a.classList.add("pluno-pa-widget--drag-over"));
601
+ !De(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ve += 1, a.classList.add("pluno-pa-widget--drag-over"));
561
602
  }), a.addEventListener("dragover", (r) => {
562
- const u = r.dataTransfer;
563
- !Se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
603
+ const d = r.dataTransfer;
604
+ !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
564
605
  }), a.addEventListener("dragleave", (r) => {
565
- Se(r.dataTransfer) && (r.stopPropagation(), he = Math.max(0, he - 1), he === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
606
+ De(r.dataTransfer) && (r.stopPropagation(), ve = Math.max(0, ve - 1), ve === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
566
607
  }), a.addEventListener("drop", (r) => {
567
- const u = r.dataTransfer;
568
- !Se(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), wn(), dt(u.files).catch((k) => {
569
- st(k instanceof Error ? k.message : "Failed to attach file"), X("web-sdk.widget", "Attachment failed", {
570
- message: k instanceof Error ? k.message : String(k)
608
+ const d = r.dataTransfer;
609
+ !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Nn(), yt(d.files).catch((S) => {
610
+ xt(S instanceof Error ? S.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
611
+ message: S instanceof Error ? S.message : String(S)
571
612
  });
572
613
  }));
573
- }), C.addEventListener("click", () => {
614
+ }), E.addEventListener("click", () => {
574
615
  if (t.loginRequired) {
575
616
  t.onLoginClick?.();
576
617
  return;
577
618
  }
578
- if (_.getState().isThinking) {
579
- _.stop();
619
+ if (w.getState().isThinking) {
620
+ w.stop();
580
621
  return;
581
622
  }
582
- ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G(), O(_.getState());
583
- }), N.addEventListener("click", () => {
584
- ae = !0, Y(!0, "newSession"), K(), _.startNewSession(), Ne.clear(), g.value = "", f = [], P(), be(g), z(), G(), g.focus(), O(_.getState());
585
- }), g.addEventListener("input", () => {
586
- be(g), z(), G(), O(_.getState());
623
+ se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
624
+ }), I.addEventListener("click", () => {
625
+ se = !0, q(!0, "newSession"), j(), ae = !1, ue(), w.startNewSession(), ze.clear(), g.value = "", T = [], me(), Ee(g), H(), W(), g.focus(), U(w.getState());
626
+ }), le.addEventListener("click", () => {
627
+ ae = !ae, ye = null, ue(), ae && ie.length === 0 && ut(null);
628
+ }), _.addEventListener("click", () => {
629
+ ae = !1, ue();
630
+ }), R.addEventListener("scroll", Pn), g.addEventListener("input", () => {
631
+ Ee(g), H(), W(), U(w.getState());
587
632
  }), g.addEventListener("keydown", (r) => {
588
633
  if (!(r.key !== "Enter" || r.shiftKey)) {
589
634
  if (r.preventDefault(), t.loginRequired) {
590
635
  t.onLoginClick?.();
591
636
  return;
592
637
  }
593
- ae = !0, Y(!0, "send"), K(), f = We(_, g, f), P(), G(), O(_.getState());
638
+ se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
594
639
  }
595
640
  }), a.addEventListener("click", (r) => {
596
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && z();
597
- }), oe.composerValue && (g.value = oe.composerValue, be(g)), oe.isOpen && pe(g.value, !1);
598
- const ye = () => i;
599
- let Be = _.getState().appearance !== null, Ce = null, me = null, de = null, ct = _.getState().isThinking, ce = null, Oe = null, ut = () => {
641
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && H();
642
+ }), pe.composerValue && (g.value = pe.composerValue, Ee(g)), pe.isOpen && he(g.value, !1);
643
+ const Te = () => i;
644
+ let je = w.getState().appearance !== null, Ne = null, Ce = null, fe = null, vt = w.getState().isThinking, we = null, Ve = null, Ct = () => {
600
645
  };
601
- const xn = !!t.socialPostDraftHandler, O = (r) => {
602
- if (Qe(r.lastErrorCode) ? ce = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !j(t.billingStatus) && (ce = null), $e(R, t.billingStatus, ce), t.loginRequired) {
603
- Rt(
604
- L,
605
- C,
606
- N,
607
- ye,
646
+ const Dn = !!t.socialPostDraftHandler, U = (r) => {
647
+ if (ue(), st(r.lastErrorCode) ? we = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(O, t.billingStatus, we), t.loginRequired) {
648
+ qt(
649
+ f,
650
+ E,
651
+ I,
652
+ Te,
608
653
  "Log in to use Pluno on this page.",
609
654
  t.loginButtonLabel,
610
655
  t.loginUrl,
@@ -613,11 +658,11 @@ async function bo(e = {}) {
613
658
  return;
614
659
  }
615
660
  if (t.signupRequired) {
616
- Rt(
617
- L,
618
- C,
619
- N,
620
- ye,
661
+ qt(
662
+ f,
663
+ E,
664
+ I,
665
+ Te,
621
666
  "Complete signup to unlock your free trial credits.",
622
667
  t.signupButtonLabel,
623
668
  t.signupUrl,
@@ -625,133 +670,133 @@ async function bo(e = {}) {
625
670
  );
626
671
  return;
627
672
  }
628
- const u = No(r), k = u !== tt;
629
- tt = u;
630
- const H = ae || ie.enabled;
631
- ae = !1, ca(
632
- L,
633
- w,
634
- C,
635
- N,
636
- ge,
673
+ const d = qo(r), S = d !== ct;
674
+ ct = d;
675
+ const B = se || de.enabled;
676
+ se = !1, Na(
677
+ f,
678
+ A,
679
+ E,
680
+ I,
681
+ M,
637
682
  r,
638
- Oe,
639
- Oe !== null && Dt(r, g.value.trim().length > 0 || f.length > 0),
683
+ Ve,
684
+ Ve !== null && $t(r, g.value.trim().length > 0 || T.length > 0),
685
+ B,
686
+ () => de.enabled,
687
+ ze,
640
688
  H,
641
- () => ie.enabled,
642
- Ne,
643
- z,
644
- ye,
645
- (U) => {
646
- ae = !0, Y(!0, "send"), K(), _.sendMessage(U);
689
+ Te,
690
+ (N) => {
691
+ se = !0, q(!0, "send"), j(), w.sendMessage(N);
647
692
  },
648
- xn && !Ie ? {
649
- dismissedCandidateIds: _e,
650
- draftingCandidateId: Ce,
651
- error: me,
652
- characterIconOptions: ye(),
653
- onSeen: (U) => {
654
- se.add(U.id), z();
693
+ Dn && !Ge ? {
694
+ dismissedCandidateIds: Le,
695
+ draftingCandidateId: Ne,
696
+ error: Ce,
697
+ characterIconOptions: Te(),
698
+ onSeen: (N) => {
699
+ be.add(N.id), H();
655
700
  },
656
- onDraft: (U) => {
657
- vn(U);
701
+ onDraft: (N) => {
702
+ Rn(N);
658
703
  },
659
- onDismiss: (U) => {
660
- se.add(U.id), _e.add(U.id), z(), me = null, O(_.getState());
704
+ onDismiss: (N) => {
705
+ be.add(N.id), Le.add(N.id), H(), Ce = null, U(w.getState());
661
706
  },
662
- onDisable: (U) => {
663
- Ie = !0, se.add(U.id), _e.add(U.id), z(), Aa(t, !0), me = null, O(_.getState());
707
+ onDisable: (N) => {
708
+ Ge = !0, be.add(N.id), Le.add(N.id), H(), Ya(t, !0), Ce = null, U(w.getState());
664
709
  }
665
710
  } : void 0
666
- ), H ? (re = L.scrollTop, K()) : k && Io(r) && hn();
711
+ ), B ? (ce = f.scrollTop, j()) : S && jo(r) && kn();
667
712
  };
668
- return ut = Fn((r) => {
669
- Oe = r, !De && Dt(_.getState(), g.value.trim().length > 0 || f.length > 0) && O(_.getState());
670
- }, { backendUrl: t.backendUrl, fetcher: T, loader: t.activeUsersLoader }), _.on("state", (r) => {
671
- const u = ct && !r.isThinking;
672
- ct = r.isThinking, r.appearance ? (Be = !0, X("web-sdk.widget", "Agent state supplied appearance", {
713
+ return Ct = Jn((r) => {
714
+ Ve = r, !He && $t(w.getState(), g.value.trim().length > 0 || T.length > 0) && U(w.getState());
715
+ }, { backendUrl: t.backendUrl, fetcher: Sn, loader: t.activeUsersLoader }), w.on("state", (r) => {
716
+ const d = vt && !r.isThinking;
717
+ vt = r.isThinking, r.appearance ? (je = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
673
718
  appearance: r.appearance
674
- }), Ue(r.appearance, "agent.state.appearance")) : Be && (Be = !1, X("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
719
+ }), Ye(r.appearance, "agent.state.appearance")) : je && (je = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
675
720
  fallbackAccentColor: t.accentColor,
676
721
  fallbackColorScheme: t.colorScheme,
677
722
  fallbackFontFamily: t.fontFamily
678
- }), Ue({}, "agent.state.appearance-cleared")), O(r), G(), u && rt();
679
- }), O(_.getState()), G(), {
680
- agent: _,
723
+ }), Ye({}, "agent.state.appearance-cleared")), U(r), W(), d && ft();
724
+ }), U(w.getState()), W(), {
725
+ agent: w,
681
726
  updateAppearance: (r) => {
682
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ue(r, "widgetHandle.updateAppearance");
727
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ye(r, "widgetHandle.updateAppearance");
683
728
  },
684
729
  updateBillingStatus: (r) => {
685
- const u = r ?? null;
686
- Nt(t.billingStatus, u, ce) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !j(t.billingStatus) && (ce = null), $e(
730
+ const d = r ?? null;
731
+ Ht(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(
687
732
  a.querySelector(".pluno-pa-widget__billing-status"),
688
733
  t.billingStatus,
689
- ce
690
- ), G());
734
+ we
735
+ ), W());
691
736
  },
692
737
  updateAuthGate: (r) => {
693
- const u = ve();
694
- 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), pt(), O(_.getState()), G(), u && !ve() && _.connect().catch((k) => {
695
- X("web-sdk.widget", "Failed to connect after auth gate cleared", {
696
- message: k instanceof Error ? k.message : String(k)
738
+ const d = Ae();
739
+ t.loginRequired = r.loginRequired === !0, t.signupRequired = r.signupRequired === !0, r.loginButtonLabel !== void 0 && (t.loginButtonLabel = r.loginButtonLabel), r.loginUrl !== void 0 && (t.loginUrl = r.loginUrl), r.signupButtonLabel !== void 0 && (t.signupButtonLabel = r.signupButtonLabel), r.signupUrl !== void 0 && (t.signupUrl = r.signupUrl), _t(), U(w.getState()), W(), d && !Ae() && w.connect().catch((S) => {
740
+ Y("web-sdk.widget", "Failed to connect after auth gate cleared", {
741
+ message: S instanceof Error ? S.message : String(S)
697
742
  });
698
743
  });
699
744
  },
700
745
  openPanel: () => {
701
- pe(g.value, !1);
746
+ he(g.value, !1);
702
747
  },
703
748
  destroy: () => {
704
- De = !0, nt.disconnect(), lt?.disconnect(), window.removeEventListener("resize", at), it(), I !== null && window.clearTimeout(I), ut(), de?.remove(), _.destroy(), n.remove();
749
+ He = !0, gt.disconnect(), wt?.disconnect(), window.removeEventListener("resize", mt), bt(), J !== null && window.clearTimeout(J), Ct(), fe?.remove(), w.destroy(), n.remove();
705
750
  }
706
751
  };
707
- async function vn(r) {
708
- if (!Ce) {
709
- Ce = r.id, me = null, O(_.getState());
752
+ async function Rn(r) {
753
+ if (!Ne) {
754
+ Ne = r.id, Ce = null, U(w.getState());
710
755
  try {
711
756
  if (!t.socialPostDraftHandler)
712
757
  throw new Error("Social post drafting is not available here.");
713
- const u = await t.socialPostDraftHandler(r);
714
- if (!u.linkedinPost || !u.xPost)
758
+ const d = await t.socialPostDraftHandler(r);
759
+ if (!d.linkedinPost || !d.xPost)
715
760
  throw new Error("Pluno did not return a complete social post draft.");
716
- se.add(r.id), _e.add(r.id), z(), de?.remove(), de = ha(u, {
761
+ be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ra(d, {
717
762
  socialPostRewardsUrl: t.socialPostRewardsUrl,
718
763
  onClose: () => {
719
- de?.remove(), de = null;
764
+ fe?.remove(), fe = null;
720
765
  }
721
- }), a.appendChild(de);
722
- } catch (u) {
723
- me = u instanceof Error ? u.message : "Could not draft social post.";
766
+ }), a.appendChild(fe);
767
+ } catch (d) {
768
+ Ce = d instanceof Error ? d.message : "Could not draft social post.";
724
769
  } finally {
725
- Ce = null, O(_.getState());
770
+ Ne = null, U(w.getState());
726
771
  }
727
772
  }
728
773
  }
729
- function Ue(r, u) {
730
- const k = r.accentColor ?? t.accentColor, H = r.colorScheme ?? t.colorScheme, U = r.fontFamily ?? t.fontFamily, Fe = r.scribbleStyle ?? t.scribbleStyle;
731
- i = Ct(k, Fe), Et(a, i, {
732
- accentColor: k,
733
- colorScheme: H,
734
- fontFamily: U,
735
- scribbleStyle: Fe
736
- }), X("web-sdk.widget", "Updated widget appearance", {
737
- source: u,
774
+ function Ye(r, d) {
775
+ const S = r.accentColor ?? t.accentColor, B = r.colorScheme ?? t.colorScheme, N = r.fontFamily ?? t.fontFamily, Ke = r.scribbleStyle ?? t.scribbleStyle;
776
+ i = Rt(S, Ke), Mt(a, i, {
777
+ accentColor: S,
778
+ colorScheme: B,
779
+ fontFamily: N,
780
+ scribbleStyle: Ke
781
+ }), Y("web-sdk.widget", "Updated widget appearance", {
782
+ source: d,
738
783
  inputAppearance: r,
739
- appliedAccentColor: k,
740
- appliedColorScheme: H,
741
- appliedFontFamily: U,
742
- appliedScribbleStyle: Fe,
784
+ appliedAccentColor: S,
785
+ appliedColorScheme: B,
786
+ appliedFontFamily: N,
787
+ appliedScribbleStyle: Ke,
743
788
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
744
789
  });
745
790
  }
746
791
  }
747
- function Ct(e, t) {
792
+ function Rt(e, t) {
748
793
  return { accentColor: e, scribbleStyle: t };
749
794
  }
750
- function fo(e) {
751
- const t = wo(e);
752
- return t === null ? "#fafafa" : _o(t) > 0.5 ? "#18181b" : "#fafaf9";
795
+ function No(e) {
796
+ const t = Io(e);
797
+ return t === null ? "#fafafa" : Do(t) > 0.5 ? "#18181b" : "#fafaf9";
753
798
  }
754
- function wo(e) {
799
+ function Io(e) {
755
800
  const t = e.trim();
756
801
  return /^#[0-9a-f]{6}$/i.test(t) ? [
757
802
  Number.parseInt(t.slice(1, 3), 16),
@@ -763,26 +808,26 @@ function wo(e) {
763
808
  Number.parseInt(t[3] + t[3], 16)
764
809
  ] : null;
765
810
  }
766
- function _o([e, t, n]) {
811
+ function Do([e, t, n]) {
767
812
  const o = (a) => {
768
813
  const i = a / 255;
769
814
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
770
815
  };
771
816
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
772
817
  }
773
- function Et(e, t, n) {
818
+ function Mt(e, t, n) {
774
819
  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);
775
- const o = n.scribbleStyle ? Wt(n.accentColor) : n.accentColor;
776
- e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", fo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? to : n.fontFamily, n.scribbleStyle && xo(e.ownerDocument);
820
+ const o = n.scribbleStyle ? Qt(n.accentColor) : n.accentColor;
821
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", No(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? bo : n.fontFamily, n.scribbleStyle && Ro(e.ownerDocument);
777
822
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
778
823
  for (const i of a)
779
- i.replaceWith(ee(Array.from(i.classList).join(" "), t));
824
+ i.replaceWith(re(Array.from(i.classList).join(" "), t));
780
825
  }
781
- function xo(e) {
782
- if (e.getElementById(_t))
826
+ function Ro(e) {
827
+ if (e.getElementById(Tt))
783
828
  return;
784
829
  const t = e.createElement("style");
785
- t.id = _t, t.textContent = `@font-face {
830
+ t.id = Tt, t.textContent = `@font-face {
786
831
  font-family: "Architects Daughter";
787
832
  font-style: normal;
788
833
  font-weight: 400;
@@ -790,7 +835,7 @@ function xo(e) {
790
835
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
791
836
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
792
837
  }
793
- function vo({
838
+ function Mo({
794
839
  root: e,
795
840
  launcher: t,
796
841
  launcherDragHandle: n,
@@ -798,137 +843,137 @@ function vo({
798
843
  setPosition: a,
799
844
  persist: i
800
845
  }) {
801
- let l = null, s = null, d = null, c = !1, p = null;
846
+ let l = null, p = null, c = null, u = !1, s = null;
802
847
  const b = () => {
803
- l = null, s = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
848
+ l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
804
849
  }, x = (h) => {
805
- e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, s = { x: h.clientX, y: h.clientY }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
806
- }, A = (h) => {
807
- if (l !== h.pointerId || !s || !d)
850
+ e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = o(), u = !1, t.setPointerCapture?.(h.pointerId));
851
+ }, P = (h) => {
852
+ if (l !== h.pointerId || !p || !c)
808
853
  return;
809
854
  h.preventDefault();
810
- const g = h.clientX - s.x, C = h.clientY - s.y;
811
- !c && Math.hypot(g, C) < vt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: d.x + g, y: d.y + C }));
812
- }, E = (h) => {
813
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (p = { x: h.clientX, y: h.clientY }, i()), b());
814
- }, R = (h) => {
855
+ const g = h.clientX - p.x, E = h.clientY - p.y;
856
+ !u && Math.hypot(g, E) < It || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + E }));
857
+ }, k = (h) => {
858
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (s = { x: h.clientX, y: h.clientY }, i()), b());
859
+ }, O = (h) => {
815
860
  l === h.pointerId && (h.preventDefault(), b());
816
- }, v = (h) => {
817
- if (!p)
818
- return;
819
- const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= vt;
820
- p = null, g && (h.preventDefault(), h.stopPropagation());
821
861
  }, y = (h) => {
862
+ if (!s)
863
+ return;
864
+ const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= It;
865
+ s = null, g && (h.preventDefault(), h.stopPropagation());
866
+ }, C = (h) => {
822
867
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
823
868
  return;
824
- const g = h.shiftKey ? go : uo, C = o();
825
- let N = null;
826
- h.key === "ArrowUp" ? N = { x: C.x, y: C.y - g } : h.key === "ArrowDown" ? N = { x: C.x, y: C.y + g } : h.key === "ArrowLeft" ? N = { x: C.x - g, y: C.y } : h.key === "ArrowRight" && (N = { x: C.x + g, y: C.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
869
+ const g = h.shiftKey ? Lo : ko, E = o();
870
+ let I = null;
871
+ 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());
827
872
  };
828
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", E), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
829
- t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", E), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
873
+ 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), () => {
874
+ 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);
830
875
  };
831
876
  }
832
- function Ke(e, t = !0) {
833
- const n = J(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
877
+ function it(e, t = !0) {
878
+ const n = ne(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
834
879
  return {
835
- width: t && a && o.width > 0 ? o.width : Math.min(Yt, n.width - 36),
836
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? no : Kt
880
+ width: t && a && o.width > 0 ? o.width : Math.min(rn, n.width - 36),
881
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? fo : ln
837
882
  };
838
883
  }
839
- function Qt() {
840
- const e = J();
884
+ function cn() {
885
+ const e = ne();
841
886
  return {
842
887
  width: Math.min(
843
- ue(e.width * io, oo, ao),
844
- e.width - F * 2
888
+ _e(e.width * xo, wo, _o),
889
+ e.width - z * 2
845
890
  ),
846
891
  height: Math.min(
847
- ue(e.height * po, ro, lo),
848
- e.height - Ye - F
892
+ _e(e.height * Co, yo, vo),
893
+ e.height - at - z
849
894
  )
850
895
  };
851
896
  }
852
- function yo(e, t, n) {
897
+ function Bo(e, t, n) {
853
898
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
854
899
  if (Number.isFinite(o) && Number.isFinite(a))
855
900
  return { x: o, y: a };
856
901
  const i = e.getBoundingClientRect();
857
902
  if (i.width > 0 || i.height > 0)
858
903
  return { x: i.left, y: i.top };
859
- const l = J();
904
+ const l = ne();
860
905
  return {
861
906
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
862
907
  y: l.height - 24 - n.height
863
908
  };
864
909
  }
865
- function St(e, t, n) {
866
- const o = J(), a = F + ko(e);
910
+ function Bt(e, t, n) {
911
+ const o = ne(), a = z + zo(e);
867
912
  return {
868
- x: ue(t.x, F, Math.max(F, o.width - n.width - F)),
869
- y: ue(t.y, a, Math.max(a, o.height - n.height - F))
913
+ x: _e(t.x, z, Math.max(z, o.width - n.width - z)),
914
+ y: _e(t.y, a, Math.max(a, o.height - n.height - z))
870
915
  };
871
916
  }
872
- function Co(e, t) {
873
- const n = J();
917
+ function Oo(e, t) {
918
+ const n = ne();
874
919
  return {
875
920
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
876
921
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
877
922
  };
878
923
  }
879
- function Eo(e, t) {
880
- const n = So(e, t), o = J();
924
+ function Uo(e, t) {
925
+ const n = Fo(e, t), o = ne();
881
926
  return {
882
927
  anchor: n,
883
928
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
884
929
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
885
930
  };
886
931
  }
887
- function So(e, t) {
888
- const n = J(), o = e.x + t.width / 2, i = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
932
+ function Fo(e, t) {
933
+ 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";
889
934
  return `${i}-${l}`;
890
935
  }
891
- function ko(e) {
892
- return e.classList.contains("pluno-pa-widget--scribble") ? co : so;
936
+ function zo(e) {
937
+ return e.classList.contains("pluno-pa-widget--scribble") ? So : Eo;
893
938
  }
894
- function kt(e, t, n) {
895
- const o = Ke(e), a = Qt(), i = {
939
+ function Ot(e, t, n) {
940
+ const o = it(e), a = cn(), i = {
896
941
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
897
942
  y: t.y + o.height - a.height
898
943
  };
899
- return Lo(i);
944
+ return Go(i);
900
945
  }
901
- function Lo(e) {
902
- const t = J(), n = Qt();
946
+ function Go(e) {
947
+ const t = ne(), n = cn();
903
948
  return {
904
- x: ue(e.x, F, Math.max(F, t.width - n.width - F)),
905
- y: ue(
949
+ x: _e(e.x, z, Math.max(z, t.width - n.width - z)),
950
+ y: _e(
906
951
  e.y,
907
- Ye,
908
- Math.max(Ye, t.height - n.height - F)
952
+ at,
953
+ Math.max(at, t.height - n.height - z)
909
954
  )
910
955
  };
911
956
  }
912
- function Ee(e, t) {
957
+ function Ie(e, t) {
913
958
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
914
959
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
915
960
  return;
916
961
  }
917
962
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
918
963
  }
919
- function Ao(e, t) {
964
+ function Ho(e, t) {
920
965
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
921
966
  }
922
- function Po(e) {
967
+ function Wo(e) {
923
968
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
924
969
  }
925
- function J() {
970
+ function ne() {
926
971
  return {
927
- width: window.innerWidth || document.documentElement.clientWidth || Yt + F * 2,
928
- height: window.innerHeight || document.documentElement.clientHeight || Kt + F * 2
972
+ width: window.innerWidth || document.documentElement.clientWidth || rn + z * 2,
973
+ height: window.innerHeight || document.documentElement.clientHeight || ln + z * 2
929
974
  };
930
975
  }
931
- function Ge(e) {
976
+ function Ze(e) {
932
977
  const t = e.getBoundingClientRect();
933
978
  return {
934
979
  x: Math.round(t.x),
@@ -937,10 +982,10 @@ function Ge(e) {
937
982
  height: Math.round(t.height)
938
983
  };
939
984
  }
940
- function ue(e, t, n) {
985
+ function _e(e, t, n) {
941
986
  return Math.min(Math.max(e, t), n);
942
987
  }
943
- function X(e, t, n) {
988
+ function Y(e, t, n) {
944
989
  if (typeof window > "u")
945
990
  return;
946
991
  const o = window, a = {
@@ -949,26 +994,26 @@ function X(e, t, n) {
949
994
  message: t,
950
995
  details: n
951
996
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
952
- 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(Zn, { detail: a }));
997
+ i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(co, { detail: a }));
953
998
  }
954
- function To(e, t) {
955
- X("web-sdk.widget.position", e, t);
999
+ function $o(e, t) {
1000
+ Y("web-sdk.widget.position", e, t);
956
1001
  }
957
- function We(e, t, n) {
1002
+ function Je(e, t, n) {
958
1003
  const o = t.value.trim();
959
1004
  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 })), []);
960
1005
  }
961
- function be(e) {
1006
+ function Ee(e) {
962
1007
  e.style.height = "0px";
963
1008
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
964
1009
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
965
1010
  }
966
- function fe(e, t = () => !0) {
1011
+ function Se(e, t = () => !0) {
967
1012
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
968
1013
  t() && (e.scrollTop = e.scrollHeight);
969
1014
  });
970
1015
  }
971
- function No(e) {
1016
+ function qo(e) {
972
1017
  const t = e.messages[e.messages.length - 1];
973
1018
  return [
974
1019
  e.messages.length,
@@ -979,37 +1024,67 @@ function No(e) {
979
1024
  e.lastError ?? ""
980
1025
  ].join(":");
981
1026
  }
982
- function Io(e) {
1027
+ function jo(e) {
983
1028
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
984
1029
  }
985
- function Do(e, t, n, o) {
986
- e.appendChild(Go()), e.appendChild(Ro(t, n, o)), e.appendChild(nn("pluno-pa-widget__close", "Close", Wo(16), !0)), e.appendChild(Mo(n));
1030
+ function Vo(e) {
1031
+ return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1032
+ }
1033
+ function Yo(e) {
1034
+ const t = e.currentPage;
1035
+ if (typeof t?.url == "string" && t.url.trim())
1036
+ try {
1037
+ const n = new URL(t.url);
1038
+ return `${n.pathname || "/"}${n.search}`;
1039
+ } catch {
1040
+ return t.url;
1041
+ }
1042
+ return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1043
+ }
1044
+ function Ko(e, t) {
1045
+ const n = new Date(e).getTime();
1046
+ if (!Number.isFinite(n))
1047
+ return "now";
1048
+ const o = Math.max(0, t - n), a = [
1049
+ ["day", 864e5],
1050
+ ["hour", 36e5],
1051
+ ["min", 6e4]
1052
+ ];
1053
+ for (const [i, l] of a)
1054
+ if (o >= l) {
1055
+ const p = Math.max(1, Math.floor(o / l));
1056
+ return i === "min" ? `${p} min` : `${p} ${i}${p === 1 ? "" : "s"}`;
1057
+ }
1058
+ return "now";
1059
+ }
1060
+ function Xo(e, t, n, o) {
1061
+ e.appendChild(ia()), e.appendChild(Zo(t, n, o)), e.appendChild(Fe("pluno-pa-widget__close", "Close", ra(16), !0)), e.appendChild(Jo(n));
987
1062
  }
988
- function Ro(e, t, n) {
1063
+ function Zo(e, t, n) {
989
1064
  const o = document.createElement("form");
990
1065
  if (o.className = "pluno-pa-widget__launcher", n) {
991
1066
  const i = document.createElement("button");
992
1067
  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);
993
1068
  }
994
- o.appendChild(on("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(ee("pluno-pa-widget__character--launcher", t));
1069
+ o.appendChild(hn("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(re("pluno-pa-widget__character--launcher", t));
995
1070
  const a = document.createElement("input");
996
1071
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
997
1072
  }
998
- function Mo(e) {
1073
+ function Jo(e) {
999
1074
  const t = document.createElement("section");
1000
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(on("pluno-pa-widget__scribble-spirals--panel", 16));
1075
+ t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(hn("pluno-pa-widget__scribble-spirals--panel", 16));
1001
1076
  const n = document.createElement("div");
1002
1077
  n.className = "pluno-pa-widget__timeline-wrap";
1003
1078
  const o = document.createElement("main");
1004
- o.className = "pluno-pa-widget__timeline", o.appendChild(Oo(e));
1079
+ o.className = "pluno-pa-widget__timeline", o.appendChild(ta(e));
1005
1080
  const a = document.createElement("div");
1006
1081
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1007
1082
  const i = document.createElement("div");
1008
1083
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1009
1084
  const l = document.createElement("button");
1010
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(nn("pluno-pa-widget__new-chat", "New chat", Ho(), !0)), t.appendChild(n), t.appendChild(Bo()), t;
1085
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Fe("pluno-pa-widget__history", "Recent chats", pa(), !0)), n.appendChild(Fe("pluno-pa-widget__new-chat", "New chat", la(), !0)), n.appendChild(ea()), t.appendChild(n), t.appendChild(Qo()), t;
1011
1086
  }
1012
- function Bo() {
1087
+ function Qo() {
1013
1088
  const e = document.createElement("form");
1014
1089
  e.className = "pluno-pa-widget__composer";
1015
1090
  const t = document.createElement("div");
@@ -1021,44 +1096,58 @@ function Bo() {
1021
1096
  const a = document.createElement("div");
1022
1097
  a.className = "pluno-pa-widget__composer-inner";
1023
1098
  const i = document.createElement("input");
1024
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Qn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1099
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = go, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1025
1100
  const l = document.createElement("button");
1026
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild($o()), l.appendChild(qo()), a.appendChild(l);
1027
- const s = document.createElement("textarea");
1028
- s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
1029
- const d = document.createElement("button");
1030
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(an()), a.appendChild(d), e.appendChild(a);
1031
- const c = document.createElement("div");
1032
- c.className = "pluno-pa-widget__composer-meta";
1033
- const p = document.createElement("a");
1034
- p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", c.appendChild(p);
1101
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(da()), l.appendChild(ca()), a.appendChild(l);
1102
+ const p = document.createElement("textarea");
1103
+ p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1104
+ const c = document.createElement("button");
1105
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(mn()), a.appendChild(c), e.appendChild(a);
1106
+ const u = document.createElement("div");
1107
+ u.className = "pluno-pa-widget__composer-meta";
1108
+ const s = document.createElement("a");
1109
+ s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai.", u.appendChild(s);
1035
1110
  const b = document.createElement("span");
1036
- return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(b), e.appendChild(c), e;
1111
+ return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1037
1112
  }
1038
- function Oo(e) {
1113
+ function ea() {
1114
+ const e = document.createElement("section");
1115
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", "Recent chats");
1039
1116
  const t = document.createElement("div");
1040
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(ee("pluno-pa-widget__character--empty", e)), t.appendChild(en()), t;
1117
+ t.className = "pluno-pa-widget__history-header";
1118
+ const n = document.createElement("strong");
1119
+ n.textContent = "Recent chats";
1120
+ const o = Fe("pluno-pa-widget__history-close", "Close recent chats", sa(), !1);
1121
+ t.append(n, o);
1122
+ const a = document.createElement("div");
1123
+ a.className = "pluno-pa-widget__history-list";
1124
+ const i = document.createElement("p");
1125
+ return i.className = "pluno-pa-widget__history-status", i.hidden = !0, e.append(t, a, i), e;
1126
+ }
1127
+ function ta(e) {
1128
+ const t = document.createElement("div");
1129
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(un()), t;
1041
1130
  }
1042
- function en() {
1131
+ function un() {
1043
1132
  const e = document.createElement("div");
1044
1133
  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;
1045
1134
  }
1046
- function Uo(e, t) {
1135
+ function na(e, t) {
1047
1136
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1048
1137
  const n = document.createElement("span");
1049
1138
  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`));
1050
1139
  }
1051
- function ee(e, t) {
1052
- const n = `pluno-pa-character-${yt}`;
1053
- yt += 1;
1054
- const o = t.scribbleStyle ? zo(t.accentColor, n) : Fo(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1140
+ function re(e, t) {
1141
+ const n = `pluno-pa-character-${Dt}`;
1142
+ Dt += 1;
1143
+ const o = t.scribbleStyle ? aa(t.accentColor, n) : oa(t.accentColor, n), a = e.split(/\s+/).filter(Boolean);
1055
1144
  return o.setAttribute(
1056
1145
  "class",
1057
1146
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1058
1147
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1059
1148
  }
1060
- function Fo(e, t) {
1061
- const n = Sn(e), o = {
1149
+ function oa(e, t) {
1150
+ const n = Un(e), o = {
1062
1151
  boltFill: `${t}-boltFill`,
1063
1152
  boltEdge: `${t}-boltEdge`,
1064
1153
  boltGlow: `${t}-boltGlow`,
@@ -1069,7 +1158,7 @@ function Fo(e, t) {
1069
1158
  eyeShadow: `${t}-eyeShadow`,
1070
1159
  pupilGloss: `${t}-pupilGloss`,
1071
1160
  boltClip: `${t}-boltClip`
1072
- }, a = tn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1161
+ }, a = gn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1073
1162
  id: o.boltFill,
1074
1163
  x1: "420",
1075
1164
  y1: "180",
@@ -1078,7 +1167,7 @@ function Fo(e, t) {
1078
1167
  gradientUnits: "userSpaceOnUse"
1079
1168
  });
1080
1169
  D(l, "0", n.top), D(l, "0.36", n.middle), D(l, "0.72", n.bottom), D(l, "1", n.bottom);
1081
- const s = m(i, "linearGradient", {
1170
+ const p = m(i, "linearGradient", {
1082
1171
  id: o.boltEdge,
1083
1172
  x1: "470",
1084
1173
  y1: "145",
@@ -1086,28 +1175,28 @@ function Fo(e, t) {
1086
1175
  y2: "980",
1087
1176
  gradientUnits: "userSpaceOnUse"
1088
1177
  });
1089
- D(s, "0", n.edgeStart), D(s, "0.32", n.edgeMiddle), D(s, "0.78", n.edgeEnd), D(s, "1", n.edgeEnd);
1090
- const d = m(i, "radialGradient", {
1178
+ D(p, "0", n.edgeStart), D(p, "0.32", n.edgeMiddle), D(p, "0.78", n.edgeEnd), D(p, "1", n.edgeEnd);
1179
+ const c = m(i, "radialGradient", {
1091
1180
  id: o.boltGlow,
1092
1181
  cx: "50%",
1093
1182
  cy: "22%",
1094
1183
  r: "82%"
1095
1184
  });
1096
- D(d, "0", n.glow, "0.72"), D(d, "0.5", n.middle, "0.44"), D(d, "1", n.bottom, "0");
1097
- const c = m(i, "radialGradient", {
1185
+ D(c, "0", n.glow, "0.72"), D(c, "0.5", n.middle, "0.44"), D(c, "1", n.bottom, "0");
1186
+ const u = m(i, "radialGradient", {
1098
1187
  id: o.eyeWhite,
1099
1188
  cx: "35%",
1100
1189
  cy: "25%",
1101
1190
  r: "70%"
1102
1191
  });
1103
- D(c, "0", "#ffffff"), D(c, "0.72", "#ffffff"), D(c, "1", "#e5e5e5");
1104
- const p = m(i, "radialGradient", {
1192
+ D(u, "0", "#ffffff"), D(u, "0.72", "#ffffff"), D(u, "1", "#e5e5e5");
1193
+ const s = m(i, "radialGradient", {
1105
1194
  id: o.pupil,
1106
1195
  cx: "42%",
1107
1196
  cy: "38%",
1108
1197
  r: "65%"
1109
1198
  });
1110
- D(p, "0", "#2a1f10"), D(p, "0.52", "#080604"), D(p, "1", "#000000");
1199
+ D(s, "0", "#2a1f10"), D(s, "0.52", "#080604"), D(s, "1", "#000000");
1111
1200
  const b = m(i, "filter", {
1112
1201
  id: o.softDropShadow,
1113
1202
  x: "-18%",
@@ -1144,7 +1233,7 @@ function Fo(e, t) {
1144
1233
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1145
1234
  result: "innerLight"
1146
1235
  }), m(x, "feBlend", { in: "SourceGraphic", in2: "innerLight", mode: "screen" });
1147
- const A = m(i, "filter", {
1236
+ const P = m(i, "filter", {
1148
1237
  id: o.eyeShadow,
1149
1238
  x: "-24%",
1150
1239
  y: "-20%",
@@ -1152,14 +1241,14 @@ function Fo(e, t) {
1152
1241
  height: "148%",
1153
1242
  "color-interpolation-filters": "sRGB"
1154
1243
  });
1155
- m(A, "feDropShadow", {
1244
+ m(P, "feDropShadow", {
1156
1245
  dx: "0",
1157
1246
  dy: "8",
1158
1247
  stdDeviation: "5",
1159
1248
  "flood-color": n.shadow,
1160
1249
  "flood-opacity": "0.3"
1161
1250
  });
1162
- const E = m(i, "filter", {
1251
+ const k = m(i, "filter", {
1163
1252
  id: o.pupilGloss,
1164
1253
  x: "-15%",
1165
1254
  y: "-15%",
@@ -1167,29 +1256,29 @@ function Fo(e, t) {
1167
1256
  height: "130%",
1168
1257
  "color-interpolation-filters": "sRGB"
1169
1258
  });
1170
- m(E, "feDropShadow", {
1259
+ m(k, "feDropShadow", {
1171
1260
  dx: "0",
1172
1261
  dy: "3",
1173
1262
  stdDeviation: "3",
1174
1263
  "flood-color": "#000000",
1175
1264
  "flood-opacity": "0.22"
1176
1265
  });
1177
- const R = m(i, "clipPath", { id: o.boltClip });
1178
- m(R, "path", { d: Ae });
1179
- const v = m(a, "g", { filter: W(o.softDropShadow) });
1180
- m(v, "path", { d: Ae, fill: W(o.boltEdge) });
1181
- const y = "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";
1182
- m(v, "path", {
1183
- d: y,
1184
- fill: W(o.boltFill),
1185
- filter: W(o.innerDepth)
1186
- }), m(v, "path", {
1187
- d: y,
1188
- fill: W(o.boltGlow),
1266
+ const O = m(i, "clipPath", { id: o.boltClip });
1267
+ m(O, "path", { d: Be });
1268
+ const y = m(a, "g", { filter: $(o.softDropShadow) });
1269
+ m(y, "path", { d: Be, fill: $(o.boltEdge) });
1270
+ const C = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1271
+ m(y, "path", {
1272
+ d: C,
1273
+ fill: $(o.boltFill),
1274
+ filter: $(o.innerDepth)
1275
+ }), m(y, "path", {
1276
+ d: C,
1277
+ fill: $(o.boltGlow),
1189
1278
  opacity: "0.74"
1190
1279
  });
1191
- const h = m(v, "g", {
1192
- "clip-path": W(o.boltClip),
1280
+ const h = m(y, "g", {
1281
+ "clip-path": $(o.boltClip),
1193
1282
  opacity: "0.42"
1194
1283
  });
1195
1284
  m(h, "path", {
@@ -1214,16 +1303,16 @@ function Fo(e, t) {
1214
1303
  "stroke-linecap": "round",
1215
1304
  opacity: "0.48"
1216
1305
  });
1217
- const g = m(a, "g", { filter: W(o.eyeShadow) });
1218
- return Lt(g, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447", o), Lt(g, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447", o), a;
1306
+ const g = m(a, "g", { filter: $(o.eyeShadow) });
1307
+ 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;
1219
1308
  }
1220
- function zo(e, t) {
1221
- const n = Wt(e), o = {
1309
+ function aa(e, t) {
1310
+ const n = Qt(e), o = {
1222
1311
  clip: `${t}-scribbleBoltClip`,
1223
1312
  wobble: `${t}-scribbleBoltWobble`
1224
- }, a = tn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1225
- m(l, "path", { d: Ae });
1226
- const s = m(i, "filter", {
1313
+ }, a = gn(), i = m(a, "defs"), l = m(i, "clipPath", { id: o.clip });
1314
+ m(l, "path", { d: Be });
1315
+ const p = m(i, "filter", {
1227
1316
  id: o.wobble,
1228
1317
  x: "-10%",
1229
1318
  y: "-10%",
@@ -1231,22 +1320,22 @@ function zo(e, t) {
1231
1320
  height: "120%",
1232
1321
  "color-interpolation-filters": "sRGB"
1233
1322
  });
1234
- m(s, "feTurbulence", {
1323
+ m(p, "feTurbulence", {
1235
1324
  type: "fractalNoise",
1236
1325
  baseFrequency: "0.011",
1237
1326
  numOctaves: "3",
1238
1327
  seed: "7",
1239
1328
  result: "noise"
1240
- }), m(s, "feDisplacementMap", {
1329
+ }), m(p, "feDisplacementMap", {
1241
1330
  in: "SourceGraphic",
1242
1331
  in2: "noise",
1243
1332
  scale: "16",
1244
1333
  xChannelSelector: "R",
1245
1334
  yChannelSelector: "G"
1246
1335
  });
1247
- const d = m(a, "g", { filter: W(o.wobble) }), c = m(d, "g", { "clip-path": W(o.clip) });
1248
- return m(c, "path", {
1249
- d: En(),
1336
+ const c = m(a, "g", { filter: $(o.wobble) }), u = m(c, "g", { "clip-path": $(o.clip) });
1337
+ return m(u, "path", {
1338
+ d: On(),
1250
1339
  fill: "none",
1251
1340
  stroke: n,
1252
1341
  "stroke-width": "56",
@@ -1254,70 +1343,70 @@ function zo(e, t) {
1254
1343
  "stroke-linejoin": "round",
1255
1344
  opacity: "0.9",
1256
1345
  transform: "rotate(-14 627 600)"
1257
- }), m(d, "path", {
1258
- d: Ae,
1346
+ }), m(c, "path", {
1347
+ d: Be,
1259
1348
  fill: "none",
1260
- stroke: Pe,
1349
+ stroke: Oe,
1261
1350
  "stroke-width": "18",
1262
1351
  "stroke-linejoin": "round"
1263
- }), At(d, "rotate(-2 528 463)", "528", "463", "533", "473", "557", "447"), At(d, "rotate(2 717 462)", "717", "462", "712", "473", "728", "447"), a;
1352
+ }), 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;
1264
1353
  }
1265
- function tn() {
1266
- return S("svg", {
1267
- xmlns: Xt,
1354
+ function gn() {
1355
+ return v("svg", {
1356
+ xmlns: pn,
1268
1357
  viewBox: "0 0 1254 1254"
1269
1358
  });
1270
1359
  }
1271
- function Lt(e, t, n, o, a, i, l, s, d) {
1272
- const c = m(e, "g", { transform: t });
1273
- m(c, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: W(d.eyeWhite) }), m(c, "ellipse", {
1360
+ function Ut(e, t, n, o, a, i, l, p, c) {
1361
+ const u = m(e, "g", { transform: t });
1362
+ m(u, "ellipse", { cx: n, cy: o, rx: "73", ry: "80", fill: $(c.eyeWhite) }), m(u, "ellipse", {
1274
1363
  cx: a,
1275
1364
  cy: i,
1276
1365
  rx: "49",
1277
1366
  ry: "57",
1278
- fill: W(d.pupil),
1279
- filter: W(d.pupilGloss)
1280
- }), m(c, "circle", { cx: l, cy: s, r: "18", fill: "#ffffff" });
1367
+ fill: $(c.pupil),
1368
+ filter: $(c.pupilGloss)
1369
+ }), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
1281
1370
  }
1282
- function At(e, t, n, o, a, i, l, s) {
1283
- const d = m(e, "g", { transform: t });
1284
- m(d, "ellipse", {
1371
+ function Ft(e, t, n, o, a, i, l, p) {
1372
+ const c = m(e, "g", { transform: t });
1373
+ m(c, "ellipse", {
1285
1374
  cx: n,
1286
1375
  cy: o,
1287
1376
  rx: "73",
1288
1377
  ry: "80",
1289
1378
  fill: "#ffffff",
1290
- stroke: Pe,
1379
+ stroke: Oe,
1291
1380
  "stroke-width": "13"
1292
- }), m(d, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Pe }), m(d, "circle", { cx: l, cy: s, r: "16", fill: "#ffffff" });
1381
+ }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Oe }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1293
1382
  }
1294
1383
  function m(e, t, n = {}) {
1295
- const o = S(t, n);
1384
+ const o = v(t, n);
1296
1385
  return e.appendChild(o), o;
1297
1386
  }
1298
1387
  function D(e, t, n, o) {
1299
1388
  const a = { offset: t, "stop-color": n };
1300
1389
  o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
1301
1390
  }
1302
- function W(e) {
1391
+ function $(e) {
1303
1392
  return `url(#${e})`;
1304
1393
  }
1305
- function nn(e, t, n, o) {
1394
+ function Fe(e, t, n, o) {
1306
1395
  const a = document.createElement("button");
1307
1396
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1308
1397
  }
1309
- function Go() {
1310
- const e = S("svg", {
1398
+ function ia() {
1399
+ const e = v("svg", {
1311
1400
  class: "pluno-pa-widget__scribble-defs",
1312
1401
  "aria-hidden": "true",
1313
1402
  focusable: "false",
1314
1403
  width: "0",
1315
1404
  height: "0"
1316
- }), t = S("defs");
1317
- return t.appendChild(He("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(He("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(He("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1405
+ }), t = v("defs");
1406
+ 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;
1318
1407
  }
1319
- function on(e, t) {
1320
- const n = S("svg", {
1408
+ function hn(e, t) {
1409
+ const n = v("svg", {
1321
1410
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1322
1411
  viewBox: `0 0 ${t * 26} 36`,
1323
1412
  preserveAspectRatio: "none",
@@ -1325,9 +1414,9 @@ function on(e, t) {
1325
1414
  focusable: "false"
1326
1415
  });
1327
1416
  for (let o = 0; o < t; o += 1) {
1328
- const a = xt[o % xt.length], i = S("g", { transform: `translate(${o * 26} 0)` });
1417
+ const a = Nt[o % Nt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
1329
1418
  i.appendChild(
1330
- S("ellipse", {
1419
+ v("ellipse", {
1331
1420
  cx: a.ellipseCx,
1332
1421
  cy: a.ellipseCy,
1333
1422
  rx: a.ellipseRx,
@@ -1338,7 +1427,7 @@ function on(e, t) {
1338
1427
  opacity: "0.8"
1339
1428
  })
1340
1429
  ), i.appendChild(
1341
- S("path", {
1430
+ v("path", {
1342
1431
  d: a.path,
1343
1432
  fill: "none",
1344
1433
  stroke: "#2c2a1e",
@@ -1349,10 +1438,10 @@ function on(e, t) {
1349
1438
  }
1350
1439
  return n;
1351
1440
  }
1352
- function He(e, t, n) {
1353
- const o = S("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1441
+ function Qe(e, t, n) {
1442
+ const o = v("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1354
1443
  return o.appendChild(
1355
- S("feTurbulence", {
1444
+ v("feTurbulence", {
1356
1445
  type: "fractalNoise",
1357
1446
  baseFrequency: "0.012 0.028",
1358
1447
  numOctaves: "3",
@@ -1360,7 +1449,7 @@ function He(e, t, n) {
1360
1449
  result: "stroke-noise"
1361
1450
  })
1362
1451
  ), o.appendChild(
1363
- S("feDisplacementMap", {
1452
+ v("feDisplacementMap", {
1364
1453
  in: "SourceGraphic",
1365
1454
  in2: "stroke-noise",
1366
1455
  scale: "3.5",
@@ -1369,7 +1458,7 @@ function He(e, t, n) {
1369
1458
  result: "warped"
1370
1459
  })
1371
1460
  ), o.appendChild(
1372
- S("feTurbulence", {
1461
+ v("feTurbulence", {
1373
1462
  type: "fractalNoise",
1374
1463
  baseFrequency: "0.7",
1375
1464
  numOctaves: "1",
@@ -1377,7 +1466,7 @@ function He(e, t, n) {
1377
1466
  result: "ink-noise"
1378
1467
  })
1379
1468
  ), o.appendChild(
1380
- S("feDisplacementMap", {
1469
+ v("feDisplacementMap", {
1381
1470
  in: "warped",
1382
1471
  in2: "ink-noise",
1383
1472
  scale: "0.9",
@@ -1386,30 +1475,38 @@ function He(e, t, n) {
1386
1475
  })
1387
1476
  ), o;
1388
1477
  }
1389
- function Wo(e) {
1390
- const t = te("0 0 24 24", e, e, "none", "currentColor", "2.25");
1391
- return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
1478
+ function ra(e) {
1479
+ const t = Z("0 0 24 24", e, e, "none", "currentColor", "2.25");
1480
+ return t.appendChild(v("path", { d: "m6 9 6 6 6-6" })), t;
1481
+ }
1482
+ function la() {
1483
+ const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1484
+ 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;
1392
1485
  }
1393
- function Ho() {
1394
- const e = te("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1395
- return e.appendChild(S("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(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1486
+ function pa() {
1487
+ const e = Z("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1488
+ 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;
1396
1489
  }
1397
- function an() {
1398
- const e = te("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1399
- return e.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
1490
+ function sa() {
1491
+ const e = Z("0 0 24 24", 15, 15, "none", "currentColor", "2.4");
1492
+ return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1400
1493
  }
1401
- function $o() {
1402
- const e = te("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1494
+ function mn() {
1495
+ const e = Z("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1496
+ return e.appendChild(v("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(v("polyline", { points: "5 12 12 5 19 12" })), e;
1497
+ }
1498
+ function da() {
1499
+ const e = Z("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1403
1500
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1404
- S("path", {
1501
+ v("path", {
1405
1502
  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"
1406
1503
  })
1407
1504
  ), e;
1408
1505
  }
1409
- function qo() {
1410
- const e = te("0 0 24 24", 19, 19, "none", "currentColor");
1506
+ function ca() {
1507
+ const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1411
1508
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1412
- S("path", {
1509
+ v("path", {
1413
1510
  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",
1414
1511
  stroke: "currentColor",
1415
1512
  "stroke-width": "2",
@@ -1418,19 +1515,19 @@ function qo() {
1418
1515
  })
1419
1516
  ), e;
1420
1517
  }
1421
- function jo() {
1422
- const e = te("0 0 24 24", 18, 18, "currentColor");
1423
- return e.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1518
+ function ua() {
1519
+ const e = Z("0 0 24 24", 18, 18, "currentColor");
1520
+ return e.appendChild(v("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1424
1521
  }
1425
- function Vo() {
1426
- const e = te("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1427
- return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
1522
+ function ga() {
1523
+ const e = Z("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1524
+ return e.appendChild(v("path", { d: "M18 6 6 18" })), e.appendChild(v("path", { d: "m6 6 12 12" })), e;
1428
1525
  }
1429
- function Yo() {
1430
- const e = te("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1431
- return e.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1526
+ function ha() {
1527
+ const e = Z("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1528
+ 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;
1432
1529
  }
1433
- function te(e, t, n, o, a, i) {
1530
+ function Z(e, t, n, o, a, i) {
1434
1531
  const l = {
1435
1532
  viewBox: e,
1436
1533
  width: String(t),
@@ -1438,41 +1535,41 @@ function te(e, t, n, o, a, i) {
1438
1535
  fill: o,
1439
1536
  "aria-hidden": "true"
1440
1537
  };
1441
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
1538
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), v("svg", l);
1442
1539
  }
1443
- function S(e, t = {}) {
1444
- const n = document.createElementNS(Xt, e);
1540
+ function v(e, t = {}) {
1541
+ const n = document.createElementNS(pn, e);
1445
1542
  for (const [o, a] of Object.entries(t))
1446
1543
  n.setAttribute(o, a);
1447
1544
  return n;
1448
1545
  }
1449
- function Pt(e) {
1546
+ function zt(e) {
1450
1547
  for (const t of ["keydown", "keypress", "keyup"])
1451
1548
  e.addEventListener(t, (n) => {
1452
1549
  n.stopPropagation();
1453
1550
  });
1454
1551
  }
1455
- function Ko(e, t, n) {
1552
+ function ma(e, t, n) {
1456
1553
  e.replaceChildren(), e.hidden = t.length === 0;
1457
1554
  for (const [o, a] of t.entries()) {
1458
1555
  const i = document.createElement("div");
1459
- i.className = "pluno-pa-widget__attachment", i.appendChild(Xo(a));
1556
+ i.className = "pluno-pa-widget__attachment", i.appendChild(ba(a));
1460
1557
  const l = document.createElement("span");
1461
1558
  l.textContent = a.name, i.appendChild(l);
1462
- const s = document.createElement("button");
1463
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(Vo()), s.addEventListener("click", () => n(o)), i.appendChild(s), e.appendChild(i);
1559
+ const p = document.createElement("button");
1560
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(ga()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1464
1561
  }
1465
1562
  }
1466
- function Xo(e) {
1467
- if (rn(e)) {
1563
+ function ba(e) {
1564
+ if (bn(e)) {
1468
1565
  const n = document.createElement("img");
1469
1566
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1470
1567
  }
1471
1568
  const t = document.createElement("span");
1472
1569
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1473
1570
  }
1474
- function Zo(e) {
1475
- if (rn(e)) {
1571
+ function fa(e) {
1572
+ if (bn(e)) {
1476
1573
  const a = document.createElement("img");
1477
1574
  return a.src = e.dataUrl, a.alt = e.name, a;
1478
1575
  }
@@ -1483,51 +1580,51 @@ function Zo(e) {
1483
1580
  const o = document.createElement("strong");
1484
1581
  return o.textContent = e.name, t.append(n, o), t;
1485
1582
  }
1486
- function rn(e) {
1583
+ function bn(e) {
1487
1584
  return e.mimeType.startsWith("image/");
1488
1585
  }
1489
- function Jo(e) {
1586
+ function wa(e) {
1490
1587
  return e === "application/pdf" ? "document.pdf" : "image";
1491
1588
  }
1492
- async function Qo(e) {
1589
+ async function _a(e) {
1493
1590
  if (!e)
1494
1591
  return [];
1495
1592
  const t = Array.from(e);
1496
- if (t.length > Te)
1497
- throw new Error(`Attach up to ${Te} files per message.`);
1593
+ if (t.length > Ue)
1594
+ throw new Error(`Attach up to ${Ue} files per message.`);
1498
1595
  return Promise.all(
1499
1596
  t.map(async (n) => {
1500
- const o = ea(n);
1597
+ const o = xa(n);
1501
1598
  if (!o)
1502
1599
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1503
- if (n.size > Jn)
1600
+ if (n.size > uo)
1504
1601
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1505
1602
  if (o === "image/gif") {
1506
- const a = new Uint8Array(await sa(n));
1507
- if (na(a))
1603
+ const a = new Uint8Array(await Aa(n));
1604
+ if (va(a))
1508
1605
  throw new Error("Pluno supports non-animated GIF images.");
1509
1606
  }
1510
1607
  return {
1511
- name: n.name || Jo(o),
1608
+ name: n.name || wa(o),
1512
1609
  mimeType: o,
1513
1610
  sizeBytes: n.size,
1514
- dataUrl: ta(await da(n), o)
1611
+ dataUrl: ya(await Ta(n), o)
1515
1612
  };
1516
1613
  })
1517
1614
  );
1518
1615
  }
1519
- function ea(e) {
1520
- if (Vt.has(e.type))
1616
+ function xa(e) {
1617
+ if (an.has(e.type))
1521
1618
  return e.type;
1522
1619
  const t = e.name.toLowerCase();
1523
1620
  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;
1524
1621
  }
1525
- function ta(e, t) {
1622
+ function ya(e, t) {
1526
1623
  const n = `data:${t};base64,`;
1527
1624
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1528
1625
  }
1529
- function na(e) {
1530
- if (e.length < 14 || !oa(e))
1626
+ function va(e) {
1627
+ if (e.length < 14 || !Ca(e))
1531
1628
  return !1;
1532
1629
  const t = e[10];
1533
1630
  let n = 13;
@@ -1538,7 +1635,7 @@ function na(e) {
1538
1635
  if (n += 1, a === 59)
1539
1636
  return !1;
1540
1637
  if (a === 33) {
1541
- n += 1, n = Tt(e, n);
1638
+ n += 1, n = Gt(e, n);
1542
1639
  continue;
1543
1640
  }
1544
1641
  if (a !== 44)
@@ -1550,14 +1647,14 @@ function na(e) {
1550
1647
  const i = e[n + 8];
1551
1648
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1552
1649
  return !1;
1553
- n += 1, n = Tt(e, n);
1650
+ n += 1, n = Gt(e, n);
1554
1651
  }
1555
1652
  return !1;
1556
1653
  }
1557
- function oa(e) {
1654
+ function Ca(e) {
1558
1655
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1559
1656
  }
1560
- function Tt(e, t) {
1657
+ function Gt(e, t) {
1561
1658
  for (; t < e.length; ) {
1562
1659
  const n = e[t];
1563
1660
  if (t += 1, n === 0)
@@ -1566,63 +1663,63 @@ function Tt(e, t) {
1566
1663
  }
1567
1664
  return t;
1568
1665
  }
1569
- function Se(e) {
1666
+ function De(e) {
1570
1667
  return !!(e && Array.from(e.types).includes("Files"));
1571
1668
  }
1572
- function $e(e, t, n = null) {
1573
- if (!e || !Xe(t, n)) {
1669
+ function et(e, t, n = null) {
1670
+ if (!e || !rt(t, n)) {
1574
1671
  e && (e.hidden = !0, e.replaceChildren());
1575
1672
  return;
1576
1673
  }
1577
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", j(t) || Qe(n) ? e.appendChild(aa(t, n)) : ln(t) && e.appendChild(ia(t));
1674
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", X(t) || st(n) ? e.appendChild(Ea(t, n)) : fn(t) && e.appendChild(Sa(t));
1578
1675
  }
1579
- function aa(e, t) {
1676
+ function Ea(e, t) {
1580
1677
  const n = document.createElement("div");
1581
1678
  n.className = "pluno-pa-widget__billing-action-card";
1582
1679
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1583
1680
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1584
1681
  const i = document.createElement("span");
1585
- 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(pn(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1682
+ 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;
1586
1683
  }
1587
- function ia(e) {
1684
+ function Sa(e) {
1588
1685
  const t = document.createElement("div");
1589
1686
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1590
1687
  const n = document.createElement("strong");
1591
1688
  n.textContent = "Credits running low", t.appendChild(n);
1592
1689
  const o = document.createElement("span");
1593
- return o.textContent = la(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(pn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1690
+ return o.textContent = La(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(wn(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1594
1691
  }
1595
- function Xe(e, t) {
1596
- return e !== null && (j(e) || ln(e) || Qe(t));
1692
+ function rt(e, t) {
1693
+ return e !== null && (X(e) || fn(e) || st(t));
1597
1694
  }
1598
- function Nt(e, t, n) {
1599
- return Xe(t, n) || ra(t) ? !0 : !Xe(e, n);
1695
+ function Ht(e, t, n) {
1696
+ return rt(t, n) || ka(t) ? !0 : !rt(e, n);
1600
1697
  }
1601
- function ra(e) {
1602
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || j(e));
1698
+ function ka(e) {
1699
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
1603
1700
  }
1604
- function j(e) {
1701
+ function X(e) {
1605
1702
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1606
1703
  }
1607
- function Qe(e) {
1704
+ function st(e) {
1608
1705
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1609
1706
  }
1610
- function ln(e) {
1611
- return !j(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1707
+ function fn(e) {
1708
+ return !X(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1612
1709
  }
1613
- function la(e) {
1614
- return e.creditsRemaining === null ? null : `${pa(e.creditsRemaining)} credits left`;
1710
+ function La(e) {
1711
+ return e.creditsRemaining === null ? null : `${Pa(e.creditsRemaining)} credits left`;
1615
1712
  }
1616
- function pa(e) {
1713
+ function Pa(e) {
1617
1714
  return new Intl.NumberFormat("en-US", {
1618
1715
  maximumFractionDigits: 0
1619
1716
  }).format(Math.ceil(e));
1620
1717
  }
1621
- function pn(e, t, n) {
1718
+ function wn(e, t, n) {
1622
1719
  const o = document.createElement("div");
1623
- return o.className = n, o.appendChild(It(t, e.pricingUrl)), o.appendChild(It("Earn credits", e.earnCreditsUrl)), o;
1720
+ return o.className = n, o.appendChild(Wt(t, e.pricingUrl)), o.appendChild(Wt("Earn credits", e.earnCreditsUrl)), o;
1624
1721
  }
1625
- function It(e, t) {
1722
+ function Wt(e, t) {
1626
1723
  const n = document.createElement("button");
1627
1724
  if (n.type = "button", e === "Earn credits") {
1628
1725
  const o = document.createElement("span");
@@ -1633,7 +1730,7 @@ function It(e, t) {
1633
1730
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1634
1731
  }), n;
1635
1732
  }
1636
- function sa(e) {
1733
+ function Aa(e) {
1637
1734
  return new Promise((t, n) => {
1638
1735
  const o = new FileReader();
1639
1736
  o.addEventListener("load", () => {
@@ -1647,7 +1744,7 @@ function sa(e) {
1647
1744
  }), o.readAsArrayBuffer(e);
1648
1745
  });
1649
1746
  }
1650
- function da(e) {
1747
+ function Ta(e) {
1651
1748
  return new Promise((t, n) => {
1652
1749
  const o = new FileReader();
1653
1750
  o.addEventListener("load", () => {
@@ -1661,167 +1758,170 @@ function da(e) {
1661
1758
  }), o.readAsDataURL(e);
1662
1759
  });
1663
1760
  }
1664
- function Dt(e, t) {
1665
- return e.messages.filter((o) => !sn(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1666
- }
1667
- function ca(e, t, n, o, a, i, l, s, d, c, p, b, x, A, E) {
1668
- const R = [...i.messages], v = R.filter((w) => !sn(w)), y = e.scrollTop;
1669
- e.replaceChildren(), cn(n, i.isThinking), a.hidden = !s, s && l !== null && Uo(a, l);
1670
- const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1671
- if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1672
- const w = document.createElement("div");
1673
- w.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1674
- const f = document.createElement("div");
1675
- f.className = "pluno-pa-widget__empty-hero";
1676
- const I = ee("pluno-pa-widget__character--empty", x());
1677
- f.appendChild(I), w.appendChild(f), w.appendChild(en());
1678
- const P = document.createElement("div");
1679
- if (P.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 && P.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1680
- for (const M of i.starterPrompts) {
1681
- const T = document.createElement("button");
1682
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${M}"`, T.addEventListener("click", () => {
1683
- A(M);
1684
- }), P.appendChild(T);
1761
+ function $t(e, t) {
1762
+ return e.messages.filter((o) => !_n(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1763
+ }
1764
+ function Na(e, t, n, o, a, i, l, p, c, u, s, b, x, P, k) {
1765
+ const O = [...i.messages], y = O.filter((_) => !_n(_)), C = e.scrollTop;
1766
+ e.replaceChildren(), yn(n, i.isThinking), a.hidden = !p, p && l !== null && na(a, l);
1767
+ const h = y.length > 0 || !!i.assistantDraft || i.isThinking;
1768
+ if (o.hidden = !h, y.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1769
+ const _ = document.createElement("div");
1770
+ _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1771
+ const L = document.createElement("div");
1772
+ L.className = "pluno-pa-widget__empty-hero";
1773
+ const G = re("pluno-pa-widget__character--empty", x());
1774
+ L.appendChild(G), _.appendChild(L), _.appendChild(un());
1775
+ const M = document.createElement("div");
1776
+ 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)
1777
+ for (const f of i.starterPrompts) {
1778
+ const A = document.createElement("button");
1779
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
1780
+ P(f);
1781
+ }), M.appendChild(A);
1685
1782
  }
1686
- else
1687
- for (let M = 0; M < eo; M += 1) {
1688
- const T = document.createElement("button");
1689
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.innerHTML = "&nbsp;", P.appendChild(T);
1783
+ else if (i.starterPromptsLoading) {
1784
+ const f = document.createElement("button");
1785
+ f.type = "button", f.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", f.disabled = !0, f.tabIndex = -1, f.textContent = "Generating example tasks...", M.appendChild(f);
1786
+ } else
1787
+ for (let f = 0; f < ho; f += 1) {
1788
+ const A = document.createElement("button");
1789
+ 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);
1690
1790
  }
1691
- w.appendChild(P), e.appendChild(w), e.appendChild(t);
1791
+ _.appendChild(M), e.appendChild(_), e.appendChild(t);
1692
1792
  return;
1693
1793
  }
1694
- let g = null, C = null, N = [];
1695
- const ne = () => {
1696
- if (N.length === 0)
1794
+ let g = null, E = null, I = [];
1795
+ const le = () => {
1796
+ if (I.length === 0)
1697
1797
  return !1;
1698
- const w = _a(N, p, b, x());
1699
- return e.appendChild(w), g = null, C = w, N = [], !0;
1798
+ const _ = Fa(I, s, b, x());
1799
+ return e.appendChild(_), g = null, E = _, I = [], !0;
1700
1800
  };
1701
- for (let w = 0; w < v.length; w += 1) {
1702
- const f = v[w];
1703
- if (f.role === "tool") {
1704
- N.push(f);
1801
+ for (let _ = 0; _ < y.length; _ += 1) {
1802
+ const L = y[_];
1803
+ if (L.role === "tool") {
1804
+ I.push(L);
1705
1805
  continue;
1706
1806
  }
1707
- if (f.role === "system")
1807
+ if (L.role === "system")
1708
1808
  continue;
1709
- const I = ne(), P = Bt(f.content);
1710
- if (f.role === "assistant" && !I) {
1711
- const _ = Ze(x());
1712
- e.appendChild(_), g = null, C = _;
1809
+ const G = le(), M = Vt(L.content);
1810
+ if (L.role === "assistant" && !G) {
1811
+ const T = lt(x());
1812
+ e.appendChild(T), g = null, E = T;
1713
1813
  }
1714
- const M = document.createElement("div");
1715
- M.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Ot(M, P) : M.textContent = P, f.role === "user" && f.attachments?.length && M.appendChild(ua(f.attachments));
1716
- const T = document.createElement("div");
1717
- T.className = "pluno-pa-widget__message-actions", T.appendChild(Mt(P)), M.appendChild(T), e.appendChild(M), g = M, C = null;
1814
+ const f = document.createElement("div");
1815
+ f.className = `pluno-pa-widget__message pluno-pa-widget__message--${L.role}`, L.role === "assistant" ? Yt(f, M) : f.textContent = M, L.role === "user" && L.attachments?.length && f.appendChild(Ia(L.attachments));
1816
+ const A = document.createElement("div");
1817
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(jt(M)), f.appendChild(A), e.appendChild(f), g = f, E = null;
1718
1818
  }
1719
- const ge = ne();
1819
+ const xe = le();
1720
1820
  if (i.assistantDraft) {
1721
- if (!ge) {
1722
- const P = Ze(x());
1723
- e.appendChild(P), g = null, C = P;
1724
- }
1725
- const w = Bt(i.assistantDraft), f = document.createElement("div");
1726
- f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ot(f, w);
1727
- const I = document.createElement("div");
1728
- I.className = "pluno-pa-widget__message-actions", I.appendChild(Mt(w)), f.appendChild(I), e.appendChild(f), g = f, C = null;
1821
+ if (!xe) {
1822
+ const M = lt(x());
1823
+ e.appendChild(M), g = null, E = M;
1824
+ }
1825
+ const _ = Vt(i.assistantDraft), L = document.createElement("div");
1826
+ L.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Yt(L, _);
1827
+ const G = document.createElement("div");
1828
+ G.className = "pluno-pa-widget__message-actions", G.appendChild(jt(_)), L.appendChild(G), e.appendChild(L), g = L, E = null;
1729
1829
  }
1730
1830
  if (i.isThinking && !i.assistantDraft)
1731
- if (ge) {
1732
- const w = dn();
1733
- e.appendChild(w), g = null, C = w;
1831
+ if (xe) {
1832
+ const _ = xn();
1833
+ e.appendChild(_), g = null, E = _;
1734
1834
  } else {
1735
- const w = xa(x());
1736
- e.appendChild(w), g = null, C = w;
1835
+ const _ = za(x());
1836
+ e.appendChild(_), g = null, E = _;
1737
1837
  }
1738
1838
  if (i.lastError) {
1739
- const w = document.createElement("div");
1740
- w.className = "pluno-pa-widget__error", w.textContent = i.lastError, e.appendChild(w), g = w, C = null;
1839
+ const _ = document.createElement("div");
1840
+ _.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
1741
1841
  }
1742
- const L = E && !i.isThinking ? Pn(R) : null;
1743
- if (E && L && !E.dismissedCandidateIds.has(L.id)) {
1744
- const w = ga(L, {
1745
- isDrafting: E.draftingCandidateId === L.id,
1746
- error: E.error,
1747
- characterIconOptions: E.characterIconOptions,
1748
- onDraft: E.onDraft,
1749
- onDismiss: E.onDismiss,
1750
- onDisable: E.onDisable
1842
+ const R = k && !i.isThinking ? Hn(O) : null;
1843
+ if (k && R && !k.dismissedCandidateIds.has(R.id)) {
1844
+ const _ = Da(R, {
1845
+ isDrafting: k.draftingCandidateId === R.id,
1846
+ error: k.error,
1847
+ characterIconOptions: k.characterIconOptions,
1848
+ onDraft: k.onDraft,
1849
+ onDismiss: k.onDismiss,
1850
+ onDisable: k.onDisable
1751
1851
  });
1752
- e.appendChild(w), E.onSeen(L), g = null, C = w;
1852
+ e.appendChild(_), k.onSeen(R), g = null, E = _;
1753
1853
  }
1754
- g?.classList.add("pluno-pa-widget__message--bottom-reserve"), C?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), d ? fe(e, c) : e.scrollTop = y;
1755
- }
1756
- function Rt(e, t, n, o, a, i, l, s) {
1757
- e.replaceChildren(), cn(t, !1), t.disabled = !0, n.hidden = !0;
1758
- const d = document.createElement("div");
1759
- d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1760
- const c = ee("pluno-pa-widget__character--empty", o());
1761
- d.appendChild(c);
1762
- const p = document.createElement("div");
1763
- if (p.className = "pluno-pa-widget__empty", p.textContent = a, d.appendChild(p), l) {
1854
+ 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;
1855
+ }
1856
+ function qt(e, t, n, o, a, i, l, p) {
1857
+ e.replaceChildren(), yn(t, !1), t.disabled = !0, n.hidden = !0;
1858
+ const c = document.createElement("div");
1859
+ c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1860
+ const u = re("pluno-pa-widget__character--empty", o());
1861
+ c.appendChild(u);
1862
+ const s = document.createElement("div");
1863
+ if (s.className = "pluno-pa-widget__empty", s.textContent = a, c.appendChild(s), l) {
1764
1864
  const b = document.createElement("a");
1765
- b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, d.appendChild(b);
1865
+ b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, c.appendChild(b);
1766
1866
  } else {
1767
1867
  const b = document.createElement("button");
1768
- b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => s?.()), d.appendChild(b);
1868
+ b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => p?.()), c.appendChild(b);
1769
1869
  }
1770
- e.appendChild(d);
1870
+ e.appendChild(c);
1771
1871
  }
1772
- function ua(e) {
1872
+ function Ia(e) {
1773
1873
  const t = document.createElement("div");
1774
1874
  t.className = "pluno-pa-widget__message-attachments";
1775
1875
  for (const n of e)
1776
- t.appendChild(Zo(n));
1876
+ t.appendChild(fa(n));
1777
1877
  return t;
1778
1878
  }
1779
- function Mt(e) {
1879
+ function jt(e) {
1780
1880
  const t = document.createElement("button");
1781
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Yo()), t.addEventListener("click", (n) => {
1881
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ha()), t.addEventListener("click", (n) => {
1782
1882
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1783
1883
  }), t;
1784
1884
  }
1785
- function ga(e, t) {
1885
+ function Da(e, t) {
1786
1886
  const n = document.createElement("article");
1787
1887
  n.className = "pluno-pa-widget__share-prompt";
1788
1888
  const o = document.createElement("div");
1789
- o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(ee("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
1889
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(re("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
1790
1890
  const a = document.createElement("div");
1791
1891
  a.className = "pluno-pa-widget__share-prompt-copy";
1792
1892
  const i = document.createElement("strong");
1793
1893
  i.textContent = "Share this win?", a.appendChild(i);
1794
1894
  const l = document.createElement("span");
1795
1895
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), t.error) {
1796
- const p = document.createElement("span");
1797
- p.className = "pluno-pa-widget__share-prompt-error", p.textContent = t.error, a.appendChild(p);
1896
+ const s = document.createElement("span");
1897
+ s.className = "pluno-pa-widget__share-prompt-error", s.textContent = t.error, a.appendChild(s);
1798
1898
  }
1799
1899
  o.appendChild(a);
1800
- const s = document.createElement("div");
1801
- s.className = "pluno-pa-widget__share-prompt-actions";
1802
- const d = document.createElement("div");
1803
- d.className = "pluno-pa-widget__share-prompt-primary-actions";
1804
- const c = document.createElement("button");
1805
- if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
1900
+ const p = document.createElement("div");
1901
+ p.className = "pluno-pa-widget__share-prompt-actions";
1902
+ const c = document.createElement("div");
1903
+ c.className = "pluno-pa-widget__share-prompt-primary-actions";
1904
+ const u = document.createElement("button");
1905
+ if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
1806
1906
  t.onDraft(e);
1807
- }), t.isDrafting ? (c.appendChild(Je()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
1808
- s.appendChild(d);
1907
+ }), t.isDrafting ? (u.appendChild(pt()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
1908
+ p.appendChild(c);
1809
1909
  else {
1810
- const p = document.createElement("button");
1811
- p.type = "button", p.className = "pluno-pa-widget__share-prompt-dismiss", p.setAttribute("aria-label", "Dismiss share prompt"), p.title = "Dismiss", p.textContent = "Dismiss", p.addEventListener("click", () => {
1910
+ const s = document.createElement("button");
1911
+ s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
1812
1912
  t.onDismiss(e);
1813
- }), d.appendChild(p), s.appendChild(d);
1913
+ }), c.appendChild(s), p.appendChild(c);
1814
1914
  const b = document.createElement("button");
1815
1915
  b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
1816
1916
  t.onDisable(e);
1817
- }), s.appendChild(b);
1917
+ }), p.appendChild(b);
1818
1918
  }
1819
- return o.appendChild(s), n.appendChild(o), n;
1919
+ return o.appendChild(p), n.appendChild(o), n;
1820
1920
  }
1821
- function ha(e, t) {
1921
+ function Ra(e, t) {
1822
1922
  const n = document.createElement("div");
1823
- n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1824
- v.target === n && t.onClose();
1923
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
1924
+ y.target === n && t.onClose();
1825
1925
  });
1826
1926
  const o = document.createElement("section");
1827
1927
  o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
@@ -1829,57 +1929,57 @@ function ha(e, t) {
1829
1929
  i.textContent = "Share this win", a.appendChild(i);
1830
1930
  const l = document.createElement("button");
1831
1931
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
1832
- const s = document.createElement("p");
1833
- s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
1834
- const d = document.createElement("div");
1835
- d.className = "pluno-pa-widget__share-dialog-step";
1932
+ const p = document.createElement("p");
1933
+ p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
1836
1934
  const c = document.createElement("div");
1837
- c.className = "pluno-pa-widget__share-dialog-step-header";
1838
- const p = document.createElement("strong");
1839
- p.textContent = "1) Copy Screenshot", c.appendChild(p);
1840
- const b = ma("Copy Screenshot", async () => {
1935
+ c.className = "pluno-pa-widget__share-dialog-step";
1936
+ const u = document.createElement("div");
1937
+ u.className = "pluno-pa-widget__share-dialog-step-header";
1938
+ const s = document.createElement("strong");
1939
+ s.textContent = "1) Copy Screenshot", u.appendChild(s);
1940
+ const b = Ma("Copy Screenshot", async () => {
1841
1941
  try {
1842
- return await Tn(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1942
+ return await Wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1843
1943
  } catch {
1844
- return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
1944
+ return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1845
1945
  }
1846
1946
  });
1847
- if (c.appendChild(b), d.appendChild(c), e.screenshotDataUrl) {
1848
- const v = document.createElement("div");
1849
- v.className = "pluno-pa-widget__share-dialog-screenshot";
1850
- const y = document.createElement("img");
1851
- y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), d.appendChild(v);
1947
+ if (u.appendChild(b), c.appendChild(u), e.screenshotDataUrl) {
1948
+ const y = document.createElement("div");
1949
+ y.className = "pluno-pa-widget__share-dialog-screenshot";
1950
+ const C = document.createElement("img");
1951
+ C.src = e.screenshotDataUrl, C.alt = "Product page with Pluno open", y.appendChild(C), c.appendChild(y);
1852
1952
  }
1853
- o.appendChild(d), o.appendChild(s);
1953
+ o.appendChild(c), o.appendChild(p);
1854
1954
  const x = document.createElement("div");
1855
1955
  x.className = "pluno-pa-widget__share-dialog-step";
1856
- const A = document.createElement("strong");
1857
- A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
1858
- const E = document.createElement("p");
1859
- E.className = "pluno-pa-widget__share-dialog-hint", E.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(E);
1860
- const R = document.createElement("footer");
1861
- R.className = "pluno-pa-widget__share-dialog-platforms";
1862
- for (const v of ba(e)) {
1863
- const y = document.createElement("a");
1864
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(fa(v.id)), R.appendChild(y);
1956
+ const P = document.createElement("strong");
1957
+ P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", x.appendChild(P);
1958
+ const k = document.createElement("p");
1959
+ k.className = "pluno-pa-widget__share-dialog-hint", k.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(k);
1960
+ const O = document.createElement("footer");
1961
+ O.className = "pluno-pa-widget__share-dialog-platforms";
1962
+ for (const y of Ba(e)) {
1963
+ const C = document.createElement("a");
1964
+ C.href = y.href, C.target = "_blank", C.rel = "noopener noreferrer", C.title = y.label, C.setAttribute("aria-label", `Open ${y.label}`), C.appendChild(Oa(y.id)), O.appendChild(C);
1865
1965
  }
1866
- if (x.appendChild(R), o.appendChild(x), t.socialPostRewardsUrl) {
1867
- const v = document.createElement("div");
1868
- v.className = "pluno-pa-widget__share-dialog-step";
1869
- const y = document.createElement("strong");
1870
- y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1966
+ if (x.appendChild(O), o.appendChild(x), t.socialPostRewardsUrl) {
1967
+ const y = document.createElement("div");
1968
+ y.className = "pluno-pa-widget__share-dialog-step";
1969
+ const C = document.createElement("strong");
1970
+ C.className = "pluno-pa-widget__share-dialog-step-title", C.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(C);
1871
1971
  const h = document.createElement("a");
1872
- 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(wa()), v.appendChild(h), o.appendChild(v);
1972
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Ua()), y.appendChild(h), o.appendChild(y);
1873
1973
  }
1874
1974
  return n.appendChild(o), n;
1875
1975
  }
1876
- function ma(e, t) {
1976
+ function Ma(e, t) {
1877
1977
  const n = document.createElement("button");
1878
1978
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1879
1979
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1880
1980
  }), n;
1881
1981
  }
1882
- function ba(e) {
1982
+ function Ba(e) {
1883
1983
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1884
1984
  return [
1885
1985
  {
@@ -1899,56 +1999,56 @@ function ba(e) {
1899
1999
  }
1900
2000
  ];
1901
2001
  }
1902
- function fa(e) {
2002
+ function Oa(e) {
1903
2003
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1904
- return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (B(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), B(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"), B(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), B(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"), B(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (B(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), B(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), B(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (B(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"), B(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"), B(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"), B(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);
2004
+ 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);
1905
2005
  }
1906
- function B(e, t, n) {
2006
+ function F(e, t, n) {
1907
2007
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1908
2008
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1909
2009
  }
1910
- function wa() {
2010
+ function Ua() {
1911
2011
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1912
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), B(e, "M14 5h5v5"), B(e, "M19 5l-8 8"), B(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
2012
+ 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;
1913
2013
  }
1914
- function sn(e) {
1915
- return e.role === "tool" && e.toolName === $t;
2014
+ function _n(e) {
2015
+ return e.role === "tool" && e.toolName === tn;
1916
2016
  }
1917
- function Bt(e) {
2017
+ function Vt(e) {
1918
2018
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1919
2019
  }
1920
- function _a(e, t, n, o) {
2020
+ function Fa(e, t, n, o) {
1921
2021
  const a = document.createElement("article");
1922
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(ee("pluno-pa-widget__character--tool-group", o));
1923
- const i = document.createElement("details"), l = va(e);
2022
+ a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(re("pluno-pa-widget__character--tool-group", o));
2023
+ const i = document.createElement("details"), l = Ga(e);
1924
2024
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1925
2025
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1926
2026
  });
1927
- const s = document.createElement("summary");
1928
- s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Je());
1929
- const c = document.createElement("span");
1930
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", s.appendChild(c), i.appendChild(s), e.length > 0) {
1931
- const p = document.createElement("div");
1932
- p.className = "pluno-pa-widget__tool-lines";
2027
+ const p = document.createElement("summary");
2028
+ p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(pt());
2029
+ const u = document.createElement("span");
2030
+ 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) {
2031
+ const s = document.createElement("div");
2032
+ s.className = "pluno-pa-widget__tool-lines";
1933
2033
  for (const b of e) {
1934
2034
  const x = document.createElement("div");
1935
- x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(Je());
1936
- const A = document.createElement("span");
1937
- A.textContent = b.content || "Run tool", x.appendChild(A), p.appendChild(x);
2035
+ x.className = "pluno-pa-widget__tool-line", b.loading && x.appendChild(pt());
2036
+ const P = document.createElement("span");
2037
+ P.textContent = b.content || "Run tool", x.appendChild(P), s.appendChild(x);
1938
2038
  }
1939
- i.appendChild(p);
2039
+ i.appendChild(s);
1940
2040
  }
1941
2041
  return a.appendChild(i), a;
1942
2042
  }
1943
- function Ze(e) {
2043
+ function lt(e) {
1944
2044
  const t = document.createElement("article");
1945
- return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(ee("pluno-pa-widget__character--tool-group", e)), t;
2045
+ return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(re("pluno-pa-widget__character--tool-group", e)), t;
1946
2046
  }
1947
- function xa(e) {
1948
- const t = Ze(e);
1949
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(dn()), t;
2047
+ function za(e) {
2048
+ const t = lt(e);
2049
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(xn()), t;
1950
2050
  }
1951
- function dn() {
2051
+ function xn() {
1952
2052
  const e = document.createElement("div");
1953
2053
  e.className = "pluno-pa-widget__status";
1954
2054
  const t = document.createElement("span");
@@ -1956,17 +2056,17 @@ function dn() {
1956
2056
  const n = document.createElement("span");
1957
2057
  return n.textContent = "Thinking...", e.appendChild(n), e;
1958
2058
  }
1959
- function va(e) {
2059
+ function Ga(e) {
1960
2060
  return `tools:${e[0]?.id ?? ""}`;
1961
2061
  }
1962
- function Je() {
2062
+ function pt() {
1963
2063
  const e = document.createElement("span");
1964
2064
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1965
2065
  }
1966
- function cn(e, t) {
1967
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? jo() : an());
2066
+ function yn(e, t) {
2067
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? ua() : mn());
1968
2068
  }
1969
- function Ot(e, t) {
2069
+ function Yt(e, t) {
1970
2070
  const n = t.replace(/\r\n/g, `
1971
2071
  `).split(`
1972
2072
  `);
@@ -1978,49 +2078,49 @@ function Ot(e, t) {
1978
2078
  continue;
1979
2079
  }
1980
2080
  if (a.match(/^```(\w+)?\s*$/)) {
1981
- const c = [];
2081
+ const u = [];
1982
2082
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1983
- c.push(n[o]), o += 1;
2083
+ u.push(n[o]), o += 1;
1984
2084
  o += o < n.length ? 1 : 0;
1985
- const p = document.createElement("pre"), b = document.createElement("code");
1986
- b.textContent = c.join(`
1987
- `), p.appendChild(b), e.appendChild(p);
2085
+ const s = document.createElement("pre"), b = document.createElement("code");
2086
+ b.textContent = u.join(`
2087
+ `), s.appendChild(b), e.appendChild(s);
1988
2088
  continue;
1989
2089
  }
1990
2090
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1991
2091
  if (l) {
1992
- const c = document.createElement(`h${l[1].length + 2}`);
1993
- ke(c, l[2]), e.appendChild(c), o += 1;
2092
+ const u = document.createElement(`h${l[1].length + 2}`);
2093
+ Re(u, l[2]), e.appendChild(u), o += 1;
1994
2094
  continue;
1995
2095
  }
1996
2096
  if (/^\s*[-*+]\s+/.test(a)) {
1997
- const c = document.createElement("ul");
2097
+ const u = document.createElement("ul");
1998
2098
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1999
- const p = document.createElement("li");
2000
- ke(p, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(p), o += 1;
2099
+ const s = document.createElement("li");
2100
+ Re(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
2001
2101
  }
2002
- e.appendChild(c);
2102
+ e.appendChild(u);
2003
2103
  continue;
2004
2104
  }
2005
2105
  if (/^\s*\d+\.\s+/.test(a)) {
2006
- const c = document.createElement("ol");
2106
+ const u = document.createElement("ol");
2007
2107
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
2008
- const p = document.createElement("li");
2009
- ke(p, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(p), o += 1;
2108
+ const s = document.createElement("li");
2109
+ Re(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
2010
2110
  }
2011
- e.appendChild(c);
2111
+ e.appendChild(u);
2012
2112
  continue;
2013
2113
  }
2014
- const s = [a];
2114
+ const p = [a];
2015
2115
  for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
2016
- s.push(n[o]), o += 1;
2017
- const d = document.createElement("p");
2018
- s.forEach((c, p) => {
2019
- p > 0 && d.appendChild(document.createElement("br")), ke(d, c);
2020
- }), e.appendChild(d);
2116
+ p.push(n[o]), o += 1;
2117
+ const c = document.createElement("p");
2118
+ p.forEach((u, s) => {
2119
+ s > 0 && c.appendChild(document.createElement("br")), Re(c, u);
2120
+ }), e.appendChild(c);
2021
2121
  }
2022
2122
  }
2023
- function ke(e, t) {
2123
+ function Re(e, t) {
2024
2124
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2025
2125
  let o = 0;
2026
2126
  for (const a of t.matchAll(n)) {
@@ -2028,19 +2128,19 @@ function ke(e, t) {
2028
2128
  i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
2029
2129
  const l = a[0];
2030
2130
  if (l.startsWith("`")) {
2031
- const s = document.createElement("code");
2032
- s.textContent = l.slice(1, -1), e.appendChild(s);
2131
+ const p = document.createElement("code");
2132
+ p.textContent = l.slice(1, -1), e.appendChild(p);
2033
2133
  } else if (l.startsWith("**")) {
2034
- const s = document.createElement("strong");
2035
- s.textContent = l.slice(2, -2), e.appendChild(s);
2134
+ const p = document.createElement("strong");
2135
+ p.textContent = l.slice(2, -2), e.appendChild(p);
2036
2136
  } else if (l.startsWith("*")) {
2037
- const s = document.createElement("em");
2038
- s.textContent = l.slice(1, -1), e.appendChild(s);
2137
+ const p = document.createElement("em");
2138
+ p.textContent = l.slice(1, -1), e.appendChild(p);
2039
2139
  } else {
2040
- const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2041
- if (s && ya(s[2])) {
2042
- const d = document.createElement("a");
2043
- d.href = s[2], d.target = "_top", d.rel = "noreferrer", d.textContent = s[1], e.appendChild(d);
2140
+ const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2141
+ if (p && Ha(p[2])) {
2142
+ const c = document.createElement("a");
2143
+ c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
2044
2144
  } else
2045
2145
  e.appendChild(document.createTextNode(l));
2046
2146
  }
@@ -2048,7 +2148,7 @@ function ke(e, t) {
2048
2148
  }
2049
2149
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2050
2150
  }
2051
- function ya(e) {
2151
+ function Ha(e) {
2052
2152
  if (e.startsWith("/") || e.startsWith("#"))
2053
2153
  return !0;
2054
2154
  try {
@@ -2058,8 +2158,8 @@ function ya(e) {
2058
2158
  return !1;
2059
2159
  }
2060
2160
  }
2061
- function Ut(e, t) {
2062
- if (Ca(e))
2161
+ function Kt(e, t) {
2162
+ if (Wa(e))
2063
2163
  return;
2064
2164
  const n = `
2065
2165
  :host {
@@ -2112,7 +2212,7 @@ function Ut(e, t) {
2112
2212
  --pluno-pa-accent-contrast: #fafafa;
2113
2213
  position: fixed;
2114
2214
  z-index: 2147483645;
2115
- font-family: ${q.fontFamily};
2215
+ font-family: ${K.fontFamily};
2116
2216
  font-size: 14px;
2117
2217
  color: var(--pluno-pa-text);
2118
2218
  width: var(--pluno-pa-launcher-width);
@@ -2405,9 +2505,9 @@ function Ut(e, t) {
2405
2505
  .pluno-pa-widget__timeline-jump:active {
2406
2506
  transform: translateX(-50%) scale(0.98);
2407
2507
  }
2508
+ .pluno-pa-widget__history,
2408
2509
  .pluno-pa-widget__new-chat {
2409
2510
  position: absolute;
2410
- right: 14px;
2411
2511
  bottom: 14px;
2412
2512
  z-index: 2;
2413
2513
  width: 36px;
@@ -2427,13 +2527,142 @@ function Ut(e, t) {
2427
2527
  transform 120ms ease,
2428
2528
  box-shadow 120ms ease;
2429
2529
  }
2530
+ .pluno-pa-widget__history {
2531
+ right: 58px;
2532
+ }
2533
+ .pluno-pa-widget__new-chat {
2534
+ right: 14px;
2535
+ }
2536
+ .pluno-pa-widget__history:hover:not(:disabled),
2430
2537
  .pluno-pa-widget__new-chat:hover:not(:disabled) {
2431
2538
  background: var(--pluno-pa-surface);
2432
2539
  box-shadow: 0 8px 18px rgba(24, 24, 27, 0.1);
2433
2540
  }
2541
+ .pluno-pa-widget__history:active:not(:disabled),
2434
2542
  .pluno-pa-widget__new-chat:active:not(:disabled) {
2435
2543
  transform: scale(0.96);
2436
2544
  }
2545
+ .pluno-pa-widget__history-panel {
2546
+ position: absolute;
2547
+ right: 18px;
2548
+ bottom: 116px;
2549
+ z-index: 4;
2550
+ display: grid;
2551
+ grid-template-rows: auto minmax(0, 1fr) auto;
2552
+ gap: 7px;
2553
+ box-sizing: border-box;
2554
+ width: min(260px, calc(100% - 36px));
2555
+ max-height: min(270px, calc(100% - 170px));
2556
+ border: 1px solid var(--pluno-pa-divider);
2557
+ border-radius: 8px;
2558
+ background: color-mix(in srgb, var(--pluno-pa-bg) 96%, transparent);
2559
+ color: var(--pluno-pa-text);
2560
+ box-shadow: 0 16px 36px rgba(24, 24, 27, 0.18);
2561
+ padding: 8px;
2562
+ }
2563
+ .pluno-pa-widget__history-header {
2564
+ display: flex;
2565
+ align-items: center;
2566
+ justify-content: space-between;
2567
+ gap: 8px;
2568
+ }
2569
+ .pluno-pa-widget__history-header strong {
2570
+ min-width: 0;
2571
+ overflow: hidden;
2572
+ text-overflow: ellipsis;
2573
+ white-space: nowrap;
2574
+ font-size: 12px;
2575
+ line-height: 1.2;
2576
+ }
2577
+ .pluno-pa-widget__history-close {
2578
+ border: 1px solid var(--pluno-pa-divider);
2579
+ border-radius: 6px;
2580
+ background: var(--pluno-pa-surface);
2581
+ color: var(--pluno-pa-text);
2582
+ font: inherit;
2583
+ font-size: 12px;
2584
+ cursor: pointer;
2585
+ }
2586
+ .pluno-pa-widget__history-close {
2587
+ display: inline-flex;
2588
+ width: 24px;
2589
+ height: 24px;
2590
+ align-items: center;
2591
+ justify-content: center;
2592
+ padding: 0;
2593
+ }
2594
+ .pluno-pa-widget__history-list {
2595
+ display: grid;
2596
+ gap: 5px;
2597
+ align-content: start;
2598
+ min-height: 0;
2599
+ overflow: auto;
2600
+ }
2601
+ .pluno-pa-widget__history-list--center {
2602
+ align-content: center;
2603
+ justify-items: center;
2604
+ }
2605
+ .pluno-pa-widget__history-loading {
2606
+ justify-self: center;
2607
+ margin: 0;
2608
+ }
2609
+ .pluno-pa-widget__history-loading--inline {
2610
+ padding: 4px 0;
2611
+ }
2612
+ .pluno-pa-widget__history-item {
2613
+ display: grid;
2614
+ grid-template-columns: minmax(0, 1fr) auto;
2615
+ gap: 3px;
2616
+ width: 100%;
2617
+ border: 1px solid var(--pluno-pa-divider);
2618
+ border-radius: 6px;
2619
+ padding: 5px 7px;
2620
+ background: var(--pluno-pa-surface);
2621
+ color: var(--pluno-pa-text);
2622
+ font: inherit;
2623
+ text-align: left;
2624
+ cursor: pointer;
2625
+ }
2626
+ .pluno-pa-widget__history-item:hover:not(:disabled),
2627
+ .pluno-pa-widget__history-item:focus-visible,
2628
+ .pluno-pa-widget__history-close:hover,
2629
+ .pluno-pa-widget__history-close:focus-visible {
2630
+ border-color: color-mix(in srgb, var(--pluno-pa-accent) 42%, var(--pluno-pa-divider));
2631
+ background: color-mix(in srgb, var(--pluno-pa-accent) 8%, var(--pluno-pa-surface));
2632
+ }
2633
+ .pluno-pa-widget__history-item span,
2634
+ .pluno-pa-widget__history-item time,
2635
+ .pluno-pa-widget__history-item small {
2636
+ min-width: 0;
2637
+ overflow: hidden;
2638
+ text-overflow: ellipsis;
2639
+ white-space: nowrap;
2640
+ }
2641
+ .pluno-pa-widget__history-item-title {
2642
+ font-size: 11px;
2643
+ font-weight: 650;
2644
+ line-height: 1.2;
2645
+ }
2646
+ .pluno-pa-widget__history-time {
2647
+ color: var(--pluno-pa-faint);
2648
+ font-size: 9px;
2649
+ line-height: 1.2;
2650
+ justify-self: end;
2651
+ }
2652
+ .pluno-pa-widget__history-path {
2653
+ grid-column: 1 / -1;
2654
+ }
2655
+ .pluno-pa-widget__history-item small,
2656
+ .pluno-pa-widget__history-loading,
2657
+ .pluno-pa-widget__history-status {
2658
+ color: var(--pluno-pa-muted);
2659
+ font-size: 10px;
2660
+ line-height: 1.25;
2661
+ }
2662
+ .pluno-pa-widget__history-status {
2663
+ margin: 0;
2664
+ overflow-wrap: anywhere;
2665
+ }
2437
2666
  .pluno-pa-widget__timeline::-webkit-scrollbar,
2438
2667
  .pluno-pa-widget__message--assistant pre::-webkit-scrollbar,
2439
2668
  .pluno-pa-widget__input::-webkit-scrollbar {
@@ -2864,7 +3093,7 @@ function Ut(e, t) {
2864
3093
  place-items: center;
2865
3094
  padding: 18px;
2866
3095
  background: rgba(24, 24, 27, 0.28);
2867
- font-family: var(--pluno-pa-font, ${q.fontFamily});
3096
+ font-family: var(--pluno-pa-font, ${K.fontFamily});
2868
3097
  color: var(--pluno-pa-text);
2869
3098
  }
2870
3099
  .pluno-pa-widget__share-dialog {
@@ -3483,6 +3712,9 @@ function Ut(e, t) {
3483
3712
  .pluno-pa-widget__starter-prompt--placeholder {
3484
3713
  visibility: hidden;
3485
3714
  }
3715
+ .pluno-pa-widget__starter-prompt--loading {
3716
+ visibility: visible;
3717
+ }
3486
3718
  .pluno-pa-widget__login {
3487
3719
  display: inline-flex;
3488
3720
  align-items: center;
@@ -3686,6 +3918,15 @@ function Ut(e, t) {
3686
3918
  }
3687
3919
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button {
3688
3920
  position: relative;
3921
+ border-radius: var(--pluno-pa-scribble-wobble);
3922
+ }
3923
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel {
3924
+ border-radius: var(--pluno-pa-scribble-wobble);
3925
+ }
3926
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close,
3927
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-item {
3928
+ position: relative;
3929
+ border-radius: var(--pluno-pa-scribble-wobble);
3689
3930
  }
3690
3931
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
3691
3932
  position: relative;
@@ -3698,7 +3939,11 @@ function Ut(e, t) {
3698
3939
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
3699
3940
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
3700
3941
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
3942
+ .pluno-pa-widget--scribble .pluno-pa-widget__history,
3701
3943
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
3944
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close,
3945
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel,
3946
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-item,
3702
3947
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
3703
3948
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
3704
3949
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card,
@@ -3714,7 +3959,11 @@ function Ut(e, t) {
3714
3959
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner::before,
3715
3960
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher::before,
3716
3961
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
3962
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3717
3963
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
3964
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
3965
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
3966
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-item::before,
3718
3967
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
3719
3968
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
3720
3969
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before,
@@ -3744,7 +3993,10 @@ function Ut(e, t) {
3744
3993
  .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
3745
3994
  background: var(--pluno-pa-surface);
3746
3995
  }
3996
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3747
3997
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
3998
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-close::before,
3999
+ .pluno-pa-widget--scribble .pluno-pa-widget__history-panel::before,
3748
4000
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
3749
4001
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
3750
4002
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
@@ -3769,6 +4021,7 @@ function Ut(e, t) {
3769
4021
  border-color: var(--pluno-pa-accent);
3770
4022
  }
3771
4023
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
4024
+ .pluno-pa-widget--scribble .pluno-pa-widget__history,
3772
4025
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
3773
4026
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
3774
4027
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
@@ -3777,6 +4030,7 @@ function Ut(e, t) {
3777
4030
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
3778
4031
  }
3779
4032
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
4033
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
3780
4034
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
3781
4035
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
3782
4036
  .pluno-pa-widget--scribble .pluno-pa-widget__close::after,
@@ -3806,6 +4060,7 @@ function Ut(e, t) {
3806
4060
  transform: rotate(-8deg);
3807
4061
  filter: url(#pluno-pa-scribble-wobble-2);
3808
4062
  }
4063
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
3809
4064
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
3810
4065
  transform: rotate(-10deg);
3811
4066
  filter: url(#pluno-pa-scribble-wobble);
@@ -3822,6 +4077,7 @@ function Ut(e, t) {
3822
4077
  transform: rotate(-7deg);
3823
4078
  filter: url(#pluno-pa-scribble-wobble);
3824
4079
  }
4080
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3825
4081
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before {
3826
4082
  transform: rotate(6deg);
3827
4083
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3876,34 +4132,35 @@ function Ut(e, t) {
3876
4132
  filter: url(#pluno-pa-scribble-wobble-2);
3877
4133
  }
3878
4134
  .pluno-pa-widget--scribble .pluno-pa-widget__send svg,
4135
+ .pluno-pa-widget--scribble .pluno-pa-widget__history svg,
3879
4136
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
3880
4137
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy svg,
3881
4138
  .pluno-pa-widget--scribble .pluno-pa-widget__close svg {
3882
4139
  filter: url(#pluno-pa-scribble-wobble-2);
3883
4140
  }
3884
4141
  `;
3885
- if (Ea(e, n))
4142
+ if ($a(e, n))
3886
4143
  return;
3887
4144
  const o = e.ownerDocument.createElement("style");
3888
- o.id = Zt, o.textContent = n, e.appendChild(o), un(e);
4145
+ o.id = sn, o.textContent = n, e.appendChild(o), vn(e);
3889
4146
  }
3890
- function Ca(e) {
3891
- return e.getElementById(Zt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Jt) === "true";
4147
+ function Wa(e) {
4148
+ return e.getElementById(sn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(dn) === "true";
3892
4149
  }
3893
- function un(e) {
3894
- e.host instanceof HTMLElement && e.host.setAttribute(Jt, "true");
4150
+ function vn(e) {
4151
+ e.host instanceof HTMLElement && e.host.setAttribute(dn, "true");
3895
4152
  }
3896
- function Ea(e, t) {
4153
+ function $a(e, t) {
3897
4154
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3898
4155
  return !1;
3899
4156
  try {
3900
4157
  const n = new CSSStyleSheet();
3901
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], un(e), !0;
4158
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], vn(e), !0;
3902
4159
  } catch {
3903
4160
  return !1;
3904
4161
  }
3905
4162
  }
3906
- async function Sa() {
4163
+ async function qa() {
3907
4164
  return document.body ? document.body : await new Promise((e) => {
3908
4165
  const t = new MutationObserver(() => {
3909
4166
  document.body && (t.disconnect(), e(document.body));
@@ -3911,49 +4168,49 @@ async function Sa() {
3911
4168
  t.observe(document.documentElement, { childList: !0 });
3912
4169
  });
3913
4170
  }
3914
- function gn(e) {
4171
+ function Cn(e) {
3915
4172
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3916
4173
  }
3917
- function ka(e) {
4174
+ function ja(e) {
3918
4175
  try {
3919
- const t = window.localStorage.getItem(gn(e));
4176
+ const t = window.localStorage.getItem(Cn(e));
3920
4177
  if (!t)
3921
- return Ft();
4178
+ return Xt();
3922
4179
  const n = JSON.parse(t);
3923
4180
  return {
3924
4181
  isOpen: n.isOpen === !0,
3925
4182
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3926
4183
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3927
- launcherPosition: Ta(n.launcherPosition) ? n.launcherPosition : null,
3928
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-qt) : [],
4184
+ launcherPosition: Xa(n.launcherPosition) ? n.launcherPosition : null,
4185
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nn) : [],
3929
4186
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3930
4187
  };
3931
4188
  } catch {
3932
- return Ft();
4189
+ return Xt();
3933
4190
  }
3934
4191
  }
3935
- async function La(e) {
4192
+ async function Va(e) {
3936
4193
  if (e.loadSharePromptsDisabled)
3937
4194
  return e.loadSharePromptsDisabled();
3938
4195
  try {
3939
- return window.localStorage.getItem(jt) === "true";
4196
+ return window.localStorage.getItem(on) === "true";
3940
4197
  } catch {
3941
4198
  return !1;
3942
4199
  }
3943
4200
  }
3944
- function Aa(e, t) {
4201
+ function Ya(e, t) {
3945
4202
  if (e.persistSharePromptsDisabled) {
3946
4203
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3947
4204
  });
3948
4205
  return;
3949
4206
  }
3950
4207
  try {
3951
- t && window.localStorage.setItem(jt, "true");
4208
+ t && window.localStorage.setItem(on, "true");
3952
4209
  } catch {
3953
4210
  return;
3954
4211
  }
3955
4212
  }
3956
- function Ft() {
4213
+ function Xt() {
3957
4214
  return {
3958
4215
  isOpen: !1,
3959
4216
  composerValue: "",
@@ -3963,43 +4220,43 @@ function Ft() {
3963
4220
  sharePromptsDisabled: !1
3964
4221
  };
3965
4222
  }
3966
- function Pa(e, t) {
4223
+ function Ka(e, t) {
3967
4224
  try {
3968
- window.localStorage.setItem(gn(e), JSON.stringify(t));
4225
+ window.localStorage.setItem(Cn(e), JSON.stringify(t));
3969
4226
  } catch {
3970
4227
  return;
3971
4228
  }
3972
4229
  }
3973
- function Ta(e) {
4230
+ function Xa(e) {
3974
4231
  if (!e || typeof e != "object")
3975
4232
  return !1;
3976
4233
  const t = e;
3977
4234
  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");
3978
4235
  }
3979
- const zt = /* @__PURE__ */ new WeakSet();
3980
- function Na(e) {
4236
+ const Zt = /* @__PURE__ */ new WeakSet();
4237
+ function Za(e) {
3981
4238
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3982
4239
  }
3983
- function Gt(e) {
4240
+ function Jt(e) {
3984
4241
  const t = e.pathname.split("/");
3985
4242
  return t[t.length - 1] ?? "";
3986
4243
  }
3987
- function Ia(e, t) {
4244
+ function Ja(e, t) {
3988
4245
  const n = new URL(e.src, document.baseURI);
3989
- return n.href === t.href || n.pathname === t.pathname ? !0 : Gt(n) === Gt(t);
4246
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Jt(n) === Jt(t);
3990
4247
  }
3991
- class Z extends EventTarget {
4248
+ class te extends EventTarget {
3992
4249
  constructor(t, n) {
3993
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Vn, () => {
3994
- this.readyState = Z.OPEN, this.dispatchEvent(new Event("open"));
3995
- }), this.addPreviewListener(Yn, (o) => {
4250
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(ro, () => {
4251
+ this.readyState = te.OPEN, this.dispatchEvent(new Event("open"));
4252
+ }), this.addPreviewListener(lo, (o) => {
3996
4253
  const a = o;
3997
4254
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3998
- }), this.addPreviewListener(Kn, () => {
3999
- this.readyState = Z.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4000
- }), this.addPreviewListener(Xn, (o) => {
4255
+ }), this.addPreviewListener(po, () => {
4256
+ this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4257
+ }), this.addPreviewListener(so, (o) => {
4001
4258
  const a = o;
4002
- this.readyState = Z.CLOSED, this.dispatchEvent(
4259
+ this.readyState = te.CLOSED, this.dispatchEvent(
4003
4260
  new CloseEvent("close", {
4004
4261
  code: a.detail?.code ?? 1e3,
4005
4262
  reason: a.detail?.reason ?? "",
@@ -4007,7 +4264,7 @@ class Z extends EventTarget {
4007
4264
  })
4008
4265
  ), this.cleanup();
4009
4266
  }), window.dispatchEvent(
4010
- new CustomEvent(Le($n, this.channelId), {
4267
+ new CustomEvent(Me(oo, this.channelId), {
4011
4268
  detail: { socketId: this.socketId, url: t }
4012
4269
  })
4013
4270
  );
@@ -4022,27 +4279,27 @@ class Z extends EventTarget {
4022
4279
  extensions = "";
4023
4280
  binaryType = "blob";
4024
4281
  bufferedAmount = 0;
4025
- readyState = Z.CONNECTING;
4026
- socketId = Da();
4282
+ readyState = te.CONNECTING;
4283
+ socketId = Qa();
4027
4284
  listeners = /* @__PURE__ */ new Map();
4028
4285
  send(t) {
4029
- if (this.readyState !== Z.OPEN)
4286
+ if (this.readyState !== te.OPEN)
4030
4287
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
4031
4288
  window.dispatchEvent(
4032
- new CustomEvent(Le(qn, this.channelId), {
4289
+ new CustomEvent(Me(ao, this.channelId), {
4033
4290
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
4034
4291
  })
4035
4292
  );
4036
4293
  }
4037
4294
  close(t, n) {
4038
- this.readyState !== Z.CLOSED && (this.readyState = Z.CLOSING, window.dispatchEvent(
4039
- new CustomEvent(Le(jn, this.channelId), {
4295
+ this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
4296
+ new CustomEvent(Me(io, this.channelId), {
4040
4297
  detail: { socketId: this.socketId, code: t, reason: n }
4041
4298
  })
4042
4299
  ), this.cleanup());
4043
4300
  }
4044
4301
  addPreviewListener(t, n) {
4045
- const o = Le(t, this.channelId), a = (i) => {
4302
+ const o = Me(t, this.channelId), a = (i) => {
4046
4303
  i.detail?.socketId === this.socketId && n(i);
4047
4304
  };
4048
4305
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -4053,36 +4310,36 @@ class Z extends EventTarget {
4053
4310
  this.listeners.clear();
4054
4311
  }
4055
4312
  }
4056
- function Da() {
4057
- const e = window.sessionStorage.getItem(wt);
4313
+ function Qa() {
4314
+ const e = window.sessionStorage.getItem(At);
4058
4315
  if (e)
4059
4316
  return e;
4060
4317
  const t = crypto.randomUUID();
4061
- return window.sessionStorage.setItem(wt, t), t;
4318
+ return window.sessionStorage.setItem(At, t), t;
4062
4319
  }
4063
- function Le(e, t) {
4320
+ function Me(e, t) {
4064
4321
  return `${e}:${t}`;
4065
4322
  }
4066
- function Ra(e) {
4323
+ function ei(e) {
4067
4324
  const t = document.currentScript;
4068
4325
  if (t instanceof HTMLScriptElement)
4069
4326
  return [t];
4070
4327
  const n = new URL(e, document.baseURI).href, o = new URL(n);
4071
4328
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
4072
- (a) => a instanceof HTMLScriptElement && Na(a) && Ia(a, o)
4329
+ (a) => a instanceof HTMLScriptElement && Za(a) && Ja(a, o)
4073
4330
  );
4074
4331
  }
4075
- function Ma(e) {
4076
- for (const t of Ra(e)) {
4077
- if (zt.has(t) || t.dataset.plunoAutoMount === "false")
4332
+ function ti(e) {
4333
+ for (const t of ei(e)) {
4334
+ if (Zt.has(t) || t.dataset.plunoAutoMount === "false")
4078
4335
  continue;
4079
- zt.add(t);
4336
+ Zt.add(t);
4080
4337
  const n = t.dataset.plunoPreviewChannel;
4081
- bo({
4338
+ To({
4082
4339
  token: t.dataset.plunoToken,
4083
4340
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
4084
4341
  backendUrl: t.dataset.plunoBackendUrl,
4085
- webSocketFactory: n ? mo(n) : void 0,
4342
+ webSocketFactory: n ? Ao(n) : void 0,
4086
4343
  launcherLabel: t.dataset.plunoLauncherLabel,
4087
4344
  accentColor: t.dataset.plunoAccentColor,
4088
4345
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -4094,8 +4351,8 @@ function Ma(e) {
4094
4351
  });
4095
4352
  }
4096
4353
  }
4097
- Ma(import.meta.url);
4354
+ ti(import.meta.url);
4098
4355
  export {
4099
- mo as createProductAgentPreviewBridgeWebSocketFactory,
4100
- bo as mountPlunoProductAgentWidget
4356
+ Ao as createProductAgentPreviewBridgeWebSocketFactory,
4357
+ To as mountPlunoProductAgentWidget
4101
4358
  };