@pluno/product-agent-web 0.1.19 → 0.1.21

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,7 +1,7 @@
1
- import { PlunoProductAgent as dt } from "./product-agent-sdk.js";
2
- const ct = "#7c3aed";
3
- function ut(t) {
4
- const e = bt(t);
1
+ import { PlunoProductAgent as yt } from "./product-agent-sdk.js";
2
+ const vt = "#7c3aed";
3
+ function Ct(t) {
4
+ const e = Pt(t);
5
5
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
6
6
  <defs>
7
7
  <linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
@@ -75,23 +75,23 @@ function ut(t) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- function gt(t) {
79
- return `data:image/svg+xml,${encodeURIComponent(ut(t))}`;
78
+ function Et(t) {
79
+ return `data:image/svg+xml,${encodeURIComponent(Ct(t))}`;
80
80
  }
81
- const G = "#2c2a1e", ye = [253, 250, 241], ve = 3.5;
82
- function Ve(t) {
83
- const e = qe(t);
84
- if (Ce(q(e), ye) >= ve)
81
+ const $ = "#2c2a1e", Ae = [253, 250, 241], Ne = 3.5;
82
+ function Qe(t) {
83
+ const e = et(t);
84
+ if (Te(X(e), Ae) >= Ne)
85
85
  return e;
86
- let o = q(e);
87
- const a = q(G);
88
- for (let r = 0; r < 6; r += 1)
89
- if (o = wt(o, a, 0.22), Ce(o, ye) >= ve)
90
- return de(o);
91
- return de(o);
92
- }
93
- function ht(t) {
94
- const e = Ve(t), 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";
86
+ let o = X(e);
87
+ const a = X($);
88
+ for (let i = 0; i < 6; i += 1)
89
+ if (o = At(o, a, 0.22), Te(o, Ae) >= Ne)
90
+ return fe(o);
91
+ return fe(o);
92
+ }
93
+ function kt(t) {
94
+ const e = Qe(t), 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";
95
95
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
96
96
  <defs>
97
97
  <clipPath id="scribbleBoltClip">
@@ -104,35 +104,35 @@ function ht(t) {
104
104
  </defs>
105
105
  <g filter="url(#scribbleBoltWobble)">
106
106
  <g clip-path="url(#scribbleBoltClip)">
107
- <path d="${mt()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
107
+ <path d="${Lt()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
108
108
  </g>
109
- <path d="${n}" fill="none" stroke="${G}" stroke-width="18" stroke-linejoin="round"/>
109
+ <path d="${n}" fill="none" stroke="${$}" stroke-width="18" stroke-linejoin="round"/>
110
110
  <g transform="rotate(-2 528 463)">
111
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${G}" stroke-width="13"/>
112
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${G}"/>
111
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${$}" stroke-width="13"/>
112
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${$}"/>
113
113
  <circle cx="557" cy="447" r="16" fill="#ffffff"/>
114
114
  </g>
115
115
  <g transform="rotate(2 717 462)">
116
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${G}" stroke-width="13"/>
117
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${G}"/>
116
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${$}" stroke-width="13"/>
117
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${$}"/>
118
118
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
119
119
  </g>
120
120
  </g>
121
121
  </svg>`;
122
122
  }
123
- function ft(t) {
124
- return `data:image/svg+xml,${encodeURIComponent(ht(t))}`;
123
+ function St(t) {
124
+ return `data:image/svg+xml,${encodeURIComponent(kt(t))}`;
125
125
  }
126
- function mt() {
126
+ function Lt() {
127
127
  let n = "M 280 120", o = !1, a = 0;
128
- for (let r = 150; r <= 1170; r += 62) {
129
- const l = (a % 3 - 1) * 18, d = o ? 280 - l : 1020 + l;
130
- n += ` L ${d} ${r}`, o = !o, a += 1;
128
+ for (let i = 150; i <= 1170; i += 62) {
129
+ const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
130
+ n += ` L ${p} ${i}`, o = !o, a += 1;
131
131
  }
132
132
  return n;
133
133
  }
134
- function bt(t) {
135
- const e = qe(t), n = ce(q(e));
134
+ function Pt(t) {
135
+ const e = et(t), n = we(X(e));
136
136
  return n > 0.86 ? {
137
137
  top: "#ffffff",
138
138
  middle: "#f6f6f6",
@@ -156,81 +156,107 @@ function bt(t) {
156
156
  inner: "#4b4b4b",
157
157
  shadow: "#000000"
158
158
  } : {
159
- top: L(e, 0.28, -0.03),
160
- middle: L(e, 0.08, 0.04),
161
- bottom: L(e, -0.1, 0.02),
162
- edgeStart: L(e, 0.08, 0.08),
163
- edgeMiddle: L(e, -0.08, 0.08),
164
- edgeEnd: L(e, -0.18, 0.05),
165
- glow: L(e, 0.32, -0.12),
166
- highlight: L(e, 0.38, -0.18),
167
- inner: L(e, 0.24, -0.1),
168
- shadow: L(e, -0.25, -0.08)
159
+ top: N(e, 0.28, -0.03),
160
+ middle: N(e, 0.08, 0.04),
161
+ bottom: N(e, -0.1, 0.02),
162
+ edgeStart: N(e, 0.08, 0.08),
163
+ edgeMiddle: N(e, -0.08, 0.08),
164
+ edgeEnd: N(e, -0.18, 0.05),
165
+ glow: N(e, 0.32, -0.12),
166
+ highlight: N(e, 0.38, -0.18),
167
+ inner: N(e, 0.24, -0.1),
168
+ shadow: N(e, -0.25, -0.08)
169
169
  };
170
170
  }
171
- function qe(t) {
171
+ function et(t) {
172
172
  const e = t.trim();
173
- return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ct;
173
+ return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : vt;
174
174
  }
175
- function q(t) {
175
+ function X(t) {
176
176
  return [
177
177
  Number.parseInt(t.slice(1, 3), 16),
178
178
  Number.parseInt(t.slice(3, 5), 16),
179
179
  Number.parseInt(t.slice(5, 7), 16)
180
180
  ];
181
181
  }
182
- function de([t, e, n]) {
182
+ function fe([t, e, n]) {
183
183
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
184
184
  return `#${o(t)}${o(e)}${o(n)}`;
185
185
  }
186
- function ce([t, e, n]) {
186
+ function we([t, e, n]) {
187
187
  const o = (a) => {
188
- const r = a / 255;
189
- return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
188
+ const i = a / 255;
189
+ return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
190
190
  };
191
191
  return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
192
192
  }
193
- function Ce(t, e) {
194
- const n = ce(t), o = ce(e), [a, r] = n > o ? [n, o] : [o, n];
195
- return (a + 0.05) / (r + 0.05);
193
+ function Te(t, e) {
194
+ const n = we(t), o = we(e), [a, i] = n > o ? [n, o] : [o, n];
195
+ return (a + 0.05) / (i + 0.05);
196
196
  }
197
- function wt(t, e, n) {
198
- const o = ue(n);
197
+ function At(t, e, n) {
198
+ const o = be(n);
199
199
  return [
200
200
  t[0] + (e[0] - t[0]) * o,
201
201
  t[1] + (e[1] - t[1]) * o,
202
202
  t[2] + (e[2] - t[2]) * o
203
203
  ];
204
204
  }
205
- function L(t, e, n) {
206
- const [o, a, r] = _t(q(t));
207
- return de(xt(o, ue(a + n), ue(r + e)));
205
+ function N(t, e, n) {
206
+ const [o, a, i] = Nt(X(t));
207
+ return fe(Tt(o, be(a + n), be(i + e)));
208
208
  }
209
- function _t([t, e, n]) {
210
- const o = t / 255, a = e / 255, r = n / 255, l = Math.max(o, a, r), d = Math.min(o, a, r), u = (l + d) / 2;
211
- if (l === d)
212
- return [0, 0, u];
213
- const h = l - d, c = u > 0.5 ? h / (2 - l - d) : h / (l + d);
214
- return [(l === o ? (a - r) / h + (a < r ? 6 : 0) : l === a ? (r - o) / h + 2 : (o - a) / h + 4) / 6, c, u];
209
+ function Nt([t, e, n]) {
210
+ const o = t / 255, a = e / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), s = (l + p) / 2;
211
+ if (l === p)
212
+ return [0, 0, s];
213
+ const d = l - p, u = s > 0.5 ? d / (2 - l - p) : d / (l + p);
214
+ return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, u, s];
215
215
  }
216
- function xt(t, e, n) {
216
+ function Tt(t, e, n) {
217
217
  if (e === 0)
218
218
  return [n * 255, n * 255, n * 255];
219
219
  const o = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - o;
220
220
  return [
221
- ie(a, o, t + 1 / 3) * 255,
222
- ie(a, o, t) * 255,
223
- ie(a, o, t - 1 / 3) * 255
221
+ ue(a, o, t + 1 / 3) * 255,
222
+ ue(a, o, t) * 255,
223
+ ue(a, o, t - 1 / 3) * 255
224
224
  ];
225
225
  }
226
- function ie(t, e, n) {
226
+ function ue(t, e, n) {
227
227
  let o = n;
228
228
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? t + (e - t) * 6 * o : o < 1 / 2 ? e : o < 2 / 3 ? t + (e - t) * (2 / 3 - o) * 6 : t;
229
229
  }
230
- function ue(t) {
230
+ function be(t) {
231
231
  return Math.max(0, Math.min(1, t));
232
232
  }
233
- const yt = "product-agent:sdk-preview-socket-connect", vt = "product-agent:sdk-preview-socket-send", Ct = "product-agent:sdk-preview-socket-close", Et = "product-agent:sdk-preview-socket-open", kt = "product-agent:sdk-preview-socket-message", St = "product-agent:sdk-preview-socket-error", Lt = "product-agent:sdk-preview-socket-closed", Ee = "product-agent:sdk-preview-socket-id", Pt = "product-agent:preview-diagnostic", ee = 10, At = 10 * 1024 * 1024, Tt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), D = {
233
+ const tt = "suggest_share_on_socials";
234
+ function Dt(t) {
235
+ for (let e = t.length - 1; e >= 0; e -= 1) {
236
+ const n = t[e];
237
+ if (n.role !== "tool" || n.toolName !== tt)
238
+ continue;
239
+ const o = De(t, e, "assistant");
240
+ if (!o)
241
+ return null;
242
+ const a = De(t, o.index, "user");
243
+ return a ? {
244
+ id: `share:${n.callId ?? n.id}`,
245
+ userPrompt: a.content,
246
+ assistantAnswer: o.content
247
+ } : null;
248
+ }
249
+ return null;
250
+ }
251
+ function De(t, e, n) {
252
+ for (let o = e - 1; o >= 0; o -= 1) {
253
+ const a = t[o];
254
+ if (a.role === n && a.content.trim())
255
+ return { index: o, content: a.content.trim() };
256
+ }
257
+ return null;
258
+ }
259
+ const nt = 100, It = "product-agent:sdk-preview-socket-connect", Rt = "product-agent:sdk-preview-socket-send", Mt = "product-agent:sdk-preview-socket-close", Ot = "product-agent:sdk-preview-socket-open", Ft = "product-agent:sdk-preview-socket-message", zt = "product-agent:sdk-preview-socket-error", Bt = "product-agent:sdk-preview-socket-closed", Ie = "product-agent:sdk-preview-socket-id", Gt = "product-agent:preview-diagnostic", ae = 10, $t = 10 * 1024 * 1024, Ut = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), I = {
234
260
  launcherLabel: "Ask for anything...",
235
261
  accentColor: "#7c3aed",
236
262
  colorScheme: "light",
@@ -238,19 +264,19 @@ const yt = "product-agent:sdk-preview-socket-connect", vt = "product-agent:sdk-p
238
264
  scribbleStyle: !1,
239
265
  position: "bottom-right",
240
266
  movableLauncher: !1
241
- }, ke = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Nt = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Se = "pluno-pa-scribble-font", Ke = 190, je = 41, It = 48, Rt = 420, Dt = 680, S = 8, Le = 50, Mt = "http://www.w3.org/2000/svg", Ot = 11, Ft = 13, Gt = 4, Bt = 10, $t = 40, zt = "movable-launcher-position-v2";
242
- function Wt(t) {
243
- return (e) => new I(e, t);
267
+ }, Re = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Wt = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Me = "pluno-pa-scribble-font", ot = 190, at = 41, Ht = 48, Vt = 420, qt = 680, A = 8, Oe = 50, jt = "http://www.w3.org/2000/svg", Kt = 11, Yt = 13, Xt = 4, Zt = 10, Jt = 40, Qt = "movable-launcher-position-v2";
268
+ function en(t) {
269
+ return (e) => new R(e, t);
244
270
  }
245
- async function Ut(t = {}) {
271
+ async function tn(t = {}) {
246
272
  const e = {
247
- launcherLabel: t.launcherLabel ?? D.launcherLabel,
248
- accentColor: t.accentColor ?? D.accentColor,
249
- colorScheme: t.colorScheme ?? D.colorScheme,
250
- fontFamily: t.fontFamily ?? D.fontFamily,
251
- scribbleStyle: t.scribbleStyle ?? D.scribbleStyle,
252
- position: t.position ?? D.position,
253
- movableLauncher: t.movableLauncher ?? D.movableLauncher,
273
+ launcherLabel: t.launcherLabel ?? I.launcherLabel,
274
+ accentColor: t.accentColor ?? I.accentColor,
275
+ colorScheme: t.colorScheme ?? I.colorScheme,
276
+ fontFamily: t.fontFamily ?? I.fontFamily,
277
+ scribbleStyle: t.scribbleStyle ?? I.scribbleStyle,
278
+ position: t.position ?? I.position,
279
+ movableLauncher: t.movableLauncher ?? I.movableLauncher,
254
280
  token: t.token,
255
281
  tokenProvider: t.tokenProvider,
256
282
  tokenEndpoint: t.tokenEndpoint,
@@ -260,9 +286,10 @@ async function Ut(t = {}) {
260
286
  webSocketFactory: t.webSocketFactory,
261
287
  loginRequired: t.loginRequired === !0,
262
288
  loginButtonLabel: t.loginButtonLabel ?? "Log in to Pluno",
263
- onLoginClick: t.onLoginClick
289
+ onLoginClick: t.onLoginClick,
290
+ socialPostDraftHandler: t.socialPostDraftHandler
264
291
  };
265
- O("web-sdk.widget", "Mounting widget with merged options", {
292
+ F("web-sdk.widget", "Mounting widget with merged options", {
266
293
  accentColor: e.accentColor,
267
294
  colorScheme: e.colorScheme,
268
295
  fontFamily: e.fontFamily,
@@ -277,84 +304,85 @@ async function Ut(t = {}) {
277
304
  n.className = "pluno-pa-widget-host";
278
305
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
279
306
  a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`;
280
- let r = Pe(e.accentColor, e.scribbleStyle);
281
- Zt(a, e.launcherLabel, r, e.movableLauncher), o.appendChild(a);
282
- const l = await kn(), d = l.ownerDocument;
283
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), We(o, e.accentColor), Ae(a, r, {
307
+ let i = Fe(e.accentColor, e.scribbleStyle);
308
+ dn(a, e.launcherLabel, i, e.movableLauncher), o.appendChild(a);
309
+ const l = await Un(), p = l.ownerDocument;
310
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), Xe(o, e.accentColor), ze(a, i, {
284
311
  accentColor: e.accentColor,
285
312
  colorScheme: e.colorScheme,
286
313
  fontFamily: e.fontFamily,
287
314
  scribbleStyle: e.scribbleStyle
288
- }), O("web-sdk.widget", "Applied initial widget appearance", {
315
+ }), F("web-sdk.widget", "Applied initial widget appearance", {
289
316
  accentColor: e.accentColor,
290
317
  colorScheme: e.colorScheme,
291
318
  fontFamily: e.fontFamily,
292
319
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
293
320
  });
294
- const u = a.querySelector(".pluno-pa-widget__launcher"), h = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), c = a.querySelector(".pluno-pa-widget__launcher-input"), m = a.querySelector(".pluno-pa-widget__panel"), y = a.querySelector(".pluno-pa-widget__close"), k = a.querySelector(".pluno-pa-widget__composer"), v = a.querySelector(".pluno-pa-widget__attachment-error"), s = a.querySelector(".pluno-pa-widget__attachments"), p = a.querySelector(".pluno-pa-widget__input"), f = a.querySelector(".pluno-pa-widget__send"), w = a.querySelector(".pluno-pa-widget__new-chat"), b = a.querySelector(".pluno-pa-widget__timeline");
295
- if (!u || !c || !m || !y || !k || !v || !s || !p || !f || !w || !b)
321
+ const s = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), u = a.querySelector(".pluno-pa-widget__launcher-input"), _ = a.querySelector(".pluno-pa-widget__panel"), w = a.querySelector(".pluno-pa-widget__close"), y = a.querySelector(".pluno-pa-widget__composer"), k = a.querySelector(".pluno-pa-widget__attachment-error"), m = a.querySelector(".pluno-pa-widget__attachments"), h = a.querySelector(".pluno-pa-widget__input"), x = a.querySelector(".pluno-pa-widget__send"), g = a.querySelector(".pluno-pa-widget__new-chat"), f = a.querySelector(".pluno-pa-widget__timeline");
322
+ if (!s || !u || !_ || !w || !y || !k || !m || !h || !x || !g || !f)
296
323
  throw new Error("Failed to mount Pluno widget");
297
- if (e.movableLauncher && !h)
324
+ if (e.movableLauncher && !d)
298
325
  throw new Error("Failed to mount Pluno widget drag handle");
299
- De(c), De(p);
300
- let x = [], P = null;
301
- const F = () => {
302
- sn(s, x, (i) => {
303
- x = x.filter((g, E) => E !== i), F(), N();
326
+ We(u), We(h);
327
+ let b = [], E = null;
328
+ const C = () => {
329
+ yn(m, b, (r) => {
330
+ b = b.filter((c, L) => L !== r), C(), D();
304
331
  });
305
- }, ot = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
332
+ }, H = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
306
333
  if (!e.tokenEndpoint)
307
334
  throw new Error("Pluno widget requires token or tokenEndpoint");
308
- const i = await fetch(e.tokenEndpoint, {
335
+ const r = await fetch(e.tokenEndpoint, {
309
336
  method: "POST",
310
337
  credentials: "include",
311
338
  headers: { "content-type": "application/json" },
312
339
  body: JSON.stringify({ origin: location.origin, url: location.href })
313
340
  });
314
- if (!i.ok)
341
+ if (!r.ok)
315
342
  throw new Error("Failed to load Pluno token");
316
- const g = await i.json();
317
- if (!g.token)
343
+ const c = await r.json();
344
+ if (!c.token)
318
345
  throw new Error("Pluno token endpoint did not return a token");
319
- return g.token;
346
+ return c.token;
320
347
  });
321
- let C;
322
- C = await dt.init({
348
+ let v;
349
+ v = await yt.init({
323
350
  token: e.token,
324
- tokenProvider: ot,
351
+ tokenProvider: H,
325
352
  backendUrl: e.backendUrl,
326
353
  metadata: () => ({
327
354
  ...e.metadata ?? {},
328
- ...!C.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
355
+ ...!v.getState().sessionId && e.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
329
356
  }),
330
357
  initialStarterPrompts: e.initialStarterPrompts,
331
358
  webSocketFactory: e.webSocketFactory,
332
359
  autoConnect: e.loginRequired ? !1 : void 0
333
360
  });
334
- const z = Sn(e), K = new Set(z.openToolGroupKeys);
335
- let A = e.movableLauncher ? z.launcherPosition : null, he = A !== null, R = null, fe = !1;
336
- const at = () => {
337
- fe || typeof document > "u" || (We(o, e.accentColor), n.isConnected || d.body?.appendChild(n));
338
- }, me = new MutationObserver(at);
339
- me.observe(d.documentElement, { childList: !0, subtree: !0 });
340
- const ne = (i = !0) => {
341
- const g = Te(a, i);
342
- return Ne(
361
+ const z = Wn(e), re = new Set(z.openToolGroupKeys), V = new Set(z.seenShareCandidateIds), le = new Set(V);
362
+ let T = e.movableLauncher ? z.launcherPosition : null, ye = T !== null, M = null, ve = !1;
363
+ const gt = () => {
364
+ ve || typeof document > "u" || (Xe(o, e.accentColor), n.isConnected || p.body?.appendChild(n));
365
+ }, Ce = new MutationObserver(gt);
366
+ Ce.observe(p.documentElement, { childList: !0, subtree: !0 });
367
+ const pe = (r = !0) => {
368
+ const c = Be(a, r);
369
+ return Ge(
343
370
  a,
344
- A ?? Kt(a, e.position, g),
345
- g
371
+ T ?? rn(a, e.position, c),
372
+ c
346
373
  );
347
- }, T = () => {
348
- Ln(e, {
374
+ }, P = () => {
375
+ Hn(e, {
349
376
  isOpen: a.classList.contains("pluno-pa-widget--open"),
350
- composerValue: p.value,
351
- openToolGroupKeys: [...K],
352
- launcherPosition: he ? A : null
377
+ composerValue: h.value,
378
+ openToolGroupKeys: [...re],
379
+ launcherPosition: ye ? T : null,
380
+ seenShareCandidateIds: [...V].slice(-nt)
353
381
  });
354
- }, M = (i, g = {}) => {
355
- Xt(i, {
356
- debugVersion: zt,
357
- launcherPosition: A,
382
+ }, O = (r, c = {}) => {
383
+ sn(r, {
384
+ debugVersion: Qt,
385
+ launcherPosition: T,
358
386
  rootClasses: a.className,
359
387
  rootStyle: {
360
388
  left: a.style.left,
@@ -362,206 +390,258 @@ async function Ut(t = {}) {
362
390
  right: a.style.right,
363
391
  bottom: a.style.bottom
364
392
  },
365
- rootRect: le(a),
366
- launcherRect: le(u),
367
- panelRect: le(m),
368
- viewport: B(),
369
- panelHidden: m.hidden,
370
- closeHidden: y.hidden,
371
- ...g
393
+ rootRect: ge(a),
394
+ launcherRect: ge(s),
395
+ panelRect: ge(_),
396
+ viewport: U(),
397
+ panelHidden: _.hidden,
398
+ closeHidden: w.hidden,
399
+ ...c
372
400
  });
373
- }, j = (i = !0) => {
374
- if (!A)
375
- return X(a, null), ne(i);
376
- const g = ne(i);
377
- return X(a, g), M("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
378
- }, be = (i, g) => {
379
- if (!i || !g) {
380
- Re(a);
401
+ }, Z = (r = !0) => {
402
+ if (!T)
403
+ return ee(a, null), pe(r);
404
+ const c = pe(r);
405
+ return ee(a, c), O("Applied stored closed launcher position", { visibleLauncherPosition: c }), c;
406
+ }, Ee = (r, c) => {
407
+ if (!r || !c) {
408
+ Ue(a);
381
409
  return;
382
410
  }
383
- Yt(a, {
384
- x: i.x - g.x,
385
- y: i.y - g.y
411
+ pn(a, {
412
+ x: r.x - c.x,
413
+ y: r.y - c.y
386
414
  });
387
- }, we = () => {
388
- const i = j();
415
+ }, ke = () => {
416
+ const r = Z();
389
417
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
390
- const g = Ie(i);
391
- be(g, i), M("Applied open panel position after viewport resize", { openPanelPosition: g });
392
- } else A && M("Applied visible launcher position after viewport resize", { visibleLauncherPosition: i });
418
+ const c = $e(r);
419
+ Ee(c, r), O("Applied open panel position after viewport resize", { openPanelPosition: c });
420
+ } else T && O("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
393
421
  };
394
- let _e = () => {
422
+ let Se = () => {
395
423
  };
396
- e.movableLauncher && h ? (j(), window.addEventListener("resize", we), _e = Vt({
424
+ e.movableLauncher && d ? (Z(), window.addEventListener("resize", ke), Se = on({
397
425
  root: a,
398
- launcherDragHandle: h,
399
- getPosition: () => ne(),
400
- setPosition: (i) => {
401
- const g = i;
402
- A = Ne(a, i, Te(a)), X(a, A), M("Dragging closed launcher", { requestedPosition: g });
426
+ launcherDragHandle: d,
427
+ getPosition: () => pe(),
428
+ setPosition: (r) => {
429
+ const c = r;
430
+ T = Ge(a, r, Be(a)), ee(a, T), O("Dragging closed launcher", { requestedPosition: c });
403
431
  },
404
432
  persist: () => {
405
- he = !0, T(), M("Persisted closed launcher drag position");
433
+ ye = !0, P(), O("Persisted closed launcher drag position");
406
434
  }
407
- })) : X(a, null);
408
- const W = (i = "", g = !0) => {
409
- if (R !== null && (window.clearTimeout(R), R = null), m.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
410
- const E = j(), H = Ie(E);
411
- be(H, E), M("Opening launcher at clamped open panel position", { openPanelPosition: H, visibleLauncherPosition: E });
435
+ })) : ee(a, null);
436
+ const B = (r = "", c = !0) => {
437
+ if (M !== null && (window.clearTimeout(M), M = null), _.hidden = !1, w.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
438
+ const L = Z(), K = $e(L);
439
+ Ee(K, L), O("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: L });
412
440
  } else
413
- Re(a);
414
- if (!g) {
415
- a.classList.add("pluno-pa-widget--open"), u.hidden = !0, i && (p.value = i, V(p)), b.scrollTop = b.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T();
441
+ Ue(a);
442
+ if (!c) {
443
+ a.classList.add("pluno-pa-widget--open"), s.hidden = !0, r && (h.value = r, Y(h)), f.scrollTop = f.scrollHeight, h.focus(), h.setSelectionRange(h.value.length, h.value.length), P();
416
444
  return;
417
445
  }
418
446
  window.requestAnimationFrame(() => {
419
- a.classList.add("pluno-pa-widget--open"), i && (p.value = i, V(p)), b.scrollTop = b.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T(), R = window.setTimeout(() => {
420
- u.hidden = !0, b.scrollTop = b.scrollHeight;
447
+ a.classList.add("pluno-pa-widget--open"), r && (h.value = r, Y(h)), f.scrollTop = f.scrollHeight, h.focus(), h.setSelectionRange(h.value.length, h.value.length), P(), M = window.setTimeout(() => {
448
+ s.hidden = !0, f.scrollTop = f.scrollHeight;
421
449
  }, 220);
422
450
  });
423
- }, rt = () => {
424
- R !== null && (window.clearTimeout(R), R = null), u.hidden = !1, A && (j(!1), M("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), T(), R = window.setTimeout(() => {
425
- m.hidden = !0, y.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
451
+ }, ht = () => {
452
+ M !== null && (window.clearTimeout(M), M = null), s.hidden = !1, T && (Z(!1), O("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), P(), M = window.setTimeout(() => {
453
+ _.hidden = !0, w.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
426
454
  }, 220);
427
455
  };
428
- u.addEventListener("submit", (i) => {
429
- i.preventDefault(), W(c.value), c.value = "";
430
- }), h?.addEventListener("click", (i) => {
431
- i.preventDefault(), i.stopPropagation();
432
- }), u.addEventListener("click", (i) => {
433
- i.target !== c && (W(c.value), c.value = "");
434
- }), c.addEventListener("focus", () => {
435
- W(c.value), c.value = "";
436
- }), c.addEventListener("input", () => {
437
- if (!c.value)
456
+ s.addEventListener("submit", (r) => {
457
+ r.preventDefault(), B(u.value), u.value = "";
458
+ }), d?.addEventListener("click", (r) => {
459
+ r.preventDefault(), r.stopPropagation();
460
+ }), s.addEventListener("click", (r) => {
461
+ r.target !== u && (B(u.value), u.value = "");
462
+ }), u.addEventListener("focus", () => {
463
+ B(u.value), u.value = "";
464
+ }), u.addEventListener("input", () => {
465
+ if (!u.value)
438
466
  return;
439
- const i = c.value;
440
- W(i), c.value = "";
441
- }), y.addEventListener("click", rt);
442
- const N = () => {
443
- f.disabled = !C.getState().isThinking && p.value.trim().length === 0 && x.length === 0;
467
+ const r = u.value;
468
+ B(r), u.value = "";
469
+ }), w.addEventListener("click", ht);
470
+ const D = () => {
471
+ x.disabled = !v.getState().isThinking && h.value.trim().length === 0 && b.length === 0;
444
472
  };
445
- e.loginRequired && (c.readOnly = !0, c.placeholder = e.loginButtonLabel, p.placeholder = e.loginButtonLabel, k.hidden = !0), k.addEventListener("submit", (i) => {
446
- if (i.preventDefault(), e.loginRequired) {
473
+ e.loginRequired && (u.readOnly = !0, u.placeholder = e.loginButtonLabel, h.placeholder = e.loginButtonLabel, y.hidden = !0), y.addEventListener("submit", (r) => {
474
+ if (r.preventDefault(), e.loginRequired) {
447
475
  e.onLoginClick?.();
448
476
  return;
449
477
  }
450
- x = pe(C, p, x), F(), N();
478
+ b = he(v, h, b), C(), D();
451
479
  });
452
- let U = 0;
453
- const it = () => {
454
- U = 0, a.classList.remove("pluno-pa-widget--drag-over");
455
- }, lt = (i) => {
456
- P !== null && window.clearTimeout(P), v.textContent = i, v.hidden = !1, P = window.setTimeout(() => {
457
- v.textContent = "", v.hidden = !0, P = null;
480
+ let q = 0;
481
+ const mt = () => {
482
+ q = 0, a.classList.remove("pluno-pa-widget--drag-over");
483
+ }, ft = (r) => {
484
+ E !== null && window.clearTimeout(E), k.textContent = r, k.hidden = !1, E = window.setTimeout(() => {
485
+ k.textContent = "", k.hidden = !0, E = null;
458
486
  }, 3e3);
459
- }, pt = () => {
460
- P !== null && (window.clearTimeout(P), P = null), v.textContent = "", v.hidden = !0;
461
- }, st = async (i) => {
462
- if (i.length === 0)
487
+ }, wt = () => {
488
+ E !== null && (window.clearTimeout(E), E = null), k.textContent = "", k.hidden = !0;
489
+ }, bt = async (r) => {
490
+ if (r.length === 0)
463
491
  return;
464
- const g = await gn(i);
465
- if (x.length + g.length > ee)
466
- throw new Error(`Attach up to ${ee} files per message.`);
467
- x = [...x, ...g], F(), pt(), N();
492
+ const c = await kn(r);
493
+ if (b.length + c.length > ae)
494
+ throw new Error(`Attach up to ${ae} files per message.`);
495
+ b = [...b, ...c], C(), wt(), D();
468
496
  };
469
- a.addEventListener("dragenter", (i) => {
470
- !Z(i.dataTransfer) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), U += 1, a.classList.add("pluno-pa-widget--drag-over"));
471
- }), a.addEventListener("dragover", (i) => {
472
- const g = i.dataTransfer;
473
- !Z(g) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), g.dropEffect = "copy");
474
- }), a.addEventListener("dragleave", (i) => {
475
- Z(i.dataTransfer) && (i.stopPropagation(), U = Math.max(0, U - 1), U === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
476
- }), a.addEventListener("drop", (i) => {
477
- const g = i.dataTransfer;
478
- !Z(g) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), it(), st(g.files).catch((E) => {
479
- lt(E instanceof Error ? E.message : "Failed to attach file"), O("web-sdk.widget", "Attachment failed", {
480
- message: E instanceof Error ? E.message : String(E)
497
+ a.addEventListener("dragenter", (r) => {
498
+ !te(r.dataTransfer) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), q += 1, a.classList.add("pluno-pa-widget--drag-over"));
499
+ }), a.addEventListener("dragover", (r) => {
500
+ const c = r.dataTransfer;
501
+ !te(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
502
+ }), a.addEventListener("dragleave", (r) => {
503
+ te(r.dataTransfer) && (r.stopPropagation(), q = Math.max(0, q - 1), q === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
504
+ }), a.addEventListener("drop", (r) => {
505
+ const c = r.dataTransfer;
506
+ !te(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), mt(), bt(c.files).catch((L) => {
507
+ ft(L instanceof Error ? L.message : "Failed to attach file"), F("web-sdk.widget", "Attachment failed", {
508
+ message: L instanceof Error ? L.message : String(L)
481
509
  });
482
510
  }));
483
- }), f.addEventListener("click", () => {
511
+ }), x.addEventListener("click", () => {
484
512
  if (e.loginRequired) {
485
513
  e.onLoginClick?.();
486
514
  return;
487
515
  }
488
- if (C.getState().isThinking) {
489
- C.stop();
516
+ if (v.getState().isThinking) {
517
+ v.stop();
490
518
  return;
491
519
  }
492
- x = pe(C, p, x), F(), N();
493
- }), w.addEventListener("click", () => {
494
- C.startNewSession(), K.clear(), p.value = "", x = [], F(), V(p), T(), N(), p.focus();
495
- }), p.addEventListener("input", () => {
496
- V(p), T(), N();
497
- }), p.addEventListener("keydown", (i) => {
498
- if (!(i.key !== "Enter" || i.shiftKey)) {
499
- if (i.preventDefault(), e.loginRequired) {
520
+ b = he(v, h, b), C(), D();
521
+ }), g.addEventListener("click", () => {
522
+ v.startNewSession(), re.clear(), h.value = "", b = [], C(), Y(h), P(), D(), h.focus();
523
+ }), h.addEventListener("input", () => {
524
+ Y(h), P(), D();
525
+ }), h.addEventListener("keydown", (r) => {
526
+ if (!(r.key !== "Enter" || r.shiftKey)) {
527
+ if (r.preventDefault(), e.loginRequired) {
500
528
  e.onLoginClick?.();
501
529
  return;
502
530
  }
503
- x = pe(C, p, x), F(), N();
504
- }
505
- }), a.addEventListener("click", (i) => {
506
- (i.target instanceof Element ? i.target : null)?.closest("a[href]") && T();
507
- }), z.composerValue && (p.value = z.composerValue, V(p)), z.isOpen && W(p.value, !1);
508
- const Y = () => r;
509
- let oe = C.getState().appearance !== null;
510
- return C.on("state", (i) => {
511
- i.appearance ? (oe = !0, O("web-sdk.widget", "Agent state supplied appearance", {
512
- appearance: i.appearance
513
- }), ae(i.appearance, "agent.state.appearance")) : oe && (oe = !1, O("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
531
+ b = he(v, h, b), C(), D();
532
+ }
533
+ }), a.addEventListener("click", (r) => {
534
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && P();
535
+ }), z.composerValue && (h.value = z.composerValue, Y(h)), z.isOpen && B(h.value, !1);
536
+ const Le = () => i;
537
+ let se = v.getState().appearance !== null, J = null, Q = null, G = null;
538
+ const _t = !!e.socialPostDraftHandler, j = (r) => {
539
+ if (e.loginRequired) {
540
+ In(f, x, g, Le, e.loginButtonLabel, e.onLoginClick);
541
+ return;
542
+ }
543
+ Dn(
544
+ f,
545
+ x,
546
+ g,
547
+ r,
548
+ re,
549
+ P,
550
+ Le,
551
+ (c) => {
552
+ v.sendMessage(c);
553
+ },
554
+ _t ? {
555
+ dismissedCandidateIds: le,
556
+ draftingCandidateId: J,
557
+ error: Q,
558
+ onSeen: (c) => {
559
+ V.add(c.id), P();
560
+ },
561
+ onDraft: (c) => {
562
+ xt(c);
563
+ },
564
+ onDismiss: (c) => {
565
+ V.add(c.id), le.add(c.id), P(), Q = null, j(v.getState());
566
+ }
567
+ } : void 0
568
+ );
569
+ };
570
+ return v.on("state", (r) => {
571
+ r.appearance ? (se = !0, F("web-sdk.widget", "Agent state supplied appearance", {
572
+ appearance: r.appearance
573
+ }), de(r.appearance, "agent.state.appearance")) : se && (se = !1, F("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
514
574
  fallbackAccentColor: e.accentColor,
515
575
  fallbackColorScheme: e.colorScheme,
516
576
  fallbackFontFamily: e.fontFamily
517
- }), ae({}, "agent.state.appearance-cleared")), e.loginRequired ? Fe(b, f, w, Y, e.loginButtonLabel, e.onLoginClick) : Oe(b, f, w, i, K, T, Y, (g) => {
518
- C.sendMessage(g);
519
- }), N();
520
- }), e.loginRequired ? Fe(b, f, w, Y, e.loginButtonLabel, e.onLoginClick) : Oe(b, f, w, C.getState(), K, T, Y, (i) => {
521
- C.sendMessage(i);
522
- }), N(), {
523
- agent: C,
524
- updateAppearance: (i) => {
525
- i.scribbleStyle !== void 0 && (e.scribbleStyle = i.scribbleStyle), ae(i, "widgetHandle.updateAppearance");
577
+ }), de({}, "agent.state.appearance-cleared")), j(r), D();
578
+ }), j(v.getState()), D(), {
579
+ agent: v,
580
+ updateAppearance: (r) => {
581
+ r.scribbleStyle !== void 0 && (e.scribbleStyle = r.scribbleStyle), de(r, "widgetHandle.updateAppearance");
582
+ },
583
+ openPanel: () => {
584
+ B(h.value, !1);
526
585
  },
527
586
  destroy: () => {
528
- fe = !0, me.disconnect(), e.movableLauncher && window.removeEventListener("resize", we), _e(), P !== null && window.clearTimeout(P), C.destroy(), n.remove();
587
+ ve = !0, Ce.disconnect(), e.movableLauncher && window.removeEventListener("resize", ke), Se(), E !== null && window.clearTimeout(E), G?.remove(), v.destroy(), n.remove();
529
588
  }
530
589
  };
531
- function ae(i, g) {
532
- const E = i.accentColor ?? e.accentColor, H = i.colorScheme ?? e.colorScheme, xe = i.fontFamily ?? e.fontFamily, re = i.scribbleStyle ?? e.scribbleStyle;
533
- r = Pe(E, re), Ae(a, r, {
534
- accentColor: E,
535
- colorScheme: H,
536
- fontFamily: xe,
537
- scribbleStyle: re
538
- }), O("web-sdk.widget", "Updated widget appearance", {
539
- source: g,
540
- inputAppearance: i,
541
- appliedAccentColor: E,
542
- appliedColorScheme: H,
543
- appliedFontFamily: xe,
544
- appliedScribbleStyle: re,
590
+ async function xt(r) {
591
+ if (!J) {
592
+ J = r.id, Q = null, j(v.getState());
593
+ try {
594
+ if (!e.socialPostDraftHandler)
595
+ throw new Error("Social post drafting is not available here.");
596
+ const c = await e.socialPostDraftHandler(r);
597
+ if (!c.linkedinPost || !c.xPost)
598
+ throw new Error("Pluno did not return a complete social post draft.");
599
+ V.add(r.id), le.add(r.id), P(), G?.remove(), G = On(c, {
600
+ onClose: () => {
601
+ G?.remove(), G = null;
602
+ }
603
+ }), a.appendChild(G);
604
+ } catch (c) {
605
+ Q = c instanceof Error ? c.message : "Could not draft social post.";
606
+ } finally {
607
+ J = null, j(v.getState());
608
+ }
609
+ }
610
+ }
611
+ function de(r, c) {
612
+ const L = r.accentColor ?? e.accentColor, K = r.colorScheme ?? e.colorScheme, Pe = r.fontFamily ?? e.fontFamily, ce = r.scribbleStyle ?? e.scribbleStyle;
613
+ i = Fe(L, ce), ze(a, i, {
614
+ accentColor: L,
615
+ colorScheme: K,
616
+ fontFamily: Pe,
617
+ scribbleStyle: ce
618
+ }), F("web-sdk.widget", "Updated widget appearance", {
619
+ source: c,
620
+ inputAppearance: r,
621
+ appliedAccentColor: L,
622
+ appliedColorScheme: K,
623
+ appliedFontFamily: Pe,
624
+ appliedScribbleStyle: ce,
545
625
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
546
626
  });
547
627
  }
548
628
  }
549
- function Pe(t, e) {
550
- return e ? ft(t) : gt(t);
629
+ function Fe(t, e) {
630
+ return e ? St(t) : Et(t);
551
631
  }
552
- function Ae(t, e, n) {
632
+ function ze(t, e, n) {
553
633
  t.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), t.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
554
- const o = n.scribbleStyle ? Ve(n.accentColor) : n.accentColor;
555
- t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? Nt : n.fontFamily, n.scribbleStyle && Ht(t.ownerDocument);
634
+ const o = n.scribbleStyle ? Qe(n.accentColor) : n.accentColor;
635
+ t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? Wt : n.fontFamily, n.scribbleStyle && nn(t.ownerDocument);
556
636
  const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
557
- for (const r of a)
558
- r.src = e;
637
+ for (const i of a)
638
+ i.src = e;
559
639
  }
560
- function Ht(t) {
561
- if (t.getElementById(Se))
640
+ function nn(t) {
641
+ if (t.getElementById(Me))
562
642
  return;
563
643
  const e = t.createElement("style");
564
- e.id = Se, e.textContent = `@font-face {
644
+ e.id = Me, e.textContent = `@font-face {
565
645
  font-family: "Architects Daughter";
566
646
  font-style: normal;
567
647
  font-weight: 400;
@@ -569,107 +649,107 @@ function Ht(t) {
569
649
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
570
650
  }`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
571
651
  }
572
- function Vt({
652
+ function on({
573
653
  root: t,
574
654
  launcherDragHandle: e,
575
655
  getPosition: n,
576
656
  setPosition: o,
577
657
  persist: a
578
658
  }) {
579
- let r = null, l = null, d = null, u = !1;
580
- const h = () => {
581
- r = null, l = null, d = null, u = !1, t.classList.remove("pluno-pa-widget--dragging");
582
- }, c = (s) => {
583
- t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (s.preventDefault(), s.stopPropagation(), r = s.pointerId, l = { x: s.clientX, y: s.clientY }, d = n(), u = !1, e.setPointerCapture?.(s.pointerId));
584
- }, m = (s) => {
585
- if (r !== s.pointerId || !l || !d)
659
+ let i = null, l = null, p = null, s = !1;
660
+ const d = () => {
661
+ i = null, l = null, p = null, s = !1, t.classList.remove("pluno-pa-widget--dragging");
662
+ }, u = (m) => {
663
+ t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), i = m.pointerId, l = { x: m.clientX, y: m.clientY }, p = n(), s = !1, e.setPointerCapture?.(m.pointerId));
664
+ }, _ = (m) => {
665
+ if (i !== m.pointerId || !l || !p)
586
666
  return;
587
- s.preventDefault();
588
- const p = s.clientX - l.x, f = s.clientY - l.y;
589
- !u && Math.hypot(p, f) < Gt || (u = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: d.x + p, y: d.y + f }));
590
- }, y = (s) => {
591
- r === s.pointerId && (s.preventDefault(), s.stopPropagation(), u && a(), h());
592
- }, k = (s) => {
593
- r === s.pointerId && (s.preventDefault(), h());
594
- }, v = (s) => {
667
+ m.preventDefault();
668
+ const h = m.clientX - l.x, x = m.clientY - l.y;
669
+ !s && Math.hypot(h, x) < Xt || (s = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + h, y: p.y + x }));
670
+ }, w = (m) => {
671
+ i === m.pointerId && (m.preventDefault(), m.stopPropagation(), s && a(), d());
672
+ }, y = (m) => {
673
+ i === m.pointerId && (m.preventDefault(), d());
674
+ }, k = (m) => {
595
675
  if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
596
676
  return;
597
- const p = s.shiftKey ? $t : Bt, f = n();
598
- let w = null;
599
- s.key === "ArrowUp" ? w = { x: f.x, y: f.y - p } : s.key === "ArrowDown" ? w = { x: f.x, y: f.y + p } : s.key === "ArrowLeft" ? w = { x: f.x - p, y: f.y } : s.key === "ArrowRight" && (w = { x: f.x + p, y: f.y }), w && (s.preventDefault(), s.stopPropagation(), o(w), a());
677
+ const h = m.shiftKey ? Jt : Zt, x = n();
678
+ let g = null;
679
+ m.key === "ArrowUp" ? g = { x: x.x, y: x.y - h } : m.key === "ArrowDown" ? g = { x: x.x, y: x.y + h } : m.key === "ArrowLeft" ? g = { x: x.x - h, y: x.y } : m.key === "ArrowRight" && (g = { x: x.x + h, y: x.y }), g && (m.preventDefault(), m.stopPropagation(), o(g), a());
600
680
  };
601
- return e.addEventListener("pointerdown", c), e.addEventListener("pointermove", m), e.addEventListener("pointerup", y), e.addEventListener("pointercancel", k), e.addEventListener("keydown", v), () => {
602
- e.removeEventListener("pointerdown", c), e.removeEventListener("pointermove", m), e.removeEventListener("pointerup", y), e.removeEventListener("pointercancel", k), e.removeEventListener("keydown", v);
681
+ return e.addEventListener("pointerdown", u), e.addEventListener("pointermove", _), e.addEventListener("pointerup", w), e.addEventListener("pointercancel", y), e.addEventListener("keydown", k), () => {
682
+ e.removeEventListener("pointerdown", u), e.removeEventListener("pointermove", _), e.removeEventListener("pointerup", w), e.removeEventListener("pointercancel", y), e.removeEventListener("keydown", k);
603
683
  };
604
684
  }
605
- function Te(t, e = !0) {
606
- const n = B(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
685
+ function Be(t, e = !0) {
686
+ const n = U(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
607
687
  return {
608
- width: e && a && o.width > 0 ? o.width : Math.min(Ke, n.width - 36),
609
- height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? It : je
688
+ width: e && a && o.width > 0 ? o.width : Math.min(ot, n.width - 36),
689
+ height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? Ht : at
610
690
  };
611
691
  }
612
- function qt() {
613
- const t = B();
692
+ function an() {
693
+ const t = U();
614
694
  return {
615
- width: Math.min(Rt, t.width - 28),
616
- height: Math.min(Dt, t.height - 28)
695
+ width: Math.min(Vt, t.width - 28),
696
+ height: Math.min(qt, t.height - 28)
617
697
  };
618
698
  }
619
- function Kt(t, e, n) {
699
+ function rn(t, e, n) {
620
700
  const o = Number.parseFloat(t.style.left), a = Number.parseFloat(t.style.top);
621
701
  if (Number.isFinite(o) && Number.isFinite(a))
622
702
  return { x: o, y: a };
623
- const r = t.getBoundingClientRect();
624
- if (r.width > 0 || r.height > 0)
625
- return { x: r.left, y: r.top };
626
- const l = B();
703
+ const i = t.getBoundingClientRect();
704
+ if (i.width > 0 || i.height > 0)
705
+ return { x: i.left, y: i.top };
706
+ const l = U();
627
707
  return {
628
708
  x: e === "bottom-left" ? 26 : l.width - 26 - n.width,
629
709
  y: l.height - 24 - n.height
630
710
  };
631
711
  }
632
- function Ne(t, e, n) {
633
- const o = B(), a = S + jt(t);
712
+ function Ge(t, e, n) {
713
+ const o = U(), a = A + ln(t);
634
714
  return {
635
- x: te(e.x, S, Math.max(S, o.width - n.width - S)),
636
- y: te(e.y, a, Math.max(a, o.height - n.height - S))
715
+ x: ie(e.x, A, Math.max(A, o.width - n.width - A)),
716
+ y: ie(e.y, a, Math.max(a, o.height - n.height - A))
637
717
  };
638
718
  }
639
- function jt(t) {
640
- return t.classList.contains("pluno-pa-widget--scribble") ? Ft : Ot;
719
+ function ln(t) {
720
+ return t.classList.contains("pluno-pa-widget--scribble") ? Yt : Kt;
641
721
  }
642
- function Ie(t) {
643
- const e = B(), n = qt();
722
+ function $e(t) {
723
+ const e = U(), n = an();
644
724
  return {
645
- x: te(t.x, S, Math.max(S, e.width - n.width - S)),
646
- y: te(
725
+ x: ie(t.x, A, Math.max(A, e.width - n.width - A)),
726
+ y: ie(
647
727
  t.y,
648
- Le,
649
- Math.max(Le, e.height - n.height - S)
728
+ Oe,
729
+ Math.max(Oe, e.height - n.height - A)
650
730
  )
651
731
  };
652
732
  }
653
- function X(t, e) {
733
+ function ee(t, e) {
654
734
  if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), !e) {
655
735
  t.style.removeProperty("left"), t.style.removeProperty("top"), t.style.removeProperty("right"), t.style.removeProperty("bottom");
656
736
  return;
657
737
  }
658
738
  t.style.left = `${e.x}px`, t.style.top = `${e.y}px`, t.style.right = "auto", t.style.bottom = "auto";
659
739
  }
660
- function Yt(t, e) {
740
+ function pn(t, e) {
661
741
  t.style.setProperty("--pluno-pa-panel-offset-x", `${e.x}px`), t.style.setProperty("--pluno-pa-panel-offset-y", `${e.y}px`);
662
742
  }
663
- function Re(t) {
743
+ function Ue(t) {
664
744
  t.style.removeProperty("--pluno-pa-panel-offset-x"), t.style.removeProperty("--pluno-pa-panel-offset-y");
665
745
  }
666
- function B() {
746
+ function U() {
667
747
  return {
668
- width: window.innerWidth || document.documentElement.clientWidth || Ke + S * 2,
669
- height: window.innerHeight || document.documentElement.clientHeight || je + S * 2
748
+ width: window.innerWidth || document.documentElement.clientWidth || ot + A * 2,
749
+ height: window.innerHeight || document.documentElement.clientHeight || at + A * 2
670
750
  };
671
751
  }
672
- function le(t) {
752
+ function ge(t) {
673
753
  const e = t.getBoundingClientRect();
674
754
  return {
675
755
  x: Math.round(e.x),
@@ -678,10 +758,10 @@ function le(t) {
678
758
  height: Math.round(e.height)
679
759
  };
680
760
  }
681
- function te(t, e, n) {
761
+ function ie(t, e, n) {
682
762
  return Math.min(Math.max(t, e), n);
683
763
  }
684
- function O(t, e, n) {
764
+ function F(t, e, n) {
685
765
  if (typeof window > "u")
686
766
  return;
687
767
  const o = window, a = {
@@ -689,43 +769,43 @@ function O(t, e, n) {
689
769
  source: t,
690
770
  message: e,
691
771
  details: n
692
- }, r = o.__plunoProductAgentDiagnostics__ ?? [];
693
- r.push(a), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent(Pt, { detail: a }));
772
+ }, i = o.__plunoProductAgentDiagnostics__ ?? [];
773
+ 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(Gt, { detail: a }));
694
774
  }
695
- function Xt(t, e) {
696
- O("web-sdk.widget.position", t, e);
775
+ function sn(t, e) {
776
+ F("web-sdk.widget.position", t, e);
697
777
  }
698
- function pe(t, e, n) {
778
+ function he(t, e, n) {
699
779
  const o = e.value.trim();
700
780
  return !o && n.length === 0 ? n : (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), e.dispatchEvent(new Event("input", { bubbles: !0 })), []);
701
781
  }
702
- function V(t) {
782
+ function Y(t) {
703
783
  t.style.height = "0px";
704
784
  const e = Math.max(22, Math.min(t.scrollHeight, 140));
705
785
  t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
706
786
  }
707
- function Zt(t, e, n, o) {
708
- t.appendChild(nn()), t.appendChild(Jt(e, n, o)), t.appendChild(Ze("pluno-pa-widget__close", "Close", on(16), !0)), t.appendChild(Qt(n));
787
+ function dn(t, e, n, o) {
788
+ t.appendChild(mn()), t.appendChild(cn(e, n, o)), t.appendChild(lt("pluno-pa-widget__close", "Close", fn(16), !0)), t.appendChild(un(n));
709
789
  }
710
- function Jt(t, e, n) {
790
+ function cn(t, e, n) {
711
791
  const o = document.createElement("form");
712
792
  if (o.className = "pluno-pa-widget__launcher", n) {
713
- const r = document.createElement("button");
714
- r.type = "button", r.className = "pluno-pa-widget__launcher-drag-handle", r.setAttribute("aria-label", "Move Pluno launcher"), r.title = "Move Pluno launcher", o.appendChild(r);
793
+ const i = document.createElement("button");
794
+ 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);
715
795
  }
716
- o.appendChild(Xe("pluno-pa-widget__character--launcher", e));
796
+ o.appendChild(rt("pluno-pa-widget__character--launcher", e));
717
797
  const a = document.createElement("input");
718
798
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), o.appendChild(a), o;
719
799
  }
720
- function Qt(t) {
800
+ function un(t) {
721
801
  const e = document.createElement("section");
722
802
  e.className = "pluno-pa-widget__panel", e.hidden = !0;
723
803
  const n = document.createElement("div");
724
804
  n.className = "pluno-pa-widget__timeline-wrap";
725
805
  const o = document.createElement("main");
726
- return o.className = "pluno-pa-widget__timeline", o.appendChild(tn(t)), n.appendChild(o), n.appendChild(Ze("pluno-pa-widget__new-chat", "New chat", an(), !0)), e.appendChild(n), e.appendChild(en()), e;
806
+ return o.className = "pluno-pa-widget__timeline", o.appendChild(hn(t)), n.appendChild(o), n.appendChild(lt("pluno-pa-widget__new-chat", "New chat", wn(), !0)), e.appendChild(n), e.appendChild(gn()), e;
727
807
  }
728
- function en() {
808
+ function gn() {
729
809
  const t = document.createElement("form");
730
810
  t.className = "pluno-pa-widget__composer";
731
811
  const e = document.createElement("div");
@@ -736,41 +816,47 @@ function en() {
736
816
  o.className = "pluno-pa-widget__composer-inner";
737
817
  const a = document.createElement("textarea");
738
818
  a.className = "pluno-pa-widget__input", a.rows = 1, a.placeholder = "Ask for anything...", o.appendChild(a);
739
- const r = document.createElement("button");
740
- r.type = "button", r.className = "pluno-pa-widget__send", r.setAttribute("aria-label", "Send"), r.appendChild(Je()), o.appendChild(r), t.appendChild(o);
741
- const l = document.createElement("a");
742
- return l.className = "pluno-pa-widget__powered-by", l.href = "https://pluno.ai", l.target = "_blank", l.rel = "noopener noreferrer", l.textContent = "Powered by Pluno.ai", t.appendChild(l), t;
819
+ const i = document.createElement("button");
820
+ i.type = "button", i.className = "pluno-pa-widget__send", i.setAttribute("aria-label", "Send"), i.appendChild(pt()), o.appendChild(i), t.appendChild(o);
821
+ const l = document.createElement("div");
822
+ l.className = "pluno-pa-widget__composer-meta";
823
+ const p = document.createElement("a");
824
+ 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", l.appendChild(p);
825
+ const s = document.createElement("span");
826
+ s.className = "pluno-pa-widget__composer-separator", s.textContent = "-", l.appendChild(s);
827
+ const d = document.createElement("span");
828
+ return d.className = "pluno-pa-widget__ai-disclaimer", d.textContent = "AI can make mistakes. Verify outputs.", l.appendChild(d), t.appendChild(l), t;
743
829
  }
744
- function tn(t) {
830
+ function hn(t) {
745
831
  const e = document.createElement("div");
746
- return e.className = "pluno-pa-widget__empty-state", e.appendChild(Xe("pluno-pa-widget__character--empty", t)), e.appendChild(Ye()), e;
832
+ return e.className = "pluno-pa-widget__empty-state", e.appendChild(rt("pluno-pa-widget__character--empty", t)), e.appendChild(it()), e;
747
833
  }
748
- function Ye() {
834
+ function it() {
749
835
  const t = document.createElement("div");
750
836
  return t.className = "pluno-pa-widget__empty", t.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), t.appendChild(document.createElement("br")), t.appendChild(document.createTextNode("What do you want to do today?")), t;
751
837
  }
752
- function Xe(t, e) {
838
+ function rt(t, e) {
753
839
  const n = document.createElement("img");
754
840
  return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
755
841
  }
756
- function Ze(t, e, n, o) {
842
+ function lt(t, e, n, o) {
757
843
  const a = document.createElement("button");
758
844
  return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
759
845
  }
760
- function nn() {
761
- const t = _("svg", {
846
+ function mn() {
847
+ const t = S("svg", {
762
848
  class: "pluno-pa-widget__scribble-defs",
763
849
  "aria-hidden": "true",
764
850
  focusable: "false",
765
851
  width: "0",
766
852
  height: "0"
767
- }), e = _("defs");
768
- return e.appendChild(se("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(se("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(se("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
853
+ }), e = S("defs");
854
+ return e.appendChild(me("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(me("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(me("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
769
855
  }
770
- function se(t, e, n) {
771
- const o = _("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
856
+ function me(t, e, n) {
857
+ const o = S("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
772
858
  return o.appendChild(
773
- _("feTurbulence", {
859
+ S("feTurbulence", {
774
860
  type: "fractalNoise",
775
861
  baseFrequency: "0.012 0.028",
776
862
  numOctaves: "3",
@@ -778,7 +864,7 @@ function se(t, e, n) {
778
864
  result: "stroke-noise"
779
865
  })
780
866
  ), o.appendChild(
781
- _("feDisplacementMap", {
867
+ S("feDisplacementMap", {
782
868
  in: "SourceGraphic",
783
869
  in2: "stroke-noise",
784
870
  scale: "3.5",
@@ -787,7 +873,7 @@ function se(t, e, n) {
787
873
  result: "warped"
788
874
  })
789
875
  ), o.appendChild(
790
- _("feTurbulence", {
876
+ S("feTurbulence", {
791
877
  type: "fractalNoise",
792
878
  baseFrequency: "0.7",
793
879
  numOctaves: "1",
@@ -795,7 +881,7 @@ function se(t, e, n) {
795
881
  result: "ink-noise"
796
882
  })
797
883
  ), o.appendChild(
798
- _("feDisplacementMap", {
884
+ S("feDisplacementMap", {
799
885
  in: "warped",
800
886
  in2: "ink-noise",
801
887
  scale: "0.9",
@@ -804,31 +890,31 @@ function se(t, e, n) {
804
890
  })
805
891
  ), o;
806
892
  }
807
- function on(t) {
808
- const e = $("0 0 24 24", t, t, "none", "currentColor", "2.25");
809
- return e.appendChild(_("path", { d: "m6 9 6 6 6-6" })), e;
893
+ function fn(t) {
894
+ const e = W("0 0 24 24", t, t, "none", "currentColor", "2.25");
895
+ return e.appendChild(S("path", { d: "m6 9 6 6 6-6" })), e;
810
896
  }
811
- function an() {
812
- const t = $("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
813
- return t.appendChild(_("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), t.appendChild(_("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
897
+ function wn() {
898
+ const t = W("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
899
+ return t.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" })), t.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
814
900
  }
815
- function Je() {
816
- const t = $("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
817
- return t.appendChild(_("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(_("polyline", { points: "5 12 12 5 19 12" })), t;
901
+ function pt() {
902
+ const t = W("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
903
+ return t.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), t;
818
904
  }
819
- function rn() {
820
- const t = $("0 0 24 24", 18, 18, "currentColor");
821
- return t.appendChild(_("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
905
+ function bn() {
906
+ const t = W("0 0 24 24", 18, 18, "currentColor");
907
+ return t.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
822
908
  }
823
- function ln() {
824
- const t = $("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
825
- return t.appendChild(_("path", { d: "M18 6 6 18" })), t.appendChild(_("path", { d: "m6 6 12 12" })), t;
909
+ function _n() {
910
+ const t = W("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
911
+ return t.appendChild(S("path", { d: "M18 6 6 18" })), t.appendChild(S("path", { d: "m6 6 12 12" })), t;
826
912
  }
827
- function pn() {
828
- const t = $("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
829
- return t.appendChild(_("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(_("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
913
+ function xn() {
914
+ const t = W("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
915
+ return t.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.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" })), t;
830
916
  }
831
- function $(t, e, n, o, a, r) {
917
+ function W(t, e, n, o, a, i) {
832
918
  const l = {
833
919
  viewBox: t,
834
920
  width: String(e),
@@ -836,41 +922,41 @@ function $(t, e, n, o, a, r) {
836
922
  fill: o,
837
923
  "aria-hidden": "true"
838
924
  };
839
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), _("svg", l);
925
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
840
926
  }
841
- function _(t, e = {}) {
842
- const n = document.createElementNS(Mt, t);
927
+ function S(t, e = {}) {
928
+ const n = document.createElementNS(jt, t);
843
929
  for (const [o, a] of Object.entries(e))
844
930
  n.setAttribute(o, a);
845
931
  return n;
846
932
  }
847
- function De(t) {
933
+ function We(t) {
848
934
  for (const e of ["keydown", "keypress", "keyup"])
849
935
  t.addEventListener(e, (n) => {
850
936
  n.stopPropagation();
851
937
  });
852
938
  }
853
- function sn(t, e, n) {
939
+ function yn(t, e, n) {
854
940
  t.replaceChildren(), t.hidden = e.length === 0;
855
941
  for (const [o, a] of e.entries()) {
856
- const r = document.createElement("div");
857
- r.className = "pluno-pa-widget__attachment", r.appendChild(dn(a));
942
+ const i = document.createElement("div");
943
+ i.className = "pluno-pa-widget__attachment", i.appendChild(vn(a));
858
944
  const l = document.createElement("span");
859
- l.textContent = a.name, r.appendChild(l);
860
- const d = document.createElement("button");
861
- d.type = "button", d.setAttribute("aria-label", `Remove ${a.name}`), d.appendChild(ln()), d.addEventListener("click", () => n(o)), r.appendChild(d), t.appendChild(r);
945
+ l.textContent = a.name, i.appendChild(l);
946
+ const p = document.createElement("button");
947
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(_n()), p.addEventListener("click", () => n(o)), i.appendChild(p), t.appendChild(i);
862
948
  }
863
949
  }
864
- function dn(t) {
865
- if (Qe(t)) {
950
+ function vn(t) {
951
+ if (st(t)) {
866
952
  const n = document.createElement("img");
867
953
  return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
868
954
  }
869
955
  const e = document.createElement("span");
870
956
  return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
871
957
  }
872
- function cn(t) {
873
- if (Qe(t)) {
958
+ function Cn(t) {
959
+ if (st(t)) {
874
960
  const a = document.createElement("img");
875
961
  return a.src = t.dataUrl, a.alt = t.name, a;
876
962
  }
@@ -881,51 +967,51 @@ function cn(t) {
881
967
  const o = document.createElement("strong");
882
968
  return o.textContent = t.name, e.append(n, o), e;
883
969
  }
884
- function Qe(t) {
970
+ function st(t) {
885
971
  return t.mimeType.startsWith("image/");
886
972
  }
887
- function un(t) {
973
+ function En(t) {
888
974
  return t === "application/pdf" ? "document.pdf" : "image";
889
975
  }
890
- async function gn(t) {
976
+ async function kn(t) {
891
977
  if (!t)
892
978
  return [];
893
979
  const e = Array.from(t);
894
- if (e.length > ee)
895
- throw new Error(`Attach up to ${ee} files per message.`);
980
+ if (e.length > ae)
981
+ throw new Error(`Attach up to ${ae} files per message.`);
896
982
  return Promise.all(
897
983
  e.map(async (n) => {
898
- const o = hn(n);
984
+ const o = Sn(n);
899
985
  if (!o)
900
986
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
901
- if (n.size > At)
987
+ if (n.size > $t)
902
988
  throw new Error("Each Pluno attachment can be up to 10 MB.");
903
989
  if (o === "image/gif") {
904
- const a = new Uint8Array(await wn(n));
905
- if (mn(a))
990
+ const a = new Uint8Array(await Nn(n));
991
+ if (Pn(a))
906
992
  throw new Error("Pluno supports non-animated GIF images.");
907
993
  }
908
994
  return {
909
- name: n.name || un(o),
995
+ name: n.name || En(o),
910
996
  mimeType: o,
911
997
  sizeBytes: n.size,
912
- dataUrl: fn(await _n(n), o)
998
+ dataUrl: Ln(await Tn(n), o)
913
999
  };
914
1000
  })
915
1001
  );
916
1002
  }
917
- function hn(t) {
918
- if (Tt.has(t.type))
1003
+ function Sn(t) {
1004
+ if (Ut.has(t.type))
919
1005
  return t.type;
920
1006
  const e = t.name.toLowerCase();
921
1007
  return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
922
1008
  }
923
- function fn(t, e) {
1009
+ function Ln(t, e) {
924
1010
  const n = `data:${e};base64,`;
925
1011
  return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
926
1012
  }
927
- function mn(t) {
928
- if (t.length < 14 || !bn(t))
1013
+ function Pn(t) {
1014
+ if (t.length < 14 || !An(t))
929
1015
  return !1;
930
1016
  const e = t[10];
931
1017
  let n = 13;
@@ -936,7 +1022,7 @@ function mn(t) {
936
1022
  if (n += 1, a === 59)
937
1023
  return !1;
938
1024
  if (a === 33) {
939
- n += 1, n = Me(t, n);
1025
+ n += 1, n = He(t, n);
940
1026
  continue;
941
1027
  }
942
1028
  if (a !== 44)
@@ -945,17 +1031,17 @@ function mn(t) {
945
1031
  return !0;
946
1032
  if (n + 9 >= t.length)
947
1033
  return !1;
948
- const r = t[n + 8];
949
- if (n += 9, r & 128 && (n += 3 * 2 ** ((r & 7) + 1)), n >= t.length)
1034
+ const i = t[n + 8];
1035
+ if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= t.length)
950
1036
  return !1;
951
- n += 1, n = Me(t, n);
1037
+ n += 1, n = He(t, n);
952
1038
  }
953
1039
  return !1;
954
1040
  }
955
- function bn(t) {
1041
+ function An(t) {
956
1042
  return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
957
1043
  }
958
- function Me(t, e) {
1044
+ function He(t, e) {
959
1045
  for (; e < t.length; ) {
960
1046
  const n = t[e];
961
1047
  if (e += 1, n === 0)
@@ -964,10 +1050,10 @@ function Me(t, e) {
964
1050
  }
965
1051
  return e;
966
1052
  }
967
- function Z(t) {
1053
+ function te(t) {
968
1054
  return !!(t && Array.from(t.types).includes("Files"));
969
1055
  }
970
- function wn(t) {
1056
+ function Nn(t) {
971
1057
  return new Promise((e, n) => {
972
1058
  const o = new FileReader();
973
1059
  o.addEventListener("load", () => {
@@ -981,7 +1067,7 @@ function wn(t) {
981
1067
  }), o.readAsArrayBuffer(t);
982
1068
  });
983
1069
  }
984
- function _n(t) {
1070
+ function Tn(t) {
985
1071
  return new Promise((e, n) => {
986
1072
  const o = new FileReader();
987
1073
  o.addEventListener("load", () => {
@@ -995,135 +1081,226 @@ function _n(t) {
995
1081
  }), o.readAsDataURL(t);
996
1082
  });
997
1083
  }
998
- function Oe(t, e, n, o, a, r, l, d) {
999
- const u = [...o.messages];
1000
- t.replaceChildren(), tt(e, o.isThinking);
1001
- const h = u.length > 0 || !!o.assistantDraft || o.isThinking;
1002
- if (n.hidden = !h, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
1003
- const s = document.createElement("div");
1004
- s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1005
- const p = document.createElement("img");
1006
- p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = l(), p.alt = "", p.setAttribute("aria-hidden", "true"), s.appendChild(p), s.appendChild(Ye());
1007
- const f = document.createElement("div");
1008
- f.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && f.setAttribute("aria-hidden", "true");
1009
- for (const w of o.starterPrompts) {
1010
- const b = document.createElement("button");
1011
- b.type = "button", b.className = "pluno-pa-widget__starter-prompt", b.textContent = `"${w}"`, b.addEventListener("click", () => {
1012
- d(w);
1013
- }), f.appendChild(b);
1014
- }
1015
- s.appendChild(f), t.appendChild(s);
1084
+ function Dn(t, e, n, o, a, i, l, p, s) {
1085
+ const d = [...o.messages], u = d.filter((g) => !Fn(g));
1086
+ t.replaceChildren(), ct(e, o.isThinking);
1087
+ const _ = u.length > 0 || !!o.assistantDraft || o.isThinking;
1088
+ if (n.hidden = !_, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
1089
+ const g = document.createElement("div");
1090
+ g.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1091
+ const f = document.createElement("img");
1092
+ f.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", f.src = l(), f.alt = "", f.setAttribute("aria-hidden", "true"), g.appendChild(f), g.appendChild(it());
1093
+ const b = document.createElement("div");
1094
+ b.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && b.setAttribute("aria-hidden", "true");
1095
+ for (const E of o.starterPrompts) {
1096
+ const C = document.createElement("button");
1097
+ C.type = "button", C.className = "pluno-pa-widget__starter-prompt", C.textContent = `"${E}"`, C.addEventListener("click", () => {
1098
+ p(E);
1099
+ }), b.appendChild(C);
1100
+ }
1101
+ g.appendChild(b), t.appendChild(g);
1016
1102
  return;
1017
1103
  }
1018
- let c = null, m = null, y = [];
1019
- const k = () => {
1020
- if (y.length === 0)
1104
+ let w = null, y = null, k = [];
1105
+ const m = () => {
1106
+ if (k.length === 0)
1021
1107
  return !1;
1022
- const s = yn(y, a, r, l());
1023
- return t.appendChild(s), c = null, m = s, y = [], !0;
1108
+ const g = zn(k, a, i, l());
1109
+ return t.appendChild(g), w = null, y = g, k = [], !0;
1024
1110
  };
1025
- for (let s = 0; s < u.length; s += 1) {
1026
- const p = u[s];
1027
- if (p.role === "tool") {
1028
- y.push(p);
1111
+ for (let g = 0; g < u.length; g += 1) {
1112
+ const f = u[g];
1113
+ if (f.role === "tool") {
1114
+ k.push(f);
1029
1115
  continue;
1030
1116
  }
1031
- if (p.role === "system")
1117
+ if (f.role === "system")
1032
1118
  continue;
1033
- const f = k(), w = Be(p.content);
1034
- if (p.role === "assistant" && !f) {
1035
- const x = ge(l());
1036
- t.appendChild(x), c = null, m = x;
1037
- }
1038
- const b = document.createElement("div");
1039
- b.className = `pluno-pa-widget__message pluno-pa-widget__message--${p.role}`, p.role === "assistant" ? ze(b, w) : b.textContent = w, p.role === "user" && p.attachments?.length && b.appendChild(xn(p.attachments)), b.appendChild(Ge(w)), t.appendChild(b), c = b, m = null;
1119
+ const b = m(), E = Ke(f.content);
1120
+ if (f.role === "assistant" && !b) {
1121
+ const v = _e(l());
1122
+ t.appendChild(v), w = null, y = v;
1123
+ }
1124
+ const C = document.createElement("div");
1125
+ C.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Ye(C, E) : C.textContent = E, f.role === "user" && f.attachments?.length && C.appendChild(Rn(f.attachments));
1126
+ const H = document.createElement("div");
1127
+ H.className = "pluno-pa-widget__message-actions", H.appendChild(Ve(E)), C.appendChild(H), t.appendChild(C), w = C, y = null;
1040
1128
  }
1041
- const v = k();
1129
+ const h = m();
1042
1130
  if (o.assistantDraft) {
1043
- if (!v) {
1044
- const f = ge(l());
1045
- t.appendChild(f), c = null, m = f;
1131
+ if (!h) {
1132
+ const E = _e(l());
1133
+ t.appendChild(E), w = null, y = E;
1046
1134
  }
1047
- const s = Be(o.assistantDraft), p = document.createElement("div");
1048
- p.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ze(p, s), p.appendChild(Ge(s)), t.appendChild(p), c = p, m = null;
1135
+ const g = Ke(o.assistantDraft), f = document.createElement("div");
1136
+ f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ye(f, g);
1137
+ const b = document.createElement("div");
1138
+ b.className = "pluno-pa-widget__message-actions", b.appendChild(Ve(g)), f.appendChild(b), t.appendChild(f), w = f, y = null;
1049
1139
  }
1050
1140
  if (o.isThinking && !o.assistantDraft)
1051
- if (v) {
1052
- const s = et();
1053
- t.appendChild(s), c = null, m = s;
1141
+ if (h) {
1142
+ const g = dt();
1143
+ t.appendChild(g), w = null, y = g;
1054
1144
  } else {
1055
- const s = vn(l());
1056
- t.appendChild(s), c = null, m = s;
1145
+ const g = Bn(l());
1146
+ t.appendChild(g), w = null, y = g;
1057
1147
  }
1058
1148
  if (o.lastError) {
1059
- const s = document.createElement("div");
1060
- s.className = "pluno-pa-widget__error", s.textContent = o.lastError, t.appendChild(s), c = s, m = null;
1149
+ const g = document.createElement("div");
1150
+ g.className = "pluno-pa-widget__error", g.textContent = o.lastError, t.appendChild(g), w = g, y = null;
1061
1151
  }
1062
- c?.classList.add("pluno-pa-widget__message--bottom-reserve"), m?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
1152
+ const x = s && !o.isThinking ? Dt(d) : null;
1153
+ if (s && x && !s.dismissedCandidateIds.has(x.id)) {
1154
+ const g = Mn(x, {
1155
+ isDrafting: s.draftingCandidateId === x.id,
1156
+ error: s.error,
1157
+ onDraft: s.onDraft,
1158
+ onDismiss: s.onDismiss
1159
+ });
1160
+ t.appendChild(g), s.onSeen(x), w = null, y = g;
1161
+ }
1162
+ w?.classList.add("pluno-pa-widget__message--bottom-reserve"), y?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
1063
1163
  }
1064
- function Fe(t, e, n, o, a, r) {
1065
- t.replaceChildren(), tt(e, !1), e.disabled = !0, n.hidden = !0;
1164
+ function In(t, e, n, o, a, i) {
1165
+ t.replaceChildren(), ct(e, !1), e.disabled = !0, n.hidden = !0;
1066
1166
  const l = document.createElement("div");
1067
1167
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1068
- const d = document.createElement("img");
1069
- d.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", d.src = o(), d.alt = "", d.setAttribute("aria-hidden", "true"), l.appendChild(d);
1070
- const u = document.createElement("div");
1071
- u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1072
- const h = document.createElement("button");
1073
- h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = a, h.addEventListener("click", () => r?.()), l.appendChild(h), t.appendChild(l);
1074
- }
1075
- function xn(t) {
1168
+ const p = document.createElement("img");
1169
+ p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = o(), p.alt = "", p.setAttribute("aria-hidden", "true"), l.appendChild(p);
1170
+ const s = document.createElement("div");
1171
+ s.className = "pluno-pa-widget__empty", s.textContent = "Log in to use Pluno on this page.", l.appendChild(s);
1172
+ const d = document.createElement("button");
1173
+ d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), t.appendChild(l);
1174
+ }
1175
+ function Rn(t) {
1076
1176
  const e = document.createElement("div");
1077
1177
  e.className = "pluno-pa-widget__message-attachments";
1078
1178
  for (const n of t)
1079
- e.appendChild(cn(n));
1179
+ e.appendChild(Cn(n));
1080
1180
  return e;
1081
1181
  }
1082
- function Ge(t) {
1182
+ function Ve(t) {
1083
1183
  const e = document.createElement("button");
1084
- return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(pn()), e.addEventListener("click", (n) => {
1184
+ return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(xn()), e.addEventListener("click", (n) => {
1085
1185
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
1086
1186
  }), e;
1087
1187
  }
1088
- function Be(t) {
1188
+ function Mn(t, e) {
1189
+ const n = document.createElement("article");
1190
+ n.className = "pluno-pa-widget__share-prompt";
1191
+ const o = document.createElement("div");
1192
+ o.className = "pluno-pa-widget__share-prompt-body";
1193
+ const a = document.createElement("div");
1194
+ a.className = "pluno-pa-widget__share-prompt-copy";
1195
+ const i = document.createElement("strong");
1196
+ i.textContent = "Share this win?", a.appendChild(i);
1197
+ const l = document.createElement("span");
1198
+ if (l.textContent = e.isDrafting ? "Drafting your social post..." : "Create LinkedIn and X copy from this session.", a.appendChild(l), e.error) {
1199
+ const d = document.createElement("span");
1200
+ d.className = "pluno-pa-widget__share-prompt-error", d.textContent = e.error, a.appendChild(d);
1201
+ }
1202
+ o.appendChild(a);
1203
+ const p = document.createElement("div");
1204
+ p.className = "pluno-pa-widget__share-prompt-actions";
1205
+ const s = document.createElement("button");
1206
+ if (s.type = "button", s.disabled = e.isDrafting, s.addEventListener("click", () => {
1207
+ e.onDraft(t);
1208
+ }), e.isDrafting ? (s.appendChild(xe()), s.appendChild(document.createTextNode("Drafting..."))) : s.textContent = "Draft social post", p.appendChild(s), !e.isDrafting) {
1209
+ const d = document.createElement("button");
1210
+ d.type = "button", d.className = "pluno-pa-widget__share-prompt-dismiss", d.setAttribute("aria-label", "Dismiss share prompt"), d.title = "Dismiss", d.textContent = "Dismiss", d.addEventListener("click", () => {
1211
+ e.onDismiss(t);
1212
+ }), p.appendChild(d);
1213
+ }
1214
+ return o.appendChild(p), n.appendChild(o), n;
1215
+ }
1216
+ function On(t, e) {
1217
+ const n = document.createElement("div");
1218
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (w) => {
1219
+ w.target === n && e.onClose();
1220
+ });
1221
+ const o = document.createElement("section");
1222
+ o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft social post");
1223
+ const a = document.createElement("header"), i = document.createElement("strong");
1224
+ i.textContent = "Draft social post", a.appendChild(i);
1225
+ const l = document.createElement("button");
1226
+ if (l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", e.onClose), a.appendChild(l), o.appendChild(a), t.screenshotDataUrl) {
1227
+ const w = document.createElement("img");
1228
+ w.className = "pluno-pa-widget__share-dialog-screenshot", w.src = t.screenshotDataUrl, w.alt = "Product page with Pluno open", o.appendChild(w);
1229
+ }
1230
+ const p = document.createElement("div");
1231
+ p.className = "pluno-pa-widget__share-dialog-fields";
1232
+ const s = qe("LinkedIn", t.linkedinPost), d = qe("X", t.xPost);
1233
+ p.appendChild(s.field), p.appendChild(d.field), o.appendChild(p);
1234
+ const u = document.createElement("p");
1235
+ u.className = "pluno-pa-widget__share-dialog-status", u.hidden = !0, o.appendChild(u);
1236
+ const _ = document.createElement("footer");
1237
+ return _.appendChild(je("Copy LinkedIn", s.textarea, u)), _.appendChild(je("Copy X", d.textarea, u)), o.appendChild(_), n.appendChild(o), window.setTimeout(() => {
1238
+ s.textarea.focus(), s.textarea.setSelectionRange(0, 0);
1239
+ }, 0), n;
1240
+ }
1241
+ function qe(t, e) {
1242
+ const n = document.createElement("label");
1243
+ n.className = "pluno-pa-widget__share-dialog-field";
1244
+ const o = document.createElement("span");
1245
+ o.textContent = t, n.appendChild(o);
1246
+ const a = document.createElement("textarea");
1247
+ return a.value = e, a.rows = t === "LinkedIn" ? 5 : 4, n.appendChild(a), { field: n, textarea: a };
1248
+ }
1249
+ function je(t, e, n) {
1250
+ const o = document.createElement("button");
1251
+ return o.type = "button", o.textContent = t, o.addEventListener("click", () => {
1252
+ navigator.clipboard.writeText(e.value).then(
1253
+ () => {
1254
+ n.textContent = `${t.replace("Copy ", "")} copied.`, n.hidden = !1;
1255
+ },
1256
+ () => {
1257
+ n.textContent = "Copy failed.", n.hidden = !1;
1258
+ }
1259
+ );
1260
+ }), o;
1261
+ }
1262
+ function Fn(t) {
1263
+ return t.role === "tool" && t.toolName === tt;
1264
+ }
1265
+ function Ke(t) {
1089
1266
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1090
1267
  }
1091
- function yn(t, e, n, o) {
1268
+ function zn(t, e, n, o) {
1092
1269
  const a = document.createElement("article");
1093
1270
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
1094
- const r = document.createElement("img");
1095
- r.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", r.src = o, r.alt = "", r.setAttribute("aria-hidden", "true"), a.appendChild(r);
1096
- const l = document.createElement("details"), d = Cn(t);
1097
- l.open = e.has(d), l.addEventListener("toggle", () => {
1098
- l.open ? e.add(d) : e.delete(d), n();
1271
+ const i = document.createElement("img");
1272
+ i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1273
+ const l = document.createElement("details"), p = Gn(t);
1274
+ l.open = e.has(p), l.addEventListener("toggle", () => {
1275
+ l.open ? e.add(p) : e.delete(p), n();
1099
1276
  });
1100
- const u = document.createElement("summary");
1101
- u.className = "pluno-pa-widget__tool-summary", t.some((m) => m.loading) && u.appendChild($e());
1102
- const c = document.createElement("span");
1103
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = t[t.length - 1].content || "Run tool", u.appendChild(c), l.appendChild(u), t.length > 0) {
1104
- const m = document.createElement("div");
1105
- m.className = "pluno-pa-widget__tool-lines";
1106
- for (const y of t) {
1107
- const k = document.createElement("div");
1108
- k.className = "pluno-pa-widget__tool-line", y.loading && k.appendChild($e());
1109
- const v = document.createElement("span");
1110
- v.textContent = y.content || "Run tool", k.appendChild(v), m.appendChild(k);
1111
- }
1112
- l.appendChild(m);
1277
+ const s = document.createElement("summary");
1278
+ s.className = "pluno-pa-widget__tool-summary", t.some((_) => _.loading) && s.appendChild(xe());
1279
+ const u = document.createElement("span");
1280
+ if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = t[t.length - 1].content || "Run tool", s.appendChild(u), l.appendChild(s), t.length > 0) {
1281
+ const _ = document.createElement("div");
1282
+ _.className = "pluno-pa-widget__tool-lines";
1283
+ for (const w of t) {
1284
+ const y = document.createElement("div");
1285
+ y.className = "pluno-pa-widget__tool-line", w.loading && y.appendChild(xe());
1286
+ const k = document.createElement("span");
1287
+ k.textContent = w.content || "Run tool", y.appendChild(k), _.appendChild(y);
1288
+ }
1289
+ l.appendChild(_);
1113
1290
  }
1114
1291
  return a.appendChild(l), a;
1115
1292
  }
1116
- function ge(t) {
1293
+ function _e(t) {
1117
1294
  const e = document.createElement("article");
1118
1295
  e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1119
1296
  const n = document.createElement("img");
1120
1297
  return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e;
1121
1298
  }
1122
- function vn(t) {
1123
- const e = ge(t);
1124
- return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(et()), e;
1299
+ function Bn(t) {
1300
+ const e = _e(t);
1301
+ return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(dt()), e;
1125
1302
  }
1126
- function et() {
1303
+ function dt() {
1127
1304
  const t = document.createElement("div");
1128
1305
  t.className = "pluno-pa-widget__status";
1129
1306
  const e = document.createElement("span");
@@ -1131,17 +1308,17 @@ function et() {
1131
1308
  const n = document.createElement("span");
1132
1309
  return n.textContent = "Thinking...", t.appendChild(n), t;
1133
1310
  }
1134
- function Cn(t) {
1311
+ function Gn(t) {
1135
1312
  return `tools:${t.map((e) => e.id).join("|")}`;
1136
1313
  }
1137
- function $e() {
1314
+ function xe() {
1138
1315
  const t = document.createElement("span");
1139
1316
  return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
1140
1317
  }
1141
- function tt(t, e) {
1142
- t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? rn() : Je());
1318
+ function ct(t, e) {
1319
+ t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? bn() : pt());
1143
1320
  }
1144
- function ze(t, e) {
1321
+ function Ye(t, e) {
1145
1322
  const n = e.replace(/\r\n/g, `
1146
1323
  `).split(`
1147
1324
  `);
@@ -1153,77 +1330,77 @@ function ze(t, e) {
1153
1330
  continue;
1154
1331
  }
1155
1332
  if (a.match(/^```(\w+)?\s*$/)) {
1156
- const h = [];
1333
+ const d = [];
1157
1334
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1158
- h.push(n[o]), o += 1;
1335
+ d.push(n[o]), o += 1;
1159
1336
  o += o < n.length ? 1 : 0;
1160
- const c = document.createElement("pre"), m = document.createElement("code");
1161
- m.textContent = h.join(`
1162
- `), c.appendChild(m), t.appendChild(c);
1337
+ const u = document.createElement("pre"), _ = document.createElement("code");
1338
+ _.textContent = d.join(`
1339
+ `), u.appendChild(_), t.appendChild(u);
1163
1340
  continue;
1164
1341
  }
1165
1342
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1166
1343
  if (l) {
1167
- const h = document.createElement(`h${l[1].length + 2}`);
1168
- J(h, l[2]), t.appendChild(h), o += 1;
1344
+ const d = document.createElement(`h${l[1].length + 2}`);
1345
+ ne(d, l[2]), t.appendChild(d), o += 1;
1169
1346
  continue;
1170
1347
  }
1171
1348
  if (/^\s*[-*+]\s+/.test(a)) {
1172
- const h = document.createElement("ul");
1349
+ const d = document.createElement("ul");
1173
1350
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1174
- const c = document.createElement("li");
1175
- J(c, n[o].replace(/^\s*[-*+]\s+/, "")), h.appendChild(c), o += 1;
1351
+ const u = document.createElement("li");
1352
+ ne(u, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(u), o += 1;
1176
1353
  }
1177
- t.appendChild(h);
1354
+ t.appendChild(d);
1178
1355
  continue;
1179
1356
  }
1180
1357
  if (/^\s*\d+\.\s+/.test(a)) {
1181
- const h = document.createElement("ol");
1358
+ const d = document.createElement("ol");
1182
1359
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1183
- const c = document.createElement("li");
1184
- J(c, n[o].replace(/^\s*\d+\.\s+/, "")), h.appendChild(c), o += 1;
1360
+ const u = document.createElement("li");
1361
+ ne(u, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(u), o += 1;
1185
1362
  }
1186
- t.appendChild(h);
1363
+ t.appendChild(d);
1187
1364
  continue;
1188
1365
  }
1189
- const d = [a];
1366
+ const p = [a];
1190
1367
  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]); )
1191
- d.push(n[o]), o += 1;
1192
- const u = document.createElement("p");
1193
- d.forEach((h, c) => {
1194
- c > 0 && u.appendChild(document.createElement("br")), J(u, h);
1195
- }), t.appendChild(u);
1368
+ p.push(n[o]), o += 1;
1369
+ const s = document.createElement("p");
1370
+ p.forEach((d, u) => {
1371
+ u > 0 && s.appendChild(document.createElement("br")), ne(s, d);
1372
+ }), t.appendChild(s);
1196
1373
  }
1197
1374
  }
1198
- function J(t, e) {
1375
+ function ne(t, e) {
1199
1376
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1200
1377
  let o = 0;
1201
1378
  for (const a of e.matchAll(n)) {
1202
- const r = a.index ?? 0;
1203
- r > o && t.appendChild(document.createTextNode(e.slice(o, r)));
1379
+ const i = a.index ?? 0;
1380
+ i > o && t.appendChild(document.createTextNode(e.slice(o, i)));
1204
1381
  const l = a[0];
1205
1382
  if (l.startsWith("`")) {
1206
- const d = document.createElement("code");
1207
- d.textContent = l.slice(1, -1), t.appendChild(d);
1383
+ const p = document.createElement("code");
1384
+ p.textContent = l.slice(1, -1), t.appendChild(p);
1208
1385
  } else if (l.startsWith("**")) {
1209
- const d = document.createElement("strong");
1210
- d.textContent = l.slice(2, -2), t.appendChild(d);
1386
+ const p = document.createElement("strong");
1387
+ p.textContent = l.slice(2, -2), t.appendChild(p);
1211
1388
  } else if (l.startsWith("*")) {
1212
- const d = document.createElement("em");
1213
- d.textContent = l.slice(1, -1), t.appendChild(d);
1389
+ const p = document.createElement("em");
1390
+ p.textContent = l.slice(1, -1), t.appendChild(p);
1214
1391
  } else {
1215
- const d = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1216
- if (d && En(d[2])) {
1217
- const u = document.createElement("a");
1218
- u.href = d[2], u.target = "_top", u.rel = "noreferrer", u.textContent = d[1], t.appendChild(u);
1392
+ const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1393
+ if (p && $n(p[2])) {
1394
+ const s = document.createElement("a");
1395
+ s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], t.appendChild(s);
1219
1396
  } else
1220
1397
  t.appendChild(document.createTextNode(l));
1221
1398
  }
1222
- o = r + l.length;
1399
+ o = i + l.length;
1223
1400
  }
1224
1401
  o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
1225
1402
  }
1226
- function En(t) {
1403
+ function $n(t) {
1227
1404
  if (t.startsWith("/") || t.startsWith("#"))
1228
1405
  return !0;
1229
1406
  try {
@@ -1233,7 +1410,7 @@ function En(t) {
1233
1410
  return !1;
1234
1411
  }
1235
1412
  }
1236
- function We(t, e) {
1413
+ function Xe(t, e) {
1237
1414
  if (t.getElementById("pluno-pa-widget-styles"))
1238
1415
  return;
1239
1416
  const n = t.ownerDocument.createElement("style");
@@ -1288,7 +1465,7 @@ function We(t, e) {
1288
1465
  --pluno-pa-accent-contrast: #fafafa;
1289
1466
  position: fixed;
1290
1467
  z-index: 2147483645;
1291
- font-family: ${D.fontFamily};
1468
+ font-family: ${I.fontFamily};
1292
1469
  font-size: 14px;
1293
1470
  color: var(--pluno-pa-text);
1294
1471
  width: var(--pluno-pa-launcher-width);
@@ -1395,10 +1572,10 @@ function We(t, e) {
1395
1572
  }
1396
1573
  .pluno-pa-widget__character--launcher {
1397
1574
  position: absolute;
1398
- left: 10px;
1575
+ left: 8px;
1399
1576
  top: 50%;
1400
- width: 34px;
1401
- height: 34px;
1577
+ width: 38px;
1578
+ height: 38px;
1402
1579
  transform: translateY(-50%);
1403
1580
  pointer-events: none;
1404
1581
  }
@@ -1409,7 +1586,7 @@ function We(t, e) {
1409
1586
  outline: none;
1410
1587
  background: transparent;
1411
1588
  color: var(--pluno-pa-text);
1412
- padding: 0 12px 0 44px;
1589
+ padding: 0 12px 0 48px;
1413
1590
  font: inherit;
1414
1591
  font-size: 15px;
1415
1592
  line-height: 22px;
@@ -1684,20 +1861,45 @@ function We(t, e) {
1684
1861
  transform: translateY(-2px);
1685
1862
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease, color 120ms ease;
1686
1863
  }
1864
+ .pluno-pa-widget__message-actions {
1865
+ position: absolute;
1866
+ bottom: -30px;
1867
+ z-index: 3;
1868
+ display: inline-flex;
1869
+ gap: 6px;
1870
+ opacity: 0;
1871
+ pointer-events: none;
1872
+ transform: translateY(-2px);
1873
+ transition: opacity 120ms ease, transform 120ms ease;
1874
+ }
1875
+ .pluno-pa-widget__message-actions .pluno-pa-widget__message-copy {
1876
+ position: static;
1877
+ opacity: 1;
1878
+ pointer-events: auto;
1879
+ transform: none;
1880
+ }
1687
1881
  .pluno-pa-widget__message--user::after {
1688
1882
  right: 0;
1689
1883
  }
1690
1884
  .pluno-pa-widget__message--user .pluno-pa-widget__message-copy {
1691
1885
  right: 4px;
1692
1886
  }
1887
+ .pluno-pa-widget__message--user .pluno-pa-widget__message-actions {
1888
+ right: 4px;
1889
+ }
1693
1890
  .pluno-pa-widget__message--assistant::after {
1694
1891
  left: 0;
1695
1892
  }
1696
1893
  .pluno-pa-widget__message--assistant .pluno-pa-widget__message-copy {
1697
1894
  left: 2px;
1698
1895
  }
1896
+ .pluno-pa-widget__message--assistant .pluno-pa-widget__message-actions {
1897
+ left: 2px;
1898
+ }
1699
1899
  .pluno-pa-widget__message:hover .pluno-pa-widget__message-copy,
1700
- .pluno-pa-widget__message-copy:focus-visible {
1900
+ .pluno-pa-widget__message-copy:focus-visible,
1901
+ .pluno-pa-widget__message:hover .pluno-pa-widget__message-actions,
1902
+ .pluno-pa-widget__message-actions:focus-within {
1701
1903
  opacity: 1;
1702
1904
  pointer-events: auto;
1703
1905
  transform: translateY(0);
@@ -1789,9 +1991,9 @@ function We(t, e) {
1789
1991
  margin-bottom: -8px;
1790
1992
  }
1791
1993
  .pluno-pa-widget__character--tool-group {
1792
- width: 33px;
1793
- height: 33px;
1794
- margin-top: -7px;
1994
+ width: 36px;
1995
+ height: 36px;
1996
+ margin-top: -8px;
1795
1997
  }
1796
1998
  .pluno-pa-widget__assistant-marker {
1797
1999
  min-height: 19px;
@@ -1863,6 +2065,188 @@ function We(t, e) {
1863
2065
  @keyframes pluno-pa-spin {
1864
2066
  to { transform: rotate(360deg); }
1865
2067
  }
2068
+ .pluno-pa-widget__share-prompt {
2069
+ align-self: stretch;
2070
+ display: block;
2071
+ color: var(--pluno-pa-muted);
2072
+ font-size: 12px;
2073
+ line-height: 1.35;
2074
+ margin-top: -4px;
2075
+ }
2076
+ .pluno-pa-widget__share-prompt-body {
2077
+ min-width: 0;
2078
+ display: grid;
2079
+ gap: 8px;
2080
+ border: 1px solid var(--pluno-pa-divider);
2081
+ border-radius: 8px;
2082
+ background: color-mix(in srgb, var(--pluno-pa-surface) 78%, transparent);
2083
+ padding: 8px;
2084
+ }
2085
+ .pluno-pa-widget__share-prompt-copy {
2086
+ min-width: 0;
2087
+ display: grid;
2088
+ gap: 2px;
2089
+ }
2090
+ .pluno-pa-widget__share-prompt-copy strong {
2091
+ color: var(--pluno-pa-text);
2092
+ font-size: 12px;
2093
+ line-height: 1.25;
2094
+ font-weight: 650;
2095
+ }
2096
+ .pluno-pa-widget__share-prompt-copy span {
2097
+ color: var(--pluno-pa-muted);
2098
+ font-size: 11px;
2099
+ line-height: 1.35;
2100
+ }
2101
+ .pluno-pa-widget__share-prompt-copy .pluno-pa-widget__share-prompt-error {
2102
+ color: #ef4444;
2103
+ }
2104
+ .pluno-pa-widget__share-prompt-actions {
2105
+ display: flex;
2106
+ align-items: center;
2107
+ justify-content: flex-start;
2108
+ gap: 6px;
2109
+ }
2110
+ .pluno-pa-widget__share-prompt-actions button {
2111
+ min-height: 28px;
2112
+ border: 1px solid var(--pluno-pa-divider);
2113
+ border-radius: 8px;
2114
+ background: var(--pluno-pa-bg);
2115
+ color: var(--pluno-pa-text);
2116
+ padding: 0 8px;
2117
+ font-size: 12px;
2118
+ font-weight: 650;
2119
+ line-height: 1;
2120
+ cursor: pointer;
2121
+ }
2122
+ .pluno-pa-widget__share-prompt-actions button:first-child {
2123
+ display: inline-flex;
2124
+ align-items: center;
2125
+ gap: 7px;
2126
+ border-color: color-mix(in srgb, var(--pluno-pa-accent) 45%, var(--pluno-pa-divider));
2127
+ background: var(--pluno-pa-bg);
2128
+ color: var(--pluno-pa-text);
2129
+ }
2130
+ .pluno-pa-widget__share-prompt-actions button:first-child:disabled {
2131
+ cursor: default;
2132
+ opacity: 0.78;
2133
+ }
2134
+ .pluno-pa-widget__share-prompt-dismiss {
2135
+ width: auto;
2136
+ padding: 0 8px !important;
2137
+ background: var(--pluno-pa-surface);
2138
+ color: var(--pluno-pa-muted);
2139
+ }
2140
+ .pluno-pa-widget__share-dialog-backdrop {
2141
+ position: fixed;
2142
+ inset: 0;
2143
+ z-index: 2147483647;
2144
+ display: grid;
2145
+ place-items: center;
2146
+ padding: 18px;
2147
+ background: rgba(24, 24, 27, 0.28);
2148
+ font-family: var(--pluno-pa-font, ${I.fontFamily});
2149
+ color: var(--pluno-pa-text);
2150
+ }
2151
+ .pluno-pa-widget__share-dialog {
2152
+ width: min(390px, calc(100vw - 36px));
2153
+ max-height: min(650px, calc(100vh - 36px));
2154
+ display: flex;
2155
+ flex-direction: column;
2156
+ gap: 12px;
2157
+ border: 1px solid var(--pluno-pa-divider);
2158
+ border-radius: 12px;
2159
+ background: var(--pluno-pa-bg);
2160
+ box-shadow: 0 24px 70px rgba(24, 24, 27, 0.22);
2161
+ padding: 14px;
2162
+ }
2163
+ .pluno-pa-widget__share-dialog header,
2164
+ .pluno-pa-widget__share-dialog footer {
2165
+ display: flex;
2166
+ align-items: center;
2167
+ justify-content: space-between;
2168
+ gap: 10px;
2169
+ }
2170
+ .pluno-pa-widget__share-dialog header strong {
2171
+ color: var(--pluno-pa-text);
2172
+ font-size: 15px;
2173
+ line-height: 1.2;
2174
+ }
2175
+ .pluno-pa-widget__share-dialog header button {
2176
+ width: 30px;
2177
+ height: 30px;
2178
+ border: 1px solid var(--pluno-pa-divider);
2179
+ border-radius: 999px;
2180
+ background: var(--pluno-pa-surface);
2181
+ color: var(--pluno-pa-muted);
2182
+ cursor: pointer;
2183
+ }
2184
+ .pluno-pa-widget__share-dialog-screenshot {
2185
+ width: 100%;
2186
+ max-height: 180px;
2187
+ object-fit: cover;
2188
+ border: 1px solid var(--pluno-pa-divider);
2189
+ border-radius: 8px;
2190
+ background: var(--pluno-pa-surface);
2191
+ }
2192
+ .pluno-pa-widget__share-dialog-fields {
2193
+ min-height: 0;
2194
+ display: grid;
2195
+ gap: 10px;
2196
+ overflow: auto;
2197
+ }
2198
+ .pluno-pa-widget__share-dialog-field {
2199
+ display: grid;
2200
+ gap: 6px;
2201
+ min-width: 0;
2202
+ }
2203
+ .pluno-pa-widget__share-dialog-field span {
2204
+ color: var(--pluno-pa-muted);
2205
+ font-size: 12px;
2206
+ font-weight: 650;
2207
+ line-height: 1.2;
2208
+ }
2209
+ .pluno-pa-widget__share-dialog-field textarea {
2210
+ width: 100%;
2211
+ resize: vertical;
2212
+ min-height: 96px;
2213
+ max-height: 220px;
2214
+ border: 1px solid var(--pluno-pa-divider);
2215
+ border-radius: 8px;
2216
+ background: var(--pluno-pa-surface);
2217
+ color: var(--pluno-pa-text);
2218
+ padding: 9px 10px;
2219
+ font-size: 13px;
2220
+ line-height: 1.45;
2221
+ outline: none;
2222
+ }
2223
+ .pluno-pa-widget__share-dialog-field textarea:focus {
2224
+ border-color: var(--pluno-pa-accent);
2225
+ }
2226
+ .pluno-pa-widget__share-dialog-status {
2227
+ min-height: 16px;
2228
+ margin: -2px 0 0;
2229
+ color: var(--pluno-pa-muted);
2230
+ font-size: 12px;
2231
+ line-height: 1.3;
2232
+ }
2233
+ .pluno-pa-widget__share-dialog-status[hidden] {
2234
+ display: none;
2235
+ }
2236
+ .pluno-pa-widget__share-dialog footer {
2237
+ justify-content: flex-end;
2238
+ }
2239
+ .pluno-pa-widget__share-dialog footer button {
2240
+ min-height: 34px;
2241
+ border: 0;
2242
+ border-radius: 8px;
2243
+ background: var(--pluno-pa-text);
2244
+ color: var(--pluno-pa-bg);
2245
+ padding: 0 12px;
2246
+ font-size: 12px;
2247
+ font-weight: 650;
2248
+ cursor: pointer;
2249
+ }
1866
2250
  .pluno-pa-widget__composer {
1867
2251
  flex: 0 0 auto;
1868
2252
  margin: 0;
@@ -2023,20 +2407,33 @@ function We(t, e) {
2023
2407
  color: var(--pluno-pa-faint);
2024
2408
  cursor: not-allowed;
2025
2409
  }
2026
- .pluno-pa-widget__powered-by {
2027
- display: block;
2028
- width: fit-content;
2029
- margin: 8px auto 0;
2410
+ .pluno-pa-widget__composer-meta {
2411
+ display: flex;
2412
+ align-items: center;
2413
+ justify-content: center;
2414
+ margin-top: 8px;
2030
2415
  color: var(--pluno-pa-faint);
2031
2416
  font: inherit;
2032
2417
  font-size: 11px;
2033
2418
  line-height: 1.2;
2419
+ flex-wrap: wrap;
2420
+ text-align: center;
2421
+ }
2422
+ .pluno-pa-widget__powered-by {
2423
+ color: inherit;
2034
2424
  text-decoration: none;
2035
2425
  transition: color 120ms ease;
2036
2426
  }
2037
2427
  .pluno-pa-widget__powered-by:hover {
2038
2428
  color: var(--pluno-pa-muted);
2039
2429
  }
2430
+ .pluno-pa-widget__composer-separator {
2431
+ margin: 0 5px;
2432
+ color: inherit;
2433
+ }
2434
+ .pluno-pa-widget__ai-disclaimer {
2435
+ color: inherit;
2436
+ }
2040
2437
  .pluno-pa-widget__empty,
2041
2438
  .pluno-pa-widget__status,
2042
2439
  .pluno-pa-widget__error {
@@ -2060,8 +2457,8 @@ function We(t, e) {
2060
2457
  padding: 0;
2061
2458
  }
2062
2459
  .pluno-pa-widget__character--empty {
2063
- width: 88px;
2064
- height: 88px;
2460
+ width: 96px;
2461
+ height: 96px;
2065
2462
  margin-bottom: -4px;
2066
2463
  }
2067
2464
  .pluno-pa-widget__empty-state--starter {
@@ -2219,7 +2616,7 @@ function We(t, e) {
2219
2616
  right: 16px;
2220
2617
  height: 36px;
2221
2618
  z-index: 3;
2222
- background-image: url('${ke}');
2619
+ background-image: url('${Re}');
2223
2620
  background-repeat: repeat-x;
2224
2621
  background-size: 104px 36px;
2225
2622
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -2257,16 +2654,16 @@ function We(t, e) {
2257
2654
  font-size: 28px;
2258
2655
  }
2259
2656
  .pluno-pa-widget--scribble .pluno-pa-widget__character--empty {
2260
- width: 132px;
2261
- height: 132px;
2657
+ width: 160px;
2658
+ height: 160px;
2262
2659
  }
2263
2660
  .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
2264
- margin-bottom: -36px;
2661
+ margin-bottom: -42px;
2265
2662
  }
2266
2663
  .pluno-pa-widget--scribble .pluno-pa-widget__character--tool-group {
2267
- width: 50px;
2268
- height: 50px;
2269
- margin-top: -11px;
2664
+ width: 60px;
2665
+ height: 60px;
2666
+ margin-top: -14px;
2270
2667
  }
2271
2668
  .pluno-pa-widget--scribble .pluno-pa-widget__tool-group {
2272
2669
  align-items: center;
@@ -2291,13 +2688,22 @@ function We(t, e) {
2291
2688
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner {
2292
2689
  border-radius: var(--pluno-pa-scribble-wobble);
2293
2690
  }
2691
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
2692
+ position: relative;
2693
+ border-radius: var(--pluno-pa-scribble-wobble);
2694
+ }
2695
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
2696
+ position: relative;
2697
+ }
2294
2698
  .pluno-pa-widget--scribble .pluno-pa-widget__message--user,
2295
2699
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
2296
2700
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
2297
2701
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
2298
2702
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
2299
2703
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
2300
- .pluno-pa-widget--scribble .pluno-pa-widget__close {
2704
+ .pluno-pa-widget--scribble .pluno-pa-widget__close,
2705
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body,
2706
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
2301
2707
  isolation: isolate;
2302
2708
  border: 2px solid transparent;
2303
2709
  background: transparent;
@@ -2309,7 +2715,9 @@ function We(t, e) {
2309
2715
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
2310
2716
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
2311
2717
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
2312
- .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
2718
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
2719
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body::before,
2720
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button::before {
2313
2721
  content: "";
2314
2722
  position: absolute;
2315
2723
  inset: -2px;
@@ -2332,7 +2740,8 @@ function We(t, e) {
2332
2740
  }
2333
2741
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
2334
2742
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
2335
- .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
2743
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
2744
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button::before {
2336
2745
  background: var(--pluno-pa-bg);
2337
2746
  }
2338
2747
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within {
@@ -2344,13 +2753,15 @@ function We(t, e) {
2344
2753
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
2345
2754
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
2346
2755
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
2347
- .pluno-pa-widget--scribble .pluno-pa-widget__close {
2756
+ .pluno-pa-widget--scribble .pluno-pa-widget__close,
2757
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
2348
2758
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
2349
2759
  }
2350
2760
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
2351
2761
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
2352
2762
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
2353
- .pluno-pa-widget--scribble .pluno-pa-widget__close::after {
2763
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::after,
2764
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button::after {
2354
2765
  content: "";
2355
2766
  position: absolute;
2356
2767
  inset: -3px;
@@ -2396,10 +2807,14 @@ function We(t, e) {
2396
2807
  height: 48px;
2397
2808
  }
2398
2809
  .pluno-pa-widget--scribble .pluno-pa-widget__character--launcher {
2810
+ left: 5px;
2811
+ width: 44px;
2812
+ height: 44px;
2399
2813
  margin-top: 3px;
2400
2814
  }
2401
2815
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-input {
2402
2816
  margin-top: 2px;
2817
+ padding-left: 54px;
2403
2818
  }
2404
2819
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-drag-handle {
2405
2820
  top: -13px;
@@ -2423,7 +2838,7 @@ function We(t, e) {
2423
2838
  right: 12px;
2424
2839
  height: 22px;
2425
2840
  z-index: 1;
2426
- background-image: url('${ke}');
2841
+ background-image: url('${Re}');
2427
2842
  background-repeat: repeat-x;
2428
2843
  background-size: 62px 21.5px;
2429
2844
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -2437,7 +2852,7 @@ function We(t, e) {
2437
2852
  }
2438
2853
  `, t.appendChild(n);
2439
2854
  }
2440
- async function kn() {
2855
+ async function Un() {
2441
2856
  return document.body ? document.body : await new Promise((t) => {
2442
2857
  const e = new MutationObserver(() => {
2443
2858
  document.body && (e.disconnect(), t(document.body));
@@ -2445,62 +2860,63 @@ async function kn() {
2445
2860
  e.observe(document.documentElement, { childList: !0 });
2446
2861
  });
2447
2862
  }
2448
- function nt(t) {
2863
+ function ut(t) {
2449
2864
  return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
2450
2865
  }
2451
- function Sn(t) {
2866
+ function Wn(t) {
2452
2867
  try {
2453
- const e = window.localStorage.getItem(nt(t));
2868
+ const e = window.localStorage.getItem(ut(t));
2454
2869
  if (!e)
2455
- return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
2870
+ return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null, seenShareCandidateIds: [] };
2456
2871
  const n = JSON.parse(e);
2457
2872
  return {
2458
2873
  isOpen: n.isOpen === !0,
2459
2874
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
2460
2875
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
2461
- launcherPosition: Pn(n.launcherPosition) ? n.launcherPosition : null
2876
+ launcherPosition: Vn(n.launcherPosition) ? n.launcherPosition : null,
2877
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-nt) : []
2462
2878
  };
2463
2879
  } catch {
2464
- return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
2880
+ return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null, seenShareCandidateIds: [] };
2465
2881
  }
2466
2882
  }
2467
- function Ln(t, e) {
2883
+ function Hn(t, e) {
2468
2884
  try {
2469
- window.localStorage.setItem(nt(t), JSON.stringify(e));
2885
+ window.localStorage.setItem(ut(t), JSON.stringify(e));
2470
2886
  } catch {
2471
2887
  return;
2472
2888
  }
2473
2889
  }
2474
- function Pn(t) {
2890
+ function Vn(t) {
2475
2891
  if (!t || typeof t != "object")
2476
2892
  return !1;
2477
2893
  const e = t;
2478
2894
  return Number.isFinite(e.x) && Number.isFinite(e.y);
2479
2895
  }
2480
- const Ue = /* @__PURE__ */ new WeakSet();
2481
- function An(t) {
2896
+ const Ze = /* @__PURE__ */ new WeakSet();
2897
+ function qn(t) {
2482
2898
  return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
2483
2899
  }
2484
- function He(t) {
2900
+ function Je(t) {
2485
2901
  const e = t.pathname.split("/");
2486
2902
  return e[e.length - 1] ?? "";
2487
2903
  }
2488
- function Tn(t, e) {
2904
+ function jn(t, e) {
2489
2905
  const n = new URL(t.src, document.baseURI);
2490
- return n.href === e.href || n.pathname === e.pathname ? !0 : He(n) === He(e);
2906
+ return n.href === e.href || n.pathname === e.pathname ? !0 : Je(n) === Je(e);
2491
2907
  }
2492
- class I extends EventTarget {
2908
+ class R extends EventTarget {
2493
2909
  constructor(e, n) {
2494
- super(), this.channelId = n, this.url = e, this.addPreviewListener(Et, () => {
2495
- this.readyState = I.OPEN, this.dispatchEvent(new Event("open"));
2496
- }), this.addPreviewListener(kt, (o) => {
2910
+ super(), this.channelId = n, this.url = e, this.addPreviewListener(Ot, () => {
2911
+ this.readyState = R.OPEN, this.dispatchEvent(new Event("open"));
2912
+ }), this.addPreviewListener(Ft, (o) => {
2497
2913
  const a = o;
2498
2914
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
2499
- }), this.addPreviewListener(St, () => {
2500
- this.readyState = I.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
2501
- }), this.addPreviewListener(Lt, (o) => {
2915
+ }), this.addPreviewListener(zt, () => {
2916
+ this.readyState = R.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
2917
+ }), this.addPreviewListener(Bt, (o) => {
2502
2918
  const a = o;
2503
- this.readyState = I.CLOSED, this.dispatchEvent(
2919
+ this.readyState = R.CLOSED, this.dispatchEvent(
2504
2920
  new CloseEvent("close", {
2505
2921
  code: a.detail?.code ?? 1e3,
2506
2922
  reason: a.detail?.reason ?? "",
@@ -2508,7 +2924,7 @@ class I extends EventTarget {
2508
2924
  })
2509
2925
  ), this.cleanup();
2510
2926
  }), window.dispatchEvent(
2511
- new CustomEvent(Q(yt, this.channelId), {
2927
+ new CustomEvent(oe(It, this.channelId), {
2512
2928
  detail: { socketId: this.socketId, url: e }
2513
2929
  })
2514
2930
  );
@@ -2523,28 +2939,28 @@ class I extends EventTarget {
2523
2939
  extensions = "";
2524
2940
  binaryType = "blob";
2525
2941
  bufferedAmount = 0;
2526
- readyState = I.CONNECTING;
2527
- socketId = Nn();
2942
+ readyState = R.CONNECTING;
2943
+ socketId = Kn();
2528
2944
  listeners = /* @__PURE__ */ new Map();
2529
2945
  send(e) {
2530
- if (this.readyState !== I.OPEN)
2946
+ if (this.readyState !== R.OPEN)
2531
2947
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
2532
2948
  window.dispatchEvent(
2533
- new CustomEvent(Q(vt, this.channelId), {
2949
+ new CustomEvent(oe(Rt, this.channelId), {
2534
2950
  detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
2535
2951
  })
2536
2952
  );
2537
2953
  }
2538
2954
  close(e, n) {
2539
- this.readyState !== I.CLOSED && (this.readyState = I.CLOSING, window.dispatchEvent(
2540
- new CustomEvent(Q(Ct, this.channelId), {
2955
+ this.readyState !== R.CLOSED && (this.readyState = R.CLOSING, window.dispatchEvent(
2956
+ new CustomEvent(oe(Mt, this.channelId), {
2541
2957
  detail: { socketId: this.socketId, code: e, reason: n }
2542
2958
  })
2543
2959
  ), this.cleanup());
2544
2960
  }
2545
2961
  addPreviewListener(e, n) {
2546
- const o = Q(e, this.channelId), a = (r) => {
2547
- r.detail?.socketId === this.socketId && n(r);
2962
+ const o = oe(e, this.channelId), a = (i) => {
2963
+ i.detail?.socketId === this.socketId && n(i);
2548
2964
  };
2549
2965
  this.listeners.set(o, a), window.addEventListener(o, a);
2550
2966
  }
@@ -2554,36 +2970,36 @@ class I extends EventTarget {
2554
2970
  this.listeners.clear();
2555
2971
  }
2556
2972
  }
2557
- function Nn() {
2558
- const t = window.sessionStorage.getItem(Ee);
2973
+ function Kn() {
2974
+ const t = window.sessionStorage.getItem(Ie);
2559
2975
  if (t)
2560
2976
  return t;
2561
2977
  const e = crypto.randomUUID();
2562
- return window.sessionStorage.setItem(Ee, e), e;
2978
+ return window.sessionStorage.setItem(Ie, e), e;
2563
2979
  }
2564
- function Q(t, e) {
2980
+ function oe(t, e) {
2565
2981
  return `${t}:${e}`;
2566
2982
  }
2567
- function In(t) {
2983
+ function Yn(t) {
2568
2984
  const e = document.currentScript;
2569
2985
  if (e instanceof HTMLScriptElement)
2570
2986
  return [e];
2571
2987
  const n = new URL(t, document.baseURI).href, o = new URL(n);
2572
2988
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
2573
- (a) => a instanceof HTMLScriptElement && An(a) && Tn(a, o)
2989
+ (a) => a instanceof HTMLScriptElement && qn(a) && jn(a, o)
2574
2990
  );
2575
2991
  }
2576
- function Rn(t) {
2577
- for (const e of In(t)) {
2578
- if (Ue.has(e) || e.dataset.plunoAutoMount === "false")
2992
+ function Xn(t) {
2993
+ for (const e of Yn(t)) {
2994
+ if (Ze.has(e) || e.dataset.plunoAutoMount === "false")
2579
2995
  continue;
2580
- Ue.add(e);
2996
+ Ze.add(e);
2581
2997
  const n = e.dataset.plunoPreviewChannel;
2582
- Ut({
2998
+ tn({
2583
2999
  token: e.dataset.plunoToken,
2584
3000
  tokenEndpoint: e.dataset.plunoTokenEndpoint,
2585
3001
  backendUrl: e.dataset.plunoBackendUrl,
2586
- webSocketFactory: n ? Wt(n) : void 0,
3002
+ webSocketFactory: n ? en(n) : void 0,
2587
3003
  launcherLabel: e.dataset.plunoLauncherLabel,
2588
3004
  accentColor: e.dataset.plunoAccentColor,
2589
3005
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -2595,8 +3011,8 @@ function Rn(t) {
2595
3011
  });
2596
3012
  }
2597
3013
  }
2598
- Rn(import.meta.url);
3014
+ Xn(import.meta.url);
2599
3015
  export {
2600
- Wt as createProductAgentPreviewBridgeWebSocketFactory,
2601
- Ut as mountPlunoProductAgentWidget
3016
+ en as createProductAgentPreviewBridgeWebSocketFactory,
3017
+ tn as mountPlunoProductAgentWidget
2602
3018
  };