@pluno/product-agent-web 0.1.20 → 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 = wt(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);
86
+ let o = X(e);
87
+ const a = X($);
88
88
  for (let i = 0; i < 6; i += 1)
89
- if (o = bt(o, a, 0.22), Ce(o, ye) >= ve)
90
- return de(o);
91
- return de(o);
89
+ if (o = At(o, a, 0.22), Te(o, Ae) >= Ne)
90
+ return fe(o);
91
+ return fe(o);
92
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";
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="${ft()}" 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 mt(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 ft() {
126
+ function Lt() {
127
127
  let n = "M 280 120", o = !1, a = 0;
128
128
  for (let i = 150; i <= 1170; i += 62) {
129
- const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
130
- n += ` L ${s} ${i}`, o = !o, a += 1;
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 wt(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 wt(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
188
  const i = a / 255;
189
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, i] = n > o ? [n, o] : [o, n];
193
+ function Te(t, e) {
194
+ const n = we(t), o = we(e), [a, i] = n > o ? [n, o] : [o, n];
195
195
  return (a + 0.05) / (i + 0.05);
196
196
  }
197
- function bt(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, i] = _t(q(t));
207
- return de(xt(o, ue(a + n), ue(i + 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, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
211
- if (l === s)
212
- return [0, 0, u];
213
- const h = l - s, c = u > 0.5 ? h / (2 - l - s) : h / (l + s);
214
- return [(l === o ? (a - i) / h + (a < i ? 6 : 0) : l === a ? (i - 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
- re(a, o, t + 1 / 3) * 255,
222
- re(a, o, t) * 255,
223
- re(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 re(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,32 +304,32 @@ 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 i = Pe(e.accentColor, e.scribbleStyle);
281
- Zt(a, e.launcherLabel, i, e.movableLauncher), o.appendChild(a);
282
- const l = await kn(), s = l.ownerDocument;
283
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), We(o, e.accentColor), Ae(a, i, {
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"), f = 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"), d = a.querySelector(".pluno-pa-widget__attachments"), p = a.querySelector(".pluno-pa-widget__input"), m = a.querySelector(".pluno-pa-widget__send"), b = a.querySelector(".pluno-pa-widget__new-chat"), w = a.querySelector(".pluno-pa-widget__timeline");
295
- if (!u || !c || !f || !y || !k || !v || !d || !p || !m || !b || !w)
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(d, x, (r) => {
303
- x = x.filter((g, E) => E !== r), 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
335
  const r = await fetch(e.tokenEndpoint, {
@@ -313,48 +340,49 @@ async function Ut(t = {}) {
313
340
  });
314
341
  if (!r.ok)
315
342
  throw new Error("Failed to load Pluno token");
316
- const g = await r.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, me = !1;
336
- const at = () => {
337
- me || typeof document > "u" || (We(o, e.accentColor), n.isConnected || s.body?.appendChild(n));
338
- }, fe = new MutationObserver(at);
339
- fe.observe(s.documentElement, { childList: !0, subtree: !0 });
340
- const ne = (r = !0) => {
341
- const g = Te(a, r);
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 = (r, g = {}) => {
355
- Xt(r, {
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(f),
368
- viewport: B(),
369
- panelHidden: f.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 = (r = !0) => {
374
- if (!A)
375
- return X(a, null), ne(r);
376
- const g = ne(r);
377
- return X(a, g), M("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
378
- }, we = (r, g) => {
379
- if (!r || !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: r.x - g.x,
385
- y: r.y - g.y
411
+ pn(a, {
412
+ x: r.x - c.x,
413
+ y: r.y - c.y
386
414
  });
387
- }, be = () => {
388
- const r = 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(r);
391
- we(g, r), M("Applied open panel position after viewport resize", { openPanelPosition: g });
392
- } else A && M("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
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", be), _e = Vt({
424
+ e.movableLauncher && d ? (Z(), window.addEventListener("resize", ke), Se = on({
397
425
  root: a,
398
- launcherDragHandle: h,
399
- getPosition: () => ne(),
426
+ launcherDragHandle: d,
427
+ getPosition: () => pe(),
400
428
  setPosition: (r) => {
401
- const g = r;
402
- A = Ne(a, r, Te(a)), X(a, A), M("Dragging closed launcher", { requestedPosition: g });
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 = (r = "", g = !0) => {
409
- if (R !== null && (window.clearTimeout(R), R = null), f.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
410
- const E = j(), H = Ie(E);
411
- we(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, r && (p.value = r, V(p)), w.scrollTop = w.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"), r && (p.value = r, V(p)), w.scrollTop = w.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T(), R = window.setTimeout(() => {
420
- u.hidden = !0, w.scrollTop = w.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
- }, it = () => {
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
- f.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", (r) => {
429
- r.preventDefault(), W(c.value), c.value = "";
430
- }), h?.addEventListener("click", (r) => {
456
+ s.addEventListener("submit", (r) => {
457
+ r.preventDefault(), B(u.value), u.value = "";
458
+ }), d?.addEventListener("click", (r) => {
431
459
  r.preventDefault(), r.stopPropagation();
432
- }), u.addEventListener("click", (r) => {
433
- r.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)
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 r = c.value;
440
- W(r), c.value = "";
441
- }), y.addEventListener("click", it);
442
- const N = () => {
443
- m.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", (r) => {
473
+ e.loginRequired && (u.readOnly = !0, u.placeholder = e.loginButtonLabel, h.placeholder = e.loginButtonLabel, y.hidden = !0), y.addEventListener("submit", (r) => {
446
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 rt = () => {
454
- U = 0, a.classList.remove("pluno-pa-widget--drag-over");
455
- }, lt = (r) => {
456
- P !== null && window.clearTimeout(P), v.textContent = r, 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 (r) => {
487
+ }, wt = () => {
488
+ E !== null && (window.clearTimeout(E), E = null), k.textContent = "", k.hidden = !0;
489
+ }, bt = async (r) => {
462
490
  if (r.length === 0)
463
491
  return;
464
- const g = await gn(r);
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
497
  a.addEventListener("dragenter", (r) => {
470
- !Z(r.dataTransfer) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), U += 1, a.classList.add("pluno-pa-widget--drag-over"));
498
+ !te(r.dataTransfer) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), q += 1, a.classList.add("pluno-pa-widget--drag-over"));
471
499
  }), a.addEventListener("dragover", (r) => {
472
- const g = r.dataTransfer;
473
- !Z(g) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), g.dropEffect = "copy");
500
+ const c = r.dataTransfer;
501
+ !te(c) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), c.dropEffect = "copy");
474
502
  }), a.addEventListener("dragleave", (r) => {
475
- Z(r.dataTransfer) && (r.stopPropagation(), U = Math.max(0, U - 1), U === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
503
+ te(r.dataTransfer) && (r.stopPropagation(), q = Math.max(0, q - 1), q === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
476
504
  }), a.addEventListener("drop", (r) => {
477
- const g = r.dataTransfer;
478
- !Z(g) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), rt(), 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)
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
- }), m.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
- }), b.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", (r) => {
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) => {
498
526
  if (!(r.key !== "Enter" || r.shiftKey)) {
499
527
  if (r.preventDefault(), e.loginRequired) {
500
528
  e.onLoginClick?.();
501
529
  return;
502
530
  }
503
- x = pe(C, p, x), F(), N();
531
+ b = he(v, h, b), C(), D();
504
532
  }
505
533
  }), a.addEventListener("click", (r) => {
506
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && T();
507
- }), z.composerValue && (p.value = z.composerValue, V(p)), z.isOpen && W(p.value, !1);
508
- const Y = () => i;
509
- let oe = C.getState().appearance !== null;
510
- return C.on("state", (r) => {
511
- r.appearance ? (oe = !0, O("web-sdk.widget", "Agent state supplied appearance", {
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", {
512
572
  appearance: r.appearance
513
- }), ae(r.appearance, "agent.state.appearance")) : oe && (oe = !1, O("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
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(w, m, b, Y, e.loginButtonLabel, e.onLoginClick) : Oe(w, m, b, r, K, T, Y, (g) => {
518
- C.sendMessage(g);
519
- }), N();
520
- }), e.loginRequired ? Fe(w, m, b, Y, e.loginButtonLabel, e.onLoginClick) : Oe(w, m, b, C.getState(), K, T, Y, (r) => {
521
- C.sendMessage(r);
522
- }), N(), {
523
- agent: C,
577
+ }), de({}, "agent.state.appearance-cleared")), j(r), D();
578
+ }), j(v.getState()), D(), {
579
+ agent: v,
524
580
  updateAppearance: (r) => {
525
- r.scribbleStyle !== void 0 && (e.scribbleStyle = r.scribbleStyle), ae(r, "widgetHandle.updateAppearance");
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
- me = !0, fe.disconnect(), e.movableLauncher && window.removeEventListener("resize", be), _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(r, g) {
532
- const E = r.accentColor ?? e.accentColor, H = r.colorScheme ?? e.colorScheme, xe = r.fontFamily ?? e.fontFamily, ie = r.scribbleStyle ?? e.scribbleStyle;
533
- i = Pe(E, ie), Ae(a, i, {
534
- accentColor: E,
535
- colorScheme: H,
536
- fontFamily: xe,
537
- scribbleStyle: ie
538
- }), O("web-sdk.widget", "Updated widget appearance", {
539
- source: g,
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,
540
620
  inputAppearance: r,
541
- appliedAccentColor: E,
542
- appliedColorScheme: H,
543
- appliedFontFamily: xe,
544
- appliedScribbleStyle: ie,
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 ? mt(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
637
  for (const i of a)
558
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 i = null, l = null, s = null, u = !1;
580
- const h = () => {
581
- i = null, l = null, s = null, u = !1, t.classList.remove("pluno-pa-widget--dragging");
582
- }, c = (d) => {
583
- t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (d.preventDefault(), d.stopPropagation(), i = d.pointerId, l = { x: d.clientX, y: d.clientY }, s = n(), u = !1, e.setPointerCapture?.(d.pointerId));
584
- }, f = (d) => {
585
- if (i !== d.pointerId || !l || !s)
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
- d.preventDefault();
588
- const p = d.clientX - l.x, m = d.clientY - l.y;
589
- !u && Math.hypot(p, m) < Gt || (u = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: s.x + p, y: s.y + m }));
590
- }, y = (d) => {
591
- i === d.pointerId && (d.preventDefault(), d.stopPropagation(), u && a(), h());
592
- }, k = (d) => {
593
- i === d.pointerId && (d.preventDefault(), h());
594
- }, v = (d) => {
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 = d.shiftKey ? $t : Bt, m = n();
598
- let b = null;
599
- d.key === "ArrowUp" ? b = { x: m.x, y: m.y - p } : d.key === "ArrowDown" ? b = { x: m.x, y: m.y + p } : d.key === "ArrowLeft" ? b = { x: m.x - p, y: m.y } : d.key === "ArrowRight" && (b = { x: m.x + p, y: m.y }), b && (d.preventDefault(), d.stopPropagation(), o(b), 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", f), e.addEventListener("pointerup", y), e.addEventListener("pointercancel", k), e.addEventListener("keydown", v), () => {
602
- e.removeEventListener("pointerdown", c), e.removeEventListener("pointermove", f), 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
703
  const i = t.getBoundingClientRect();
624
704
  if (i.width > 0 || i.height > 0)
625
705
  return { x: i.left, y: i.top };
626
- const l = B();
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 = {
@@ -690,42 +770,42 @@ function O(t, e, n) {
690
770
  message: e,
691
771
  details: n
692
772
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
693
- 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(Pt, { detail: a }));
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
793
  const i = document.createElement("button");
714
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");
@@ -737,44 +817,46 @@ function en() {
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
819
  const i = document.createElement("button");
740
- i.type = "button", i.className = "pluno-pa-widget__send", i.setAttribute("aria-label", "Send"), i.appendChild(Je()), o.appendChild(i), t.appendChild(o);
820
+ i.type = "button", i.className = "pluno-pa-widget__send", i.setAttribute("aria-label", "Send"), i.appendChild(pt()), o.appendChild(i), t.appendChild(o);
741
821
  const l = document.createElement("div");
742
822
  l.className = "pluno-pa-widget__composer-meta";
743
- const s = document.createElement("a");
744
- s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai", l.appendChild(s);
745
- const u = document.createElement("span");
746
- return u.className = "pluno-pa-widget__ai-disclaimer", u.textContent = "AI can make mistakes", l.appendChild(u), t.appendChild(l), t;
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;
747
829
  }
748
- function tn(t) {
830
+ function hn(t) {
749
831
  const e = document.createElement("div");
750
- 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;
751
833
  }
752
- function Ye() {
834
+ function it() {
753
835
  const t = document.createElement("div");
754
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;
755
837
  }
756
- function Xe(t, e) {
838
+ function rt(t, e) {
757
839
  const n = document.createElement("img");
758
840
  return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
759
841
  }
760
- function Ze(t, e, n, o) {
842
+ function lt(t, e, n, o) {
761
843
  const a = document.createElement("button");
762
844
  return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
763
845
  }
764
- function nn() {
765
- const t = _("svg", {
846
+ function mn() {
847
+ const t = S("svg", {
766
848
  class: "pluno-pa-widget__scribble-defs",
767
849
  "aria-hidden": "true",
768
850
  focusable: "false",
769
851
  width: "0",
770
852
  height: "0"
771
- }), e = _("defs");
772
- 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;
773
855
  }
774
- function se(t, e, n) {
775
- 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%" });
776
858
  return o.appendChild(
777
- _("feTurbulence", {
859
+ S("feTurbulence", {
778
860
  type: "fractalNoise",
779
861
  baseFrequency: "0.012 0.028",
780
862
  numOctaves: "3",
@@ -782,7 +864,7 @@ function se(t, e, n) {
782
864
  result: "stroke-noise"
783
865
  })
784
866
  ), o.appendChild(
785
- _("feDisplacementMap", {
867
+ S("feDisplacementMap", {
786
868
  in: "SourceGraphic",
787
869
  in2: "stroke-noise",
788
870
  scale: "3.5",
@@ -791,7 +873,7 @@ function se(t, e, n) {
791
873
  result: "warped"
792
874
  })
793
875
  ), o.appendChild(
794
- _("feTurbulence", {
876
+ S("feTurbulence", {
795
877
  type: "fractalNoise",
796
878
  baseFrequency: "0.7",
797
879
  numOctaves: "1",
@@ -799,7 +881,7 @@ function se(t, e, n) {
799
881
  result: "ink-noise"
800
882
  })
801
883
  ), o.appendChild(
802
- _("feDisplacementMap", {
884
+ S("feDisplacementMap", {
803
885
  in: "warped",
804
886
  in2: "ink-noise",
805
887
  scale: "0.9",
@@ -808,31 +890,31 @@ function se(t, e, n) {
808
890
  })
809
891
  ), o;
810
892
  }
811
- function on(t) {
812
- const e = $("0 0 24 24", t, t, "none", "currentColor", "2.25");
813
- 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;
814
896
  }
815
- function an() {
816
- const t = $("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
817
- 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;
818
900
  }
819
- function Je() {
820
- const t = $("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
821
- 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;
822
904
  }
823
- function rn() {
824
- const t = $("0 0 24 24", 18, 18, "currentColor");
825
- 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;
826
908
  }
827
- function ln() {
828
- const t = $("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
829
- 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;
830
912
  }
831
- function pn() {
832
- const t = $("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
833
- 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;
834
916
  }
835
- function $(t, e, n, o, a, i) {
917
+ function W(t, e, n, o, a, i) {
836
918
  const l = {
837
919
  viewBox: t,
838
920
  width: String(e),
@@ -840,41 +922,41 @@ function $(t, e, n, o, a, i) {
840
922
  fill: o,
841
923
  "aria-hidden": "true"
842
924
  };
843
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), _("svg", l);
925
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), S("svg", l);
844
926
  }
845
- function _(t, e = {}) {
846
- const n = document.createElementNS(Mt, t);
927
+ function S(t, e = {}) {
928
+ const n = document.createElementNS(jt, t);
847
929
  for (const [o, a] of Object.entries(e))
848
930
  n.setAttribute(o, a);
849
931
  return n;
850
932
  }
851
- function De(t) {
933
+ function We(t) {
852
934
  for (const e of ["keydown", "keypress", "keyup"])
853
935
  t.addEventListener(e, (n) => {
854
936
  n.stopPropagation();
855
937
  });
856
938
  }
857
- function sn(t, e, n) {
939
+ function yn(t, e, n) {
858
940
  t.replaceChildren(), t.hidden = e.length === 0;
859
941
  for (const [o, a] of e.entries()) {
860
942
  const i = document.createElement("div");
861
- i.className = "pluno-pa-widget__attachment", i.appendChild(dn(a));
943
+ i.className = "pluno-pa-widget__attachment", i.appendChild(vn(a));
862
944
  const l = document.createElement("span");
863
945
  l.textContent = a.name, i.appendChild(l);
864
- const s = document.createElement("button");
865
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(ln()), s.addEventListener("click", () => n(o)), i.appendChild(s), t.appendChild(i);
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);
866
948
  }
867
949
  }
868
- function dn(t) {
869
- if (Qe(t)) {
950
+ function vn(t) {
951
+ if (st(t)) {
870
952
  const n = document.createElement("img");
871
953
  return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
872
954
  }
873
955
  const e = document.createElement("span");
874
956
  return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
875
957
  }
876
- function cn(t) {
877
- if (Qe(t)) {
958
+ function Cn(t) {
959
+ if (st(t)) {
878
960
  const a = document.createElement("img");
879
961
  return a.src = t.dataUrl, a.alt = t.name, a;
880
962
  }
@@ -885,51 +967,51 @@ function cn(t) {
885
967
  const o = document.createElement("strong");
886
968
  return o.textContent = t.name, e.append(n, o), e;
887
969
  }
888
- function Qe(t) {
970
+ function st(t) {
889
971
  return t.mimeType.startsWith("image/");
890
972
  }
891
- function un(t) {
973
+ function En(t) {
892
974
  return t === "application/pdf" ? "document.pdf" : "image";
893
975
  }
894
- async function gn(t) {
976
+ async function kn(t) {
895
977
  if (!t)
896
978
  return [];
897
979
  const e = Array.from(t);
898
- if (e.length > ee)
899
- 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.`);
900
982
  return Promise.all(
901
983
  e.map(async (n) => {
902
- const o = hn(n);
984
+ const o = Sn(n);
903
985
  if (!o)
904
986
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
905
- if (n.size > At)
987
+ if (n.size > $t)
906
988
  throw new Error("Each Pluno attachment can be up to 10 MB.");
907
989
  if (o === "image/gif") {
908
- const a = new Uint8Array(await bn(n));
909
- if (fn(a))
990
+ const a = new Uint8Array(await Nn(n));
991
+ if (Pn(a))
910
992
  throw new Error("Pluno supports non-animated GIF images.");
911
993
  }
912
994
  return {
913
- name: n.name || un(o),
995
+ name: n.name || En(o),
914
996
  mimeType: o,
915
997
  sizeBytes: n.size,
916
- dataUrl: mn(await _n(n), o)
998
+ dataUrl: Ln(await Tn(n), o)
917
999
  };
918
1000
  })
919
1001
  );
920
1002
  }
921
- function hn(t) {
922
- if (Tt.has(t.type))
1003
+ function Sn(t) {
1004
+ if (Ut.has(t.type))
923
1005
  return t.type;
924
1006
  const e = t.name.toLowerCase();
925
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;
926
1008
  }
927
- function mn(t, e) {
1009
+ function Ln(t, e) {
928
1010
  const n = `data:${e};base64,`;
929
1011
  return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
930
1012
  }
931
- function fn(t) {
932
- if (t.length < 14 || !wn(t))
1013
+ function Pn(t) {
1014
+ if (t.length < 14 || !An(t))
933
1015
  return !1;
934
1016
  const e = t[10];
935
1017
  let n = 13;
@@ -940,7 +1022,7 @@ function fn(t) {
940
1022
  if (n += 1, a === 59)
941
1023
  return !1;
942
1024
  if (a === 33) {
943
- n += 1, n = Me(t, n);
1025
+ n += 1, n = He(t, n);
944
1026
  continue;
945
1027
  }
946
1028
  if (a !== 44)
@@ -952,14 +1034,14 @@ function fn(t) {
952
1034
  const i = t[n + 8];
953
1035
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= t.length)
954
1036
  return !1;
955
- n += 1, n = Me(t, n);
1037
+ n += 1, n = He(t, n);
956
1038
  }
957
1039
  return !1;
958
1040
  }
959
- function wn(t) {
1041
+ function An(t) {
960
1042
  return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
961
1043
  }
962
- function Me(t, e) {
1044
+ function He(t, e) {
963
1045
  for (; e < t.length; ) {
964
1046
  const n = t[e];
965
1047
  if (e += 1, n === 0)
@@ -968,10 +1050,10 @@ function Me(t, e) {
968
1050
  }
969
1051
  return e;
970
1052
  }
971
- function Z(t) {
1053
+ function te(t) {
972
1054
  return !!(t && Array.from(t.types).includes("Files"));
973
1055
  }
974
- function bn(t) {
1056
+ function Nn(t) {
975
1057
  return new Promise((e, n) => {
976
1058
  const o = new FileReader();
977
1059
  o.addEventListener("load", () => {
@@ -985,7 +1067,7 @@ function bn(t) {
985
1067
  }), o.readAsArrayBuffer(t);
986
1068
  });
987
1069
  }
988
- function _n(t) {
1070
+ function Tn(t) {
989
1071
  return new Promise((e, n) => {
990
1072
  const o = new FileReader();
991
1073
  o.addEventListener("load", () => {
@@ -999,135 +1081,226 @@ function _n(t) {
999
1081
  }), o.readAsDataURL(t);
1000
1082
  });
1001
1083
  }
1002
- function Oe(t, e, n, o, a, i, l, s) {
1003
- const u = [...o.messages];
1004
- t.replaceChildren(), tt(e, o.isThinking);
1005
- const h = u.length > 0 || !!o.assistantDraft || o.isThinking;
1006
- if (n.hidden = !h, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
1007
- const d = document.createElement("div");
1008
- d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1009
- const p = document.createElement("img");
1010
- p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = l(), p.alt = "", p.setAttribute("aria-hidden", "true"), d.appendChild(p), d.appendChild(Ye());
1011
- const m = document.createElement("div");
1012
- m.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 && m.setAttribute("aria-hidden", "true");
1013
- for (const b of o.starterPrompts) {
1014
- const w = document.createElement("button");
1015
- w.type = "button", w.className = "pluno-pa-widget__starter-prompt", w.textContent = `"${b}"`, w.addEventListener("click", () => {
1016
- s(b);
1017
- }), m.appendChild(w);
1018
- }
1019
- d.appendChild(m), t.appendChild(d);
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);
1020
1102
  return;
1021
1103
  }
1022
- let c = null, f = null, y = [];
1023
- const k = () => {
1024
- if (y.length === 0)
1104
+ let w = null, y = null, k = [];
1105
+ const m = () => {
1106
+ if (k.length === 0)
1025
1107
  return !1;
1026
- const d = yn(y, a, i, l());
1027
- return t.appendChild(d), c = null, f = d, y = [], !0;
1108
+ const g = zn(k, a, i, l());
1109
+ return t.appendChild(g), w = null, y = g, k = [], !0;
1028
1110
  };
1029
- for (let d = 0; d < u.length; d += 1) {
1030
- const p = u[d];
1031
- if (p.role === "tool") {
1032
- 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);
1033
1115
  continue;
1034
1116
  }
1035
- if (p.role === "system")
1117
+ if (f.role === "system")
1036
1118
  continue;
1037
- const m = k(), b = Be(p.content);
1038
- if (p.role === "assistant" && !m) {
1039
- const x = ge(l());
1040
- t.appendChild(x), c = null, f = x;
1041
- }
1042
- const w = document.createElement("div");
1043
- w.className = `pluno-pa-widget__message pluno-pa-widget__message--${p.role}`, p.role === "assistant" ? ze(w, b) : w.textContent = b, p.role === "user" && p.attachments?.length && w.appendChild(xn(p.attachments)), w.appendChild(Ge(b)), t.appendChild(w), c = w, f = 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;
1044
1128
  }
1045
- const v = k();
1129
+ const h = m();
1046
1130
  if (o.assistantDraft) {
1047
- if (!v) {
1048
- const m = ge(l());
1049
- t.appendChild(m), c = null, f = m;
1050
- }
1051
- const d = Be(o.assistantDraft), p = document.createElement("div");
1052
- p.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ze(p, d), p.appendChild(Ge(d)), t.appendChild(p), c = p, f = null;
1131
+ if (!h) {
1132
+ const E = _e(l());
1133
+ t.appendChild(E), w = null, y = E;
1134
+ }
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;
1053
1139
  }
1054
1140
  if (o.isThinking && !o.assistantDraft)
1055
- if (v) {
1056
- const d = et();
1057
- t.appendChild(d), c = null, f = d;
1141
+ if (h) {
1142
+ const g = dt();
1143
+ t.appendChild(g), w = null, y = g;
1058
1144
  } else {
1059
- const d = vn(l());
1060
- t.appendChild(d), c = null, f = d;
1145
+ const g = Bn(l());
1146
+ t.appendChild(g), w = null, y = g;
1061
1147
  }
1062
1148
  if (o.lastError) {
1063
- const d = document.createElement("div");
1064
- d.className = "pluno-pa-widget__error", d.textContent = o.lastError, t.appendChild(d), c = d, f = 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;
1151
+ }
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;
1065
1161
  }
1066
- c?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
1162
+ w?.classList.add("pluno-pa-widget__message--bottom-reserve"), y?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
1067
1163
  }
1068
- function Fe(t, e, n, o, a, i) {
1069
- 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;
1070
1166
  const l = document.createElement("div");
1071
1167
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1072
- const s = document.createElement("img");
1073
- s.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", s.src = o(), s.alt = "", s.setAttribute("aria-hidden", "true"), l.appendChild(s);
1074
- const u = document.createElement("div");
1075
- u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1076
- const h = document.createElement("button");
1077
- h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = a, h.addEventListener("click", () => i?.()), l.appendChild(h), t.appendChild(l);
1078
- }
1079
- 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) {
1080
1176
  const e = document.createElement("div");
1081
1177
  e.className = "pluno-pa-widget__message-attachments";
1082
1178
  for (const n of t)
1083
- e.appendChild(cn(n));
1179
+ e.appendChild(Cn(n));
1084
1180
  return e;
1085
1181
  }
1086
- function Ge(t) {
1182
+ function Ve(t) {
1087
1183
  const e = document.createElement("button");
1088
- 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) => {
1089
1185
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
1090
1186
  }), e;
1091
1187
  }
1092
- 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) {
1093
1266
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1094
1267
  }
1095
- function yn(t, e, n, o) {
1268
+ function zn(t, e, n, o) {
1096
1269
  const a = document.createElement("article");
1097
1270
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
1098
1271
  const i = document.createElement("img");
1099
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);
1100
- const l = document.createElement("details"), s = Cn(t);
1101
- l.open = e.has(s), l.addEventListener("toggle", () => {
1102
- l.open ? e.add(s) : e.delete(s), n();
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();
1103
1276
  });
1104
- const u = document.createElement("summary");
1105
- u.className = "pluno-pa-widget__tool-summary", t.some((f) => f.loading) && u.appendChild($e());
1106
- const c = document.createElement("span");
1107
- 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) {
1108
- const f = document.createElement("div");
1109
- f.className = "pluno-pa-widget__tool-lines";
1110
- for (const y of t) {
1111
- const k = document.createElement("div");
1112
- k.className = "pluno-pa-widget__tool-line", y.loading && k.appendChild($e());
1113
- const v = document.createElement("span");
1114
- v.textContent = y.content || "Run tool", k.appendChild(v), f.appendChild(k);
1115
- }
1116
- l.appendChild(f);
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(_);
1117
1290
  }
1118
1291
  return a.appendChild(l), a;
1119
1292
  }
1120
- function ge(t) {
1293
+ function _e(t) {
1121
1294
  const e = document.createElement("article");
1122
1295
  e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1123
1296
  const n = document.createElement("img");
1124
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;
1125
1298
  }
1126
- function vn(t) {
1127
- const e = ge(t);
1128
- 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;
1129
1302
  }
1130
- function et() {
1303
+ function dt() {
1131
1304
  const t = document.createElement("div");
1132
1305
  t.className = "pluno-pa-widget__status";
1133
1306
  const e = document.createElement("span");
@@ -1135,17 +1308,17 @@ function et() {
1135
1308
  const n = document.createElement("span");
1136
1309
  return n.textContent = "Thinking...", t.appendChild(n), t;
1137
1310
  }
1138
- function Cn(t) {
1311
+ function Gn(t) {
1139
1312
  return `tools:${t.map((e) => e.id).join("|")}`;
1140
1313
  }
1141
- function $e() {
1314
+ function xe() {
1142
1315
  const t = document.createElement("span");
1143
1316
  return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
1144
1317
  }
1145
- function tt(t, e) {
1146
- 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());
1147
1320
  }
1148
- function ze(t, e) {
1321
+ function Ye(t, e) {
1149
1322
  const n = e.replace(/\r\n/g, `
1150
1323
  `).split(`
1151
1324
  `);
@@ -1157,49 +1330,49 @@ function ze(t, e) {
1157
1330
  continue;
1158
1331
  }
1159
1332
  if (a.match(/^```(\w+)?\s*$/)) {
1160
- const h = [];
1333
+ const d = [];
1161
1334
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1162
- h.push(n[o]), o += 1;
1335
+ d.push(n[o]), o += 1;
1163
1336
  o += o < n.length ? 1 : 0;
1164
- const c = document.createElement("pre"), f = document.createElement("code");
1165
- f.textContent = h.join(`
1166
- `), c.appendChild(f), t.appendChild(c);
1337
+ const u = document.createElement("pre"), _ = document.createElement("code");
1338
+ _.textContent = d.join(`
1339
+ `), u.appendChild(_), t.appendChild(u);
1167
1340
  continue;
1168
1341
  }
1169
1342
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1170
1343
  if (l) {
1171
- const h = document.createElement(`h${l[1].length + 2}`);
1172
- 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;
1173
1346
  continue;
1174
1347
  }
1175
1348
  if (/^\s*[-*+]\s+/.test(a)) {
1176
- const h = document.createElement("ul");
1349
+ const d = document.createElement("ul");
1177
1350
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1178
- const c = document.createElement("li");
1179
- 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;
1180
1353
  }
1181
- t.appendChild(h);
1354
+ t.appendChild(d);
1182
1355
  continue;
1183
1356
  }
1184
1357
  if (/^\s*\d+\.\s+/.test(a)) {
1185
- const h = document.createElement("ol");
1358
+ const d = document.createElement("ol");
1186
1359
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1187
- const c = document.createElement("li");
1188
- 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;
1189
1362
  }
1190
- t.appendChild(h);
1363
+ t.appendChild(d);
1191
1364
  continue;
1192
1365
  }
1193
- const s = [a];
1366
+ const p = [a];
1194
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]); )
1195
- s.push(n[o]), o += 1;
1196
- const u = document.createElement("p");
1197
- s.forEach((h, c) => {
1198
- c > 0 && u.appendChild(document.createElement("br")), J(u, h);
1199
- }), 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);
1200
1373
  }
1201
1374
  }
1202
- function J(t, e) {
1375
+ function ne(t, e) {
1203
1376
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1204
1377
  let o = 0;
1205
1378
  for (const a of e.matchAll(n)) {
@@ -1207,19 +1380,19 @@ function J(t, e) {
1207
1380
  i > o && t.appendChild(document.createTextNode(e.slice(o, i)));
1208
1381
  const l = a[0];
1209
1382
  if (l.startsWith("`")) {
1210
- const s = document.createElement("code");
1211
- s.textContent = l.slice(1, -1), t.appendChild(s);
1383
+ const p = document.createElement("code");
1384
+ p.textContent = l.slice(1, -1), t.appendChild(p);
1212
1385
  } else if (l.startsWith("**")) {
1213
- const s = document.createElement("strong");
1214
- s.textContent = l.slice(2, -2), t.appendChild(s);
1386
+ const p = document.createElement("strong");
1387
+ p.textContent = l.slice(2, -2), t.appendChild(p);
1215
1388
  } else if (l.startsWith("*")) {
1216
- const s = document.createElement("em");
1217
- s.textContent = l.slice(1, -1), t.appendChild(s);
1389
+ const p = document.createElement("em");
1390
+ p.textContent = l.slice(1, -1), t.appendChild(p);
1218
1391
  } else {
1219
- const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1220
- if (s && En(s[2])) {
1221
- const u = document.createElement("a");
1222
- u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[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);
1223
1396
  } else
1224
1397
  t.appendChild(document.createTextNode(l));
1225
1398
  }
@@ -1227,7 +1400,7 @@ function J(t, e) {
1227
1400
  }
1228
1401
  o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
1229
1402
  }
1230
- function En(t) {
1403
+ function $n(t) {
1231
1404
  if (t.startsWith("/") || t.startsWith("#"))
1232
1405
  return !0;
1233
1406
  try {
@@ -1237,7 +1410,7 @@ function En(t) {
1237
1410
  return !1;
1238
1411
  }
1239
1412
  }
1240
- function We(t, e) {
1413
+ function Xe(t, e) {
1241
1414
  if (t.getElementById("pluno-pa-widget-styles"))
1242
1415
  return;
1243
1416
  const n = t.ownerDocument.createElement("style");
@@ -1292,7 +1465,7 @@ function We(t, e) {
1292
1465
  --pluno-pa-accent-contrast: #fafafa;
1293
1466
  position: fixed;
1294
1467
  z-index: 2147483645;
1295
- font-family: ${D.fontFamily};
1468
+ font-family: ${I.fontFamily};
1296
1469
  font-size: 14px;
1297
1470
  color: var(--pluno-pa-text);
1298
1471
  width: var(--pluno-pa-launcher-width);
@@ -1399,10 +1572,10 @@ function We(t, e) {
1399
1572
  }
1400
1573
  .pluno-pa-widget__character--launcher {
1401
1574
  position: absolute;
1402
- left: 10px;
1575
+ left: 8px;
1403
1576
  top: 50%;
1404
- width: 34px;
1405
- height: 34px;
1577
+ width: 38px;
1578
+ height: 38px;
1406
1579
  transform: translateY(-50%);
1407
1580
  pointer-events: none;
1408
1581
  }
@@ -1413,7 +1586,7 @@ function We(t, e) {
1413
1586
  outline: none;
1414
1587
  background: transparent;
1415
1588
  color: var(--pluno-pa-text);
1416
- padding: 0 12px 0 44px;
1589
+ padding: 0 12px 0 48px;
1417
1590
  font: inherit;
1418
1591
  font-size: 15px;
1419
1592
  line-height: 22px;
@@ -1688,20 +1861,45 @@ function We(t, e) {
1688
1861
  transform: translateY(-2px);
1689
1862
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease, color 120ms ease;
1690
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
+ }
1691
1881
  .pluno-pa-widget__message--user::after {
1692
1882
  right: 0;
1693
1883
  }
1694
1884
  .pluno-pa-widget__message--user .pluno-pa-widget__message-copy {
1695
1885
  right: 4px;
1696
1886
  }
1887
+ .pluno-pa-widget__message--user .pluno-pa-widget__message-actions {
1888
+ right: 4px;
1889
+ }
1697
1890
  .pluno-pa-widget__message--assistant::after {
1698
1891
  left: 0;
1699
1892
  }
1700
1893
  .pluno-pa-widget__message--assistant .pluno-pa-widget__message-copy {
1701
1894
  left: 2px;
1702
1895
  }
1896
+ .pluno-pa-widget__message--assistant .pluno-pa-widget__message-actions {
1897
+ left: 2px;
1898
+ }
1703
1899
  .pluno-pa-widget__message:hover .pluno-pa-widget__message-copy,
1704
- .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 {
1705
1903
  opacity: 1;
1706
1904
  pointer-events: auto;
1707
1905
  transform: translateY(0);
@@ -1793,9 +1991,9 @@ function We(t, e) {
1793
1991
  margin-bottom: -8px;
1794
1992
  }
1795
1993
  .pluno-pa-widget__character--tool-group {
1796
- width: 33px;
1797
- height: 33px;
1798
- margin-top: -7px;
1994
+ width: 36px;
1995
+ height: 36px;
1996
+ margin-top: -8px;
1799
1997
  }
1800
1998
  .pluno-pa-widget__assistant-marker {
1801
1999
  min-height: 19px;
@@ -1867,6 +2065,188 @@ function We(t, e) {
1867
2065
  @keyframes pluno-pa-spin {
1868
2066
  to { transform: rotate(360deg); }
1869
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
+ }
1870
2250
  .pluno-pa-widget__composer {
1871
2251
  flex: 0 0 auto;
1872
2252
  margin: 0;
@@ -2030,13 +2410,14 @@ function We(t, e) {
2030
2410
  .pluno-pa-widget__composer-meta {
2031
2411
  display: flex;
2032
2412
  align-items: center;
2033
- justify-content: space-between;
2034
- gap: 10px;
2413
+ justify-content: center;
2035
2414
  margin-top: 8px;
2036
2415
  color: var(--pluno-pa-faint);
2037
2416
  font: inherit;
2038
2417
  font-size: 11px;
2039
2418
  line-height: 1.2;
2419
+ flex-wrap: wrap;
2420
+ text-align: center;
2040
2421
  }
2041
2422
  .pluno-pa-widget__powered-by {
2042
2423
  color: inherit;
@@ -2046,10 +2427,12 @@ function We(t, e) {
2046
2427
  .pluno-pa-widget__powered-by:hover {
2047
2428
  color: var(--pluno-pa-muted);
2048
2429
  }
2430
+ .pluno-pa-widget__composer-separator {
2431
+ margin: 0 5px;
2432
+ color: inherit;
2433
+ }
2049
2434
  .pluno-pa-widget__ai-disclaimer {
2050
2435
  color: inherit;
2051
- text-align: right;
2052
- white-space: nowrap;
2053
2436
  }
2054
2437
  .pluno-pa-widget__empty,
2055
2438
  .pluno-pa-widget__status,
@@ -2074,8 +2457,8 @@ function We(t, e) {
2074
2457
  padding: 0;
2075
2458
  }
2076
2459
  .pluno-pa-widget__character--empty {
2077
- width: 88px;
2078
- height: 88px;
2460
+ width: 96px;
2461
+ height: 96px;
2079
2462
  margin-bottom: -4px;
2080
2463
  }
2081
2464
  .pluno-pa-widget__empty-state--starter {
@@ -2233,7 +2616,7 @@ function We(t, e) {
2233
2616
  right: 16px;
2234
2617
  height: 36px;
2235
2618
  z-index: 3;
2236
- background-image: url('${ke}');
2619
+ background-image: url('${Re}');
2237
2620
  background-repeat: repeat-x;
2238
2621
  background-size: 104px 36px;
2239
2622
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -2271,16 +2654,16 @@ function We(t, e) {
2271
2654
  font-size: 28px;
2272
2655
  }
2273
2656
  .pluno-pa-widget--scribble .pluno-pa-widget__character--empty {
2274
- width: 132px;
2275
- height: 132px;
2657
+ width: 160px;
2658
+ height: 160px;
2276
2659
  }
2277
2660
  .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
2278
- margin-bottom: -36px;
2661
+ margin-bottom: -42px;
2279
2662
  }
2280
2663
  .pluno-pa-widget--scribble .pluno-pa-widget__character--tool-group {
2281
- width: 50px;
2282
- height: 50px;
2283
- margin-top: -11px;
2664
+ width: 60px;
2665
+ height: 60px;
2666
+ margin-top: -14px;
2284
2667
  }
2285
2668
  .pluno-pa-widget--scribble .pluno-pa-widget__tool-group {
2286
2669
  align-items: center;
@@ -2305,13 +2688,22 @@ function We(t, e) {
2305
2688
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner {
2306
2689
  border-radius: var(--pluno-pa-scribble-wobble);
2307
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
+ }
2308
2698
  .pluno-pa-widget--scribble .pluno-pa-widget__message--user,
2309
2699
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
2310
2700
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
2311
2701
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
2312
2702
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
2313
2703
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
2314
- .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 {
2315
2707
  isolation: isolate;
2316
2708
  border: 2px solid transparent;
2317
2709
  background: transparent;
@@ -2323,7 +2715,9 @@ function We(t, e) {
2323
2715
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
2324
2716
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
2325
2717
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
2326
- .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 {
2327
2721
  content: "";
2328
2722
  position: absolute;
2329
2723
  inset: -2px;
@@ -2346,7 +2740,8 @@ function We(t, e) {
2346
2740
  }
2347
2741
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
2348
2742
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
2349
- .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 {
2350
2745
  background: var(--pluno-pa-bg);
2351
2746
  }
2352
2747
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within {
@@ -2358,13 +2753,15 @@ function We(t, e) {
2358
2753
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
2359
2754
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
2360
2755
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
2361
- .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 {
2362
2758
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
2363
2759
  }
2364
2760
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
2365
2761
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
2366
2762
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
2367
- .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 {
2368
2765
  content: "";
2369
2766
  position: absolute;
2370
2767
  inset: -3px;
@@ -2410,10 +2807,14 @@ function We(t, e) {
2410
2807
  height: 48px;
2411
2808
  }
2412
2809
  .pluno-pa-widget--scribble .pluno-pa-widget__character--launcher {
2810
+ left: 5px;
2811
+ width: 44px;
2812
+ height: 44px;
2413
2813
  margin-top: 3px;
2414
2814
  }
2415
2815
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-input {
2416
2816
  margin-top: 2px;
2817
+ padding-left: 54px;
2417
2818
  }
2418
2819
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-drag-handle {
2419
2820
  top: -13px;
@@ -2437,7 +2838,7 @@ function We(t, e) {
2437
2838
  right: 12px;
2438
2839
  height: 22px;
2439
2840
  z-index: 1;
2440
- background-image: url('${ke}');
2841
+ background-image: url('${Re}');
2441
2842
  background-repeat: repeat-x;
2442
2843
  background-size: 62px 21.5px;
2443
2844
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -2451,7 +2852,7 @@ function We(t, e) {
2451
2852
  }
2452
2853
  `, t.appendChild(n);
2453
2854
  }
2454
- async function kn() {
2855
+ async function Un() {
2455
2856
  return document.body ? document.body : await new Promise((t) => {
2456
2857
  const e = new MutationObserver(() => {
2457
2858
  document.body && (e.disconnect(), t(document.body));
@@ -2459,62 +2860,63 @@ async function kn() {
2459
2860
  e.observe(document.documentElement, { childList: !0 });
2460
2861
  });
2461
2862
  }
2462
- function nt(t) {
2863
+ function ut(t) {
2463
2864
  return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
2464
2865
  }
2465
- function Sn(t) {
2866
+ function Wn(t) {
2466
2867
  try {
2467
- const e = window.localStorage.getItem(nt(t));
2868
+ const e = window.localStorage.getItem(ut(t));
2468
2869
  if (!e)
2469
- return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
2870
+ return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null, seenShareCandidateIds: [] };
2470
2871
  const n = JSON.parse(e);
2471
2872
  return {
2472
2873
  isOpen: n.isOpen === !0,
2473
2874
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
2474
2875
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
2475
- 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) : []
2476
2878
  };
2477
2879
  } catch {
2478
- return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
2880
+ return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null, seenShareCandidateIds: [] };
2479
2881
  }
2480
2882
  }
2481
- function Ln(t, e) {
2883
+ function Hn(t, e) {
2482
2884
  try {
2483
- window.localStorage.setItem(nt(t), JSON.stringify(e));
2885
+ window.localStorage.setItem(ut(t), JSON.stringify(e));
2484
2886
  } catch {
2485
2887
  return;
2486
2888
  }
2487
2889
  }
2488
- function Pn(t) {
2890
+ function Vn(t) {
2489
2891
  if (!t || typeof t != "object")
2490
2892
  return !1;
2491
2893
  const e = t;
2492
2894
  return Number.isFinite(e.x) && Number.isFinite(e.y);
2493
2895
  }
2494
- const Ue = /* @__PURE__ */ new WeakSet();
2495
- function An(t) {
2896
+ const Ze = /* @__PURE__ */ new WeakSet();
2897
+ function qn(t) {
2496
2898
  return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
2497
2899
  }
2498
- function He(t) {
2900
+ function Je(t) {
2499
2901
  const e = t.pathname.split("/");
2500
2902
  return e[e.length - 1] ?? "";
2501
2903
  }
2502
- function Tn(t, e) {
2904
+ function jn(t, e) {
2503
2905
  const n = new URL(t.src, document.baseURI);
2504
- 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);
2505
2907
  }
2506
- class I extends EventTarget {
2908
+ class R extends EventTarget {
2507
2909
  constructor(e, n) {
2508
- super(), this.channelId = n, this.url = e, this.addPreviewListener(Et, () => {
2509
- this.readyState = I.OPEN, this.dispatchEvent(new Event("open"));
2510
- }), 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) => {
2511
2913
  const a = o;
2512
2914
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
2513
- }), this.addPreviewListener(St, () => {
2514
- this.readyState = I.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
2515
- }), 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) => {
2516
2918
  const a = o;
2517
- this.readyState = I.CLOSED, this.dispatchEvent(
2919
+ this.readyState = R.CLOSED, this.dispatchEvent(
2518
2920
  new CloseEvent("close", {
2519
2921
  code: a.detail?.code ?? 1e3,
2520
2922
  reason: a.detail?.reason ?? "",
@@ -2522,7 +2924,7 @@ class I extends EventTarget {
2522
2924
  })
2523
2925
  ), this.cleanup();
2524
2926
  }), window.dispatchEvent(
2525
- new CustomEvent(Q(yt, this.channelId), {
2927
+ new CustomEvent(oe(It, this.channelId), {
2526
2928
  detail: { socketId: this.socketId, url: e }
2527
2929
  })
2528
2930
  );
@@ -2537,27 +2939,27 @@ class I extends EventTarget {
2537
2939
  extensions = "";
2538
2940
  binaryType = "blob";
2539
2941
  bufferedAmount = 0;
2540
- readyState = I.CONNECTING;
2541
- socketId = Nn();
2942
+ readyState = R.CONNECTING;
2943
+ socketId = Kn();
2542
2944
  listeners = /* @__PURE__ */ new Map();
2543
2945
  send(e) {
2544
- if (this.readyState !== I.OPEN)
2946
+ if (this.readyState !== R.OPEN)
2545
2947
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
2546
2948
  window.dispatchEvent(
2547
- new CustomEvent(Q(vt, this.channelId), {
2949
+ new CustomEvent(oe(Rt, this.channelId), {
2548
2950
  detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
2549
2951
  })
2550
2952
  );
2551
2953
  }
2552
2954
  close(e, n) {
2553
- this.readyState !== I.CLOSED && (this.readyState = I.CLOSING, window.dispatchEvent(
2554
- new CustomEvent(Q(Ct, this.channelId), {
2955
+ this.readyState !== R.CLOSED && (this.readyState = R.CLOSING, window.dispatchEvent(
2956
+ new CustomEvent(oe(Mt, this.channelId), {
2555
2957
  detail: { socketId: this.socketId, code: e, reason: n }
2556
2958
  })
2557
2959
  ), this.cleanup());
2558
2960
  }
2559
2961
  addPreviewListener(e, n) {
2560
- const o = Q(e, this.channelId), a = (i) => {
2962
+ const o = oe(e, this.channelId), a = (i) => {
2561
2963
  i.detail?.socketId === this.socketId && n(i);
2562
2964
  };
2563
2965
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -2568,36 +2970,36 @@ class I extends EventTarget {
2568
2970
  this.listeners.clear();
2569
2971
  }
2570
2972
  }
2571
- function Nn() {
2572
- const t = window.sessionStorage.getItem(Ee);
2973
+ function Kn() {
2974
+ const t = window.sessionStorage.getItem(Ie);
2573
2975
  if (t)
2574
2976
  return t;
2575
2977
  const e = crypto.randomUUID();
2576
- return window.sessionStorage.setItem(Ee, e), e;
2978
+ return window.sessionStorage.setItem(Ie, e), e;
2577
2979
  }
2578
- function Q(t, e) {
2980
+ function oe(t, e) {
2579
2981
  return `${t}:${e}`;
2580
2982
  }
2581
- function In(t) {
2983
+ function Yn(t) {
2582
2984
  const e = document.currentScript;
2583
2985
  if (e instanceof HTMLScriptElement)
2584
2986
  return [e];
2585
2987
  const n = new URL(t, document.baseURI).href, o = new URL(n);
2586
2988
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
2587
- (a) => a instanceof HTMLScriptElement && An(a) && Tn(a, o)
2989
+ (a) => a instanceof HTMLScriptElement && qn(a) && jn(a, o)
2588
2990
  );
2589
2991
  }
2590
- function Rn(t) {
2591
- for (const e of In(t)) {
2592
- 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")
2593
2995
  continue;
2594
- Ue.add(e);
2996
+ Ze.add(e);
2595
2997
  const n = e.dataset.plunoPreviewChannel;
2596
- Ut({
2998
+ tn({
2597
2999
  token: e.dataset.plunoToken,
2598
3000
  tokenEndpoint: e.dataset.plunoTokenEndpoint,
2599
3001
  backendUrl: e.dataset.plunoBackendUrl,
2600
- webSocketFactory: n ? Wt(n) : void 0,
3002
+ webSocketFactory: n ? en(n) : void 0,
2601
3003
  launcherLabel: e.dataset.plunoLauncherLabel,
2602
3004
  accentColor: e.dataset.plunoAccentColor,
2603
3005
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -2609,8 +3011,8 @@ function Rn(t) {
2609
3011
  });
2610
3012
  }
2611
3013
  }
2612
- Rn(import.meta.url);
3014
+ Xn(import.meta.url);
2613
3015
  export {
2614
- Wt as createProductAgentPreviewBridgeWebSocketFactory,
2615
- Ut as mountPlunoProductAgentWidget
3016
+ en as createProductAgentPreviewBridgeWebSocketFactory,
3017
+ tn as mountPlunoProductAgentWidget
2616
3018
  };