@pluno/product-agent-web 0.1.40 → 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,132 +1,26 @@
1
- import { PlunoProductAgent as hn } from "./product-agent-sdk.js";
2
- const mn = "#7c3aed";
3
- function fn(e) {
4
- const t = _n(e);
5
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
6
- <defs>
7
- <linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
8
- <stop offset="0" stop-color="${t.top}"/>
9
- <stop offset="0.36" stop-color="${t.middle}"/>
10
- <stop offset="0.72" stop-color="${t.bottom}"/>
11
- <stop offset="1" stop-color="${t.bottom}"/>
12
- </linearGradient>
13
- <linearGradient id="boltEdge" x1="470" y1="145" x2="900" y2="980" gradientUnits="userSpaceOnUse">
14
- <stop offset="0" stop-color="${t.edgeStart}"/>
15
- <stop offset="0.32" stop-color="${t.edgeMiddle}"/>
16
- <stop offset="0.78" stop-color="${t.edgeEnd}"/>
17
- <stop offset="1" stop-color="${t.edgeEnd}"/>
18
- </linearGradient>
19
- <radialGradient id="boltGlow" cx="50%" cy="22%" r="82%">
20
- <stop offset="0" stop-color="${t.glow}" stop-opacity="0.72"/>
21
- <stop offset="0.5" stop-color="${t.middle}" stop-opacity="0.44"/>
22
- <stop offset="1" stop-color="${t.bottom}" stop-opacity="0"/>
23
- </radialGradient>
24
- <radialGradient id="eyeWhite" cx="35%" cy="25%" r="70%">
25
- <stop offset="0" stop-color="#ffffff"/>
26
- <stop offset="0.72" stop-color="#ffffff"/>
27
- <stop offset="1" stop-color="#e5e5e5"/>
28
- </radialGradient>
29
- <radialGradient id="pupil" cx="42%" cy="38%" r="65%">
30
- <stop offset="0" stop-color="#2a1f10"/>
31
- <stop offset="0.52" stop-color="#080604"/>
32
- <stop offset="1" stop-color="#000000"/>
33
- </radialGradient>
34
- <filter id="softDropShadow" x="-18%" y="-12%" width="136%" height="136%" color-interpolation-filters="sRGB">
35
- <feDropShadow dx="0" dy="12" stdDeviation="18" flood-color="${t.shadow}" flood-opacity="0.24"/>
36
- </filter>
37
- <filter id="innerDepth" x="-8%" y="-8%" width="116%" height="116%" color-interpolation-filters="sRGB">
38
- <feGaussianBlur in="SourceAlpha" stdDeviation="8" result="blur"/>
39
- <feOffset dx="-7" dy="-9" result="topLeft"/>
40
- <feComposite in="topLeft" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="innerShadow"/>
41
- <feColorMatrix in="innerShadow" type="matrix" values="1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0" result="innerLight"/>
42
- <feBlend in="SourceGraphic" in2="innerLight" mode="screen"/>
43
- </filter>
44
- <filter id="eyeShadow" x="-24%" y="-20%" width="148%" height="148%" color-interpolation-filters="sRGB">
45
- <feDropShadow dx="0" dy="8" stdDeviation="5" flood-color="${t.shadow}" flood-opacity="0.3"/>
46
- </filter>
47
- <filter id="pupilGloss" x="-15%" y="-15%" width="130%" height="130%" color-interpolation-filters="sRGB">
48
- <feDropShadow dx="0" dy="3" stdDeviation="3" flood-color="#000000" flood-opacity="0.22"/>
49
- </filter>
50
- <clipPath id="boltClip">
51
- <path d="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"/>
52
- </clipPath>
53
- </defs>
54
- <g filter="url(#softDropShadow)">
55
- <path d="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" fill="url(#boltEdge)"/>
56
- <path d="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" fill="url(#boltFill)" filter="url(#innerDepth)"/>
57
- <path d="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" fill="url(#boltGlow)" opacity="0.74"/>
58
- <g clip-path="url(#boltClip)" opacity="0.42">
59
- <path d="M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626" fill="none" stroke="${t.highlight}" stroke-width="22" stroke-linecap="round" opacity="0.65"/>
60
- <path d="M556 685 L501 994" fill="none" stroke="${t.highlight}" stroke-width="20" stroke-linecap="round" opacity="0.55"/>
61
- <path d="M858 160 C882 166 893 181 883 204" fill="none" stroke="${t.inner}" stroke-width="18" stroke-linecap="round" opacity="0.48"/>
62
- </g>
63
- </g>
64
- <g filter="url(#eyeShadow)">
65
- <g transform="rotate(-2 528 463)">
66
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="url(#eyeWhite)"/>
67
- <ellipse cx="533" cy="473" rx="49" ry="57" fill="url(#pupil)" filter="url(#pupilGloss)"/>
68
- <circle cx="557" cy="447" r="18" fill="#ffffff"/>
69
- </g>
70
- <g transform="rotate(2 717 462)">
71
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="url(#eyeWhite)"/>
72
- <ellipse cx="712" cy="473" rx="49" ry="57" fill="url(#pupil)" filter="url(#pupilGloss)"/>
73
- <circle cx="728" cy="447" r="18" fill="#ffffff"/>
74
- </g>
75
- </g>
76
- </svg>`;
77
- }
78
- const se = "#2c2a1e", st = [253, 250, 241], dt = 3.5;
79
- function Bt(e) {
80
- const t = Ot(e);
81
- if (ct(fe(t), st) >= dt)
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)
82
6
  return t;
83
- let o = fe(t);
84
- const a = fe(se);
7
+ let o = ke(t);
8
+ const a = ke(Oe);
85
9
  for (let i = 0; i < 6; i += 1)
86
- if (o = xn(o, a, 0.22), ct(o, st) >= dt)
87
- return $e(o);
88
- return $e(o);
10
+ if (o = Fn(o, a, 0.22), kt(o, Et) >= St)
11
+ return tt(o);
12
+ return tt(o);
89
13
  }
90
- function bn(e) {
91
- const t = Bt(e), n = "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";
92
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
93
- <defs>
94
- <clipPath id="scribbleBoltClip">
95
- <path d="${n}"/>
96
- </clipPath>
97
- <filter id="scribbleBoltWobble" x="-10%" y="-10%" width="120%" height="120%" color-interpolation-filters="sRGB">
98
- <feTurbulence type="fractalNoise" baseFrequency="0.011" numOctaves="3" seed="7" result="noise"/>
99
- <feDisplacementMap in="SourceGraphic" in2="noise" scale="16" xChannelSelector="R" yChannelSelector="G"/>
100
- </filter>
101
- </defs>
102
- <g filter="url(#scribbleBoltWobble)">
103
- <g clip-path="url(#scribbleBoltClip)">
104
- <path d="${wn()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
105
- </g>
106
- <path d="${n}" fill="none" stroke="${se}" stroke-width="18" stroke-linejoin="round"/>
107
- <g transform="rotate(-2 528 463)">
108
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
109
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${se}"/>
110
- <circle cx="557" cy="447" r="16" fill="#ffffff"/>
111
- </g>
112
- <g transform="rotate(2 717 462)">
113
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${se}" stroke-width="13"/>
114
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${se}"/>
115
- <circle cx="728" cy="447" r="16" fill="#ffffff"/>
116
- </g>
117
- </g>
118
- </svg>`;
119
- }
120
- function wn() {
14
+ function On() {
121
15
  let n = "M 280 120", o = !1, a = 0;
122
16
  for (let i = 150; i <= 1170; i += 62) {
123
- const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
124
- 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;
125
19
  }
126
20
  return n;
127
21
  }
128
- function _n(e) {
129
- const t = Ot(e), n = Ge(fe(t));
22
+ function Un(e) {
23
+ const t = en(e), n = nt(ke(t));
130
24
  return n > 0.86 ? {
131
25
  top: "#ffffff",
132
26
  middle: "#f6f6f6",
@@ -150,90 +44,90 @@ function _n(e) {
150
44
  inner: "#4b4b4b",
151
45
  shadow: "#000000"
152
46
  } : {
153
- top: $(t, 0.28, -0.03),
154
- middle: $(t, 0.08, 0.04),
155
- bottom: $(t, -0.1, 0.02),
156
- edgeStart: $(t, 0.08, 0.08),
157
- edgeMiddle: $(t, -0.08, 0.08),
158
- edgeEnd: $(t, -0.18, 0.05),
159
- glow: $(t, 0.32, -0.12),
160
- highlight: $(t, 0.38, -0.18),
161
- inner: $(t, 0.24, -0.1),
162
- shadow: $(t, -0.25, -0.08)
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)
163
57
  };
164
58
  }
165
- function Ot(e) {
59
+ function en(e) {
166
60
  const t = e.trim();
167
- 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()}` : mn;
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;
168
62
  }
169
- function fe(e) {
63
+ function ke(e) {
170
64
  return [
171
65
  Number.parseInt(e.slice(1, 3), 16),
172
66
  Number.parseInt(e.slice(3, 5), 16),
173
67
  Number.parseInt(e.slice(5, 7), 16)
174
68
  ];
175
69
  }
176
- function $e([e, t, n]) {
70
+ function tt([e, t, n]) {
177
71
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
178
72
  return `#${o(e)}${o(t)}${o(n)}`;
179
73
  }
180
- function Ge([e, t, n]) {
74
+ function nt([e, t, n]) {
181
75
  const o = (a) => {
182
76
  const i = a / 255;
183
77
  return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
184
78
  };
185
79
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
186
80
  }
187
- function ct(e, t) {
188
- const n = Ge(e), o = Ge(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];
189
83
  return (a + 0.05) / (i + 0.05);
190
84
  }
191
- function xn(e, t, n) {
192
- const o = We(n);
85
+ function Fn(e, t, n) {
86
+ const o = ot(n);
193
87
  return [
194
88
  e[0] + (t[0] - e[0]) * o,
195
89
  e[1] + (t[1] - e[1]) * o,
196
90
  e[2] + (t[2] - e[2]) * o
197
91
  ];
198
92
  }
199
- function $(e, t, n) {
200
- const [o, a, i] = vn(fe(e));
201
- return $e(yn(o, We(a + n), We(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)));
202
96
  }
203
- function vn([e, t, n]) {
204
- const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), c = (l + s) / 2;
205
- if (l === s)
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)
206
100
  return [0, 0, c];
207
- const u = l - s, p = c > 0.5 ? u / (2 - l - s) : u / (l + s);
208
- return [(l === o ? (a - i) / u + (a < i ? 6 : 0) : l === a ? (i - o) / u + 2 : (o - a) / u + 4) / 6, p, 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];
209
103
  }
210
- function yn(e, t, n) {
104
+ function Gn(e, t, n) {
211
105
  if (t === 0)
212
106
  return [n * 255, n * 255, n * 255];
213
107
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
214
108
  return [
215
- Be(a, o, e + 1 / 3) * 255,
216
- Be(a, o, e) * 255,
217
- Be(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
218
112
  ];
219
113
  }
220
- function Be(e, t, n) {
114
+ function Xe(e, t, n) {
221
115
  let o = n;
222
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;
223
117
  }
224
- function We(e) {
118
+ function ot(e) {
225
119
  return Math.max(0, Math.min(1, e));
226
120
  }
227
- const Ut = "suggest_share_on_socials";
228
- function Cn(e) {
121
+ const tn = "suggest_share_on_socials";
122
+ function Hn(e) {
229
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
230
124
  const n = e[t];
231
- if (n.role !== "tool" || n.toolName !== Ut)
125
+ if (n.role !== "tool" || n.toolName !== tn)
232
126
  continue;
233
- const o = ut(e, t, "assistant");
127
+ const o = Lt(e, t, "assistant");
234
128
  if (!o)
235
129
  return null;
236
- const a = ut(e, o.index, "user");
130
+ const a = Lt(e, o.index, "user");
237
131
  return a ? {
238
132
  id: `share:${n.callId ?? n.id}`,
239
133
  userPrompt: a.content,
@@ -242,13 +136,13 @@ function Cn(e) {
242
136
  }
243
137
  return null;
244
138
  }
245
- async function En(e) {
246
- const t = await Sn(e);
139
+ async function Wn(e) {
140
+ const t = await $n(e);
247
141
  if (!navigator.clipboard || typeof ClipboardItem > "u")
248
142
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
249
143
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
250
144
  }
251
- function ut(e, t, n) {
145
+ function Lt(e, t, n) {
252
146
  for (let o = t - 1; o >= 0; o -= 1) {
253
147
  const a = e[o];
254
148
  if (a.role === n && a.content.trim())
@@ -256,73 +150,73 @@ function ut(e, t, n) {
256
150
  }
257
151
  return null;
258
152
  }
259
- async function Sn(e) {
153
+ async function $n(e) {
260
154
  return await (await fetch(e)).blob();
261
155
  }
262
- const kn = "https://app.pluno.ai", Ln = "/api/product-agent/embed/active-users", An = 1800, Pn = 15e3, Tn = 250, Nn = 1e3, In = 3e4;
263
- function Dn(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 = {}) {
264
158
  let n = !1, o = null, a = null, i = null;
265
159
  const l = () => {
266
160
  i !== null && (window.clearInterval(i), i = null);
267
- }, s = (p) => {
161
+ }, p = (s) => {
268
162
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
269
163
  u();
270
- }, Bn(p)));
271
- }, c = (p) => {
164
+ }, to(s)));
165
+ }, c = (s) => {
272
166
  if (l(), o === null) {
273
- o = p, e(p);
167
+ o = s, e(s);
274
168
  return;
275
169
  }
276
- const m = o, x = performance.now();
170
+ const b = o, x = performance.now();
277
171
  i = window.setInterval(() => {
278
172
  if (n) {
279
173
  l();
280
174
  return;
281
175
  }
282
- const A = Math.min(1, (performance.now() - x) / An);
283
- o = Math.round(m + (p - m) * On(A)), e(o), A >= 1 && (o = p, e(p), l());
284
- }, Tn);
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);
285
179
  }, u = async () => {
286
180
  try {
287
- const p = await Rn(t);
181
+ const s = await Qn(t);
288
182
  if (n)
289
183
  return;
290
- c(p.count), s(p.refreshAfterMs);
184
+ c(s.count), p(s.refreshAfterMs);
291
185
  } catch {
292
- s(Pn);
186
+ p(Yn);
293
187
  }
294
188
  };
295
189
  return u(), () => {
296
190
  n = !0, a !== null && window.clearTimeout(a), l();
297
191
  };
298
192
  }
299
- async function Rn(e) {
193
+ async function Qn(e) {
300
194
  if (e.loader)
301
195
  return e.loader();
302
- const n = await (e.fetcher ?? fetch)(new URL(Ln, Mn(e.backendUrl ?? kn)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(jn, eo(e.backendUrl ?? qn)).toString(), {
303
197
  cache: "no-store",
304
198
  credentials: "omit"
305
199
  });
306
200
  if (!n.ok)
307
201
  throw new Error("Failed to load active users");
308
- const o = await n.json(), a = gt(o.count), i = gt(o.refreshAfterMs ?? o.refresh_after_ms);
202
+ const o = await n.json(), a = Pt(o.count), i = Pt(o.refreshAfterMs ?? o.refresh_after_ms);
309
203
  if (a === null || i === null)
310
204
  throw new Error("Invalid active users response");
311
205
  return { count: a, refreshAfterMs: i };
312
206
  }
313
- function gt(e) {
207
+ function Pt(e) {
314
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
315
209
  }
316
- function Mn(e) {
210
+ function eo(e) {
317
211
  return e.endsWith("/") ? e : `${e}/`;
318
212
  }
319
- function Bn(e) {
320
- return Math.min(In, Math.max(Nn, e));
213
+ function to(e) {
214
+ return Math.min(Zn, Math.max(Xn, e));
321
215
  }
322
- function On(e) {
216
+ function no(e) {
323
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
324
218
  }
325
- const Ft = 100, Un = "product-agent:sdk-preview-socket-connect", Fn = "product-agent:sdk-preview-socket-send", zn = "product-agent:sdk-preview-socket-close", $n = "product-agent:sdk-preview-socket-open", Gn = "product-agent:sdk-preview-socket-message", Wn = "product-agent:sdk-preview-socket-error", Hn = "product-agent:sdk-preview-socket-closed", ht = "product-agent:sdk-preview-socket-id", qn = "product-agent:preview-diagnostic", zt = "pluno.productAgent.sharePromptsDisabled", ke = 10, jn = 10 * 1024 * 1024, $t = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Vn = Array.from($t).join(","), Yn = 3, G = {
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 = {
326
220
  launcherLabel: "Ask for anything...",
327
221
  accentColor: "#7c3aed",
328
222
  colorScheme: "light",
@@ -330,7 +224,7 @@ const Ft = 100, Un = "product-agent:sdk-preview-socket-connect", Fn = "product-a
330
224
  scribbleStyle: !1,
331
225
  position: "bottom-right",
332
226
  movableLauncher: !1
333
- }, Kn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', mt = "pluno-pa-scribble-font", Gt = 190, Wt = 41, Xn = 48, Zn = 420, Jn = 520, Qn = 0.24, eo = 680, to = 800, no = 0.76, O = 8, He = 50, oo = "http://www.w3.org/2000/svg", ft = [
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 = [
334
228
  {
335
229
  ellipseCx: "17.5",
336
230
  ellipseCy: "24.5",
@@ -367,20 +261,20 @@ const Ft = 100, Un = "product-agent:sdk-preview-socket-connect", Fn = "product-a
367
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
368
262
  pathStrokeWidth: "2.45"
369
263
  }
370
- ], ao = 11, io = 13, bt = 4, ro = 10, lo = 40, po = "movable-launcher-position-v2", Ht = "pluno-pa-widget-styles", qt = "data-pluno-pa-widget-styles";
371
- let wt = 0;
372
- function so(e) {
373
- return (t) => new Y(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);
374
268
  }
375
- async function co(e = {}) {
269
+ async function To(e = {}) {
376
270
  const t = {
377
- launcherLabel: e.launcherLabel ?? G.launcherLabel,
378
- accentColor: e.accentColor ?? G.accentColor,
379
- colorScheme: e.colorScheme ?? G.colorScheme,
380
- fontFamily: e.fontFamily ?? G.fontFamily,
381
- scribbleStyle: e.scribbleStyle ?? G.scribbleStyle,
382
- position: e.position ?? G.position,
383
- movableLauncher: e.movableLauncher ?? G.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,
384
278
  token: e.token,
385
279
  tokenProvider: e.tokenProvider,
386
280
  tokenEndpoint: e.tokenEndpoint,
@@ -407,7 +301,7 @@ async function co(e = {}) {
407
301
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
408
302
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
409
303
  };
410
- V("web-sdk.widget", "Mounting widget with merged options", {
304
+ Y("web-sdk.widget", "Mounting widget with merged options", {
411
305
  accentColor: t.accentColor,
412
306
  colorScheme: t.colorScheme,
413
307
  fontFamily: t.fontFamily,
@@ -422,32 +316,32 @@ async function co(e = {}) {
422
316
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
423
317
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
424
318
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
425
- let i = _t(t.accentColor, t.scribbleStyle);
426
- Ao(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
427
- const l = await _a(), s = l.ownerDocument;
428
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), It(o, t.accentColor), xt(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, {
429
323
  accentColor: t.accentColor,
430
324
  colorScheme: t.colorScheme,
431
325
  fontFamily: t.fontFamily,
432
326
  scribbleStyle: t.scribbleStyle
433
- }), V("web-sdk.widget", "Applied initial widget appearance", {
327
+ }), Y("web-sdk.widget", "Applied initial widget appearance", {
434
328
  accentColor: t.accentColor,
435
329
  colorScheme: t.colorScheme,
436
330
  fontFamily: t.fontFamily,
437
331
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
438
332
  });
439
- const c = a.querySelector(".pluno-pa-widget__launcher"), u = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), p = a.querySelector(".pluno-pa-widget__launcher-input"), m = a.querySelector(".pluno-pa-widget__panel"), x = a.querySelector(".pluno-pa-widget__close"), A = a.querySelector(".pluno-pa-widget__composer"), C = a.querySelector(".pluno-pa-widget__attachment-error"), B = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), T = a.querySelector(".pluno-pa-widget__new-chat"), Q = a.querySelector(".pluno-pa-widget__timeline-jump"), ce = a.querySelector(".pluno-pa-widget__active-users-counter"), k = a.querySelector(".pluno-pa-widget__timeline"), b = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
440
- if (!c || !p || !m || !x || !A || !C || !B || !v || !y || !h || !g || !_ || !T || !Q || !ce || !k || !b)
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)
441
335
  throw new Error("Failed to mount Pluno widget");
442
336
  if (t.movableLauncher && !u)
443
337
  throw new Error("Failed to mount Pluno widget drag handle");
444
- Ct(p), Ct(g);
445
- let f = [], N = null;
446
- const L = () => {
447
- Wo(v, f, (r) => {
448
- f = f.filter((d, E) => E !== r), L(), R(w.getState()), F();
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();
449
343
  });
450
- }, I = 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 () => {
451
345
  if (!t.tokenEndpoint)
452
346
  throw new Error("Pluno widget requires token or tokenEndpoint");
453
347
  const r = await fetch(t.tokenEndpoint, {
@@ -462,11 +356,11 @@ async function co(e = {}) {
462
356
  if (!d.token)
463
357
  throw new Error("Pluno token endpoint did not return a token");
464
358
  return d.token;
465
- }), P = window.fetch.bind(window);
359
+ }), Sn = window.fetch.bind(window);
466
360
  let w;
467
- w = await hn.init({
361
+ w = await Mn.init({
468
362
  token: t.token,
469
- tokenProvider: I,
363
+ tokenProvider: En,
470
364
  backendUrl: t.backendUrl,
471
365
  metadata: () => ({
472
366
  ...t.metadata ?? {},
@@ -479,42 +373,83 @@ async function co(e = {}) {
479
373
  webSocketFactory: t.webSocketFactory,
480
374
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
481
375
  });
482
- const ee = xa(t), Le = new Set(ee.openToolGroupKeys), re = new Set(ee.seenShareCandidateIds), be = new Set(re);
483
- let Ae = ee.sharePromptsDisabled || await va(t), H = t.movableLauncher ? ee.launcherPosition : null, Xe = H !== null, X = null, Pe = !1, te = !1, ne = {
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 = {
484
378
  enabled: !0
485
- }, oe = 0, Ze = "";
379
+ }, ce = 0, ct = "", ae = !1, ee = !1, ie = [], We = null, ye = null;
486
380
  const q = (r, d) => {
487
- ne = { enabled: r, reason: d };
381
+ de = { enabled: r, reason: d };
488
382
  }, j = () => {
489
- Q.hidden = !0;
490
- }, rn = () => {
491
- Q.hidden = !1;
492
- }, ln = (r = "jump") => {
493
- q(!0, r), j(), me(k, () => ne.enabled), oe = k.scrollTop;
494
- }, pn = () => {
495
- Pe || typeof document > "u" || (It(o, t.accentColor), n.isConnected || s.body?.appendChild(n));
496
- }, Je = new MutationObserver(pn);
497
- Je.observe(s.documentElement, { childList: !0, subtree: !0 });
498
- const Te = (r = !0) => {
499
- const d = qe(a, r);
500
- return vt(
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(
501
436
  a,
502
- H ? wo(H, d) : bo(a, t.position, d),
437
+ Q ? Oo(Q, d) : Bo(a, t.position, d),
503
438
  d
504
439
  );
505
- }, U = () => {
506
- Ca(t, {
440
+ }, H = () => {
441
+ Ka(t, {
507
442
  isOpen: a.classList.contains("pluno-pa-widget--open"),
508
443
  composerValue: g.value,
509
- openToolGroupKeys: [...Le],
510
- launcherPosition: Xe ? H : null,
511
- seenShareCandidateIds: [...re].slice(-Ft),
512
- sharePromptsDisabled: Ae
444
+ openToolGroupKeys: [...ze],
445
+ launcherPosition: dt ? Q : null,
446
+ seenShareCandidateIds: [...be].slice(-nn),
447
+ sharePromptsDisabled: Ge
513
448
  });
514
- }, ae = (r, d = {}) => {
515
- So(r, {
516
- debugVersion: po,
517
- launcherPosition: H,
449
+ }, ge = (r, d = {}) => {
450
+ $o(r, {
451
+ debugVersion: Po,
452
+ launcherPosition: Q,
518
453
  rootClasses: a.className,
519
454
  rootStyle: {
520
455
  left: a.style.left,
@@ -522,110 +457,110 @@ async function co(e = {}) {
522
457
  right: a.style.right,
523
458
  bottom: a.style.bottom
524
459
  },
525
- rootRect: Oe(a),
526
- launcherRect: Oe(c),
527
- panelRect: Oe(m),
528
- viewport: K(),
529
- panelHidden: m.hidden,
460
+ rootRect: Ze(a),
461
+ launcherRect: Ze(c),
462
+ panelRect: Ze(b),
463
+ viewport: ne(),
464
+ panelHidden: b.hidden,
530
465
  closeHidden: x.hidden,
531
466
  ...d
532
467
  });
533
- }, we = (r = !0) => {
534
- if (!H)
535
- return ye(a, null), Te(r);
536
- const d = Te(r);
537
- return ye(a, d), ae("Applied stored closed launcher position", { visibleLauncherPosition: d }), d;
538
- }, Qe = (r, d) => {
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) => {
539
474
  if (!r || !d) {
540
- Eo(a);
475
+ Wo(a);
541
476
  return;
542
477
  }
543
- Co(a, {
478
+ Ho(a, {
544
479
  x: r.x - d.x,
545
480
  y: r.y - d.y
546
481
  });
547
- }, et = () => {
548
- const r = we();
482
+ }, mt = () => {
483
+ const r = Pe();
549
484
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
550
- const d = yt(a, r, t.position);
551
- Qe(d, r), ae("Applied open panel position after viewport resize", { openPanelPosition: d });
552
- } else H && ae("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 });
553
488
  };
554
- let tt = () => {
489
+ let bt = () => {
555
490
  };
556
- window.addEventListener("resize", et), t.movableLauncher && u ? (we(), tt = fo({
491
+ window.addEventListener("resize", mt), t.movableLauncher && u ? (Pe(), bt = Mo({
557
492
  root: a,
558
493
  launcher: c,
559
494
  launcherDragHandle: u,
560
- getPosition: () => Te(),
495
+ getPosition: () => $e(),
561
496
  setPosition: (r) => {
562
- const d = r, E = qe(a), z = vt(a, r, E);
563
- H = _o(z, E), ye(a, z), ae("Dragging closed launcher", { requestedPosition: d });
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 });
564
499
  },
565
500
  persist: () => {
566
- Xe = !0, U(), ae("Persisted closed launcher drag position");
501
+ dt = !0, H(), ge("Persisted closed launcher drag position");
567
502
  }
568
- })) : ye(a, null);
569
- let Ne = !1;
570
- const nt = async () => {
571
- if (!(!t.billingStatusLoader || Ne)) {
572
- Ne = !0;
503
+ })) : Ie(a, null);
504
+ let qe = !1;
505
+ const ft = async () => {
506
+ if (!(!t.billingStatusLoader || qe)) {
507
+ qe = !0;
573
508
  try {
574
509
  const r = await t.billingStatusLoader();
575
- St(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, ze(B, t.billingStatus, w.getState().lastErrorCode), F());
510
+ Ht(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, et(O, t.billingStatus, w.getState().lastErrorCode), W());
576
511
  } finally {
577
- Ne = !1;
512
+ qe = !1;
578
513
  }
579
514
  }
580
- }, ie = (r = "", d = !0) => {
581
- nt(), X !== null && (window.clearTimeout(X), X = null), m.hidden = !1, x.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
582
- const E = we(), z = yt(a, E, t.position);
583
- if (Qe(z, E), ae("Opening launcher at clamped open panel position", { openPanelPosition: z, visibleLauncherPosition: E }), q(!0, "open"), j(), !d) {
584
- a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, he(g)), me(k, () => ne.enabled), oe = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), U();
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();
585
520
  return;
586
521
  }
587
522
  window.requestAnimationFrame(() => {
588
- a.classList.add("pluno-pa-widget--open"), r && (g.value = r, he(g)), me(k, () => ne.enabled), oe = k.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), U(), X = window.setTimeout(() => {
589
- c.hidden = !0, me(k, () => ne.enabled), oe = k.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;
590
525
  }, 220);
591
526
  });
592
- }, sn = () => {
593
- X !== null && (window.clearTimeout(X), X = null), c.hidden = !1, H && (we(!1), ae("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), U(), X = window.setTimeout(() => {
594
- m.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
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(() => {
529
+ b.hidden = !0, x.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
595
530
  }, 220);
596
531
  };
597
532
  c.addEventListener("submit", (r) => {
598
- r.preventDefault(), ie(p.value), p.value = "";
533
+ r.preventDefault(), he(s.value), s.value = "";
599
534
  }), u?.addEventListener("click", (r) => {
600
535
  r.preventDefault(), r.stopPropagation();
601
536
  }), c.addEventListener("click", (r) => {
602
- r.target === p && !u || (ie(p.value), p.value = "");
603
- }), p.addEventListener("focus", () => {
604
- ie(p.value), p.value = "";
605
- }), p.addEventListener("input", () => {
606
- if (!p.value)
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)
607
542
  return;
608
- const r = p.value;
609
- ie(r), p.value = "";
610
- }), x.addEventListener("click", sn), k.addEventListener("scroll", () => {
611
- k.scrollTop < oe - 1 && q(!1, "userScroll"), oe = k.scrollTop;
612
- }), Q.addEventListener("click", () => {
613
- ln();
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();
614
549
  });
615
- const ot = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
550
+ const wt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
616
551
  ([r]) => {
617
552
  r?.isIntersecting && (q(!0, "bottom"), j());
618
553
  },
619
- { root: k, threshold: 0 }
554
+ { root: f, threshold: 0 }
620
555
  );
621
- ot?.observe(b);
622
- const _e = () => t.loginRequired || t.signupRequired, at = () => {
623
- const r = _e();
624
- p.readOnly = r, p.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : t.launcherLabel, g.placeholder = r ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : G.launcherLabel, A.hidden = r;
625
- }, F = () => {
626
- _.disabled = W(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && f.length === 0, h.disabled = _e() || W(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);
627
562
  };
628
- at(), A.addEventListener("submit", (r) => {
563
+ _t(), P.addEventListener("submit", (r) => {
629
564
  if (r.preventDefault(), t.loginRequired) {
630
565
  t.onLoginClick?.();
631
566
  return;
@@ -634,49 +569,49 @@ async function co(e = {}) {
634
569
  t.onSignupClick?.();
635
570
  return;
636
571
  }
637
- W(t.billingStatus) || (te = !0, q(!0, "send"), j(), f = Ue(w, g, f), L(), F());
572
+ X(t.billingStatus) || (se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W());
638
573
  });
639
- let ue = 0;
640
- const dn = () => {
641
- ue = 0, a.classList.remove("pluno-pa-widget--drag-over");
642
- }, it = (r) => {
643
- N !== null && window.clearTimeout(N), C.textContent = r, C.hidden = !1, N = window.setTimeout(() => {
644
- C.textContent = "", C.hidden = !0, N = 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;
645
580
  }, 3e3);
646
- }, cn = () => {
647
- N !== null && (window.clearTimeout(N), N = null), C.textContent = "", C.hidden = !0;
648
- }, rt = async (r) => {
581
+ }, In = () => {
582
+ J !== null && (window.clearTimeout(J), J = null), k.textContent = "", k.hidden = !0;
583
+ }, yt = async (r) => {
649
584
  if (r.length === 0)
650
585
  return;
651
- const d = await Vo(r);
652
- if (f.length + d.length > ke)
653
- throw new Error(`Attach up to ${ke} files per message.`);
654
- f = [...f, ...d], L(), cn(), F(), R(w.getState()), a.classList.contains("pluno-pa-widget--open") || ie();
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();
655
590
  };
656
591
  h.addEventListener("click", () => {
657
- t.loginRequired || W(t.billingStatus) || y.click();
658
- }), y.addEventListener("change", () => {
659
- const r = Array.from(y.files ?? []);
660
- y.value = "", rt(r).catch((d) => {
661
- it(d instanceof Error ? d.message : "Failed to attach file"), V("web-sdk.widget", "Attachment failed", {
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", {
662
597
  message: d instanceof Error ? d.message : String(d)
663
598
  });
664
599
  });
665
600
  }), a.addEventListener("dragenter", (r) => {
666
- !Ce(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ue += 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"));
667
602
  }), a.addEventListener("dragover", (r) => {
668
603
  const d = r.dataTransfer;
669
- !Ce(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
604
+ !De(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), d.dropEffect = "copy");
670
605
  }), a.addEventListener("dragleave", (r) => {
671
- Ce(r.dataTransfer) && (r.stopPropagation(), ue = Math.max(0, ue - 1), ue === 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"));
672
607
  }), a.addEventListener("drop", (r) => {
673
608
  const d = r.dataTransfer;
674
- !Ce(d) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), dn(), rt(d.files).catch((E) => {
675
- it(E instanceof Error ? E.message : "Failed to attach file"), V("web-sdk.widget", "Attachment failed", {
676
- message: E instanceof Error ? E.message : String(E)
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)
677
612
  });
678
613
  }));
679
- }), _.addEventListener("click", () => {
614
+ }), E.addEventListener("click", () => {
680
615
  if (t.loginRequired) {
681
616
  t.onLoginClick?.();
682
617
  return;
@@ -685,32 +620,36 @@ async function co(e = {}) {
685
620
  w.stop();
686
621
  return;
687
622
  }
688
- te = !0, q(!0, "send"), j(), f = Ue(w, g, f), L(), F(), R(w.getState());
689
- }), T.addEventListener("click", () => {
690
- te = !0, q(!0, "newSession"), j(), w.startNewSession(), Le.clear(), g.value = "", f = [], L(), he(g), U(), F(), g.focus(), R(w.getState());
691
- }), g.addEventListener("input", () => {
692
- he(g), U(), F(), R(w.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());
693
632
  }), g.addEventListener("keydown", (r) => {
694
633
  if (!(r.key !== "Enter" || r.shiftKey)) {
695
634
  if (r.preventDefault(), t.loginRequired) {
696
635
  t.onLoginClick?.();
697
636
  return;
698
637
  }
699
- te = !0, q(!0, "send"), j(), f = Ue(w, g, f), L(), F(), R(w.getState());
638
+ se = !0, q(!0, "send"), j(), T = Je(w, g, T), me(), W(), U(w.getState());
700
639
  }
701
640
  }), a.addEventListener("click", (r) => {
702
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && U();
703
- }), ee.composerValue && (g.value = ee.composerValue, he(g)), ee.isOpen && ie(g.value, !1);
704
- const xe = () => i;
705
- let Ie = w.getState().appearance !== null, ve = null, ge = null, le = null, lt = w.getState().isThinking, pe = null, De = null, pt = () => {
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 = () => {
706
645
  };
707
- const un = !!t.socialPostDraftHandler, R = (r) => {
708
- if (Ke(r.lastErrorCode) ? pe = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), ze(B, t.billingStatus, pe), t.loginRequired) {
709
- At(
710
- k,
711
- _,
712
- T,
713
- xe,
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,
714
653
  "Log in to use Pluno on this page.",
715
654
  t.loginButtonLabel,
716
655
  t.loginUrl,
@@ -719,11 +658,11 @@ async function co(e = {}) {
719
658
  return;
720
659
  }
721
660
  if (t.signupRequired) {
722
- At(
723
- k,
724
- _,
725
- T,
726
- xe,
661
+ qt(
662
+ f,
663
+ E,
664
+ I,
665
+ Te,
727
666
  "Complete signup to unlock your free trial credits.",
728
667
  t.signupButtonLabel,
729
668
  t.signupUrl,
@@ -731,133 +670,133 @@ async function co(e = {}) {
731
670
  );
732
671
  return;
733
672
  }
734
- const d = ko(r), E = d !== Ze;
735
- Ze = d;
736
- const z = te || ne.enabled;
737
- te = !1, ia(
738
- k,
739
- b,
740
- _,
741
- T,
742
- ce,
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,
743
682
  r,
744
- De,
745
- De !== null && Lt(r, g.value.trim().length > 0 || f.length > 0),
746
- z,
747
- () => ne.enabled,
748
- Le,
749
- U,
750
- xe,
751
- (M) => {
752
- te = !0, q(!0, "send"), j(), w.sendMessage(M);
683
+ Ve,
684
+ Ve !== null && $t(r, g.value.trim().length > 0 || T.length > 0),
685
+ B,
686
+ () => de.enabled,
687
+ ze,
688
+ H,
689
+ Te,
690
+ (N) => {
691
+ se = !0, q(!0, "send"), j(), w.sendMessage(N);
753
692
  },
754
- un && !Ae ? {
755
- dismissedCandidateIds: be,
756
- draftingCandidateId: ve,
757
- error: ge,
758
- characterIconSvg: xe(),
759
- onSeen: (M) => {
760
- re.add(M.id), U();
693
+ Dn && !Ge ? {
694
+ dismissedCandidateIds: Le,
695
+ draftingCandidateId: Ne,
696
+ error: Ce,
697
+ characterIconOptions: Te(),
698
+ onSeen: (N) => {
699
+ be.add(N.id), H();
761
700
  },
762
- onDraft: (M) => {
763
- gn(M);
701
+ onDraft: (N) => {
702
+ Rn(N);
764
703
  },
765
- onDismiss: (M) => {
766
- re.add(M.id), be.add(M.id), U(), ge = null, R(w.getState());
704
+ onDismiss: (N) => {
705
+ be.add(N.id), Le.add(N.id), H(), Ce = null, U(w.getState());
767
706
  },
768
- onDisable: (M) => {
769
- Ae = !0, re.add(M.id), be.add(M.id), U(), ya(t, !0), ge = null, R(w.getState());
707
+ onDisable: (N) => {
708
+ Ge = !0, be.add(N.id), Le.add(N.id), H(), Ya(t, !0), Ce = null, U(w.getState());
770
709
  }
771
710
  } : void 0
772
- ), z ? (oe = k.scrollTop, j()) : E && Lo(r) && rn();
711
+ ), B ? (ce = f.scrollTop, j()) : S && jo(r) && kn();
773
712
  };
774
- return pt = Dn((r) => {
775
- De = r, !Pe && Lt(w.getState(), g.value.trim().length > 0 || f.length > 0) && R(w.getState());
776
- }, { backendUrl: t.backendUrl, fetcher: P, loader: t.activeUsersLoader }), w.on("state", (r) => {
777
- const d = lt && !r.isThinking;
778
- lt = r.isThinking, r.appearance ? (Ie = !0, V("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", {
779
718
  appearance: r.appearance
780
- }), Re(r.appearance, "agent.state.appearance")) : Ie && (Ie = !1, V("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", {
781
720
  fallbackAccentColor: t.accentColor,
782
721
  fallbackColorScheme: t.colorScheme,
783
722
  fallbackFontFamily: t.fontFamily
784
- }), Re({}, "agent.state.appearance-cleared")), R(r), F(), d && nt();
785
- }), R(w.getState()), F(), {
723
+ }), Ye({}, "agent.state.appearance-cleared")), U(r), W(), d && ft();
724
+ }), U(w.getState()), W(), {
786
725
  agent: w,
787
726
  updateAppearance: (r) => {
788
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Re(r, "widgetHandle.updateAppearance");
727
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ye(r, "widgetHandle.updateAppearance");
789
728
  },
790
729
  updateBillingStatus: (r) => {
791
730
  const d = r ?? null;
792
- St(t.billingStatus, d, pe) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !W(t.billingStatus) && (pe = null), ze(
731
+ Ht(t.billingStatus, d, we) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !X(t.billingStatus) && (we = null), et(
793
732
  a.querySelector(".pluno-pa-widget__billing-status"),
794
733
  t.billingStatus,
795
- pe
796
- ), F());
734
+ we
735
+ ), W());
797
736
  },
798
737
  updateAuthGate: (r) => {
799
- const d = _e();
800
- 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), at(), R(w.getState()), F(), d && !_e() && w.connect().catch((E) => {
801
- V("web-sdk.widget", "Failed to connect after auth gate cleared", {
802
- message: E instanceof Error ? E.message : String(E)
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)
803
742
  });
804
743
  });
805
744
  },
806
745
  openPanel: () => {
807
- ie(g.value, !1);
746
+ he(g.value, !1);
808
747
  },
809
748
  destroy: () => {
810
- Pe = !0, Je.disconnect(), ot?.disconnect(), window.removeEventListener("resize", et), tt(), N !== null && window.clearTimeout(N), pt(), le?.remove(), w.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();
811
750
  }
812
751
  };
813
- async function gn(r) {
814
- if (!ve) {
815
- ve = r.id, ge = null, R(w.getState());
752
+ async function Rn(r) {
753
+ if (!Ne) {
754
+ Ne = r.id, Ce = null, U(w.getState());
816
755
  try {
817
756
  if (!t.socialPostDraftHandler)
818
757
  throw new Error("Social post drafting is not available here.");
819
758
  const d = await t.socialPostDraftHandler(r);
820
759
  if (!d.linkedinPost || !d.xPost)
821
760
  throw new Error("Pluno did not return a complete social post draft.");
822
- re.add(r.id), be.add(r.id), U(), le?.remove(), le = pa(d, {
761
+ be.add(r.id), Le.add(r.id), H(), fe?.remove(), fe = Ra(d, {
823
762
  socialPostRewardsUrl: t.socialPostRewardsUrl,
824
763
  onClose: () => {
825
- le?.remove(), le = null;
764
+ fe?.remove(), fe = null;
826
765
  }
827
- }), a.appendChild(le);
766
+ }), a.appendChild(fe);
828
767
  } catch (d) {
829
- ge = d instanceof Error ? d.message : "Could not draft social post.";
768
+ Ce = d instanceof Error ? d.message : "Could not draft social post.";
830
769
  } finally {
831
- ve = null, R(w.getState());
770
+ Ne = null, U(w.getState());
832
771
  }
833
772
  }
834
773
  }
835
- function Re(r, d) {
836
- const E = r.accentColor ?? t.accentColor, z = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, Me = r.scribbleStyle ?? t.scribbleStyle;
837
- i = _t(E, Me), xt(a, i, {
838
- accentColor: E,
839
- colorScheme: z,
840
- fontFamily: M,
841
- scribbleStyle: Me
842
- }), V("web-sdk.widget", "Updated widget appearance", {
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", {
843
782
  source: d,
844
783
  inputAppearance: r,
845
- appliedAccentColor: E,
846
- appliedColorScheme: z,
847
- appliedFontFamily: M,
848
- appliedScribbleStyle: Me,
784
+ appliedAccentColor: S,
785
+ appliedColorScheme: B,
786
+ appliedFontFamily: N,
787
+ appliedScribbleStyle: Ke,
849
788
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
850
789
  });
851
790
  }
852
791
  }
853
- function _t(e, t) {
854
- return t ? bn(e) : fn(e);
792
+ function Rt(e, t) {
793
+ return { accentColor: e, scribbleStyle: t };
855
794
  }
856
- function uo(e) {
857
- const t = go(e);
858
- return t === null ? "#fafafa" : ho(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";
859
798
  }
860
- function go(e) {
799
+ function Io(e) {
861
800
  const t = e.trim();
862
801
  return /^#[0-9a-f]{6}$/i.test(t) ? [
863
802
  Number.parseInt(t.slice(1, 3), 16),
@@ -869,26 +808,26 @@ function go(e) {
869
808
  Number.parseInt(t[3] + t[3], 16)
870
809
  ] : null;
871
810
  }
872
- function ho([e, t, n]) {
811
+ function Do([e, t, n]) {
873
812
  const o = (a) => {
874
813
  const i = a / 255;
875
814
  return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
876
815
  };
877
816
  return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
878
817
  }
879
- function xt(e, t, n) {
818
+ function Mt(e, t, n) {
880
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);
881
- const o = n.scribbleStyle ? Bt(n.accentColor) : n.accentColor;
882
- e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", uo(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Kn : n.fontFamily, n.scribbleStyle && mo(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);
883
822
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
884
823
  for (const i of a)
885
- i.replaceWith(Z(Array.from(i.classList).join(" "), t));
824
+ i.replaceWith(re(Array.from(i.classList).join(" "), t));
886
825
  }
887
- function mo(e) {
888
- if (e.getElementById(mt))
826
+ function Ro(e) {
827
+ if (e.getElementById(Tt))
889
828
  return;
890
829
  const t = e.createElement("style");
891
- t.id = mt, t.textContent = `@font-face {
830
+ t.id = Tt, t.textContent = `@font-face {
892
831
  font-family: "Architects Daughter";
893
832
  font-style: normal;
894
833
  font-weight: 400;
@@ -896,7 +835,7 @@ function mo(e) {
896
835
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
897
836
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
898
837
  }
899
- function fo({
838
+ function Mo({
900
839
  root: e,
901
840
  launcher: t,
902
841
  launcherDragHandle: n,
@@ -904,137 +843,137 @@ function fo({
904
843
  setPosition: a,
905
844
  persist: i
906
845
  }) {
907
- let l = null, s = null, c = null, u = !1, p = null;
908
- const m = () => {
909
- l = null, s = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
846
+ let l = null, p = null, c = null, u = !1, s = null;
847
+ const b = () => {
848
+ l = null, p = null, c = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
910
849
  }, x = (h) => {
911
- 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 }, c = o(), u = !1, t.setPointerCapture?.(h.pointerId));
912
- }, A = (h) => {
913
- if (l !== h.pointerId || !s || !c)
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)
914
853
  return;
915
854
  h.preventDefault();
916
- const g = h.clientX - s.x, _ = h.clientY - s.y;
917
- !u && Math.hypot(g, _) < bt || (u = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
918
- }, C = (h) => {
919
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (p = { x: h.clientX, y: h.clientY }, i()), m());
920
- }, B = (h) => {
921
- l === h.pointerId && (h.preventDefault(), m());
922
- }, v = (h) => {
923
- if (!p)
924
- return;
925
- const g = Math.hypot(h.clientX - p.x, h.clientY - p.y) <= bt;
926
- p = null, g && (h.preventDefault(), h.stopPropagation());
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) => {
860
+ l === h.pointerId && (h.preventDefault(), b());
927
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) => {
928
867
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
929
868
  return;
930
- const g = h.shiftKey ? lo : ro, _ = o();
931
- let T = null;
932
- h.key === "ArrowUp" ? T = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? T = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? T = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (T = { x: _.x + g, y: _.y }), T && (h.preventDefault(), h.stopPropagation(), a(T), 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());
933
872
  };
934
- return t.addEventListener("pointerdown", x), t.addEventListener("pointermove", A), t.addEventListener("pointerup", C), t.addEventListener("pointercancel", B), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
935
- t.removeEventListener("pointerdown", x), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", C), t.removeEventListener("pointercancel", B), 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);
936
875
  };
937
876
  }
938
- function qe(e, t = !0) {
939
- const n = K(), 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");
940
879
  return {
941
- width: t && a && o.width > 0 ? o.width : Math.min(Gt, n.width - 36),
942
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Xn : Wt
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
943
882
  };
944
883
  }
945
- function jt() {
946
- const e = K();
884
+ function cn() {
885
+ const e = ne();
947
886
  return {
948
887
  width: Math.min(
949
- de(e.width * Qn, Zn, Jn),
950
- e.width - O * 2
888
+ _e(e.width * xo, wo, _o),
889
+ e.width - z * 2
951
890
  ),
952
891
  height: Math.min(
953
- de(e.height * no, eo, to),
954
- e.height - He - O
892
+ _e(e.height * Co, yo, vo),
893
+ e.height - at - z
955
894
  )
956
895
  };
957
896
  }
958
- function bo(e, t, n) {
897
+ function Bo(e, t, n) {
959
898
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
960
899
  if (Number.isFinite(o) && Number.isFinite(a))
961
900
  return { x: o, y: a };
962
901
  const i = e.getBoundingClientRect();
963
902
  if (i.width > 0 || i.height > 0)
964
903
  return { x: i.left, y: i.top };
965
- const l = K();
904
+ const l = ne();
966
905
  return {
967
906
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
968
907
  y: l.height - 24 - n.height
969
908
  };
970
909
  }
971
- function vt(e, t, n) {
972
- const o = K(), a = O + vo(e);
910
+ function Bt(e, t, n) {
911
+ const o = ne(), a = z + zo(e);
973
912
  return {
974
- x: de(t.x, O, Math.max(O, o.width - n.width - O)),
975
- y: de(t.y, a, Math.max(a, o.height - n.height - O))
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))
976
915
  };
977
916
  }
978
- function wo(e, t) {
979
- const n = K();
917
+ function Oo(e, t) {
918
+ const n = ne();
980
919
  return {
981
920
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
982
921
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
983
922
  };
984
923
  }
985
- function _o(e, t) {
986
- const n = xo(e, t), o = K();
924
+ function Uo(e, t) {
925
+ const n = Fo(e, t), o = ne();
987
926
  return {
988
927
  anchor: n,
989
928
  x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
990
929
  y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
991
930
  };
992
931
  }
993
- function xo(e, t) {
994
- const n = K(), 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";
995
934
  return `${i}-${l}`;
996
935
  }
997
- function vo(e) {
998
- return e.classList.contains("pluno-pa-widget--scribble") ? io : ao;
936
+ function zo(e) {
937
+ return e.classList.contains("pluno-pa-widget--scribble") ? So : Eo;
999
938
  }
1000
- function yt(e, t, n) {
1001
- const o = qe(e), a = jt(), i = {
939
+ function Ot(e, t, n) {
940
+ const o = it(e), a = cn(), i = {
1002
941
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
1003
942
  y: t.y + o.height - a.height
1004
943
  };
1005
- return yo(i);
944
+ return Go(i);
1006
945
  }
1007
- function yo(e) {
1008
- const t = K(), n = jt();
946
+ function Go(e) {
947
+ const t = ne(), n = cn();
1009
948
  return {
1010
- x: de(e.x, O, Math.max(O, t.width - n.width - O)),
1011
- y: de(
949
+ x: _e(e.x, z, Math.max(z, t.width - n.width - z)),
950
+ y: _e(
1012
951
  e.y,
1013
- He,
1014
- Math.max(He, t.height - n.height - O)
952
+ at,
953
+ Math.max(at, t.height - n.height - z)
1015
954
  )
1016
955
  };
1017
956
  }
1018
- function ye(e, t) {
957
+ function Ie(e, t) {
1019
958
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1020
959
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1021
960
  return;
1022
961
  }
1023
962
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1024
963
  }
1025
- function Co(e, t) {
964
+ function Ho(e, t) {
1026
965
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1027
966
  }
1028
- function Eo(e) {
967
+ function Wo(e) {
1029
968
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1030
969
  }
1031
- function K() {
970
+ function ne() {
1032
971
  return {
1033
- width: window.innerWidth || document.documentElement.clientWidth || Gt + O * 2,
1034
- height: window.innerHeight || document.documentElement.clientHeight || Wt + O * 2
972
+ width: window.innerWidth || document.documentElement.clientWidth || rn + z * 2,
973
+ height: window.innerHeight || document.documentElement.clientHeight || ln + z * 2
1035
974
  };
1036
975
  }
1037
- function Oe(e) {
976
+ function Ze(e) {
1038
977
  const t = e.getBoundingClientRect();
1039
978
  return {
1040
979
  x: Math.round(t.x),
@@ -1043,10 +982,10 @@ function Oe(e) {
1043
982
  height: Math.round(t.height)
1044
983
  };
1045
984
  }
1046
- function de(e, t, n) {
985
+ function _e(e, t, n) {
1047
986
  return Math.min(Math.max(e, t), n);
1048
987
  }
1049
- function V(e, t, n) {
988
+ function Y(e, t, n) {
1050
989
  if (typeof window > "u")
1051
990
  return;
1052
991
  const o = window, a = {
@@ -1055,26 +994,26 @@ function V(e, t, n) {
1055
994
  message: t,
1056
995
  details: n
1057
996
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
1058
- 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(qn, { 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 }));
1059
998
  }
1060
- function So(e, t) {
1061
- V("web-sdk.widget.position", e, t);
999
+ function $o(e, t) {
1000
+ Y("web-sdk.widget.position", e, t);
1062
1001
  }
1063
- function Ue(e, t, n) {
1002
+ function Je(e, t, n) {
1064
1003
  const o = t.value.trim();
1065
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 })), []);
1066
1005
  }
1067
- function he(e) {
1006
+ function Ee(e) {
1068
1007
  e.style.height = "0px";
1069
1008
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1070
1009
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1071
1010
  }
1072
- function me(e, t = () => !0) {
1011
+ function Se(e, t = () => !0) {
1073
1012
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1074
1013
  t() && (e.scrollTop = e.scrollHeight);
1075
1014
  });
1076
1015
  }
1077
- function ko(e) {
1016
+ function qo(e) {
1078
1017
  const t = e.messages[e.messages.length - 1];
1079
1018
  return [
1080
1019
  e.messages.length,
@@ -1085,37 +1024,67 @@ function ko(e) {
1085
1024
  e.lastError ?? ""
1086
1025
  ].join(":");
1087
1026
  }
1088
- function Lo(e) {
1027
+ function jo(e) {
1089
1028
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1090
1029
  }
1091
- function Ao(e, t, n, o) {
1092
- e.appendChild(Mo()), e.appendChild(Po(t, n, o)), e.appendChild(Yt("pluno-pa-widget__close", "Close", Bo(16), !0)), e.appendChild(To(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";
1093
1059
  }
1094
- function Po(e, t, n) {
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));
1062
+ }
1063
+ function Zo(e, t, n) {
1095
1064
  const o = document.createElement("form");
1096
1065
  if (o.className = "pluno-pa-widget__launcher", n) {
1097
1066
  const i = document.createElement("button");
1098
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);
1099
1068
  }
1100
- o.appendChild(Kt("pluno-pa-widget__scribble-spirals--launcher", 8)), o.appendChild(Z("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));
1101
1070
  const a = document.createElement("input");
1102
1071
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
1103
1072
  }
1104
- function To(e) {
1073
+ function Jo(e) {
1105
1074
  const t = document.createElement("section");
1106
- t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(Kt("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));
1107
1076
  const n = document.createElement("div");
1108
1077
  n.className = "pluno-pa-widget__timeline-wrap";
1109
1078
  const o = document.createElement("main");
1110
- o.className = "pluno-pa-widget__timeline", o.appendChild(Io(e));
1079
+ o.className = "pluno-pa-widget__timeline", o.appendChild(ta(e));
1111
1080
  const a = document.createElement("div");
1112
1081
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
1113
1082
  const i = document.createElement("div");
1114
1083
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
1115
1084
  const l = document.createElement("button");
1116
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Yt("pluno-pa-widget__new-chat", "New chat", Oo(), !0)), t.appendChild(n), t.appendChild(No()), 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;
1117
1086
  }
1118
- function No() {
1087
+ function Qo() {
1119
1088
  const e = document.createElement("form");
1120
1089
  e.className = "pluno-pa-widget__composer";
1121
1090
  const t = document.createElement("div");
@@ -1127,75 +1096,317 @@ function No() {
1127
1096
  const a = document.createElement("div");
1128
1097
  a.className = "pluno-pa-widget__composer-inner";
1129
1098
  const i = document.createElement("input");
1130
- i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Vn, 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);
1131
1100
  const l = document.createElement("button");
1132
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Uo()), l.appendChild(Fo()), a.appendChild(l);
1133
- const s = document.createElement("textarea");
1134
- s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", a.appendChild(s);
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);
1135
1104
  const c = document.createElement("button");
1136
- c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(Xt()), a.appendChild(c), e.appendChild(a);
1105
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(mn()), a.appendChild(c), e.appendChild(a);
1137
1106
  const u = document.createElement("div");
1138
1107
  u.className = "pluno-pa-widget__composer-meta";
1139
- const p = document.createElement("a");
1140
- 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.", u.appendChild(p);
1141
- const m = document.createElement("span");
1142
- return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(m), e.appendChild(u), e;
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);
1110
+ const b = document.createElement("span");
1111
+ return b.className = "pluno-pa-widget__ai-disclaimer", b.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(b), e.appendChild(u), e;
1112
+ }
1113
+ 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");
1116
+ const t = document.createElement("div");
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;
1143
1126
  }
1144
- function Io(e) {
1127
+ function ta(e) {
1145
1128
  const t = document.createElement("div");
1146
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(Z("pluno-pa-widget__character--empty", e)), t.appendChild(Vt()), t;
1129
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(re("pluno-pa-widget__character--empty", e)), t.appendChild(un()), t;
1147
1130
  }
1148
- function Vt() {
1131
+ function un() {
1149
1132
  const e = document.createElement("div");
1150
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;
1151
1134
  }
1152
- function Do(e, t) {
1135
+ function na(e, t) {
1153
1136
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1154
1137
  const n = document.createElement("span");
1155
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`));
1156
1139
  }
1157
- function Z(e, t) {
1158
- const n = new DOMParser().parseFromString(t, "image/svg+xml"), o = document.importNode(n.documentElement, !0);
1159
- Ro(o, `pluno-pa-character-${wt}`), wt += 1;
1160
- const 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);
1161
1144
  return o.setAttribute(
1162
1145
  "class",
1163
1146
  a.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1164
1147
  ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1165
1148
  }
1166
- function Ro(e, t) {
1167
- const n = /* @__PURE__ */ new Map();
1168
- for (const a of Array.from(e.querySelectorAll("[id]"))) {
1169
- const i = a.id, l = `${t}-${i}`;
1170
- n.set(i, l), a.id = l;
1171
- }
1172
- if (n.size === 0)
1173
- return;
1174
- const o = [e, ...Array.from(e.querySelectorAll("*"))];
1175
- for (const a of o)
1176
- for (const i of Array.from(a.attributes)) {
1177
- let l = i.value;
1178
- for (const [s, c] of n)
1179
- l = l.split(`url(#${s})`).join(`url(#${c})`), l === `#${s}` && (l = `#${c}`);
1180
- l !== i.value && a.setAttribute(i.name, l);
1181
- }
1149
+ function oa(e, t) {
1150
+ const n = Un(e), o = {
1151
+ boltFill: `${t}-boltFill`,
1152
+ boltEdge: `${t}-boltEdge`,
1153
+ boltGlow: `${t}-boltGlow`,
1154
+ eyeWhite: `${t}-eyeWhite`,
1155
+ pupil: `${t}-pupil`,
1156
+ softDropShadow: `${t}-softDropShadow`,
1157
+ innerDepth: `${t}-innerDepth`,
1158
+ eyeShadow: `${t}-eyeShadow`,
1159
+ pupilGloss: `${t}-pupilGloss`,
1160
+ boltClip: `${t}-boltClip`
1161
+ }, a = gn(), i = m(a, "defs"), l = m(i, "linearGradient", {
1162
+ id: o.boltFill,
1163
+ x1: "420",
1164
+ y1: "180",
1165
+ x2: "790",
1166
+ y2: "1040",
1167
+ gradientUnits: "userSpaceOnUse"
1168
+ });
1169
+ D(l, "0", n.top), D(l, "0.36", n.middle), D(l, "0.72", n.bottom), D(l, "1", n.bottom);
1170
+ const p = m(i, "linearGradient", {
1171
+ id: o.boltEdge,
1172
+ x1: "470",
1173
+ y1: "145",
1174
+ x2: "900",
1175
+ y2: "980",
1176
+ gradientUnits: "userSpaceOnUse"
1177
+ });
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", {
1180
+ id: o.boltGlow,
1181
+ cx: "50%",
1182
+ cy: "22%",
1183
+ r: "82%"
1184
+ });
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", {
1187
+ id: o.eyeWhite,
1188
+ cx: "35%",
1189
+ cy: "25%",
1190
+ r: "70%"
1191
+ });
1192
+ D(u, "0", "#ffffff"), D(u, "0.72", "#ffffff"), D(u, "1", "#e5e5e5");
1193
+ const s = m(i, "radialGradient", {
1194
+ id: o.pupil,
1195
+ cx: "42%",
1196
+ cy: "38%",
1197
+ r: "65%"
1198
+ });
1199
+ D(s, "0", "#2a1f10"), D(s, "0.52", "#080604"), D(s, "1", "#000000");
1200
+ const b = m(i, "filter", {
1201
+ id: o.softDropShadow,
1202
+ x: "-18%",
1203
+ y: "-12%",
1204
+ width: "136%",
1205
+ height: "136%",
1206
+ "color-interpolation-filters": "sRGB"
1207
+ });
1208
+ m(b, "feDropShadow", {
1209
+ dx: "0",
1210
+ dy: "12",
1211
+ stdDeviation: "18",
1212
+ "flood-color": n.shadow,
1213
+ "flood-opacity": "0.24"
1214
+ });
1215
+ const x = m(i, "filter", {
1216
+ id: o.innerDepth,
1217
+ x: "-8%",
1218
+ y: "-8%",
1219
+ width: "116%",
1220
+ height: "116%",
1221
+ "color-interpolation-filters": "sRGB"
1222
+ });
1223
+ m(x, "feGaussianBlur", { in: "SourceAlpha", stdDeviation: "8", result: "blur" }), m(x, "feOffset", { dx: "-7", dy: "-9", result: "topLeft" }), m(x, "feComposite", {
1224
+ in: "topLeft",
1225
+ in2: "SourceAlpha",
1226
+ operator: "arithmetic",
1227
+ k2: "-1",
1228
+ k3: "1",
1229
+ result: "innerShadow"
1230
+ }), m(x, "feColorMatrix", {
1231
+ in: "innerShadow",
1232
+ type: "matrix",
1233
+ values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1234
+ result: "innerLight"
1235
+ }), m(x, "feBlend", { in: "SourceGraphic", in2: "innerLight", mode: "screen" });
1236
+ const P = m(i, "filter", {
1237
+ id: o.eyeShadow,
1238
+ x: "-24%",
1239
+ y: "-20%",
1240
+ width: "148%",
1241
+ height: "148%",
1242
+ "color-interpolation-filters": "sRGB"
1243
+ });
1244
+ m(P, "feDropShadow", {
1245
+ dx: "0",
1246
+ dy: "8",
1247
+ stdDeviation: "5",
1248
+ "flood-color": n.shadow,
1249
+ "flood-opacity": "0.3"
1250
+ });
1251
+ const k = m(i, "filter", {
1252
+ id: o.pupilGloss,
1253
+ x: "-15%",
1254
+ y: "-15%",
1255
+ width: "130%",
1256
+ height: "130%",
1257
+ "color-interpolation-filters": "sRGB"
1258
+ });
1259
+ m(k, "feDropShadow", {
1260
+ dx: "0",
1261
+ dy: "3",
1262
+ stdDeviation: "3",
1263
+ "flood-color": "#000000",
1264
+ "flood-opacity": "0.22"
1265
+ });
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),
1278
+ opacity: "0.74"
1279
+ });
1280
+ const h = m(y, "g", {
1281
+ "clip-path": $(o.boltClip),
1282
+ opacity: "0.42"
1283
+ });
1284
+ m(h, "path", {
1285
+ d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
1286
+ fill: "none",
1287
+ stroke: n.highlight,
1288
+ "stroke-width": "22",
1289
+ "stroke-linecap": "round",
1290
+ opacity: "0.65"
1291
+ }), m(h, "path", {
1292
+ d: "M556 685 L501 994",
1293
+ fill: "none",
1294
+ stroke: n.highlight,
1295
+ "stroke-width": "20",
1296
+ "stroke-linecap": "round",
1297
+ opacity: "0.55"
1298
+ }), m(h, "path", {
1299
+ d: "M858 160 C882 166 893 181 883 204",
1300
+ fill: "none",
1301
+ stroke: n.inner,
1302
+ "stroke-width": "18",
1303
+ "stroke-linecap": "round",
1304
+ opacity: "0.48"
1305
+ });
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;
1308
+ }
1309
+ function aa(e, t) {
1310
+ const n = Qt(e), o = {
1311
+ clip: `${t}-scribbleBoltClip`,
1312
+ wobble: `${t}-scribbleBoltWobble`
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", {
1316
+ id: o.wobble,
1317
+ x: "-10%",
1318
+ y: "-10%",
1319
+ width: "120%",
1320
+ height: "120%",
1321
+ "color-interpolation-filters": "sRGB"
1322
+ });
1323
+ m(p, "feTurbulence", {
1324
+ type: "fractalNoise",
1325
+ baseFrequency: "0.011",
1326
+ numOctaves: "3",
1327
+ seed: "7",
1328
+ result: "noise"
1329
+ }), m(p, "feDisplacementMap", {
1330
+ in: "SourceGraphic",
1331
+ in2: "noise",
1332
+ scale: "16",
1333
+ xChannelSelector: "R",
1334
+ yChannelSelector: "G"
1335
+ });
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(),
1339
+ fill: "none",
1340
+ stroke: n,
1341
+ "stroke-width": "56",
1342
+ "stroke-linecap": "round",
1343
+ "stroke-linejoin": "round",
1344
+ opacity: "0.9",
1345
+ transform: "rotate(-14 627 600)"
1346
+ }), m(c, "path", {
1347
+ d: Be,
1348
+ fill: "none",
1349
+ stroke: Oe,
1350
+ "stroke-width": "18",
1351
+ "stroke-linejoin": "round"
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;
1353
+ }
1354
+ function gn() {
1355
+ return v("svg", {
1356
+ xmlns: pn,
1357
+ viewBox: "0 0 1254 1254"
1358
+ });
1182
1359
  }
1183
- function Yt(e, t, n, o) {
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", {
1363
+ cx: a,
1364
+ cy: i,
1365
+ rx: "49",
1366
+ ry: "57",
1367
+ fill: $(c.pupil),
1368
+ filter: $(c.pupilGloss)
1369
+ }), m(u, "circle", { cx: l, cy: p, r: "18", fill: "#ffffff" });
1370
+ }
1371
+ function Ft(e, t, n, o, a, i, l, p) {
1372
+ const c = m(e, "g", { transform: t });
1373
+ m(c, "ellipse", {
1374
+ cx: n,
1375
+ cy: o,
1376
+ rx: "73",
1377
+ ry: "80",
1378
+ fill: "#ffffff",
1379
+ stroke: Oe,
1380
+ "stroke-width": "13"
1381
+ }), m(c, "ellipse", { cx: a, cy: i, rx: "45", ry: "53", fill: Oe }), m(c, "circle", { cx: l, cy: p, r: "16", fill: "#ffffff" });
1382
+ }
1383
+ function m(e, t, n = {}) {
1384
+ const o = v(t, n);
1385
+ return e.appendChild(o), o;
1386
+ }
1387
+ function D(e, t, n, o) {
1388
+ const a = { offset: t, "stop-color": n };
1389
+ o !== void 0 && (a["stop-opacity"] = o), m(e, "stop", a);
1390
+ }
1391
+ function $(e) {
1392
+ return `url(#${e})`;
1393
+ }
1394
+ function Fe(e, t, n, o) {
1184
1395
  const a = document.createElement("button");
1185
1396
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1186
1397
  }
1187
- function Mo() {
1188
- const e = S("svg", {
1398
+ function ia() {
1399
+ const e = v("svg", {
1189
1400
  class: "pluno-pa-widget__scribble-defs",
1190
1401
  "aria-hidden": "true",
1191
1402
  focusable: "false",
1192
1403
  width: "0",
1193
1404
  height: "0"
1194
- }), t = S("defs");
1195
- return t.appendChild(Fe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Fe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Fe("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;
1196
1407
  }
1197
- function Kt(e, t) {
1198
- const n = S("svg", {
1408
+ function hn(e, t) {
1409
+ const n = v("svg", {
1199
1410
  class: `pluno-pa-widget__scribble-spirals ${e}`,
1200
1411
  viewBox: `0 0 ${t * 26} 36`,
1201
1412
  preserveAspectRatio: "none",
@@ -1203,9 +1414,9 @@ function Kt(e, t) {
1203
1414
  focusable: "false"
1204
1415
  });
1205
1416
  for (let o = 0; o < t; o += 1) {
1206
- const a = ft[o % ft.length], i = S("g", { transform: `translate(${o * 26} 0)` });
1417
+ const a = Nt[o % Nt.length], i = v("g", { transform: `translate(${o * 26} 0)` });
1207
1418
  i.appendChild(
1208
- S("ellipse", {
1419
+ v("ellipse", {
1209
1420
  cx: a.ellipseCx,
1210
1421
  cy: a.ellipseCy,
1211
1422
  rx: a.ellipseRx,
@@ -1216,7 +1427,7 @@ function Kt(e, t) {
1216
1427
  opacity: "0.8"
1217
1428
  })
1218
1429
  ), i.appendChild(
1219
- S("path", {
1430
+ v("path", {
1220
1431
  d: a.path,
1221
1432
  fill: "none",
1222
1433
  stroke: "#2c2a1e",
@@ -1227,10 +1438,10 @@ function Kt(e, t) {
1227
1438
  }
1228
1439
  return n;
1229
1440
  }
1230
- function Fe(e, t, n) {
1231
- 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%" });
1232
1443
  return o.appendChild(
1233
- S("feTurbulence", {
1444
+ v("feTurbulence", {
1234
1445
  type: "fractalNoise",
1235
1446
  baseFrequency: "0.012 0.028",
1236
1447
  numOctaves: "3",
@@ -1238,7 +1449,7 @@ function Fe(e, t, n) {
1238
1449
  result: "stroke-noise"
1239
1450
  })
1240
1451
  ), o.appendChild(
1241
- S("feDisplacementMap", {
1452
+ v("feDisplacementMap", {
1242
1453
  in: "SourceGraphic",
1243
1454
  in2: "stroke-noise",
1244
1455
  scale: "3.5",
@@ -1247,7 +1458,7 @@ function Fe(e, t, n) {
1247
1458
  result: "warped"
1248
1459
  })
1249
1460
  ), o.appendChild(
1250
- S("feTurbulence", {
1461
+ v("feTurbulence", {
1251
1462
  type: "fractalNoise",
1252
1463
  baseFrequency: "0.7",
1253
1464
  numOctaves: "1",
@@ -1255,7 +1466,7 @@ function Fe(e, t, n) {
1255
1466
  result: "ink-noise"
1256
1467
  })
1257
1468
  ), o.appendChild(
1258
- S("feDisplacementMap", {
1469
+ v("feDisplacementMap", {
1259
1470
  in: "warped",
1260
1471
  in2: "ink-noise",
1261
1472
  scale: "0.9",
@@ -1264,30 +1475,38 @@ function Fe(e, t, n) {
1264
1475
  })
1265
1476
  ), o;
1266
1477
  }
1267
- function Bo(e) {
1268
- const t = J("0 0 24 24", e, e, "none", "currentColor", "2.25");
1269
- 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;
1270
1481
  }
1271
- function Oo() {
1272
- const e = J("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1273
- 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;
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;
1274
1485
  }
1275
- function Xt() {
1276
- const e = J("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1277
- 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;
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;
1489
+ }
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;
1278
1493
  }
1279
- function Uo() {
1280
- const e = J("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");
1281
1500
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1282
- S("path", {
1501
+ v("path", {
1283
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"
1284
1503
  })
1285
1504
  ), e;
1286
1505
  }
1287
- function Fo() {
1288
- const e = J("0 0 24 24", 19, 19, "none", "currentColor");
1506
+ function ca() {
1507
+ const e = Z("0 0 24 24", 19, 19, "none", "currentColor");
1289
1508
  return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1290
- S("path", {
1509
+ v("path", {
1291
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",
1292
1511
  stroke: "currentColor",
1293
1512
  "stroke-width": "2",
@@ -1296,19 +1515,19 @@ function Fo() {
1296
1515
  })
1297
1516
  ), e;
1298
1517
  }
1299
- function zo() {
1300
- const e = J("0 0 24 24", 18, 18, "currentColor");
1301
- 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;
1302
1521
  }
1303
- function $o() {
1304
- const e = J("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1305
- 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;
1306
1525
  }
1307
- function Go() {
1308
- const e = J("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1309
- 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;
1310
1529
  }
1311
- function J(e, t, n, o, a, i) {
1530
+ function Z(e, t, n, o, a, i) {
1312
1531
  const l = {
1313
1532
  viewBox: e,
1314
1533
  width: String(t),
@@ -1316,41 +1535,41 @@ function J(e, t, n, o, a, i) {
1316
1535
  fill: o,
1317
1536
  "aria-hidden": "true"
1318
1537
  };
1319
- 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);
1320
1539
  }
1321
- function S(e, t = {}) {
1322
- const n = document.createElementNS(oo, e);
1540
+ function v(e, t = {}) {
1541
+ const n = document.createElementNS(pn, e);
1323
1542
  for (const [o, a] of Object.entries(t))
1324
1543
  n.setAttribute(o, a);
1325
1544
  return n;
1326
1545
  }
1327
- function Ct(e) {
1546
+ function zt(e) {
1328
1547
  for (const t of ["keydown", "keypress", "keyup"])
1329
1548
  e.addEventListener(t, (n) => {
1330
1549
  n.stopPropagation();
1331
1550
  });
1332
1551
  }
1333
- function Wo(e, t, n) {
1552
+ function ma(e, t, n) {
1334
1553
  e.replaceChildren(), e.hidden = t.length === 0;
1335
1554
  for (const [o, a] of t.entries()) {
1336
1555
  const i = document.createElement("div");
1337
- i.className = "pluno-pa-widget__attachment", i.appendChild(Ho(a));
1556
+ i.className = "pluno-pa-widget__attachment", i.appendChild(ba(a));
1338
1557
  const l = document.createElement("span");
1339
1558
  l.textContent = a.name, i.appendChild(l);
1340
- const s = document.createElement("button");
1341
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild($o()), 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);
1342
1561
  }
1343
1562
  }
1344
- function Ho(e) {
1345
- if (Zt(e)) {
1563
+ function ba(e) {
1564
+ if (bn(e)) {
1346
1565
  const n = document.createElement("img");
1347
1566
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1348
1567
  }
1349
1568
  const t = document.createElement("span");
1350
1569
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1351
1570
  }
1352
- function qo(e) {
1353
- if (Zt(e)) {
1571
+ function fa(e) {
1572
+ if (bn(e)) {
1354
1573
  const a = document.createElement("img");
1355
1574
  return a.src = e.dataUrl, a.alt = e.name, a;
1356
1575
  }
@@ -1361,51 +1580,51 @@ function qo(e) {
1361
1580
  const o = document.createElement("strong");
1362
1581
  return o.textContent = e.name, t.append(n, o), t;
1363
1582
  }
1364
- function Zt(e) {
1583
+ function bn(e) {
1365
1584
  return e.mimeType.startsWith("image/");
1366
1585
  }
1367
- function jo(e) {
1586
+ function wa(e) {
1368
1587
  return e === "application/pdf" ? "document.pdf" : "image";
1369
1588
  }
1370
- async function Vo(e) {
1589
+ async function _a(e) {
1371
1590
  if (!e)
1372
1591
  return [];
1373
1592
  const t = Array.from(e);
1374
- if (t.length > ke)
1375
- throw new Error(`Attach up to ${ke} files per message.`);
1593
+ if (t.length > Ue)
1594
+ throw new Error(`Attach up to ${Ue} files per message.`);
1376
1595
  return Promise.all(
1377
1596
  t.map(async (n) => {
1378
- const o = Yo(n);
1597
+ const o = xa(n);
1379
1598
  if (!o)
1380
1599
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1381
- if (n.size > jn)
1600
+ if (n.size > uo)
1382
1601
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1383
1602
  if (o === "image/gif") {
1384
- const a = new Uint8Array(await oa(n));
1385
- if (Xo(a))
1603
+ const a = new Uint8Array(await Aa(n));
1604
+ if (va(a))
1386
1605
  throw new Error("Pluno supports non-animated GIF images.");
1387
1606
  }
1388
1607
  return {
1389
- name: n.name || jo(o),
1608
+ name: n.name || wa(o),
1390
1609
  mimeType: o,
1391
1610
  sizeBytes: n.size,
1392
- dataUrl: Ko(await aa(n), o)
1611
+ dataUrl: ya(await Ta(n), o)
1393
1612
  };
1394
1613
  })
1395
1614
  );
1396
1615
  }
1397
- function Yo(e) {
1398
- if ($t.has(e.type))
1616
+ function xa(e) {
1617
+ if (an.has(e.type))
1399
1618
  return e.type;
1400
1619
  const t = e.name.toLowerCase();
1401
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;
1402
1621
  }
1403
- function Ko(e, t) {
1622
+ function ya(e, t) {
1404
1623
  const n = `data:${t};base64,`;
1405
1624
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1406
1625
  }
1407
- function Xo(e) {
1408
- if (e.length < 14 || !Zo(e))
1626
+ function va(e) {
1627
+ if (e.length < 14 || !Ca(e))
1409
1628
  return !1;
1410
1629
  const t = e[10];
1411
1630
  let n = 13;
@@ -1416,7 +1635,7 @@ function Xo(e) {
1416
1635
  if (n += 1, a === 59)
1417
1636
  return !1;
1418
1637
  if (a === 33) {
1419
- n += 1, n = Et(e, n);
1638
+ n += 1, n = Gt(e, n);
1420
1639
  continue;
1421
1640
  }
1422
1641
  if (a !== 44)
@@ -1428,14 +1647,14 @@ function Xo(e) {
1428
1647
  const i = e[n + 8];
1429
1648
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1430
1649
  return !1;
1431
- n += 1, n = Et(e, n);
1650
+ n += 1, n = Gt(e, n);
1432
1651
  }
1433
1652
  return !1;
1434
1653
  }
1435
- function Zo(e) {
1654
+ function Ca(e) {
1436
1655
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1437
1656
  }
1438
- function Et(e, t) {
1657
+ function Gt(e, t) {
1439
1658
  for (; t < e.length; ) {
1440
1659
  const n = e[t];
1441
1660
  if (t += 1, n === 0)
@@ -1444,63 +1663,63 @@ function Et(e, t) {
1444
1663
  }
1445
1664
  return t;
1446
1665
  }
1447
- function Ce(e) {
1666
+ function De(e) {
1448
1667
  return !!(e && Array.from(e.types).includes("Files"));
1449
1668
  }
1450
- function ze(e, t, n = null) {
1451
- if (!e || !je(t, n)) {
1669
+ function et(e, t, n = null) {
1670
+ if (!e || !rt(t, n)) {
1452
1671
  e && (e.hidden = !0, e.replaceChildren());
1453
1672
  return;
1454
1673
  }
1455
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", W(t) || Ke(n) ? e.appendChild(Jo(t, n)) : Jt(t) && e.appendChild(Qo(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));
1456
1675
  }
1457
- function Jo(e, t) {
1676
+ function Ea(e, t) {
1458
1677
  const n = document.createElement("div");
1459
1678
  n.className = "pluno-pa-widget__billing-action-card";
1460
1679
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1461
1680
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1462
1681
  const i = document.createElement("span");
1463
- 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(Qt(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;
1464
1683
  }
1465
- function Qo(e) {
1684
+ function Sa(e) {
1466
1685
  const t = document.createElement("div");
1467
1686
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1468
1687
  const n = document.createElement("strong");
1469
1688
  n.textContent = "Credits running low", t.appendChild(n);
1470
1689
  const o = document.createElement("span");
1471
- return o.textContent = ta(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Qt(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;
1472
1691
  }
1473
- function je(e, t) {
1474
- return e !== null && (W(e) || Jt(e) || Ke(t));
1692
+ function rt(e, t) {
1693
+ return e !== null && (X(e) || fn(e) || st(t));
1475
1694
  }
1476
- function St(e, t, n) {
1477
- return je(t, n) || ea(t) ? !0 : !je(e, n);
1695
+ function Ht(e, t, n) {
1696
+ return rt(t, n) || ka(t) ? !0 : !rt(e, n);
1478
1697
  }
1479
- function ea(e) {
1480
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || W(e));
1698
+ function ka(e) {
1699
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || X(e));
1481
1700
  }
1482
- function W(e) {
1701
+ function X(e) {
1483
1702
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1484
1703
  }
1485
- function Ke(e) {
1704
+ function st(e) {
1486
1705
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1487
1706
  }
1488
- function Jt(e) {
1489
- return !W(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;
1490
1709
  }
1491
- function ta(e) {
1492
- return e.creditsRemaining === null ? null : `${na(e.creditsRemaining)} credits left`;
1710
+ function La(e) {
1711
+ return e.creditsRemaining === null ? null : `${Pa(e.creditsRemaining)} credits left`;
1493
1712
  }
1494
- function na(e) {
1713
+ function Pa(e) {
1495
1714
  return new Intl.NumberFormat("en-US", {
1496
1715
  maximumFractionDigits: 0
1497
1716
  }).format(Math.ceil(e));
1498
1717
  }
1499
- function Qt(e, t, n) {
1718
+ function wn(e, t, n) {
1500
1719
  const o = document.createElement("div");
1501
- return o.className = n, o.appendChild(kt(t, e.pricingUrl)), o.appendChild(kt("Earn credits", e.earnCreditsUrl)), o;
1720
+ return o.className = n, o.appendChild(Wt(t, e.pricingUrl)), o.appendChild(Wt("Earn credits", e.earnCreditsUrl)), o;
1502
1721
  }
1503
- function kt(e, t) {
1722
+ function Wt(e, t) {
1504
1723
  const n = document.createElement("button");
1505
1724
  if (n.type = "button", e === "Earn credits") {
1506
1725
  const o = document.createElement("span");
@@ -1511,7 +1730,7 @@ function kt(e, t) {
1511
1730
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1512
1731
  }), n;
1513
1732
  }
1514
- function oa(e) {
1733
+ function Aa(e) {
1515
1734
  return new Promise((t, n) => {
1516
1735
  const o = new FileReader();
1517
1736
  o.addEventListener("load", () => {
@@ -1525,7 +1744,7 @@ function oa(e) {
1525
1744
  }), o.readAsArrayBuffer(e);
1526
1745
  });
1527
1746
  }
1528
- function aa(e) {
1747
+ function Ta(e) {
1529
1748
  return new Promise((t, n) => {
1530
1749
  const o = new FileReader();
1531
1750
  o.addEventListener("load", () => {
@@ -1539,167 +1758,170 @@ function aa(e) {
1539
1758
  }), o.readAsDataURL(e);
1540
1759
  });
1541
1760
  }
1542
- function Lt(e, t) {
1543
- return e.messages.filter((o) => !en(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1761
+ function $t(e, t) {
1762
+ return e.messages.filter((o) => !_n(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1544
1763
  }
1545
- function ia(e, t, n, o, a, i, l, s, c, u, p, m, x, A, C) {
1546
- const B = [...i.messages], v = B.filter((b) => !en(b)), y = e.scrollTop;
1547
- e.replaceChildren(), nn(n, i.isThinking), a.hidden = !s, s && l !== null && Do(a, l);
1548
- const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1549
- if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1550
- const b = document.createElement("div");
1551
- b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1552
- const f = document.createElement("div");
1553
- f.className = "pluno-pa-widget__empty-hero";
1554
- const N = Z("pluno-pa-widget__character--empty", x());
1555
- f.appendChild(N), b.appendChild(f), b.appendChild(Vt());
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";
1556
1771
  const L = document.createElement("div");
1557
- if (L.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && L.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1558
- for (const I of i.starterPrompts) {
1559
- const P = document.createElement("button");
1560
- P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${I}"`, P.addEventListener("click", () => {
1561
- A(I);
1562
- }), L.appendChild(P);
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);
1563
1782
  }
1564
- else
1565
- for (let I = 0; I < Yn; I += 1) {
1566
- const P = document.createElement("button");
1567
- P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.innerHTML = "&nbsp;", L.appendChild(P);
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);
1568
1790
  }
1569
- b.appendChild(L), e.appendChild(b), e.appendChild(t);
1791
+ _.appendChild(M), e.appendChild(_), e.appendChild(t);
1570
1792
  return;
1571
1793
  }
1572
- let g = null, _ = null, T = [];
1573
- const Q = () => {
1574
- if (T.length === 0)
1794
+ let g = null, E = null, I = [];
1795
+ const le = () => {
1796
+ if (I.length === 0)
1575
1797
  return !1;
1576
- const b = ga(T, p, m, x());
1577
- return e.appendChild(b), g = null, _ = b, T = [], !0;
1798
+ const _ = Fa(I, s, b, x());
1799
+ return e.appendChild(_), g = null, E = _, I = [], !0;
1578
1800
  };
1579
- for (let b = 0; b < v.length; b += 1) {
1580
- const f = v[b];
1581
- if (f.role === "tool") {
1582
- T.push(f);
1801
+ for (let _ = 0; _ < y.length; _ += 1) {
1802
+ const L = y[_];
1803
+ if (L.role === "tool") {
1804
+ I.push(L);
1583
1805
  continue;
1584
1806
  }
1585
- if (f.role === "system")
1807
+ if (L.role === "system")
1586
1808
  continue;
1587
- const N = Q(), L = Tt(f.content);
1588
- if (f.role === "assistant" && !N) {
1589
- const w = Ve(x());
1590
- e.appendChild(w), g = null, _ = w;
1591
- }
1592
- const I = document.createElement("div");
1593
- I.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Nt(I, L) : I.textContent = L, f.role === "user" && f.attachments?.length && I.appendChild(ra(f.attachments));
1594
- const P = document.createElement("div");
1595
- P.className = "pluno-pa-widget__message-actions", P.appendChild(Pt(L)), I.appendChild(P), e.appendChild(I), g = I, _ = null;
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;
1813
+ }
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;
1596
1818
  }
1597
- const ce = Q();
1819
+ const xe = le();
1598
1820
  if (i.assistantDraft) {
1599
- if (!ce) {
1600
- const L = Ve(x());
1601
- e.appendChild(L), g = null, _ = L;
1602
- }
1603
- const b = Tt(i.assistantDraft), f = document.createElement("div");
1604
- f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Nt(f, b);
1605
- const N = document.createElement("div");
1606
- N.className = "pluno-pa-widget__message-actions", N.appendChild(Pt(b)), f.appendChild(N), e.appendChild(f), g = f, _ = 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;
1607
1829
  }
1608
1830
  if (i.isThinking && !i.assistantDraft)
1609
- if (ce) {
1610
- const b = tn();
1611
- e.appendChild(b), g = null, _ = b;
1831
+ if (xe) {
1832
+ const _ = xn();
1833
+ e.appendChild(_), g = null, E = _;
1612
1834
  } else {
1613
- const b = ha(x());
1614
- e.appendChild(b), g = null, _ = b;
1835
+ const _ = za(x());
1836
+ e.appendChild(_), g = null, E = _;
1615
1837
  }
1616
1838
  if (i.lastError) {
1617
- const b = document.createElement("div");
1618
- b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
1839
+ const _ = document.createElement("div");
1840
+ _.className = "pluno-pa-widget__error", _.textContent = i.lastError, e.appendChild(_), g = _, E = null;
1619
1841
  }
1620
- const k = C && !i.isThinking ? Cn(B) : null;
1621
- if (C && k && !C.dismissedCandidateIds.has(k.id)) {
1622
- const b = la(k, {
1623
- isDrafting: C.draftingCandidateId === k.id,
1624
- error: C.error,
1625
- characterIconSvg: C.characterIconSvg,
1626
- onDraft: C.onDraft,
1627
- onDismiss: C.onDismiss,
1628
- onDisable: C.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
1629
1851
  });
1630
- e.appendChild(b), C.onSeen(k), g = null, _ = b;
1852
+ e.appendChild(_), k.onSeen(R), g = null, E = _;
1631
1853
  }
1632
- g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? me(e, u) : e.scrollTop = y;
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;
1633
1855
  }
1634
- function At(e, t, n, o, a, i, l, s) {
1635
- e.replaceChildren(), nn(t, !1), t.disabled = !0, n.hidden = !0;
1856
+ function qt(e, t, n, o, a, i, l, p) {
1857
+ e.replaceChildren(), yn(t, !1), t.disabled = !0, n.hidden = !0;
1636
1858
  const c = document.createElement("div");
1637
1859
  c.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1638
- const u = Z("pluno-pa-widget__character--empty", o());
1860
+ const u = re("pluno-pa-widget__character--empty", o());
1639
1861
  c.appendChild(u);
1640
- const p = document.createElement("div");
1641
- if (p.className = "pluno-pa-widget__empty", p.textContent = a, c.appendChild(p), l) {
1642
- const m = document.createElement("a");
1643
- m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = i, c.appendChild(m);
1862
+ const s = document.createElement("div");
1863
+ if (s.className = "pluno-pa-widget__empty", s.textContent = a, c.appendChild(s), l) {
1864
+ const b = document.createElement("a");
1865
+ b.className = "pluno-pa-widget__login", b.href = l, b.target = "_blank", b.rel = "noopener noreferrer", b.textContent = i, c.appendChild(b);
1644
1866
  } else {
1645
- const m = document.createElement("button");
1646
- m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = i, m.addEventListener("click", () => s?.()), c.appendChild(m);
1867
+ const b = document.createElement("button");
1868
+ b.type = "button", b.className = "pluno-pa-widget__login", b.textContent = i, b.addEventListener("click", () => p?.()), c.appendChild(b);
1647
1869
  }
1648
1870
  e.appendChild(c);
1649
1871
  }
1650
- function ra(e) {
1872
+ function Ia(e) {
1651
1873
  const t = document.createElement("div");
1652
1874
  t.className = "pluno-pa-widget__message-attachments";
1653
1875
  for (const n of e)
1654
- t.appendChild(qo(n));
1876
+ t.appendChild(fa(n));
1655
1877
  return t;
1656
1878
  }
1657
- function Pt(e) {
1879
+ function jt(e) {
1658
1880
  const t = document.createElement("button");
1659
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Go()), 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) => {
1660
1882
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1661
1883
  }), t;
1662
1884
  }
1663
- function la(e, t) {
1885
+ function Da(e, t) {
1664
1886
  const n = document.createElement("article");
1665
1887
  n.className = "pluno-pa-widget__share-prompt";
1666
1888
  const o = document.createElement("div");
1667
- o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(Z("pluno-pa-widget__share-prompt-icon", t.characterIconSvg));
1889
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(re("pluno-pa-widget__share-prompt-icon", t.characterIconOptions));
1668
1890
  const a = document.createElement("div");
1669
1891
  a.className = "pluno-pa-widget__share-prompt-copy";
1670
1892
  const i = document.createElement("strong");
1671
1893
  i.textContent = "Share this win?", a.appendChild(i);
1672
1894
  const l = document.createElement("span");
1673
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) {
1674
- const p = document.createElement("span");
1675
- 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);
1676
1898
  }
1677
1899
  o.appendChild(a);
1678
- const s = document.createElement("div");
1679
- s.className = "pluno-pa-widget__share-prompt-actions";
1900
+ const p = document.createElement("div");
1901
+ p.className = "pluno-pa-widget__share-prompt-actions";
1680
1902
  const c = document.createElement("div");
1681
1903
  c.className = "pluno-pa-widget__share-prompt-primary-actions";
1682
1904
  const u = document.createElement("button");
1683
1905
  if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
1684
1906
  t.onDraft(e);
1685
- }), t.isDrafting ? (u.appendChild(Ye()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", c.appendChild(u), t.isDrafting)
1686
- s.appendChild(c);
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);
1687
1909
  else {
1688
- const p = document.createElement("button");
1689
- 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", () => {
1690
1912
  t.onDismiss(e);
1691
- }), c.appendChild(p), s.appendChild(c);
1692
- const m = document.createElement("button");
1693
- m.type = "button", m.className = "pluno-pa-widget__share-prompt-disable", m.textContent = "Don't ask again", m.addEventListener("click", () => {
1913
+ }), c.appendChild(s), p.appendChild(c);
1914
+ const b = document.createElement("button");
1915
+ b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
1694
1916
  t.onDisable(e);
1695
- }), s.appendChild(m);
1917
+ }), p.appendChild(b);
1696
1918
  }
1697
- return o.appendChild(s), n.appendChild(o), n;
1919
+ return o.appendChild(p), n.appendChild(o), n;
1698
1920
  }
1699
- function pa(e, t) {
1921
+ function Ra(e, t) {
1700
1922
  const n = document.createElement("div");
1701
- n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1702
- v.target === n && t.onClose();
1923
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (y) => {
1924
+ y.target === n && t.onClose();
1703
1925
  });
1704
1926
  const o = document.createElement("section");
1705
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");
@@ -1707,57 +1929,57 @@ function pa(e, t) {
1707
1929
  i.textContent = "Share this win", a.appendChild(i);
1708
1930
  const l = document.createElement("button");
1709
1931
  l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), a.appendChild(l), o.appendChild(a);
1710
- const s = document.createElement("p");
1711
- s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
1932
+ const p = document.createElement("p");
1933
+ p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
1712
1934
  const c = document.createElement("div");
1713
1935
  c.className = "pluno-pa-widget__share-dialog-step";
1714
1936
  const u = document.createElement("div");
1715
1937
  u.className = "pluno-pa-widget__share-dialog-step-header";
1716
- const p = document.createElement("strong");
1717
- p.textContent = "1) Copy Screenshot", u.appendChild(p);
1718
- const m = sa("Copy Screenshot", async () => {
1938
+ const s = document.createElement("strong");
1939
+ s.textContent = "1) Copy Screenshot", u.appendChild(s);
1940
+ const b = Ma("Copy Screenshot", async () => {
1719
1941
  try {
1720
- return await En(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
1942
+ return await Wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1721
1943
  } catch {
1722
- return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
1944
+ return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1723
1945
  }
1724
1946
  });
1725
- if (u.appendChild(m), c.appendChild(u), e.screenshotDataUrl) {
1726
- const v = document.createElement("div");
1727
- v.className = "pluno-pa-widget__share-dialog-screenshot";
1728
- const y = document.createElement("img");
1729
- y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.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);
1730
1952
  }
1731
- o.appendChild(c), o.appendChild(s);
1953
+ o.appendChild(c), o.appendChild(p);
1732
1954
  const x = document.createElement("div");
1733
1955
  x.className = "pluno-pa-widget__share-dialog-step";
1734
- const A = document.createElement("strong");
1735
- A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", x.appendChild(A);
1736
- const C = document.createElement("p");
1737
- C.className = "pluno-pa-widget__share-dialog-hint", C.textContent = "Post draft opens prefilled on supported platforms.", x.appendChild(C);
1738
- const B = document.createElement("footer");
1739
- B.className = "pluno-pa-widget__share-dialog-platforms";
1740
- for (const v of da(e)) {
1741
- const y = document.createElement("a");
1742
- y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ca(v.id)), B.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);
1743
1965
  }
1744
- if (x.appendChild(B), o.appendChild(x), t.socialPostRewardsUrl) {
1745
- const v = document.createElement("div");
1746
- v.className = "pluno-pa-widget__share-dialog-step";
1747
- const y = document.createElement("strong");
1748
- 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);
1749
1971
  const h = document.createElement("a");
1750
- 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()), 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);
1751
1973
  }
1752
1974
  return n.appendChild(o), n;
1753
1975
  }
1754
- function sa(e, t) {
1976
+ function Ma(e, t) {
1755
1977
  const n = document.createElement("button");
1756
1978
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1757
1979
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1758
1980
  }), n;
1759
1981
  }
1760
- function da(e) {
1982
+ function Ba(e) {
1761
1983
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1762
1984
  return [
1763
1985
  {
@@ -1777,56 +1999,56 @@ function da(e) {
1777
1999
  }
1778
2000
  ];
1779
2001
  }
1780
- function ca(e) {
2002
+ function Oa(e) {
1781
2003
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1782
- return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), D(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), D(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), D(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
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);
1783
2005
  }
1784
- function D(e, t, n) {
2006
+ function F(e, t, n) {
1785
2007
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1786
2008
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1787
2009
  }
1788
- function ua() {
2010
+ function Ua() {
1789
2011
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1790
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
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;
1791
2013
  }
1792
- function en(e) {
1793
- return e.role === "tool" && e.toolName === Ut;
2014
+ function _n(e) {
2015
+ return e.role === "tool" && e.toolName === tn;
1794
2016
  }
1795
- function Tt(e) {
2017
+ function Vt(e) {
1796
2018
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1797
2019
  }
1798
- function ga(e, t, n, o) {
2020
+ function Fa(e, t, n, o) {
1799
2021
  const a = document.createElement("article");
1800
- a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString(), a.appendChild(Z("pluno-pa-widget__character--tool-group", o));
1801
- const i = document.createElement("details"), l = ma(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);
1802
2024
  i.open = t.has(l), a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.addEventListener("toggle", () => {
1803
2025
  a.classList.toggle("pluno-pa-widget__tool-group--open", i.open), i.open ? t.add(l) : t.delete(l), n();
1804
2026
  });
1805
- const s = document.createElement("summary");
1806
- s.className = "pluno-pa-widget__tool-summary", e.some((p) => p.loading) && s.appendChild(Ye());
2027
+ const p = document.createElement("summary");
2028
+ p.className = "pluno-pa-widget__tool-summary", e.some((s) => s.loading) && p.appendChild(pt());
1807
2029
  const u = document.createElement("span");
1808
- if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", s.appendChild(u), i.appendChild(s), e.length > 0) {
1809
- const p = document.createElement("div");
1810
- p.className = "pluno-pa-widget__tool-lines";
1811
- for (const m of e) {
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";
2033
+ for (const b of e) {
1812
2034
  const x = document.createElement("div");
1813
- x.className = "pluno-pa-widget__tool-line", m.loading && x.appendChild(Ye());
1814
- const A = document.createElement("span");
1815
- A.textContent = m.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);
1816
2038
  }
1817
- i.appendChild(p);
2039
+ i.appendChild(s);
1818
2040
  }
1819
2041
  return a.appendChild(i), a;
1820
2042
  }
1821
- function Ve(e) {
2043
+ function lt(e) {
1822
2044
  const t = document.createElement("article");
1823
- return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(Z("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;
1824
2046
  }
1825
- function ha(e) {
1826
- const t = Ve(e);
1827
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(tn()), t;
2047
+ function za(e) {
2048
+ const t = lt(e);
2049
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(xn()), t;
1828
2050
  }
1829
- function tn() {
2051
+ function xn() {
1830
2052
  const e = document.createElement("div");
1831
2053
  e.className = "pluno-pa-widget__status";
1832
2054
  const t = document.createElement("span");
@@ -1834,17 +2056,17 @@ function tn() {
1834
2056
  const n = document.createElement("span");
1835
2057
  return n.textContent = "Thinking...", e.appendChild(n), e;
1836
2058
  }
1837
- function ma(e) {
2059
+ function Ga(e) {
1838
2060
  return `tools:${e[0]?.id ?? ""}`;
1839
2061
  }
1840
- function Ye() {
2062
+ function pt() {
1841
2063
  const e = document.createElement("span");
1842
2064
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1843
2065
  }
1844
- function nn(e, t) {
1845
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? zo() : Xt());
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());
1846
2068
  }
1847
- function Nt(e, t) {
2069
+ function Yt(e, t) {
1848
2070
  const n = t.replace(/\r\n/g, `
1849
2071
  `).split(`
1850
2072
  `);
@@ -1860,22 +2082,22 @@ function Nt(e, t) {
1860
2082
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1861
2083
  u.push(n[o]), o += 1;
1862
2084
  o += o < n.length ? 1 : 0;
1863
- const p = document.createElement("pre"), m = document.createElement("code");
1864
- m.textContent = u.join(`
1865
- `), p.appendChild(m), 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);
1866
2088
  continue;
1867
2089
  }
1868
2090
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1869
2091
  if (l) {
1870
2092
  const u = document.createElement(`h${l[1].length + 2}`);
1871
- Ee(u, l[2]), e.appendChild(u), o += 1;
2093
+ Re(u, l[2]), e.appendChild(u), o += 1;
1872
2094
  continue;
1873
2095
  }
1874
2096
  if (/^\s*[-*+]\s+/.test(a)) {
1875
2097
  const u = document.createElement("ul");
1876
2098
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1877
- const p = document.createElement("li");
1878
- Ee(p, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(p), o += 1;
2099
+ const s = document.createElement("li");
2100
+ Re(s, n[o].replace(/^\s*[-*+]\s+/, "")), u.appendChild(s), o += 1;
1879
2101
  }
1880
2102
  e.appendChild(u);
1881
2103
  continue;
@@ -1883,22 +2105,22 @@ function Nt(e, t) {
1883
2105
  if (/^\s*\d+\.\s+/.test(a)) {
1884
2106
  const u = document.createElement("ol");
1885
2107
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1886
- const p = document.createElement("li");
1887
- Ee(p, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(p), o += 1;
2108
+ const s = document.createElement("li");
2109
+ Re(s, n[o].replace(/^\s*\d+\.\s+/, "")), u.appendChild(s), o += 1;
1888
2110
  }
1889
2111
  e.appendChild(u);
1890
2112
  continue;
1891
2113
  }
1892
- const s = [a];
2114
+ const p = [a];
1893
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]); )
1894
- s.push(n[o]), o += 1;
2116
+ p.push(n[o]), o += 1;
1895
2117
  const c = document.createElement("p");
1896
- s.forEach((u, p) => {
1897
- p > 0 && c.appendChild(document.createElement("br")), Ee(c, u);
2118
+ p.forEach((u, s) => {
2119
+ s > 0 && c.appendChild(document.createElement("br")), Re(c, u);
1898
2120
  }), e.appendChild(c);
1899
2121
  }
1900
2122
  }
1901
- function Ee(e, t) {
2123
+ function Re(e, t) {
1902
2124
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1903
2125
  let o = 0;
1904
2126
  for (const a of t.matchAll(n)) {
@@ -1906,19 +2128,19 @@ function Ee(e, t) {
1906
2128
  i > o && e.appendChild(document.createTextNode(t.slice(o, i)));
1907
2129
  const l = a[0];
1908
2130
  if (l.startsWith("`")) {
1909
- const s = document.createElement("code");
1910
- 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);
1911
2133
  } else if (l.startsWith("**")) {
1912
- const s = document.createElement("strong");
1913
- 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);
1914
2136
  } else if (l.startsWith("*")) {
1915
- const s = document.createElement("em");
1916
- 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);
1917
2139
  } else {
1918
- const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1919
- if (s && fa(s[2])) {
2140
+ const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2141
+ if (p && Ha(p[2])) {
1920
2142
  const c = document.createElement("a");
1921
- c.href = s[2], c.target = "_top", c.rel = "noreferrer", c.textContent = s[1], e.appendChild(c);
2143
+ c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
1922
2144
  } else
1923
2145
  e.appendChild(document.createTextNode(l));
1924
2146
  }
@@ -1926,7 +2148,7 @@ function Ee(e, t) {
1926
2148
  }
1927
2149
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1928
2150
  }
1929
- function fa(e) {
2151
+ function Ha(e) {
1930
2152
  if (e.startsWith("/") || e.startsWith("#"))
1931
2153
  return !0;
1932
2154
  try {
@@ -1936,8 +2158,8 @@ function fa(e) {
1936
2158
  return !1;
1937
2159
  }
1938
2160
  }
1939
- function It(e, t) {
1940
- if (ba(e))
2161
+ function Kt(e, t) {
2162
+ if (Wa(e))
1941
2163
  return;
1942
2164
  const n = `
1943
2165
  :host {
@@ -1990,7 +2212,7 @@ function It(e, t) {
1990
2212
  --pluno-pa-accent-contrast: #fafafa;
1991
2213
  position: fixed;
1992
2214
  z-index: 2147483645;
1993
- font-family: ${G.fontFamily};
2215
+ font-family: ${K.fontFamily};
1994
2216
  font-size: 14px;
1995
2217
  color: var(--pluno-pa-text);
1996
2218
  width: var(--pluno-pa-launcher-width);
@@ -2283,9 +2505,9 @@ function It(e, t) {
2283
2505
  .pluno-pa-widget__timeline-jump:active {
2284
2506
  transform: translateX(-50%) scale(0.98);
2285
2507
  }
2508
+ .pluno-pa-widget__history,
2286
2509
  .pluno-pa-widget__new-chat {
2287
2510
  position: absolute;
2288
- right: 14px;
2289
2511
  bottom: 14px;
2290
2512
  z-index: 2;
2291
2513
  width: 36px;
@@ -2305,13 +2527,142 @@ function It(e, t) {
2305
2527
  transform 120ms ease,
2306
2528
  box-shadow 120ms ease;
2307
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),
2308
2537
  .pluno-pa-widget__new-chat:hover:not(:disabled) {
2309
2538
  background: var(--pluno-pa-surface);
2310
2539
  box-shadow: 0 8px 18px rgba(24, 24, 27, 0.1);
2311
2540
  }
2541
+ .pluno-pa-widget__history:active:not(:disabled),
2312
2542
  .pluno-pa-widget__new-chat:active:not(:disabled) {
2313
2543
  transform: scale(0.96);
2314
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
+ }
2315
2666
  .pluno-pa-widget__timeline::-webkit-scrollbar,
2316
2667
  .pluno-pa-widget__message--assistant pre::-webkit-scrollbar,
2317
2668
  .pluno-pa-widget__input::-webkit-scrollbar {
@@ -2742,7 +3093,7 @@ function It(e, t) {
2742
3093
  place-items: center;
2743
3094
  padding: 18px;
2744
3095
  background: rgba(24, 24, 27, 0.28);
2745
- font-family: var(--pluno-pa-font, ${G.fontFamily});
3096
+ font-family: var(--pluno-pa-font, ${K.fontFamily});
2746
3097
  color: var(--pluno-pa-text);
2747
3098
  }
2748
3099
  .pluno-pa-widget__share-dialog {
@@ -3361,6 +3712,9 @@ function It(e, t) {
3361
3712
  .pluno-pa-widget__starter-prompt--placeholder {
3362
3713
  visibility: hidden;
3363
3714
  }
3715
+ .pluno-pa-widget__starter-prompt--loading {
3716
+ visibility: visible;
3717
+ }
3364
3718
  .pluno-pa-widget__login {
3365
3719
  display: inline-flex;
3366
3720
  align-items: center;
@@ -3564,6 +3918,15 @@ function It(e, t) {
3564
3918
  }
3565
3919
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button {
3566
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);
3567
3930
  }
3568
3931
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
3569
3932
  position: relative;
@@ -3576,7 +3939,11 @@ function It(e, t) {
3576
3939
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
3577
3940
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
3578
3941
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
3942
+ .pluno-pa-widget--scribble .pluno-pa-widget__history,
3579
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,
3580
3947
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
3581
3948
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
3582
3949
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card,
@@ -3592,7 +3959,11 @@ function It(e, t) {
3592
3959
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner::before,
3593
3960
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher::before,
3594
3961
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
3962
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3595
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,
3596
3967
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
3597
3968
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
3598
3969
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before,
@@ -3622,7 +3993,10 @@ function It(e, t) {
3622
3993
  .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
3623
3994
  background: var(--pluno-pa-surface);
3624
3995
  }
3996
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3625
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,
3626
4000
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
3627
4001
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
3628
4002
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
@@ -3647,6 +4021,7 @@ function It(e, t) {
3647
4021
  border-color: var(--pluno-pa-accent);
3648
4022
  }
3649
4023
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
4024
+ .pluno-pa-widget--scribble .pluno-pa-widget__history,
3650
4025
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
3651
4026
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
3652
4027
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
@@ -3655,6 +4030,7 @@ function It(e, t) {
3655
4030
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
3656
4031
  }
3657
4032
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
4033
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
3658
4034
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
3659
4035
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
3660
4036
  .pluno-pa-widget--scribble .pluno-pa-widget__close::after,
@@ -3684,6 +4060,7 @@ function It(e, t) {
3684
4060
  transform: rotate(-8deg);
3685
4061
  filter: url(#pluno-pa-scribble-wobble-2);
3686
4062
  }
4063
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::after,
3687
4064
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
3688
4065
  transform: rotate(-10deg);
3689
4066
  filter: url(#pluno-pa-scribble-wobble);
@@ -3700,6 +4077,7 @@ function It(e, t) {
3700
4077
  transform: rotate(-7deg);
3701
4078
  filter: url(#pluno-pa-scribble-wobble);
3702
4079
  }
4080
+ .pluno-pa-widget--scribble .pluno-pa-widget__history::before,
3703
4081
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before {
3704
4082
  transform: rotate(6deg);
3705
4083
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3754,34 +4132,35 @@ function It(e, t) {
3754
4132
  filter: url(#pluno-pa-scribble-wobble-2);
3755
4133
  }
3756
4134
  .pluno-pa-widget--scribble .pluno-pa-widget__send svg,
4135
+ .pluno-pa-widget--scribble .pluno-pa-widget__history svg,
3757
4136
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat svg,
3758
4137
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy svg,
3759
4138
  .pluno-pa-widget--scribble .pluno-pa-widget__close svg {
3760
4139
  filter: url(#pluno-pa-scribble-wobble-2);
3761
4140
  }
3762
4141
  `;
3763
- if (wa(e, n))
4142
+ if ($a(e, n))
3764
4143
  return;
3765
4144
  const o = e.ownerDocument.createElement("style");
3766
- o.id = Ht, o.textContent = n, e.appendChild(o), on(e);
4145
+ o.id = sn, o.textContent = n, e.appendChild(o), vn(e);
3767
4146
  }
3768
- function ba(e) {
3769
- return e.getElementById(Ht) !== null || e.host instanceof HTMLElement && e.host.getAttribute(qt) === "true";
4147
+ function Wa(e) {
4148
+ return e.getElementById(sn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(dn) === "true";
3770
4149
  }
3771
- function on(e) {
3772
- e.host instanceof HTMLElement && e.host.setAttribute(qt, "true");
4150
+ function vn(e) {
4151
+ e.host instanceof HTMLElement && e.host.setAttribute(dn, "true");
3773
4152
  }
3774
- function wa(e, t) {
4153
+ function $a(e, t) {
3775
4154
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3776
4155
  return !1;
3777
4156
  try {
3778
4157
  const n = new CSSStyleSheet();
3779
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], on(e), !0;
4158
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], vn(e), !0;
3780
4159
  } catch {
3781
4160
  return !1;
3782
4161
  }
3783
4162
  }
3784
- async function _a() {
4163
+ async function qa() {
3785
4164
  return document.body ? document.body : await new Promise((e) => {
3786
4165
  const t = new MutationObserver(() => {
3787
4166
  document.body && (t.disconnect(), e(document.body));
@@ -3789,49 +4168,49 @@ async function _a() {
3789
4168
  t.observe(document.documentElement, { childList: !0 });
3790
4169
  });
3791
4170
  }
3792
- function an(e) {
4171
+ function Cn(e) {
3793
4172
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3794
4173
  }
3795
- function xa(e) {
4174
+ function ja(e) {
3796
4175
  try {
3797
- const t = window.localStorage.getItem(an(e));
4176
+ const t = window.localStorage.getItem(Cn(e));
3798
4177
  if (!t)
3799
- return Dt();
4178
+ return Xt();
3800
4179
  const n = JSON.parse(t);
3801
4180
  return {
3802
4181
  isOpen: n.isOpen === !0,
3803
4182
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3804
4183
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3805
- launcherPosition: Ea(n.launcherPosition) ? n.launcherPosition : null,
3806
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Ft) : [],
4184
+ launcherPosition: Xa(n.launcherPosition) ? n.launcherPosition : null,
4185
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nn) : [],
3807
4186
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3808
4187
  };
3809
4188
  } catch {
3810
- return Dt();
4189
+ return Xt();
3811
4190
  }
3812
4191
  }
3813
- async function va(e) {
4192
+ async function Va(e) {
3814
4193
  if (e.loadSharePromptsDisabled)
3815
4194
  return e.loadSharePromptsDisabled();
3816
4195
  try {
3817
- return window.localStorage.getItem(zt) === "true";
4196
+ return window.localStorage.getItem(on) === "true";
3818
4197
  } catch {
3819
4198
  return !1;
3820
4199
  }
3821
4200
  }
3822
- function ya(e, t) {
4201
+ function Ya(e, t) {
3823
4202
  if (e.persistSharePromptsDisabled) {
3824
4203
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3825
4204
  });
3826
4205
  return;
3827
4206
  }
3828
4207
  try {
3829
- t && window.localStorage.setItem(zt, "true");
4208
+ t && window.localStorage.setItem(on, "true");
3830
4209
  } catch {
3831
4210
  return;
3832
4211
  }
3833
4212
  }
3834
- function Dt() {
4213
+ function Xt() {
3835
4214
  return {
3836
4215
  isOpen: !1,
3837
4216
  composerValue: "",
@@ -3841,43 +4220,43 @@ function Dt() {
3841
4220
  sharePromptsDisabled: !1
3842
4221
  };
3843
4222
  }
3844
- function Ca(e, t) {
4223
+ function Ka(e, t) {
3845
4224
  try {
3846
- window.localStorage.setItem(an(e), JSON.stringify(t));
4225
+ window.localStorage.setItem(Cn(e), JSON.stringify(t));
3847
4226
  } catch {
3848
4227
  return;
3849
4228
  }
3850
4229
  }
3851
- function Ea(e) {
4230
+ function Xa(e) {
3852
4231
  if (!e || typeof e != "object")
3853
4232
  return !1;
3854
4233
  const t = e;
3855
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");
3856
4235
  }
3857
- const Rt = /* @__PURE__ */ new WeakSet();
3858
- function Sa(e) {
4236
+ const Zt = /* @__PURE__ */ new WeakSet();
4237
+ function Za(e) {
3859
4238
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3860
4239
  }
3861
- function Mt(e) {
4240
+ function Jt(e) {
3862
4241
  const t = e.pathname.split("/");
3863
4242
  return t[t.length - 1] ?? "";
3864
4243
  }
3865
- function ka(e, t) {
4244
+ function Ja(e, t) {
3866
4245
  const n = new URL(e.src, document.baseURI);
3867
- return n.href === t.href || n.pathname === t.pathname ? !0 : Mt(n) === Mt(t);
4246
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Jt(n) === Jt(t);
3868
4247
  }
3869
- class Y extends EventTarget {
4248
+ class te extends EventTarget {
3870
4249
  constructor(t, n) {
3871
- super(), this.channelId = n, this.url = t, this.addPreviewListener($n, () => {
3872
- this.readyState = Y.OPEN, this.dispatchEvent(new Event("open"));
3873
- }), this.addPreviewListener(Gn, (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) => {
3874
4253
  const a = o;
3875
4254
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3876
- }), this.addPreviewListener(Wn, () => {
3877
- this.readyState = Y.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3878
- }), this.addPreviewListener(Hn, (o) => {
4255
+ }), this.addPreviewListener(po, () => {
4256
+ this.readyState = te.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
4257
+ }), this.addPreviewListener(so, (o) => {
3879
4258
  const a = o;
3880
- this.readyState = Y.CLOSED, this.dispatchEvent(
4259
+ this.readyState = te.CLOSED, this.dispatchEvent(
3881
4260
  new CloseEvent("close", {
3882
4261
  code: a.detail?.code ?? 1e3,
3883
4262
  reason: a.detail?.reason ?? "",
@@ -3885,7 +4264,7 @@ class Y extends EventTarget {
3885
4264
  })
3886
4265
  ), this.cleanup();
3887
4266
  }), window.dispatchEvent(
3888
- new CustomEvent(Se(Un, this.channelId), {
4267
+ new CustomEvent(Me(oo, this.channelId), {
3889
4268
  detail: { socketId: this.socketId, url: t }
3890
4269
  })
3891
4270
  );
@@ -3900,27 +4279,27 @@ class Y extends EventTarget {
3900
4279
  extensions = "";
3901
4280
  binaryType = "blob";
3902
4281
  bufferedAmount = 0;
3903
- readyState = Y.CONNECTING;
3904
- socketId = La();
4282
+ readyState = te.CONNECTING;
4283
+ socketId = Qa();
3905
4284
  listeners = /* @__PURE__ */ new Map();
3906
4285
  send(t) {
3907
- if (this.readyState !== Y.OPEN)
4286
+ if (this.readyState !== te.OPEN)
3908
4287
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3909
4288
  window.dispatchEvent(
3910
- new CustomEvent(Se(Fn, this.channelId), {
4289
+ new CustomEvent(Me(ao, this.channelId), {
3911
4290
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3912
4291
  })
3913
4292
  );
3914
4293
  }
3915
4294
  close(t, n) {
3916
- this.readyState !== Y.CLOSED && (this.readyState = Y.CLOSING, window.dispatchEvent(
3917
- new CustomEvent(Se(zn, this.channelId), {
4295
+ this.readyState !== te.CLOSED && (this.readyState = te.CLOSING, window.dispatchEvent(
4296
+ new CustomEvent(Me(io, this.channelId), {
3918
4297
  detail: { socketId: this.socketId, code: t, reason: n }
3919
4298
  })
3920
4299
  ), this.cleanup());
3921
4300
  }
3922
4301
  addPreviewListener(t, n) {
3923
- const o = Se(t, this.channelId), a = (i) => {
4302
+ const o = Me(t, this.channelId), a = (i) => {
3924
4303
  i.detail?.socketId === this.socketId && n(i);
3925
4304
  };
3926
4305
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -3931,36 +4310,36 @@ class Y extends EventTarget {
3931
4310
  this.listeners.clear();
3932
4311
  }
3933
4312
  }
3934
- function La() {
3935
- const e = window.sessionStorage.getItem(ht);
4313
+ function Qa() {
4314
+ const e = window.sessionStorage.getItem(At);
3936
4315
  if (e)
3937
4316
  return e;
3938
4317
  const t = crypto.randomUUID();
3939
- return window.sessionStorage.setItem(ht, t), t;
4318
+ return window.sessionStorage.setItem(At, t), t;
3940
4319
  }
3941
- function Se(e, t) {
4320
+ function Me(e, t) {
3942
4321
  return `${e}:${t}`;
3943
4322
  }
3944
- function Aa(e) {
4323
+ function ei(e) {
3945
4324
  const t = document.currentScript;
3946
4325
  if (t instanceof HTMLScriptElement)
3947
4326
  return [t];
3948
4327
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3949
4328
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3950
- (a) => a instanceof HTMLScriptElement && Sa(a) && ka(a, o)
4329
+ (a) => a instanceof HTMLScriptElement && Za(a) && Ja(a, o)
3951
4330
  );
3952
4331
  }
3953
- function Pa(e) {
3954
- for (const t of Aa(e)) {
3955
- if (Rt.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")
3956
4335
  continue;
3957
- Rt.add(t);
4336
+ Zt.add(t);
3958
4337
  const n = t.dataset.plunoPreviewChannel;
3959
- co({
4338
+ To({
3960
4339
  token: t.dataset.plunoToken,
3961
4340
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3962
4341
  backendUrl: t.dataset.plunoBackendUrl,
3963
- webSocketFactory: n ? so(n) : void 0,
4342
+ webSocketFactory: n ? Ao(n) : void 0,
3964
4343
  launcherLabel: t.dataset.plunoLauncherLabel,
3965
4344
  accentColor: t.dataset.plunoAccentColor,
3966
4345
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3972,8 +4351,8 @@ function Pa(e) {
3972
4351
  });
3973
4352
  }
3974
4353
  }
3975
- Pa(import.meta.url);
4354
+ ti(import.meta.url);
3976
4355
  export {
3977
- so as createProductAgentPreviewBridgeWebSocketFactory,
3978
- co as mountPlunoProductAgentWidget
4356
+ Ao as createProductAgentPreviewBridgeWebSocketFactory,
4357
+ To as mountPlunoProductAgentWidget
3979
4358
  };