@pluno/product-agent-web 0.1.32 → 0.1.35

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 rn } from "./product-agent-sdk.js";
2
- const ln = "#7c3aed";
3
- function pn(e) {
4
- const t = gn(e);
1
+ import { PlunoProductAgent as sn } from "./product-agent-sdk.js";
2
+ const dn = "#7c3aed";
3
+ function cn(e) {
4
+ const t = fn(e);
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 pn(e) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- function sn(e) {
79
- return `data:image/svg+xml,${encodeURIComponent(pn(e))}`;
78
+ function un(e) {
79
+ return `data:image/svg+xml,${encodeURIComponent(cn(e))}`;
80
80
  }
81
- const re = "#2c2a1e", nt = [253, 250, 241], ot = 3.5;
82
- function Lt(e) {
83
- const t = Pt(e);
84
- if (at(he(t), nt) >= ot)
81
+ const le = "#2c2a1e", rt = [253, 250, 241], lt = 3.5;
82
+ function Nt(e) {
83
+ const t = It(e);
84
+ if (pt(me(t), rt) >= lt)
85
85
  return t;
86
- let o = he(t);
87
- const a = he(re);
86
+ let o = me(t);
87
+ const a = me(le);
88
88
  for (let i = 0; i < 6; i += 1)
89
- if (o = hn(o, a, 0.22), at(o, nt) >= ot)
90
- return Oe(o);
91
- return Oe(o);
89
+ if (o = bn(o, a, 0.22), pt(o, rt) >= lt)
90
+ return Fe(o);
91
+ return Fe(o);
92
92
  }
93
- function dn(e) {
94
- const t = Lt(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
93
+ function gn(e) {
94
+ const t = Nt(e), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
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,26 +104,26 @@ function dn(e) {
104
104
  </defs>
105
105
  <g filter="url(#scribbleBoltWobble)">
106
106
  <g clip-path="url(#scribbleBoltClip)">
107
- <path d="${un()}" fill="none" stroke="${t}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
107
+ <path d="${mn()}" fill="none" stroke="${t}" 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="${re}" stroke-width="18" stroke-linejoin="round"/>
109
+ <path d="${n}" fill="none" stroke="${le}" 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="${re}" stroke-width="13"/>
112
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${re}"/>
111
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${le}" stroke-width="13"/>
112
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${le}"/>
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="${re}" stroke-width="13"/>
117
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${re}"/>
116
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${le}" stroke-width="13"/>
117
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${le}"/>
118
118
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
119
119
  </g>
120
120
  </g>
121
121
  </svg>`;
122
122
  }
123
- function cn(e) {
124
- return `data:image/svg+xml,${encodeURIComponent(dn(e))}`;
123
+ function hn(e) {
124
+ return `data:image/svg+xml,${encodeURIComponent(gn(e))}`;
125
125
  }
126
- function un() {
126
+ function mn() {
127
127
  let n = "M 280 120", o = !1, a = 0;
128
128
  for (let i = 150; i <= 1170; i += 62) {
129
129
  const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
@@ -131,8 +131,8 @@ function un() {
131
131
  }
132
132
  return n;
133
133
  }
134
- function gn(e) {
135
- const t = Pt(e), n = Be(he(t));
134
+ function fn(e) {
135
+ const t = It(e), n = Ue(me(t));
136
136
  return n > 0.86 ? {
137
137
  top: "#ffffff",
138
138
  middle: "#f6f6f6",
@@ -168,34 +168,34 @@ function gn(e) {
168
168
  shadow: z(t, -0.25, -0.08)
169
169
  };
170
170
  }
171
- function Pt(e) {
171
+ function It(e) {
172
172
  const t = e.trim();
173
- return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ln;
173
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : dn;
174
174
  }
175
- function he(e) {
175
+ function me(e) {
176
176
  return [
177
177
  Number.parseInt(e.slice(1, 3), 16),
178
178
  Number.parseInt(e.slice(3, 5), 16),
179
179
  Number.parseInt(e.slice(5, 7), 16)
180
180
  ];
181
181
  }
182
- function Oe([e, t, n]) {
182
+ function Fe([e, t, n]) {
183
183
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
184
184
  return `#${o(e)}${o(t)}${o(n)}`;
185
185
  }
186
- function Be([e, t, n]) {
186
+ function Ue([e, t, 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(e) + 0.7152 * o(t) + 0.0722 * o(n);
192
192
  }
193
- function at(e, t) {
194
- const n = Be(e), o = Be(t), [a, i] = n > o ? [n, o] : [o, n];
193
+ function pt(e, t) {
194
+ const n = Ue(e), o = Ue(t), [a, i] = n > o ? [n, o] : [o, n];
195
195
  return (a + 0.05) / (i + 0.05);
196
196
  }
197
- function hn(e, t, n) {
198
- const o = Fe(n);
197
+ function bn(e, t, n) {
198
+ const o = ze(n);
199
199
  return [
200
200
  e[0] + (t[0] - e[0]) * o,
201
201
  e[1] + (t[1] - e[1]) * o,
@@ -203,43 +203,43 @@ function hn(e, t, n) {
203
203
  ];
204
204
  }
205
205
  function z(e, t, n) {
206
- const [o, a, i] = mn(he(e));
207
- return Oe(fn(o, Fe(a + n), Fe(i + t)));
206
+ const [o, a, i] = wn(me(e));
207
+ return Fe(_n(o, ze(a + n), ze(i + t)));
208
208
  }
209
- function mn([e, t, n]) {
209
+ function wn([e, t, n]) {
210
210
  const o = e / 255, a = t / 255, i = n / 255, l = Math.max(o, a, i), p = Math.min(o, a, i), c = (l + p) / 2;
211
211
  if (l === p)
212
212
  return [0, 0, c];
213
213
  const d = l - p, s = c > 0.5 ? d / (2 - l - p) : d / (l + p);
214
214
  return [(l === o ? (a - i) / d + (a < i ? 6 : 0) : l === a ? (i - o) / d + 2 : (o - a) / d + 4) / 6, s, c];
215
215
  }
216
- function fn(e, t, n) {
216
+ function _n(e, t, n) {
217
217
  if (t === 0)
218
218
  return [n * 255, n * 255, n * 255];
219
219
  const o = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - o;
220
220
  return [
221
- Ne(a, o, e + 1 / 3) * 255,
222
- Ne(a, o, e) * 255,
223
- Ne(a, o, e - 1 / 3) * 255
221
+ De(a, o, e + 1 / 3) * 255,
222
+ De(a, o, e) * 255,
223
+ De(a, o, e - 1 / 3) * 255
224
224
  ];
225
225
  }
226
- function Ne(e, t, n) {
226
+ function De(e, t, n) {
227
227
  let o = n;
228
228
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
229
229
  }
230
- function Fe(e) {
230
+ function ze(e) {
231
231
  return Math.max(0, Math.min(1, e));
232
232
  }
233
- const At = "suggest_share_on_socials";
234
- function bn(e) {
233
+ const Dt = "suggest_share_on_socials";
234
+ function xn(e) {
235
235
  for (let t = e.length - 1; t >= 0; t -= 1) {
236
236
  const n = e[t];
237
- if (n.role !== "tool" || n.toolName !== At)
237
+ if (n.role !== "tool" || n.toolName !== Dt)
238
238
  continue;
239
- const o = it(e, t, "assistant");
239
+ const o = st(e, t, "assistant");
240
240
  if (!o)
241
241
  return null;
242
- const a = it(e, o.index, "user");
242
+ const a = st(e, o.index, "user");
243
243
  return a ? {
244
244
  id: `share:${n.callId ?? n.id}`,
245
245
  userPrompt: a.content,
@@ -248,13 +248,13 @@ function bn(e) {
248
248
  }
249
249
  return null;
250
250
  }
251
- async function wn(e) {
252
- const t = await _n(e);
251
+ async function vn(e) {
252
+ const t = await yn(e);
253
253
  if (!navigator.clipboard || typeof ClipboardItem > "u")
254
254
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
255
255
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
256
256
  }
257
- function it(e, t, n) {
257
+ function st(e, t, n) {
258
258
  for (let o = t - 1; o >= 0; o -= 1) {
259
259
  const a = e[o];
260
260
  if (a.role === n && a.content.trim())
@@ -262,73 +262,73 @@ function it(e, t, n) {
262
262
  }
263
263
  return null;
264
264
  }
265
- async function _n(e) {
265
+ async function yn(e) {
266
266
  return await (await fetch(e)).blob();
267
267
  }
268
- const xn = "https://app.pluno.ai", vn = "/api/product-agent/embed/active-users", yn = 1800, Cn = 15e3, En = 250, Sn = 1e3, kn = 3e4;
269
- function Ln(e, t = {}) {
268
+ const Cn = "https://app.pluno.ai", En = "/api/product-agent/embed/active-users", Sn = 1800, kn = 15e3, Ln = 250, Pn = 1e3, An = 3e4;
269
+ function Tn(e, t = {}) {
270
270
  let n = !1, o = null, a = null, i = null;
271
271
  const l = () => {
272
272
  i !== null && (window.clearInterval(i), i = null);
273
273
  }, p = (s) => {
274
274
  n || (a !== null && window.clearTimeout(a), a = window.setTimeout(() => {
275
275
  d();
276
- }, Tn(s)));
276
+ }, Dn(s)));
277
277
  }, c = (s) => {
278
278
  if (l(), o === null) {
279
279
  o = s, e(s);
280
280
  return;
281
281
  }
282
- const b = o, y = performance.now();
282
+ const f = o, C = performance.now();
283
283
  i = window.setInterval(() => {
284
284
  if (n) {
285
285
  l();
286
286
  return;
287
287
  }
288
- const S = Math.min(1, (performance.now() - y) / yn);
289
- o = Math.round(b + (s - b) * Nn(S)), e(o), S >= 1 && (o = s, e(s), l());
290
- }, En);
288
+ const k = Math.min(1, (performance.now() - C) / Sn);
289
+ o = Math.round(f + (s - f) * Mn(k)), e(o), k >= 1 && (o = s, e(s), l());
290
+ }, Ln);
291
291
  }, d = async () => {
292
292
  try {
293
- const s = await Pn(t);
293
+ const s = await Nn(t);
294
294
  if (n)
295
295
  return;
296
296
  c(s.count), p(s.refreshAfterMs);
297
297
  } catch {
298
- p(Cn);
298
+ p(kn);
299
299
  }
300
300
  };
301
301
  return d(), () => {
302
302
  n = !0, a !== null && window.clearTimeout(a), l();
303
303
  };
304
304
  }
305
- async function Pn(e) {
305
+ async function Nn(e) {
306
306
  if (e.loader)
307
307
  return e.loader();
308
- const n = await (e.fetcher ?? fetch)(new URL(vn, An(e.backendUrl ?? xn)).toString(), {
308
+ const n = await (e.fetcher ?? fetch)(new URL(En, In(e.backendUrl ?? Cn)).toString(), {
309
309
  cache: "no-store",
310
310
  credentials: "omit"
311
311
  });
312
312
  if (!n.ok)
313
313
  throw new Error("Failed to load active users");
314
- const o = await n.json(), a = rt(o.count), i = rt(o.refreshAfterMs ?? o.refresh_after_ms);
314
+ const o = await n.json(), a = dt(o.count), i = dt(o.refreshAfterMs ?? o.refresh_after_ms);
315
315
  if (a === null || i === null)
316
316
  throw new Error("Invalid active users response");
317
317
  return { count: a, refreshAfterMs: i };
318
318
  }
319
- function rt(e) {
319
+ function dt(e) {
320
320
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
321
321
  }
322
- function An(e) {
322
+ function In(e) {
323
323
  return e.endsWith("/") ? e : `${e}/`;
324
324
  }
325
- function Tn(e) {
326
- return Math.min(kn, Math.max(Sn, e));
325
+ function Dn(e) {
326
+ return Math.min(An, Math.max(Pn, e));
327
327
  }
328
- function Nn(e) {
328
+ function Mn(e) {
329
329
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
330
330
  }
331
- const Tt = 100, Dn = "product-agent:sdk-preview-socket-connect", In = "product-agent:sdk-preview-socket-send", Mn = "product-agent:sdk-preview-socket-close", Rn = "product-agent:sdk-preview-socket-open", On = "product-agent:sdk-preview-socket-message", Bn = "product-agent:sdk-preview-socket-error", Fn = "product-agent:sdk-preview-socket-closed", lt = "product-agent:sdk-preview-socket-id", Un = "product-agent:preview-diagnostic", Nt = "pluno.productAgent.sharePromptsDisabled", ye = 10, zn = 10 * 1024 * 1024, Gn = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), W = {
331
+ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", On = "product-agent:sdk-preview-socket-send", Bn = "product-agent:sdk-preview-socket-close", Fn = "product-agent:sdk-preview-socket-open", Un = "product-agent:sdk-preview-socket-message", zn = "product-agent:sdk-preview-socket-error", $n = "product-agent:sdk-preview-socket-closed", ct = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Rt = "pluno.productAgent.sharePromptsDisabled", Ce = 10, Hn = 10 * 1024 * 1024, Ot = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Ot).join(","), jn = 3, j = {
332
332
  launcherLabel: "Ask for anything...",
333
333
  accentColor: "#7c3aed",
334
334
  colorScheme: "light",
@@ -336,19 +336,19 @@ const Tt = 100, Dn = "product-agent:sdk-preview-socket-connect", In = "product-a
336
336
  scribbleStyle: !1,
337
337
  position: "bottom-right",
338
338
  movableLauncher: !1
339
- }, pt = '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>', $n = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', st = "pluno-pa-scribble-font", Dt = 190, It = 41, Hn = 48, Wn = 420, Vn = 520, jn = 0.24, qn = 680, Kn = 800, Yn = 0.76, B = 8, Ue = 50, Xn = "http://www.w3.org/2000/svg", Zn = 11, Jn = 13, dt = 4, Qn = 10, eo = 40, to = "movable-launcher-position-v2", Mt = "pluno-pa-widget-styles", Rt = "data-pluno-pa-widget-styles";
340
- function no(e) {
339
+ }, ut = '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>', Vn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Bt = 190, Ft = 41, qn = 48, Kn = 420, Yn = 520, Xn = 0.24, Zn = 680, Jn = 800, Qn = 0.76, B = 8, $e = 50, eo = "http://www.w3.org/2000/svg", to = 11, no = 13, ht = 4, oo = 10, ao = 40, io = "movable-launcher-position-v2", Ut = "pluno-pa-widget-styles", zt = "data-pluno-pa-widget-styles";
340
+ function ro(e) {
341
341
  return (t) => new V(t, e);
342
342
  }
343
- async function oo(e = {}) {
343
+ async function lo(e = {}) {
344
344
  const t = {
345
- launcherLabel: e.launcherLabel ?? W.launcherLabel,
346
- accentColor: e.accentColor ?? W.accentColor,
347
- colorScheme: e.colorScheme ?? W.colorScheme,
348
- fontFamily: e.fontFamily ?? W.fontFamily,
349
- scribbleStyle: e.scribbleStyle ?? W.scribbleStyle,
350
- position: e.position ?? W.position,
351
- movableLauncher: e.movableLauncher ?? W.movableLauncher,
345
+ launcherLabel: e.launcherLabel ?? j.launcherLabel,
346
+ accentColor: e.accentColor ?? j.accentColor,
347
+ colorScheme: e.colorScheme ?? j.colorScheme,
348
+ fontFamily: e.fontFamily ?? j.fontFamily,
349
+ scribbleStyle: e.scribbleStyle ?? j.scribbleStyle,
350
+ position: e.position ?? j.position,
351
+ movableLauncher: e.movableLauncher ?? j.movableLauncher,
352
352
  token: e.token,
353
353
  tokenProvider: e.tokenProvider,
354
354
  tokenEndpoint: e.tokenEndpoint,
@@ -370,7 +370,7 @@ async function oo(e = {}) {
370
370
  loadSharePromptsDisabled: e.loadSharePromptsDisabled,
371
371
  persistSharePromptsDisabled: e.persistSharePromptsDisabled
372
372
  };
373
- ee("web-sdk.widget", "Mounting widget with merged options", {
373
+ Y("web-sdk.widget", "Mounting widget with merged options", {
374
374
  accentColor: t.accentColor,
375
375
  colorScheme: t.colorScheme,
376
376
  fontFamily: t.fontFamily,
@@ -385,32 +385,32 @@ async function oo(e = {}) {
385
385
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget");
386
386
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
387
387
  a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
388
- let i = ct(t.accentColor, t.scribbleStyle);
389
- mo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
390
- const l = await aa(), p = l.ownerDocument;
391
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Ct(o, t.accentColor), ut(a, i, {
388
+ let i = mt(t.accentColor, t.scribbleStyle);
389
+ yo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
390
+ const l = await ga(), p = l.ownerDocument;
391
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Lt(o, t.accentColor), ft(a, i, {
392
392
  accentColor: t.accentColor,
393
393
  colorScheme: t.colorScheme,
394
394
  fontFamily: t.fontFamily,
395
395
  scribbleStyle: t.scribbleStyle
396
- }), ee("web-sdk.widget", "Applied initial widget appearance", {
396
+ }), Y("web-sdk.widget", "Applied initial widget appearance", {
397
397
  accentColor: t.accentColor,
398
398
  colorScheme: t.colorScheme,
399
399
  fontFamily: t.fontFamily,
400
400
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
401
401
  });
402
- const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), y = a.querySelector(".pluno-pa-widget__close"), S = a.querySelector(".pluno-pa-widget__composer"), w = a.querySelector(".pluno-pa-widget__attachment-error"), I = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), u = a.querySelector(".pluno-pa-widget__input"), h = a.querySelector(".pluno-pa-widget__send"), C = a.querySelector(".pluno-pa-widget__new-chat"), _ = a.querySelector(".pluno-pa-widget__timeline-jump"), N = a.querySelector(".pluno-pa-widget__active-users-counter"), k = a.querySelector(".pluno-pa-widget__timeline"), te = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
403
- if (!c || !s || !b || !y || !S || !w || !I || !v || !u || !h || !C || !_ || !N || !k || !te)
402
+ const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), C = a.querySelector(".pluno-pa-widget__close"), k = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"), R = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), de = a.querySelector(".pluno-pa-widget__active-users-counter"), E = a.querySelector(".pluno-pa-widget__timeline"), b = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
403
+ if (!c || !s || !f || !C || !k || !x || !R || !v || !y || !h || !g || !_ || !N || !Z || !de || !E || !b)
404
404
  throw new Error("Failed to mount Pluno widget");
405
405
  if (t.movableLauncher && !d)
406
406
  throw new Error("Failed to mount Pluno widget drag handle");
407
- mt(s), mt(u);
408
- let E = [], m = null;
409
- const x = () => {
410
- Lo(v, E, (r) => {
411
- E = E.filter((g, L) => L !== r), x(), O(f.getState()), U();
407
+ _t(s), _t(g);
408
+ let m = [], S = null;
409
+ const P = () => {
410
+ Oo(v, m, (r) => {
411
+ m = m.filter((u, T) => T !== r), P(), O(w.getState()), U();
412
412
  });
413
- }, M = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
413
+ }, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
414
414
  if (!t.tokenEndpoint)
415
415
  throw new Error("Pluno widget requires token or tokenEndpoint");
416
416
  const r = await fetch(t.tokenEndpoint, {
@@ -421,19 +421,19 @@ async function oo(e = {}) {
421
421
  });
422
422
  if (!r.ok)
423
423
  throw new Error("Failed to load Pluno token");
424
- const g = await r.json();
425
- if (!g.token)
424
+ const u = await r.json();
425
+ if (!u.token)
426
426
  throw new Error("Pluno token endpoint did not return a token");
427
- return g.token;
428
- }), R = window.fetch.bind(window);
429
- let f;
430
- f = await rn.init({
427
+ return u.token;
428
+ }), A = window.fetch.bind(window);
429
+ let w;
430
+ w = await sn.init({
431
431
  token: t.token,
432
- tokenProvider: M,
432
+ tokenProvider: I,
433
433
  backendUrl: t.backendUrl,
434
434
  metadata: () => ({
435
435
  ...t.metadata ?? {},
436
- ...!f.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
436
+ ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
437
437
  }),
438
438
  initialStarterPrompts: t.initialStarterPrompts,
439
439
  clientId: t.clientId,
@@ -442,41 +442,41 @@ async function oo(e = {}) {
442
442
  webSocketFactory: t.webSocketFactory,
443
443
  autoConnect: t.loginRequired ? !1 : void 0
444
444
  });
445
- const A = ia(t), ne = new Set(A.openToolGroupKeys), oe = new Set(A.seenShareCandidateIds), me = new Set(oe);
446
- let Ce = A.sharePromptsDisabled || await ra(t), G = t.movableLauncher ? A.launcherPosition : null, Ve = G !== null, j = null, Ee = !1, Y = !1, X = {
445
+ const J = ha(t), Ee = new Set(J.openToolGroupKeys), ae = new Set(J.seenShareCandidateIds), fe = new Set(ae);
446
+ let Se = J.sharePromptsDisabled || await ma(t), G = t.movableLauncher ? J.launcherPosition : null, qe = G !== null, q = null, ke = !1, Q = !1, ee = {
447
447
  enabled: !0
448
- }, Z = 0, je = "";
449
- const $ = (r, g) => {
450
- X = { enabled: r, reason: g };
451
- }, H = () => {
452
- _.hidden = !0;
453
- }, Yt = () => {
454
- _.hidden = !1;
455
- }, Xt = (r = "jump") => {
456
- $(!0, r), H(), ge(k, () => X.enabled), Z = k.scrollTop;
457
- }, Zt = () => {
458
- Ee || typeof document > "u" || (Ct(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
459
- }, qe = new MutationObserver(Zt);
460
- qe.observe(p.documentElement, { childList: !0, subtree: !0 });
461
- const Se = (r = !0) => {
462
- const g = ze(a, r);
463
- return gt(
448
+ }, te = 0, Ke = "";
449
+ const H = (r, u) => {
450
+ ee = { enabled: r, reason: u };
451
+ }, W = () => {
452
+ Z.hidden = !0;
453
+ }, en = () => {
454
+ Z.hidden = !1;
455
+ }, tn = (r = "jump") => {
456
+ H(!0, r), W(), he(E, () => ee.enabled), te = E.scrollTop;
457
+ }, nn = () => {
458
+ ke || typeof document > "u" || (Lt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
459
+ }, Ye = new MutationObserver(nn);
460
+ Ye.observe(p.documentElement, { childList: !0, subtree: !0 });
461
+ const Le = (r = !0) => {
462
+ const u = Ge(a, r);
463
+ return bt(
464
464
  a,
465
- G ?? ro(a, t.position, g),
466
- g
465
+ G ?? ho(a, t.position, u),
466
+ u
467
467
  );
468
468
  }, F = () => {
469
- pa(t, {
469
+ ba(t, {
470
470
  isOpen: a.classList.contains("pluno-pa-widget--open"),
471
- composerValue: u.value,
472
- openToolGroupKeys: [...ne],
473
- launcherPosition: Ve ? G : null,
474
- seenShareCandidateIds: [...oe].slice(-Tt),
475
- sharePromptsDisabled: Ce
471
+ composerValue: g.value,
472
+ openToolGroupKeys: [...Ee],
473
+ launcherPosition: qe ? G : null,
474
+ seenShareCandidateIds: [...ae].slice(-Mt),
475
+ sharePromptsDisabled: Se
476
476
  });
477
- }, J = (r, g = {}) => {
478
- uo(r, {
479
- debugVersion: to,
477
+ }, ne = (r, u = {}) => {
478
+ _o(r, {
479
+ debugVersion: io,
480
480
  launcherPosition: G,
481
481
  rootClasses: a.className,
482
482
  rootStyle: {
@@ -485,303 +485,335 @@ async function oo(e = {}) {
485
485
  right: a.style.right,
486
486
  bottom: a.style.bottom
487
487
  },
488
- rootRect: De(a),
489
- launcherRect: De(c),
490
- panelRect: De(b),
491
- viewport: pe(),
492
- panelHidden: b.hidden,
493
- closeHidden: y.hidden,
494
- ...g
488
+ rootRect: Me(a),
489
+ launcherRect: Me(c),
490
+ panelRect: Me(f),
491
+ viewport: se(),
492
+ panelHidden: f.hidden,
493
+ closeHidden: C.hidden,
494
+ ...u
495
495
  });
496
- }, fe = (r = !0) => {
496
+ }, be = (r = !0) => {
497
497
  if (!G)
498
- return we(a, null), Se(r);
499
- const g = Se(r);
500
- return we(a, g), J("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
501
- }, Ke = (r, g) => {
502
- if (!r || !g) {
503
- co(a);
498
+ return _e(a, null), Le(r);
499
+ const u = Le(r);
500
+ return _e(a, u), ne("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
501
+ }, Xe = (r, u) => {
502
+ if (!r || !u) {
503
+ wo(a);
504
504
  return;
505
505
  }
506
- so(a, {
507
- x: r.x - g.x,
508
- y: r.y - g.y
506
+ bo(a, {
507
+ x: r.x - u.x,
508
+ y: r.y - u.y
509
509
  });
510
- }, Ye = () => {
511
- const r = fe();
510
+ }, Ze = () => {
511
+ const r = be();
512
512
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
513
- const g = ht(a, r, t.position);
514
- Ke(g, r), J("Applied open panel position after viewport resize", { openPanelPosition: g });
515
- } else G && J("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
513
+ const u = wt(a, r, t.position);
514
+ Xe(u, r), ne("Applied open panel position after viewport resize", { openPanelPosition: u });
515
+ } else G && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
516
516
  };
517
- let Xe = () => {
517
+ let Je = () => {
518
518
  };
519
- window.addEventListener("resize", Ye), t.movableLauncher && d ? (fe(), Xe = io({
519
+ window.addEventListener("resize", Ze), t.movableLauncher && d ? (be(), Je = go({
520
520
  root: a,
521
521
  launcher: c,
522
522
  launcherDragHandle: d,
523
- getPosition: () => Se(),
523
+ getPosition: () => Le(),
524
524
  setPosition: (r) => {
525
- const g = r;
526
- G = gt(a, r, ze(a)), we(a, G), J("Dragging closed launcher", { requestedPosition: g });
525
+ const u = r;
526
+ G = bt(a, r, Ge(a)), _e(a, G), ne("Dragging closed launcher", { requestedPosition: u });
527
527
  },
528
528
  persist: () => {
529
- Ve = !0, F(), J("Persisted closed launcher drag position");
529
+ qe = !0, F(), ne("Persisted closed launcher drag position");
530
530
  }
531
- })) : we(a, null);
532
- let ke = !1;
533
- const Ze = async () => {
534
- if (!(!t.billingStatusLoader || ke)) {
535
- ke = !0;
531
+ })) : _e(a, null);
532
+ let Pe = !1;
533
+ const Qe = async () => {
534
+ if (!(!t.billingStatusLoader || Pe)) {
535
+ Pe = !0;
536
536
  try {
537
537
  const r = await t.billingStatusLoader();
538
- bt(t.billingStatus, r, f.getState().lastErrorCode) && (t.billingStatus = r, Re(I, t.billingStatus, f.getState().lastErrorCode), U());
538
+ vt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, Be(R, t.billingStatus, w.getState().lastErrorCode), U());
539
539
  } finally {
540
- ke = !1;
540
+ Pe = !1;
541
541
  }
542
542
  }
543
- }, Q = (r = "", g = !0) => {
544
- Ze(), j !== null && (window.clearTimeout(j), j = null), b.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
545
- const L = fe(), q = ht(a, L, t.position);
546
- if (Ke(q, L), J("Opening launcher at clamped open panel position", { openPanelPosition: q, visibleLauncherPosition: L }), $(!0, "open"), H(), !g) {
547
- a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (u.value = r, ue(u)), ge(k, () => X.enabled), Z = k.scrollTop, u.focus(), u.setSelectionRange(u.value.length, u.value.length), F();
543
+ }, oe = (r = "", u = !0) => {
544
+ Qe(), q !== null && (window.clearTimeout(q), q = null), f.hidden = !1, C.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
545
+ const T = be(), K = wt(a, T, t.position);
546
+ if (Xe(K, T), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: T }), H(!0, "open"), W(), !u) {
547
+ a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
548
548
  return;
549
549
  }
550
550
  window.requestAnimationFrame(() => {
551
- a.classList.add("pluno-pa-widget--open"), r && (u.value = r, ue(u)), ge(k, () => X.enabled), Z = k.scrollTop, u.focus(), u.setSelectionRange(u.value.length, u.value.length), F(), j = window.setTimeout(() => {
552
- c.hidden = !0, ge(k, () => X.enabled), Z = k.scrollTop;
551
+ a.classList.add("pluno-pa-widget--open"), r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
552
+ c.hidden = !0, he(E, () => ee.enabled), te = E.scrollTop;
553
553
  }, 220);
554
554
  });
555
- }, Jt = () => {
556
- j !== null && (window.clearTimeout(j), j = null), c.hidden = !1, G && (fe(!1), J("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), j = window.setTimeout(() => {
557
- b.hidden = !0, y.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
555
+ }, on = () => {
556
+ q !== null && (window.clearTimeout(q), q = null), c.hidden = !1, G && (be(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
557
+ f.hidden = !0, C.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
558
558
  }, 220);
559
559
  };
560
560
  c.addEventListener("submit", (r) => {
561
- r.preventDefault(), Q(s.value), s.value = "";
561
+ r.preventDefault(), oe(s.value), s.value = "";
562
562
  }), d?.addEventListener("click", (r) => {
563
563
  r.preventDefault(), r.stopPropagation();
564
564
  }), c.addEventListener("click", (r) => {
565
- r.target === s && !d || (Q(s.value), s.value = "");
565
+ r.target === s && !d || (oe(s.value), s.value = "");
566
566
  }), s.addEventListener("focus", () => {
567
- Q(s.value), s.value = "";
567
+ oe(s.value), s.value = "";
568
568
  }), s.addEventListener("input", () => {
569
569
  if (!s.value)
570
570
  return;
571
571
  const r = s.value;
572
- Q(r), s.value = "";
573
- }), y.addEventListener("click", Jt), k.addEventListener("scroll", () => {
574
- k.scrollTop < Z - 1 && $(!1, "userScroll"), Z = k.scrollTop;
575
- }), _.addEventListener("click", () => {
576
- Xt();
572
+ oe(r), s.value = "";
573
+ }), C.addEventListener("click", on), E.addEventListener("scroll", () => {
574
+ E.scrollTop < te - 1 && H(!1, "userScroll"), te = E.scrollTop;
575
+ }), Z.addEventListener("click", () => {
576
+ tn();
577
577
  });
578
- const Je = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
578
+ const et = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
579
579
  ([r]) => {
580
- r?.isIntersecting && ($(!0, "bottom"), H());
580
+ r?.isIntersecting && (H(!0, "bottom"), W());
581
581
  },
582
- { root: k, threshold: 0 }
582
+ { root: E, threshold: 0 }
583
583
  );
584
- Je?.observe(te);
584
+ et?.observe(b);
585
585
  const U = () => {
586
- h.disabled = K(t.billingStatus) || !f.getState().isThinking && u.value.trim().length === 0 && E.length === 0;
586
+ _.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || $(t.billingStatus);
587
587
  };
588
- t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, u.placeholder = t.loginButtonLabel, S.hidden = !0), S.addEventListener("submit", (r) => {
588
+ t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, k.hidden = !0), k.addEventListener("submit", (r) => {
589
589
  if (r.preventDefault(), t.loginRequired) {
590
590
  t.onLoginClick?.();
591
591
  return;
592
592
  }
593
- K(t.billingStatus) || (Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U());
593
+ $(t.billingStatus) || (Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U());
594
594
  });
595
- let de = 0;
596
- const Qt = () => {
597
- de = 0, a.classList.remove("pluno-pa-widget--drag-over");
598
- }, en = (r) => {
599
- m !== null && window.clearTimeout(m), w.textContent = r, w.hidden = !1, m = window.setTimeout(() => {
600
- w.textContent = "", w.hidden = !0, m = null;
595
+ let ce = 0;
596
+ const an = () => {
597
+ ce = 0, a.classList.remove("pluno-pa-widget--drag-over");
598
+ }, tt = (r) => {
599
+ S !== null && window.clearTimeout(S), x.textContent = r, x.hidden = !1, S = window.setTimeout(() => {
600
+ x.textContent = "", x.hidden = !0, S = null;
601
601
  }, 3e3);
602
- }, tn = () => {
603
- m !== null && (window.clearTimeout(m), m = null), w.textContent = "", w.hidden = !0;
604
- }, nn = async (r) => {
602
+ }, rn = () => {
603
+ S !== null && (window.clearTimeout(S), S = null), x.textContent = "", x.hidden = !0;
604
+ }, nt = async (r) => {
605
605
  if (r.length === 0)
606
606
  return;
607
- const g = await No(r);
608
- if (E.length + g.length > ye)
609
- throw new Error(`Attach up to ${ye} files per message.`);
610
- E = [...E, ...g], x(), tn(), U(), O(f.getState()), a.classList.contains("pluno-pa-widget--open") || Q();
607
+ const u = await zo(r);
608
+ if (m.length + u.length > Ce)
609
+ throw new Error(`Attach up to ${Ce} files per message.`);
610
+ m = [...m, ...u], P(), rn(), U(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
611
611
  };
612
- a.addEventListener("dragenter", (r) => {
613
- !_e(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), de += 1, a.classList.add("pluno-pa-widget--drag-over"));
612
+ h.addEventListener("click", () => {
613
+ t.loginRequired || $(t.billingStatus) || y.click();
614
+ }), y.addEventListener("change", () => {
615
+ const r = Array.from(y.files ?? []);
616
+ y.value = "", nt(r).catch((u) => {
617
+ tt(u instanceof Error ? u.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
618
+ message: u instanceof Error ? u.message : String(u)
619
+ });
620
+ });
621
+ }), a.addEventListener("dragenter", (r) => {
622
+ !xe(r.dataTransfer) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), ce += 1, a.classList.add("pluno-pa-widget--drag-over"));
614
623
  }), a.addEventListener("dragover", (r) => {
615
- const g = r.dataTransfer;
616
- !_e(g) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), g.dropEffect = "copy");
624
+ const u = r.dataTransfer;
625
+ !xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), u.dropEffect = "copy");
617
626
  }), a.addEventListener("dragleave", (r) => {
618
- _e(r.dataTransfer) && (r.stopPropagation(), de = Math.max(0, de - 1), de === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
627
+ xe(r.dataTransfer) && (r.stopPropagation(), ce = Math.max(0, ce - 1), ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
619
628
  }), a.addEventListener("drop", (r) => {
620
- const g = r.dataTransfer;
621
- !_e(g) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), Qt(), nn(g.files).catch((L) => {
622
- en(L instanceof Error ? L.message : "Failed to attach file"), ee("web-sdk.widget", "Attachment failed", {
623
- message: L instanceof Error ? L.message : String(L)
629
+ const u = r.dataTransfer;
630
+ !xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), an(), nt(u.files).catch((T) => {
631
+ tt(T instanceof Error ? T.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
632
+ message: T instanceof Error ? T.message : String(T)
624
633
  });
625
634
  }));
626
- }), h.addEventListener("click", () => {
635
+ }), _.addEventListener("click", () => {
627
636
  if (t.loginRequired) {
628
637
  t.onLoginClick?.();
629
638
  return;
630
639
  }
631
- if (f.getState().isThinking) {
632
- f.stop();
640
+ if (w.getState().isThinking) {
641
+ w.stop();
633
642
  return;
634
643
  }
635
- Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U(), O(f.getState());
636
- }), C.addEventListener("click", () => {
637
- Y = !0, $(!0, "newSession"), H(), f.startNewSession(), ne.clear(), u.value = "", E = [], x(), ue(u), F(), U(), u.focus(), O(f.getState());
638
- }), u.addEventListener("input", () => {
639
- ue(u), F(), U(), O(f.getState());
640
- }), u.addEventListener("keydown", (r) => {
644
+ Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
645
+ }), N.addEventListener("click", () => {
646
+ Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g), F(), U(), g.focus(), O(w.getState());
647
+ }), g.addEventListener("input", () => {
648
+ ge(g), F(), U(), O(w.getState());
649
+ }), g.addEventListener("keydown", (r) => {
641
650
  if (!(r.key !== "Enter" || r.shiftKey)) {
642
651
  if (r.preventDefault(), t.loginRequired) {
643
652
  t.onLoginClick?.();
644
653
  return;
645
654
  }
646
- Y = !0, $(!0, "send"), H(), E = Ie(f, u, E), x(), U(), O(f.getState());
655
+ Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
647
656
  }
648
657
  }), a.addEventListener("click", (r) => {
649
658
  (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
650
- }), A.composerValue && (u.value = A.composerValue, ue(u)), A.isOpen && Q(u.value, !1);
651
- const Qe = () => i;
652
- let Le = f.getState().appearance !== null, be = null, ce = null, ae = null, et = f.getState().isThinking, ie = null, Pe = null, tt = () => {
659
+ }), J.composerValue && (g.value = J.composerValue, ge(g)), J.isOpen && oe(g.value, !1);
660
+ const ot = () => i;
661
+ let Ae = w.getState().appearance !== null, we = null, ue = null, ie = null, at = w.getState().isThinking, re = null, Te = null, it = () => {
653
662
  };
654
- const on = !!t.socialPostDraftHandler, O = (r) => {
655
- if (We(r.lastErrorCode) ? ie = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !K(t.billingStatus) && (ie = null), Re(I, t.billingStatus, ie), t.loginRequired) {
656
- Wo(k, h, C, Qe, t.loginButtonLabel, t.onLoginClick);
663
+ const ln = !!t.socialPostDraftHandler, O = (r) => {
664
+ if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(R, t.billingStatus, re), t.loginRequired) {
665
+ Qo(E, _, N, ot, t.loginButtonLabel, t.onLoginClick);
657
666
  return;
658
667
  }
659
- const g = go(r), L = g !== je;
660
- je = g;
661
- const q = Y || X.enabled;
662
- Y = !1, Ho(
663
- k,
664
- te,
665
- h,
666
- C,
668
+ const u = xo(r), T = u !== Ke;
669
+ Ke = u;
670
+ const K = Q || ee.enabled;
671
+ Q = !1, Jo(
672
+ E,
673
+ b,
674
+ _,
667
675
  N,
676
+ de,
668
677
  r,
669
- Pe,
670
- Pe !== null && _t(r, u.value.trim().length > 0 || E.length > 0),
671
- q,
672
- () => X.enabled,
673
- ne,
678
+ Te,
679
+ Te !== null && Ct(r, g.value.trim().length > 0 || m.length > 0),
680
+ K,
681
+ () => ee.enabled,
682
+ Ee,
674
683
  F,
675
- Qe,
676
- (D) => {
677
- Y = !0, $(!0, "send"), H(), f.sendMessage(D);
684
+ ot,
685
+ (M) => {
686
+ Q = !0, H(!0, "send"), W(), w.sendMessage(M);
678
687
  },
679
- on && !Ce ? {
680
- dismissedCandidateIds: me,
681
- draftingCandidateId: be,
682
- error: ce,
683
- onSeen: (D) => {
684
- oe.add(D.id), F();
688
+ ln && !Se ? {
689
+ dismissedCandidateIds: fe,
690
+ draftingCandidateId: we,
691
+ error: ue,
692
+ onSeen: (M) => {
693
+ ae.add(M.id), F();
685
694
  },
686
- onDraft: (D) => {
687
- an(D);
695
+ onDraft: (M) => {
696
+ pn(M);
688
697
  },
689
- onDismiss: (D) => {
690
- oe.add(D.id), me.add(D.id), F(), ce = null, O(f.getState());
698
+ onDismiss: (M) => {
699
+ ae.add(M.id), fe.add(M.id), F(), ue = null, O(w.getState());
691
700
  },
692
- onDisable: (D) => {
693
- Ce = !0, oe.add(D.id), me.add(D.id), F(), la(t, !0), ce = null, O(f.getState());
701
+ onDisable: (M) => {
702
+ Se = !0, ae.add(M.id), fe.add(M.id), F(), fa(t, !0), ue = null, O(w.getState());
694
703
  }
695
704
  } : void 0
696
- ), q ? (Z = k.scrollTop, H()) : L && ho(r) && Yt();
705
+ ), K ? (te = E.scrollTop, W()) : T && vo(r) && en();
697
706
  };
698
- return tt = Ln((r) => {
699
- Pe = r, !Ee && _t(f.getState(), u.value.trim().length > 0 || E.length > 0) && O(f.getState());
700
- }, { backendUrl: t.backendUrl, fetcher: R, loader: t.activeUsersLoader }), f.on("state", (r) => {
701
- const g = et && !r.isThinking;
702
- et = r.isThinking, r.appearance ? (Le = !0, ee("web-sdk.widget", "Agent state supplied appearance", {
707
+ return it = Tn((r) => {
708
+ Te = r, !ke && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) && O(w.getState());
709
+ }, { backendUrl: t.backendUrl, fetcher: A, loader: t.activeUsersLoader }), w.on("state", (r) => {
710
+ const u = at && !r.isThinking;
711
+ at = r.isThinking, r.appearance ? (Ae = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
703
712
  appearance: r.appearance
704
- }), Ae(r.appearance, "agent.state.appearance")) : Le && (Le = !1, ee("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
713
+ }), Ne(r.appearance, "agent.state.appearance")) : Ae && (Ae = !1, Y("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
705
714
  fallbackAccentColor: t.accentColor,
706
715
  fallbackColorScheme: t.colorScheme,
707
716
  fallbackFontFamily: t.fontFamily
708
- }), Ae({}, "agent.state.appearance-cleared")), O(r), U(), g && Ze();
709
- }), O(f.getState()), U(), {
710
- agent: f,
717
+ }), Ne({}, "agent.state.appearance-cleared")), O(r), U(), u && Qe();
718
+ }), O(w.getState()), U(), {
719
+ agent: w,
711
720
  updateAppearance: (r) => {
712
- r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ae(r, "widgetHandle.updateAppearance");
721
+ r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ne(r, "widgetHandle.updateAppearance");
713
722
  },
714
723
  updateBillingStatus: (r) => {
715
- const g = r ?? null;
716
- bt(t.billingStatus, g, ie) && (t.billingStatus = g, t.billingStatus?.creditsUsed !== null && !K(t.billingStatus) && (ie = null), Re(
724
+ const u = r ?? null;
725
+ vt(t.billingStatus, u, re) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(
717
726
  a.querySelector(".pluno-pa-widget__billing-status"),
718
727
  t.billingStatus,
719
- ie
728
+ re
720
729
  ), U());
721
730
  },
722
731
  openPanel: () => {
723
- Q(u.value, !1);
732
+ oe(g.value, !1);
724
733
  },
725
734
  destroy: () => {
726
- Ee = !0, qe.disconnect(), Je?.disconnect(), window.removeEventListener("resize", Ye), Xe(), m !== null && window.clearTimeout(m), tt(), ae?.remove(), f.destroy(), n.remove();
735
+ ke = !0, Ye.disconnect(), et?.disconnect(), window.removeEventListener("resize", Ze), Je(), S !== null && window.clearTimeout(S), it(), ie?.remove(), w.destroy(), n.remove();
727
736
  }
728
737
  };
729
- async function an(r) {
730
- if (!be) {
731
- be = r.id, ce = null, O(f.getState());
738
+ async function pn(r) {
739
+ if (!we) {
740
+ we = r.id, ue = null, O(w.getState());
732
741
  try {
733
742
  if (!t.socialPostDraftHandler)
734
743
  throw new Error("Social post drafting is not available here.");
735
- const g = await t.socialPostDraftHandler(r);
736
- if (!g.linkedinPost || !g.xPost)
744
+ const u = await t.socialPostDraftHandler(r);
745
+ if (!u.linkedinPost || !u.xPost)
737
746
  throw new Error("Pluno did not return a complete social post draft.");
738
- oe.add(r.id), me.add(r.id), F(), ae?.remove(), ae = qo(g, {
747
+ ae.add(r.id), fe.add(r.id), F(), ie?.remove(), ie = na(u, {
739
748
  socialPostRewardsUrl: t.socialPostRewardsUrl,
740
749
  onClose: () => {
741
- ae?.remove(), ae = null;
750
+ ie?.remove(), ie = null;
742
751
  }
743
- }), a.appendChild(ae);
744
- } catch (g) {
745
- ce = g instanceof Error ? g.message : "Could not draft social post.";
752
+ }), a.appendChild(ie);
753
+ } catch (u) {
754
+ ue = u instanceof Error ? u.message : "Could not draft social post.";
746
755
  } finally {
747
- be = null, O(f.getState());
756
+ we = null, O(w.getState());
748
757
  }
749
758
  }
750
759
  }
751
- function Ae(r, g) {
752
- const L = r.accentColor ?? t.accentColor, q = r.colorScheme ?? t.colorScheme, D = r.fontFamily ?? t.fontFamily, Te = r.scribbleStyle ?? t.scribbleStyle;
753
- i = ct(L, Te), ut(a, i, {
754
- accentColor: L,
755
- colorScheme: q,
756
- fontFamily: D,
757
- scribbleStyle: Te
758
- }), ee("web-sdk.widget", "Updated widget appearance", {
759
- source: g,
760
+ function Ne(r, u) {
761
+ const T = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, Ie = r.scribbleStyle ?? t.scribbleStyle;
762
+ i = mt(T, Ie), ft(a, i, {
763
+ accentColor: T,
764
+ colorScheme: K,
765
+ fontFamily: M,
766
+ scribbleStyle: Ie
767
+ }), Y("web-sdk.widget", "Updated widget appearance", {
768
+ source: u,
760
769
  inputAppearance: r,
761
- appliedAccentColor: L,
762
- appliedColorScheme: q,
763
- appliedFontFamily: D,
764
- appliedScribbleStyle: Te,
770
+ appliedAccentColor: T,
771
+ appliedColorScheme: K,
772
+ appliedFontFamily: M,
773
+ appliedScribbleStyle: Ie,
765
774
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
766
775
  });
767
776
  }
768
777
  }
769
- function ct(e, t) {
770
- return t ? cn(e) : sn(e);
778
+ function mt(e, t) {
779
+ return t ? hn(e) : un(e);
780
+ }
781
+ function po(e) {
782
+ const t = so(e);
783
+ return t === null ? "#fafafa" : co(t) > 0.5 ? "#18181b" : "#fafaf9";
784
+ }
785
+ function so(e) {
786
+ const t = e.trim();
787
+ return /^#[0-9a-f]{6}$/i.test(t) ? [
788
+ Number.parseInt(t.slice(1, 3), 16),
789
+ Number.parseInt(t.slice(3, 5), 16),
790
+ Number.parseInt(t.slice(5, 7), 16)
791
+ ] : /^#[0-9a-f]{3}$/i.test(t) ? [
792
+ Number.parseInt(t[1] + t[1], 16),
793
+ Number.parseInt(t[2] + t[2], 16),
794
+ Number.parseInt(t[3] + t[3], 16)
795
+ ] : null;
796
+ }
797
+ function co([e, t, n]) {
798
+ const o = (a) => {
799
+ const i = a / 255;
800
+ return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
801
+ };
802
+ return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
771
803
  }
772
- function ut(e, t, n) {
804
+ function ft(e, t, n) {
773
805
  e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
774
- const o = n.scribbleStyle ? Lt(n.accentColor) : n.accentColor;
775
- e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? $n : n.fontFamily, n.scribbleStyle && ao(e.ownerDocument);
806
+ const o = n.scribbleStyle ? Nt(n.accentColor) : n.accentColor;
807
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", po(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Vn : n.fontFamily, n.scribbleStyle && uo(e.ownerDocument);
776
808
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
777
809
  for (const i of a)
778
810
  i.src = t;
779
811
  }
780
- function ao(e) {
781
- if (e.getElementById(st))
812
+ function uo(e) {
813
+ if (e.getElementById(gt))
782
814
  return;
783
815
  const t = e.createElement("style");
784
- t.id = st, t.textContent = `@font-face {
816
+ t.id = gt, t.textContent = `@font-face {
785
817
  font-family: "Architects Daughter";
786
818
  font-style: normal;
787
819
  font-weight: 400;
@@ -789,7 +821,7 @@ function ao(e) {
789
821
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
790
822
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
791
823
  }
792
- function io({
824
+ function go({
793
825
  root: e,
794
826
  launcher: t,
795
827
  launcherDragHandle: n,
@@ -798,117 +830,117 @@ function io({
798
830
  persist: i
799
831
  }) {
800
832
  let l = null, p = null, c = null, d = !1, s = null;
801
- const b = () => {
833
+ const f = () => {
802
834
  l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
803
- }, y = (h) => {
835
+ }, C = (h) => {
804
836
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, c = o(), d = !1, t.setPointerCapture?.(h.pointerId));
805
- }, S = (h) => {
837
+ }, k = (h) => {
806
838
  if (l !== h.pointerId || !p || !c)
807
839
  return;
808
840
  h.preventDefault();
809
- const C = h.clientX - p.x, _ = h.clientY - p.y;
810
- !d && Math.hypot(C, _) < dt || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + C, y: c.y + _ }));
811
- }, w = (h) => {
812
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), b());
813
- }, I = (h) => {
814
- l === h.pointerId && (h.preventDefault(), b());
841
+ const g = h.clientX - p.x, _ = h.clientY - p.y;
842
+ !d && Math.hypot(g, _) < ht || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
843
+ }, x = (h) => {
844
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
845
+ }, R = (h) => {
846
+ l === h.pointerId && (h.preventDefault(), f());
815
847
  }, v = (h) => {
816
848
  if (!s)
817
849
  return;
818
- const C = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= dt;
819
- s = null, C && (h.preventDefault(), h.stopPropagation());
820
- }, u = (h) => {
850
+ const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= ht;
851
+ s = null, g && (h.preventDefault(), h.stopPropagation());
852
+ }, y = (h) => {
821
853
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
822
854
  return;
823
- const C = h.shiftKey ? eo : Qn, _ = o();
855
+ const g = h.shiftKey ? ao : oo, _ = o();
824
856
  let N = null;
825
- h.key === "ArrowUp" ? N = { x: _.x, y: _.y - C } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + C } : h.key === "ArrowLeft" ? N = { x: _.x - C, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + C, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
857
+ h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
826
858
  };
827
- return t.addEventListener("pointerdown", y), t.addEventListener("pointermove", S), t.addEventListener("pointerup", w), t.addEventListener("pointercancel", I), t.addEventListener("click", v, !0), n.addEventListener("keydown", u), () => {
828
- t.removeEventListener("pointerdown", y), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", w), t.removeEventListener("pointercancel", I), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", u);
859
+ return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", k), t.addEventListener("pointerup", x), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
860
+ t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", k), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
829
861
  };
830
862
  }
831
- function ze(e, t = !0) {
832
- const n = pe(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
863
+ function Ge(e, t = !0) {
864
+ const n = se(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
833
865
  return {
834
- width: t && a && o.width > 0 ? o.width : Math.min(Dt, n.width - 36),
835
- height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Hn : It
866
+ width: t && a && o.width > 0 ? o.width : Math.min(Bt, n.width - 36),
867
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? qn : Ft
836
868
  };
837
869
  }
838
- function Ot() {
839
- const e = pe();
870
+ function $t() {
871
+ const e = se();
840
872
  return {
841
873
  width: Math.min(
842
- le(e.width * jn, Wn, Vn),
874
+ pe(e.width * Xn, Kn, Yn),
843
875
  e.width - B * 2
844
876
  ),
845
877
  height: Math.min(
846
- le(e.height * Yn, qn, Kn),
847
- e.height - Ue - B
878
+ pe(e.height * Qn, Zn, Jn),
879
+ e.height - $e - B
848
880
  )
849
881
  };
850
882
  }
851
- function ro(e, t, n) {
883
+ function ho(e, t, n) {
852
884
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
853
885
  if (Number.isFinite(o) && Number.isFinite(a))
854
886
  return { x: o, y: a };
855
887
  const i = e.getBoundingClientRect();
856
888
  if (i.width > 0 || i.height > 0)
857
889
  return { x: i.left, y: i.top };
858
- const l = pe();
890
+ const l = se();
859
891
  return {
860
892
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
861
893
  y: l.height - 24 - n.height
862
894
  };
863
895
  }
864
- function gt(e, t, n) {
865
- const o = pe(), a = B + lo(e);
896
+ function bt(e, t, n) {
897
+ const o = se(), a = B + mo(e);
866
898
  return {
867
- x: le(t.x, B, Math.max(B, o.width - n.width - B)),
868
- y: le(t.y, a, Math.max(a, o.height - n.height - B))
899
+ x: pe(t.x, B, Math.max(B, o.width - n.width - B)),
900
+ y: pe(t.y, a, Math.max(a, o.height - n.height - B))
869
901
  };
870
902
  }
871
- function lo(e) {
872
- return e.classList.contains("pluno-pa-widget--scribble") ? Jn : Zn;
903
+ function mo(e) {
904
+ return e.classList.contains("pluno-pa-widget--scribble") ? no : to;
873
905
  }
874
- function ht(e, t, n) {
875
- const o = ze(e), a = Ot(), i = {
906
+ function wt(e, t, n) {
907
+ const o = Ge(e), a = $t(), i = {
876
908
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
877
909
  y: t.y + o.height - a.height
878
910
  };
879
- return po(i);
911
+ return fo(i);
880
912
  }
881
- function po(e) {
882
- const t = pe(), n = Ot();
913
+ function fo(e) {
914
+ const t = se(), n = $t();
883
915
  return {
884
- x: le(e.x, B, Math.max(B, t.width - n.width - B)),
885
- y: le(
916
+ x: pe(e.x, B, Math.max(B, t.width - n.width - B)),
917
+ y: pe(
886
918
  e.y,
887
- Ue,
888
- Math.max(Ue, t.height - n.height - B)
919
+ $e,
920
+ Math.max($e, t.height - n.height - B)
889
921
  )
890
922
  };
891
923
  }
892
- function we(e, t) {
924
+ function _e(e, t) {
893
925
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
894
926
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
895
927
  return;
896
928
  }
897
929
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
898
930
  }
899
- function so(e, t) {
931
+ function bo(e, t) {
900
932
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
901
933
  }
902
- function co(e) {
934
+ function wo(e) {
903
935
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
904
936
  }
905
- function pe() {
937
+ function se() {
906
938
  return {
907
- width: window.innerWidth || document.documentElement.clientWidth || Dt + B * 2,
908
- height: window.innerHeight || document.documentElement.clientHeight || It + B * 2
939
+ width: window.innerWidth || document.documentElement.clientWidth || Bt + B * 2,
940
+ height: window.innerHeight || document.documentElement.clientHeight || Ft + B * 2
909
941
  };
910
942
  }
911
- function De(e) {
943
+ function Me(e) {
912
944
  const t = e.getBoundingClientRect();
913
945
  return {
914
946
  x: Math.round(t.x),
@@ -917,10 +949,10 @@ function De(e) {
917
949
  height: Math.round(t.height)
918
950
  };
919
951
  }
920
- function le(e, t, n) {
952
+ function pe(e, t, n) {
921
953
  return Math.min(Math.max(e, t), n);
922
954
  }
923
- function ee(e, t, n) {
955
+ function Y(e, t, n) {
924
956
  if (typeof window > "u")
925
957
  return;
926
958
  const o = window, a = {
@@ -929,26 +961,26 @@ function ee(e, t, n) {
929
961
  message: t,
930
962
  details: n
931
963
  }, i = o.__plunoProductAgentDiagnostics__ ?? [];
932
- 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(Un, { detail: a }));
964
+ 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(Gn, { detail: a }));
933
965
  }
934
- function uo(e, t) {
935
- ee("web-sdk.widget.position", e, t);
966
+ function _o(e, t) {
967
+ Y("web-sdk.widget.position", e, t);
936
968
  }
937
- function Ie(e, t, n) {
969
+ function Re(e, t, n) {
938
970
  const o = t.value.trim();
939
971
  return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
940
972
  }
941
- function ue(e) {
973
+ function ge(e) {
942
974
  e.style.height = "0px";
943
975
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
944
976
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
945
977
  }
946
- function ge(e, t = () => !0) {
978
+ function he(e, t = () => !0) {
947
979
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
948
980
  t() && (e.scrollTop = e.scrollHeight);
949
981
  });
950
982
  }
951
- function go(e) {
983
+ function xo(e) {
952
984
  const t = e.messages[e.messages.length - 1];
953
985
  return [
954
986
  e.messages.length,
@@ -959,37 +991,37 @@ function go(e) {
959
991
  e.lastError ?? ""
960
992
  ].join(":");
961
993
  }
962
- function ho(e) {
994
+ function vo(e) {
963
995
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
964
996
  }
965
- function mo(e, t, n, o) {
966
- e.appendChild(vo()), e.appendChild(fo(t, n, o)), e.appendChild(Ut("pluno-pa-widget__close", "Close", yo(16), !0)), e.appendChild(bo(n));
997
+ function yo(e, t, n, o) {
998
+ e.appendChild(Po()), e.appendChild(Co(t, n, o)), e.appendChild(Wt("pluno-pa-widget__close", "Close", Ao(16), !0)), e.appendChild(Eo(n));
967
999
  }
968
- function fo(e, t, n) {
1000
+ function Co(e, t, n) {
969
1001
  const o = document.createElement("form");
970
1002
  if (o.className = "pluno-pa-widget__launcher", n) {
971
1003
  const i = document.createElement("button");
972
1004
  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);
973
1005
  }
974
- o.appendChild(Ft("pluno-pa-widget__character--launcher", t));
1006
+ o.appendChild(Ht("pluno-pa-widget__character--launcher", t));
975
1007
  const a = document.createElement("input");
976
1008
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
977
1009
  }
978
- function bo(e) {
1010
+ function Eo(e) {
979
1011
  const t = document.createElement("section");
980
1012
  t.className = "pluno-pa-widget__panel", t.hidden = !0;
981
1013
  const n = document.createElement("div");
982
1014
  n.className = "pluno-pa-widget__timeline-wrap";
983
1015
  const o = document.createElement("main");
984
- o.className = "pluno-pa-widget__timeline", o.appendChild(_o(e));
1016
+ o.className = "pluno-pa-widget__timeline", o.appendChild(ko(e));
985
1017
  const a = document.createElement("div");
986
1018
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
987
1019
  const i = document.createElement("div");
988
1020
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
989
1021
  const l = document.createElement("button");
990
- return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Ut("pluno-pa-widget__new-chat", "New chat", Co(), !0)), t.appendChild(n), t.appendChild(wo()), t;
1022
+ return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Wt("pluno-pa-widget__new-chat", "New chat", To(), !0)), t.appendChild(n), t.appendChild(So()), t;
991
1023
  }
992
- function wo() {
1024
+ function So() {
993
1025
  const e = document.createElement("form");
994
1026
  e.className = "pluno-pa-widget__composer";
995
1027
  const t = document.createElement("div");
@@ -1000,52 +1032,56 @@ function wo() {
1000
1032
  o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1001
1033
  const a = document.createElement("div");
1002
1034
  a.className = "pluno-pa-widget__composer-inner";
1003
- const i = document.createElement("textarea");
1004
- i.className = "pluno-pa-widget__input", i.rows = 1, i.placeholder = "Ask for anything...", a.appendChild(i);
1035
+ const i = document.createElement("input");
1036
+ i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Wn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1005
1037
  const l = document.createElement("button");
1006
- l.type = "button", l.className = "pluno-pa-widget__send", l.setAttribute("aria-label", "Send"), l.appendChild(zt()), a.appendChild(l), e.appendChild(a);
1007
- const p = document.createElement("div");
1008
- p.className = "pluno-pa-widget__composer-meta";
1009
- const c = document.createElement("a");
1010
- c.className = "pluno-pa-widget__powered-by", c.href = "https://pluno.ai", c.target = "_blank", c.rel = "noopener noreferrer", c.textContent = "Powered by Pluno.ai.", p.appendChild(c);
1011
- const d = document.createElement("span");
1012
- return d.className = "pluno-pa-widget__ai-disclaimer", d.textContent = "AI can make mistakes. Verify outputs.", p.appendChild(d), e.appendChild(p), e;
1038
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(No()), l.appendChild(Io()), a.appendChild(l);
1039
+ const p = document.createElement("textarea");
1040
+ p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1041
+ const c = document.createElement("button");
1042
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(jt()), a.appendChild(c), e.appendChild(a);
1043
+ const d = document.createElement("div");
1044
+ d.className = "pluno-pa-widget__composer-meta";
1045
+ const s = document.createElement("a");
1046
+ 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.", d.appendChild(s);
1047
+ const f = document.createElement("span");
1048
+ return f.className = "pluno-pa-widget__ai-disclaimer", f.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(f), e.appendChild(d), e;
1013
1049
  }
1014
- function _o(e) {
1050
+ function ko(e) {
1015
1051
  const t = document.createElement("div");
1016
- return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ft("pluno-pa-widget__character--empty", e)), t.appendChild(Bt()), t;
1052
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild(Gt()), t;
1017
1053
  }
1018
- function Bt() {
1054
+ function Gt() {
1019
1055
  const e = document.createElement("div");
1020
1056
  return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
1021
1057
  }
1022
- function xo(e, t) {
1058
+ function Lo(e, t) {
1023
1059
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1024
1060
  const n = document.createElement("span");
1025
1061
  n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
1026
1062
  }
1027
- function Ft(e, t) {
1063
+ function Ht(e, t) {
1028
1064
  const n = document.createElement("img");
1029
1065
  return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1030
1066
  }
1031
- function Ut(e, t, n, o) {
1067
+ function Wt(e, t, n, o) {
1032
1068
  const a = document.createElement("button");
1033
1069
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1034
1070
  }
1035
- function vo() {
1036
- const e = P("svg", {
1071
+ function Po() {
1072
+ const e = L("svg", {
1037
1073
  class: "pluno-pa-widget__scribble-defs",
1038
1074
  "aria-hidden": "true",
1039
1075
  focusable: "false",
1040
1076
  width: "0",
1041
1077
  height: "0"
1042
- }), t = P("defs");
1043
- return t.appendChild(Me("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Me("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Me("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1078
+ }), t = L("defs");
1079
+ return t.appendChild(Oe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Oe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Oe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1044
1080
  }
1045
- function Me(e, t, n) {
1046
- const o = P("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1081
+ function Oe(e, t, n) {
1082
+ const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1047
1083
  return o.appendChild(
1048
- P("feTurbulence", {
1084
+ L("feTurbulence", {
1049
1085
  type: "fractalNoise",
1050
1086
  baseFrequency: "0.012 0.028",
1051
1087
  numOctaves: "3",
@@ -1053,7 +1089,7 @@ function Me(e, t, n) {
1053
1089
  result: "stroke-noise"
1054
1090
  })
1055
1091
  ), o.appendChild(
1056
- P("feDisplacementMap", {
1092
+ L("feDisplacementMap", {
1057
1093
  in: "SourceGraphic",
1058
1094
  in2: "stroke-noise",
1059
1095
  scale: "3.5",
@@ -1062,7 +1098,7 @@ function Me(e, t, n) {
1062
1098
  result: "warped"
1063
1099
  })
1064
1100
  ), o.appendChild(
1065
- P("feTurbulence", {
1101
+ L("feTurbulence", {
1066
1102
  type: "fractalNoise",
1067
1103
  baseFrequency: "0.7",
1068
1104
  numOctaves: "1",
@@ -1070,7 +1106,7 @@ function Me(e, t, n) {
1070
1106
  result: "ink-noise"
1071
1107
  })
1072
1108
  ), o.appendChild(
1073
- P("feDisplacementMap", {
1109
+ L("feDisplacementMap", {
1074
1110
  in: "warped",
1075
1111
  in2: "ink-noise",
1076
1112
  scale: "0.9",
@@ -1079,31 +1115,51 @@ function Me(e, t, n) {
1079
1115
  })
1080
1116
  ), o;
1081
1117
  }
1082
- function yo(e) {
1083
- const t = se("0 0 24 24", e, e, "none", "currentColor", "2.25");
1084
- return t.appendChild(P("path", { d: "m6 9 6 6 6-6" })), t;
1085
- }
1086
- function Co() {
1087
- const e = se("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1088
- return e.appendChild(P("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(P("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1089
- }
1090
- function zt() {
1091
- const e = se("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1092
- return e.appendChild(P("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(P("polyline", { points: "5 12 12 5 19 12" })), e;
1118
+ function Ao(e) {
1119
+ const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
1120
+ return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
1121
+ }
1122
+ function To() {
1123
+ const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1124
+ return e.appendChild(L("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(L("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
1125
+ }
1126
+ function jt() {
1127
+ const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1128
+ return e.appendChild(L("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(L("polyline", { points: "5 12 12 5 19 12" })), e;
1129
+ }
1130
+ function No() {
1131
+ const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1132
+ return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1133
+ L("path", {
1134
+ d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
1135
+ })
1136
+ ), e;
1137
+ }
1138
+ function Io() {
1139
+ const e = X("0 0 24 24", 19, 19, "none", "currentColor");
1140
+ return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1141
+ L("path", {
1142
+ d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
1143
+ stroke: "currentColor",
1144
+ "stroke-width": "2",
1145
+ "stroke-linecap": "round",
1146
+ "stroke-linejoin": "round"
1147
+ })
1148
+ ), e;
1093
1149
  }
1094
- function Eo() {
1095
- const e = se("0 0 24 24", 18, 18, "currentColor");
1096
- return e.appendChild(P("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1150
+ function Do() {
1151
+ const e = X("0 0 24 24", 18, 18, "currentColor");
1152
+ return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1097
1153
  }
1098
- function So() {
1099
- const e = se("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1100
- return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
1154
+ function Mo() {
1155
+ const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1156
+ return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
1101
1157
  }
1102
- function ko() {
1103
- const e = se("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1104
- return e.appendChild(P("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(P("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1158
+ function Ro() {
1159
+ const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1160
+ return e.appendChild(L("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(L("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
1105
1161
  }
1106
- function se(e, t, n, o, a, i) {
1162
+ function X(e, t, n, o, a, i) {
1107
1163
  const l = {
1108
1164
  viewBox: e,
1109
1165
  width: String(t),
@@ -1111,41 +1167,41 @@ function se(e, t, n, o, a, i) {
1111
1167
  fill: o,
1112
1168
  "aria-hidden": "true"
1113
1169
  };
1114
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), P("svg", l);
1170
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
1115
1171
  }
1116
- function P(e, t = {}) {
1117
- const n = document.createElementNS(Xn, e);
1172
+ function L(e, t = {}) {
1173
+ const n = document.createElementNS(eo, e);
1118
1174
  for (const [o, a] of Object.entries(t))
1119
1175
  n.setAttribute(o, a);
1120
1176
  return n;
1121
1177
  }
1122
- function mt(e) {
1178
+ function _t(e) {
1123
1179
  for (const t of ["keydown", "keypress", "keyup"])
1124
1180
  e.addEventListener(t, (n) => {
1125
1181
  n.stopPropagation();
1126
1182
  });
1127
1183
  }
1128
- function Lo(e, t, n) {
1184
+ function Oo(e, t, n) {
1129
1185
  e.replaceChildren(), e.hidden = t.length === 0;
1130
1186
  for (const [o, a] of t.entries()) {
1131
1187
  const i = document.createElement("div");
1132
- i.className = "pluno-pa-widget__attachment", i.appendChild(Po(a));
1188
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Bo(a));
1133
1189
  const l = document.createElement("span");
1134
1190
  l.textContent = a.name, i.appendChild(l);
1135
1191
  const p = document.createElement("button");
1136
- p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(So()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1192
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Mo()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1137
1193
  }
1138
1194
  }
1139
- function Po(e) {
1140
- if (Gt(e)) {
1195
+ function Bo(e) {
1196
+ if (Vt(e)) {
1141
1197
  const n = document.createElement("img");
1142
1198
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1143
1199
  }
1144
1200
  const t = document.createElement("span");
1145
1201
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1146
1202
  }
1147
- function Ao(e) {
1148
- if (Gt(e)) {
1203
+ function Fo(e) {
1204
+ if (Vt(e)) {
1149
1205
  const a = document.createElement("img");
1150
1206
  return a.src = e.dataUrl, a.alt = e.name, a;
1151
1207
  }
@@ -1156,51 +1212,51 @@ function Ao(e) {
1156
1212
  const o = document.createElement("strong");
1157
1213
  return o.textContent = e.name, t.append(n, o), t;
1158
1214
  }
1159
- function Gt(e) {
1215
+ function Vt(e) {
1160
1216
  return e.mimeType.startsWith("image/");
1161
1217
  }
1162
- function To(e) {
1218
+ function Uo(e) {
1163
1219
  return e === "application/pdf" ? "document.pdf" : "image";
1164
1220
  }
1165
- async function No(e) {
1221
+ async function zo(e) {
1166
1222
  if (!e)
1167
1223
  return [];
1168
1224
  const t = Array.from(e);
1169
- if (t.length > ye)
1170
- throw new Error(`Attach up to ${ye} files per message.`);
1225
+ if (t.length > Ce)
1226
+ throw new Error(`Attach up to ${Ce} files per message.`);
1171
1227
  return Promise.all(
1172
1228
  t.map(async (n) => {
1173
- const o = Do(n);
1229
+ const o = $o(n);
1174
1230
  if (!o)
1175
1231
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1176
- if (n.size > zn)
1232
+ if (n.size > Hn)
1177
1233
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1178
1234
  if (o === "image/gif") {
1179
- const a = new Uint8Array(await Go(n));
1180
- if (Mo(a))
1235
+ const a = new Uint8Array(await Xo(n));
1236
+ if (Ho(a))
1181
1237
  throw new Error("Pluno supports non-animated GIF images.");
1182
1238
  }
1183
1239
  return {
1184
- name: n.name || To(o),
1240
+ name: n.name || Uo(o),
1185
1241
  mimeType: o,
1186
1242
  sizeBytes: n.size,
1187
- dataUrl: Io(await $o(n), o)
1243
+ dataUrl: Go(await Zo(n), o)
1188
1244
  };
1189
1245
  })
1190
1246
  );
1191
1247
  }
1192
- function Do(e) {
1193
- if (Gn.has(e.type))
1248
+ function $o(e) {
1249
+ if (Ot.has(e.type))
1194
1250
  return e.type;
1195
1251
  const t = e.name.toLowerCase();
1196
1252
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
1197
1253
  }
1198
- function Io(e, t) {
1254
+ function Go(e, t) {
1199
1255
  const n = `data:${t};base64,`;
1200
1256
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1201
1257
  }
1202
- function Mo(e) {
1203
- if (e.length < 14 || !Ro(e))
1258
+ function Ho(e) {
1259
+ if (e.length < 14 || !Wo(e))
1204
1260
  return !1;
1205
1261
  const t = e[10];
1206
1262
  let n = 13;
@@ -1211,7 +1267,7 @@ function Mo(e) {
1211
1267
  if (n += 1, a === 59)
1212
1268
  return !1;
1213
1269
  if (a === 33) {
1214
- n += 1, n = ft(e, n);
1270
+ n += 1, n = xt(e, n);
1215
1271
  continue;
1216
1272
  }
1217
1273
  if (a !== 44)
@@ -1223,14 +1279,14 @@ function Mo(e) {
1223
1279
  const i = e[n + 8];
1224
1280
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1225
1281
  return !1;
1226
- n += 1, n = ft(e, n);
1282
+ n += 1, n = xt(e, n);
1227
1283
  }
1228
1284
  return !1;
1229
1285
  }
1230
- function Ro(e) {
1286
+ function Wo(e) {
1231
1287
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1232
1288
  }
1233
- function ft(e, t) {
1289
+ function xt(e, t) {
1234
1290
  for (; t < e.length; ) {
1235
1291
  const n = e[t];
1236
1292
  if (t += 1, n === 0)
@@ -1239,69 +1295,69 @@ function ft(e, t) {
1239
1295
  }
1240
1296
  return t;
1241
1297
  }
1242
- function _e(e) {
1298
+ function xe(e) {
1243
1299
  return !!(e && Array.from(e.types).includes("Files"));
1244
1300
  }
1245
- function Re(e, t, n = null) {
1246
- if (!e || !Ge(t, n)) {
1301
+ function Be(e, t, n = null) {
1302
+ if (!e || !He(t, n)) {
1247
1303
  e && (e.hidden = !0, e.replaceChildren());
1248
1304
  return;
1249
1305
  }
1250
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", K(t) || We(n) ? e.appendChild(Oo(t, n)) : $t(t) && e.appendChild(Bo(t));
1306
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", $(t) || Ve(n) ? e.appendChild(jo(t, n)) : qt(t) && e.appendChild(Vo(t));
1251
1307
  }
1252
- function Oo(e, t) {
1308
+ function jo(e, t) {
1253
1309
  const n = document.createElement("div");
1254
1310
  n.className = "pluno-pa-widget__billing-action-card";
1255
1311
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1256
1312
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1257
1313
  const i = document.createElement("span");
1258
- return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Ht(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1314
+ return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Kt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
1259
1315
  }
1260
- function Bo(e) {
1316
+ function Vo(e) {
1261
1317
  const t = document.createElement("div");
1262
1318
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1263
1319
  const n = document.createElement("strong");
1264
1320
  n.textContent = "Credits running low", t.appendChild(n);
1265
1321
  const o = document.createElement("span");
1266
- return o.textContent = Uo(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Ht(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1322
+ return o.textContent = Ko(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Kt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
1267
1323
  }
1268
- function Ge(e, t) {
1269
- return e !== null && (K(e) || $t(e) || We(t));
1324
+ function He(e, t) {
1325
+ return e !== null && ($(e) || qt(e) || Ve(t));
1270
1326
  }
1271
- function bt(e, t, n) {
1272
- return Ge(t, n) || Fo(t) ? !0 : !Ge(e, n);
1327
+ function vt(e, t, n) {
1328
+ return He(t, n) || qo(t) ? !0 : !He(e, n);
1273
1329
  }
1274
- function Fo(e) {
1275
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || K(e));
1330
+ function qo(e) {
1331
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || $(e));
1276
1332
  }
1277
- function K(e) {
1333
+ function $(e) {
1278
1334
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1279
1335
  }
1280
- function We(e) {
1336
+ function Ve(e) {
1281
1337
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1282
1338
  }
1283
- function $t(e) {
1284
- return !K(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1339
+ function qt(e) {
1340
+ return !$(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1285
1341
  }
1286
- function Uo(e) {
1287
- return e.creditsRemaining === null ? null : `${zo(e.creditsRemaining)} credits left`;
1342
+ function Ko(e) {
1343
+ return e.creditsRemaining === null ? null : `${Yo(e.creditsRemaining)} credits left`;
1288
1344
  }
1289
- function zo(e) {
1345
+ function Yo(e) {
1290
1346
  return new Intl.NumberFormat("en-US", {
1291
1347
  maximumFractionDigits: 0
1292
1348
  }).format(Math.ceil(e));
1293
1349
  }
1294
- function Ht(e, t, n) {
1350
+ function Kt(e, t, n) {
1295
1351
  const o = document.createElement("div");
1296
- return o.className = n, o.appendChild(wt(t, e.pricingUrl)), o.appendChild(wt("Earn credits", e.earnCreditsUrl)), o;
1352
+ return o.className = n, o.appendChild(yt(t, e.pricingUrl)), o.appendChild(yt("Earn credits", e.earnCreditsUrl)), o;
1297
1353
  }
1298
- function wt(e, t) {
1354
+ function yt(e, t) {
1299
1355
  const n = document.createElement("button");
1300
1356
  return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
1301
1357
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1302
1358
  }), n;
1303
1359
  }
1304
- function Go(e) {
1360
+ function Xo(e) {
1305
1361
  return new Promise((t, n) => {
1306
1362
  const o = new FileReader();
1307
1363
  o.addEventListener("load", () => {
@@ -1315,7 +1371,7 @@ function Go(e) {
1315
1371
  }), o.readAsArrayBuffer(e);
1316
1372
  });
1317
1373
  }
1318
- function $o(e) {
1374
+ function Zo(e) {
1319
1375
  return new Promise((t, n) => {
1320
1376
  const o = new FileReader();
1321
1377
  o.addEventListener("load", () => {
@@ -1329,94 +1385,99 @@ function $o(e) {
1329
1385
  }), o.readAsDataURL(e);
1330
1386
  });
1331
1387
  }
1332
- function _t(e, t) {
1333
- return e.messages.filter((o) => !Wt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1388
+ function Ct(e, t) {
1389
+ return e.messages.filter((o) => !Yt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1334
1390
  }
1335
- function Ho(e, t, n, o, a, i, l, p, c, d, s, b, y, S, w) {
1336
- const I = [...i.messages], v = I.filter((m) => !Wt(m)), u = e.scrollTop;
1337
- e.replaceChildren(), jt(n, i.isThinking), a.hidden = !p, p && l !== null && xo(a, l);
1391
+ function Jo(e, t, n, o, a, i, l, p, c, d, s, f, C, k, x) {
1392
+ const R = [...i.messages], v = R.filter((b) => !Yt(b)), y = e.scrollTop;
1393
+ e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null && Lo(a, l);
1338
1394
  const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1339
1395
  if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1396
+ const b = document.createElement("div");
1397
+ b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1340
1398
  const m = document.createElement("div");
1341
- m.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1342
- const x = document.createElement("div");
1343
- x.className = "pluno-pa-widget__empty-hero";
1344
- const M = document.createElement("img");
1345
- M.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", M.src = y(), M.alt = "", M.setAttribute("aria-hidden", "true"), x.appendChild(M), m.appendChild(x), m.appendChild(Bt());
1346
- const R = document.createElement("div");
1347
- R.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && R.setAttribute("aria-hidden", "true");
1348
- for (const f of i.starterPrompts) {
1349
- const A = document.createElement("button");
1350
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${f}"`, A.addEventListener("click", () => {
1351
- S(f);
1352
- }), R.appendChild(A);
1353
- }
1354
- m.appendChild(R), e.appendChild(m), e.appendChild(t);
1399
+ m.className = "pluno-pa-widget__empty-hero";
1400
+ const S = document.createElement("img");
1401
+ S.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", S.src = C(), S.alt = "", S.setAttribute("aria-hidden", "true"), m.appendChild(S), b.appendChild(m), b.appendChild(Gt());
1402
+ const P = document.createElement("div");
1403
+ if (P.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && P.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
1404
+ for (const I of i.starterPrompts) {
1405
+ const A = document.createElement("button");
1406
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${I}"`, A.addEventListener("click", () => {
1407
+ k(I);
1408
+ }), P.appendChild(A);
1409
+ }
1410
+ else
1411
+ for (let I = 0; I < jn; I += 1) {
1412
+ const A = document.createElement("button");
1413
+ A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.innerHTML = "&nbsp;", P.appendChild(A);
1414
+ }
1415
+ b.appendChild(P), e.appendChild(b), e.appendChild(t);
1355
1416
  return;
1356
1417
  }
1357
- let C = null, _ = null, N = [];
1358
- const k = () => {
1418
+ let g = null, _ = null, N = [];
1419
+ const Z = () => {
1359
1420
  if (N.length === 0)
1360
1421
  return !1;
1361
- const m = Jo(N, s, b, y());
1362
- return e.appendChild(m), C = null, _ = m, N = [], !0;
1422
+ const b = la(N, s, f, C());
1423
+ return e.appendChild(b), g = null, _ = b, N = [], !0;
1363
1424
  };
1364
- for (let m = 0; m < v.length; m += 1) {
1365
- const x = v[m];
1366
- if (x.role === "tool") {
1367
- N.push(x);
1425
+ for (let b = 0; b < v.length; b += 1) {
1426
+ const m = v[b];
1427
+ if (m.role === "tool") {
1428
+ N.push(m);
1368
1429
  continue;
1369
1430
  }
1370
- if (x.role === "system")
1431
+ if (m.role === "system")
1371
1432
  continue;
1372
- const M = k(), R = vt(x.content);
1373
- if (x.role === "assistant" && !M) {
1374
- const ne = $e(y());
1375
- e.appendChild(ne), C = null, _ = ne;
1433
+ const S = Z(), P = St(m.content);
1434
+ if (m.role === "assistant" && !S) {
1435
+ const w = We(C());
1436
+ e.appendChild(w), g = null, _ = w;
1376
1437
  }
1377
- const f = document.createElement("div");
1378
- f.className = `pluno-pa-widget__message pluno-pa-widget__message--${x.role}`, x.role === "assistant" ? yt(f, R) : f.textContent = R, x.role === "user" && x.attachments?.length && f.appendChild(Vo(x.attachments));
1438
+ const I = document.createElement("div");
1439
+ I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? kt(I, P) : I.textContent = P, m.role === "user" && m.attachments?.length && I.appendChild(ea(m.attachments));
1379
1440
  const A = document.createElement("div");
1380
- A.className = "pluno-pa-widget__message-actions", A.appendChild(xt(R)), f.appendChild(A), e.appendChild(f), C = f, _ = null;
1441
+ A.className = "pluno-pa-widget__message-actions", A.appendChild(Et(P)), I.appendChild(A), e.appendChild(I), g = I, _ = null;
1381
1442
  }
1382
- const te = k();
1443
+ const de = Z();
1383
1444
  if (i.assistantDraft) {
1384
- if (!te) {
1385
- const R = $e(y());
1386
- e.appendChild(R), C = null, _ = R;
1387
- }
1388
- const m = vt(i.assistantDraft), x = document.createElement("div");
1389
- x.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", yt(x, m);
1390
- const M = document.createElement("div");
1391
- M.className = "pluno-pa-widget__message-actions", M.appendChild(xt(m)), x.appendChild(M), e.appendChild(x), C = x, _ = null;
1445
+ if (!de) {
1446
+ const P = We(C());
1447
+ e.appendChild(P), g = null, _ = P;
1448
+ }
1449
+ const b = St(i.assistantDraft), m = document.createElement("div");
1450
+ m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", kt(m, b);
1451
+ const S = document.createElement("div");
1452
+ S.className = "pluno-pa-widget__message-actions", S.appendChild(Et(b)), m.appendChild(S), e.appendChild(m), g = m, _ = null;
1392
1453
  }
1393
1454
  if (i.isThinking && !i.assistantDraft)
1394
- if (te) {
1395
- const m = Vt();
1396
- e.appendChild(m), C = null, _ = m;
1455
+ if (de) {
1456
+ const b = Xt();
1457
+ e.appendChild(b), g = null, _ = b;
1397
1458
  } else {
1398
- const m = Qo(y());
1399
- e.appendChild(m), C = null, _ = m;
1459
+ const b = pa(C());
1460
+ e.appendChild(b), g = null, _ = b;
1400
1461
  }
1401
1462
  if (i.lastError) {
1402
- const m = document.createElement("div");
1403
- m.className = "pluno-pa-widget__error", m.textContent = i.lastError, e.appendChild(m), C = m, _ = null;
1463
+ const b = document.createElement("div");
1464
+ b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
1404
1465
  }
1405
- const E = w && !i.isThinking ? bn(I) : null;
1406
- if (w && E && !w.dismissedCandidateIds.has(E.id)) {
1407
- const m = jo(E, {
1408
- isDrafting: w.draftingCandidateId === E.id,
1409
- error: w.error,
1410
- onDraft: w.onDraft,
1411
- onDismiss: w.onDismiss,
1412
- onDisable: w.onDisable
1466
+ const E = x && !i.isThinking ? xn(R) : null;
1467
+ if (x && E && !x.dismissedCandidateIds.has(E.id)) {
1468
+ const b = ta(E, {
1469
+ isDrafting: x.draftingCandidateId === E.id,
1470
+ error: x.error,
1471
+ onDraft: x.onDraft,
1472
+ onDismiss: x.onDismiss,
1473
+ onDisable: x.onDisable
1413
1474
  });
1414
- e.appendChild(m), w.onSeen(E), C = null, _ = m;
1475
+ e.appendChild(b), x.onSeen(E), g = null, _ = b;
1415
1476
  }
1416
- C?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? ge(e, d) : e.scrollTop = u;
1477
+ g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? he(e, d) : e.scrollTop = y;
1417
1478
  }
1418
- function Wo(e, t, n, o, a, i) {
1419
- e.replaceChildren(), jt(t, !1), t.disabled = !0, n.hidden = !0;
1479
+ function Qo(e, t, n, o, a, i) {
1480
+ e.replaceChildren(), Zt(t, !1), t.disabled = !0, n.hidden = !0;
1420
1481
  const l = document.createElement("div");
1421
1482
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1422
1483
  const p = document.createElement("img");
@@ -1426,20 +1487,20 @@ function Wo(e, t, n, o, a, i) {
1426
1487
  const d = document.createElement("button");
1427
1488
  d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1428
1489
  }
1429
- function Vo(e) {
1490
+ function ea(e) {
1430
1491
  const t = document.createElement("div");
1431
1492
  t.className = "pluno-pa-widget__message-attachments";
1432
1493
  for (const n of e)
1433
- t.appendChild(Ao(n));
1494
+ t.appendChild(Fo(n));
1434
1495
  return t;
1435
1496
  }
1436
- function xt(e) {
1497
+ function Et(e) {
1437
1498
  const t = document.createElement("button");
1438
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ko()), t.addEventListener("click", (n) => {
1499
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ro()), t.addEventListener("click", (n) => {
1439
1500
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1440
1501
  }), t;
1441
1502
  }
1442
- function jo(e, t) {
1503
+ function ta(e, t) {
1443
1504
  const n = document.createElement("article");
1444
1505
  n.className = "pluno-pa-widget__share-prompt";
1445
1506
  const o = document.createElement("div");
@@ -1461,21 +1522,21 @@ function jo(e, t) {
1461
1522
  const d = document.createElement("button");
1462
1523
  if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
1463
1524
  t.onDraft(e);
1464
- }), t.isDrafting ? (d.appendChild(He()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
1525
+ }), t.isDrafting ? (d.appendChild(je()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
1465
1526
  p.appendChild(c);
1466
1527
  else {
1467
1528
  const s = document.createElement("button");
1468
1529
  s.type = "button", s.className = "pluno-pa-widget__share-prompt-dismiss", s.setAttribute("aria-label", "Dismiss share prompt"), s.title = "Dismiss", s.textContent = "Dismiss", s.addEventListener("click", () => {
1469
1530
  t.onDismiss(e);
1470
1531
  }), c.appendChild(s), p.appendChild(c);
1471
- const b = document.createElement("button");
1472
- b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
1532
+ const f = document.createElement("button");
1533
+ f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
1473
1534
  t.onDisable(e);
1474
- }), p.appendChild(b);
1535
+ }), p.appendChild(f);
1475
1536
  }
1476
1537
  return o.appendChild(p), n.appendChild(o), n;
1477
1538
  }
1478
- function qo(e, t) {
1539
+ function na(e, t) {
1479
1540
  const n = document.createElement("div");
1480
1541
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1481
1542
  v.target === n && t.onClose();
@@ -1494,49 +1555,49 @@ function qo(e, t) {
1494
1555
  d.className = "pluno-pa-widget__share-dialog-step-header";
1495
1556
  const s = document.createElement("strong");
1496
1557
  s.textContent = "1) Copy Screenshot", d.appendChild(s);
1497
- const b = Ko("Copy Screenshot", async () => {
1558
+ const f = oa("Copy Screenshot", async () => {
1498
1559
  try {
1499
- return await wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1560
+ return await vn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1500
1561
  } catch {
1501
1562
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1502
1563
  }
1503
1564
  });
1504
- if (d.appendChild(b), c.appendChild(d), e.screenshotDataUrl) {
1565
+ if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
1505
1566
  const v = document.createElement("div");
1506
1567
  v.className = "pluno-pa-widget__share-dialog-screenshot";
1507
- const u = document.createElement("img");
1508
- u.src = e.screenshotDataUrl, u.alt = "Product page with Pluno open", v.appendChild(u), c.appendChild(v);
1568
+ const y = document.createElement("img");
1569
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
1509
1570
  }
1510
1571
  o.appendChild(c), o.appendChild(p);
1511
- const y = document.createElement("div");
1512
- y.className = "pluno-pa-widget__share-dialog-step";
1513
- const S = document.createElement("strong");
1514
- S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", y.appendChild(S);
1515
- const w = document.createElement("p");
1516
- w.className = "pluno-pa-widget__share-dialog-hint", w.textContent = "Post draft opens prefilled on supported platforms.", y.appendChild(w);
1517
- const I = document.createElement("footer");
1518
- I.className = "pluno-pa-widget__share-dialog-platforms";
1519
- for (const v of Yo(e)) {
1520
- const u = document.createElement("a");
1521
- u.href = v.href, u.target = "_blank", u.rel = "noopener noreferrer", u.title = v.label, u.setAttribute("aria-label", `Open ${v.label}`), u.appendChild(Xo(v.id)), I.appendChild(u);
1572
+ const C = document.createElement("div");
1573
+ C.className = "pluno-pa-widget__share-dialog-step";
1574
+ const k = document.createElement("strong");
1575
+ k.className = "pluno-pa-widget__share-dialog-step-title", k.textContent = "2) Share on", C.appendChild(k);
1576
+ const x = document.createElement("p");
1577
+ x.className = "pluno-pa-widget__share-dialog-hint", x.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(x);
1578
+ const R = document.createElement("footer");
1579
+ R.className = "pluno-pa-widget__share-dialog-platforms";
1580
+ for (const v of aa(e)) {
1581
+ const y = document.createElement("a");
1582
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ia(v.id)), R.appendChild(y);
1522
1583
  }
1523
- if (y.appendChild(I), o.appendChild(y), t.socialPostRewardsUrl) {
1584
+ if (C.appendChild(R), o.appendChild(C), t.socialPostRewardsUrl) {
1524
1585
  const v = document.createElement("div");
1525
1586
  v.className = "pluno-pa-widget__share-dialog-step";
1526
- const u = document.createElement("strong");
1527
- u.className = "pluno-pa-widget__share-dialog-step-title", u.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(u);
1587
+ const y = document.createElement("strong");
1588
+ y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1528
1589
  const h = document.createElement("a");
1529
- h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Zo()), v.appendChild(h), o.appendChild(v);
1590
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(ra()), v.appendChild(h), o.appendChild(v);
1530
1591
  }
1531
1592
  return n.appendChild(o), n;
1532
1593
  }
1533
- function Ko(e, t) {
1594
+ function oa(e, t) {
1534
1595
  const n = document.createElement("button");
1535
1596
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1536
1597
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1537
1598
  }), n;
1538
1599
  }
1539
- function Yo(e) {
1600
+ function aa(e) {
1540
1601
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1541
1602
  return [
1542
1603
  {
@@ -1556,60 +1617,60 @@ function Yo(e) {
1556
1617
  }
1557
1618
  ];
1558
1619
  }
1559
- function Xo(e) {
1620
+ function ia(e) {
1560
1621
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1561
- return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (T(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), T(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), T(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), T(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), T(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (T(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), T(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), T(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (T(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), T(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), T(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), T(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
1622
+ return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), D(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), D(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), D(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
1562
1623
  }
1563
- function T(e, t, n) {
1624
+ function D(e, t, n) {
1564
1625
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1565
1626
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1566
1627
  }
1567
- function Zo() {
1628
+ function ra() {
1568
1629
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1569
- return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), T(e, "M14 5h5v5"), T(e, "M19 5l-8 8"), T(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1630
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1570
1631
  }
1571
- function Wt(e) {
1572
- return e.role === "tool" && e.toolName === At;
1632
+ function Yt(e) {
1633
+ return e.role === "tool" && e.toolName === Dt;
1573
1634
  }
1574
- function vt(e) {
1635
+ function St(e) {
1575
1636
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1576
1637
  }
1577
- function Jo(e, t, n, o) {
1638
+ function la(e, t, n, o) {
1578
1639
  const a = document.createElement("article");
1579
1640
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
1580
1641
  const i = document.createElement("img");
1581
1642
  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);
1582
- const l = document.createElement("details"), p = ea(e);
1643
+ const l = document.createElement("details"), p = sa(e);
1583
1644
  l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
1584
1645
  a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
1585
1646
  });
1586
1647
  const c = document.createElement("summary");
1587
- c.className = "pluno-pa-widget__tool-summary", e.some((b) => b.loading) && c.appendChild(He());
1648
+ c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(je());
1588
1649
  const s = document.createElement("span");
1589
1650
  if (s.className = "pluno-pa-widget__tool-summary-title", s.textContent = e[e.length - 1].content || "Run tool", c.appendChild(s), l.appendChild(c), e.length > 0) {
1590
- const b = document.createElement("div");
1591
- b.className = "pluno-pa-widget__tool-lines";
1592
- for (const y of e) {
1593
- const S = document.createElement("div");
1594
- S.className = "pluno-pa-widget__tool-line", y.loading && S.appendChild(He());
1595
- const w = document.createElement("span");
1596
- w.textContent = y.content || "Run tool", S.appendChild(w), b.appendChild(S);
1597
- }
1598
- l.appendChild(b);
1651
+ const f = document.createElement("div");
1652
+ f.className = "pluno-pa-widget__tool-lines";
1653
+ for (const C of e) {
1654
+ const k = document.createElement("div");
1655
+ k.className = "pluno-pa-widget__tool-line", C.loading && k.appendChild(je());
1656
+ const x = document.createElement("span");
1657
+ x.textContent = C.content || "Run tool", k.appendChild(x), f.appendChild(k);
1658
+ }
1659
+ l.appendChild(f);
1599
1660
  }
1600
1661
  return a.appendChild(l), a;
1601
1662
  }
1602
- function $e(e) {
1663
+ function We(e) {
1603
1664
  const t = document.createElement("article");
1604
1665
  t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1605
1666
  const n = document.createElement("img");
1606
1667
  return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), t.appendChild(n), t;
1607
1668
  }
1608
- function Qo(e) {
1609
- const t = $e(e);
1610
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Vt()), t;
1669
+ function pa(e) {
1670
+ const t = We(e);
1671
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Xt()), t;
1611
1672
  }
1612
- function Vt() {
1673
+ function Xt() {
1613
1674
  const e = document.createElement("div");
1614
1675
  e.className = "pluno-pa-widget__status";
1615
1676
  const t = document.createElement("span");
@@ -1617,17 +1678,17 @@ function Vt() {
1617
1678
  const n = document.createElement("span");
1618
1679
  return n.textContent = "Thinking...", e.appendChild(n), e;
1619
1680
  }
1620
- function ea(e) {
1681
+ function sa(e) {
1621
1682
  return `tools:${e[0]?.id ?? ""}`;
1622
1683
  }
1623
- function He() {
1684
+ function je() {
1624
1685
  const e = document.createElement("span");
1625
1686
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1626
1687
  }
1627
- function jt(e, t) {
1628
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Eo() : zt());
1688
+ function Zt(e, t) {
1689
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Do() : jt());
1629
1690
  }
1630
- function yt(e, t) {
1691
+ function kt(e, t) {
1631
1692
  const n = t.replace(/\r\n/g, `
1632
1693
  `).split(`
1633
1694
  `);
@@ -1643,22 +1704,22 @@ function yt(e, t) {
1643
1704
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1644
1705
  d.push(n[o]), o += 1;
1645
1706
  o += o < n.length ? 1 : 0;
1646
- const s = document.createElement("pre"), b = document.createElement("code");
1647
- b.textContent = d.join(`
1648
- `), s.appendChild(b), e.appendChild(s);
1707
+ const s = document.createElement("pre"), f = document.createElement("code");
1708
+ f.textContent = d.join(`
1709
+ `), s.appendChild(f), e.appendChild(s);
1649
1710
  continue;
1650
1711
  }
1651
1712
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1652
1713
  if (l) {
1653
1714
  const d = document.createElement(`h${l[1].length + 2}`);
1654
- xe(d, l[2]), e.appendChild(d), o += 1;
1715
+ ve(d, l[2]), e.appendChild(d), o += 1;
1655
1716
  continue;
1656
1717
  }
1657
1718
  if (/^\s*[-*+]\s+/.test(a)) {
1658
1719
  const d = document.createElement("ul");
1659
1720
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1660
1721
  const s = document.createElement("li");
1661
- xe(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1722
+ ve(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1662
1723
  }
1663
1724
  e.appendChild(d);
1664
1725
  continue;
@@ -1667,7 +1728,7 @@ function yt(e, t) {
1667
1728
  const d = document.createElement("ol");
1668
1729
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1669
1730
  const s = document.createElement("li");
1670
- xe(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1731
+ ve(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1671
1732
  }
1672
1733
  e.appendChild(d);
1673
1734
  continue;
@@ -1677,11 +1738,11 @@ function yt(e, t) {
1677
1738
  p.push(n[o]), o += 1;
1678
1739
  const c = document.createElement("p");
1679
1740
  p.forEach((d, s) => {
1680
- s > 0 && c.appendChild(document.createElement("br")), xe(c, d);
1741
+ s > 0 && c.appendChild(document.createElement("br")), ve(c, d);
1681
1742
  }), e.appendChild(c);
1682
1743
  }
1683
1744
  }
1684
- function xe(e, t) {
1745
+ function ve(e, t) {
1685
1746
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1686
1747
  let o = 0;
1687
1748
  for (const a of t.matchAll(n)) {
@@ -1699,7 +1760,7 @@ function xe(e, t) {
1699
1760
  p.textContent = l.slice(1, -1), e.appendChild(p);
1700
1761
  } else {
1701
1762
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1702
- if (p && ta(p[2])) {
1763
+ if (p && da(p[2])) {
1703
1764
  const c = document.createElement("a");
1704
1765
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
1705
1766
  } else
@@ -1709,7 +1770,7 @@ function xe(e, t) {
1709
1770
  }
1710
1771
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1711
1772
  }
1712
- function ta(e) {
1773
+ function da(e) {
1713
1774
  if (e.startsWith("/") || e.startsWith("#"))
1714
1775
  return !0;
1715
1776
  try {
@@ -1719,8 +1780,8 @@ function ta(e) {
1719
1780
  return !1;
1720
1781
  }
1721
1782
  }
1722
- function Ct(e, t) {
1723
- if (na(e))
1783
+ function Lt(e, t) {
1784
+ if (ca(e))
1724
1785
  return;
1725
1786
  const n = `
1726
1787
  :host {
@@ -1773,7 +1834,7 @@ function Ct(e, t) {
1773
1834
  --pluno-pa-accent-contrast: #fafafa;
1774
1835
  position: fixed;
1775
1836
  z-index: 2147483645;
1776
- font-family: ${W.fontFamily};
1837
+ font-family: ${j.fontFamily};
1777
1838
  font-size: 14px;
1778
1839
  color: var(--pluno-pa-text);
1779
1840
  width: var(--pluno-pa-launcher-width);
@@ -2514,7 +2575,7 @@ function Ct(e, t) {
2514
2575
  place-items: center;
2515
2576
  padding: 18px;
2516
2577
  background: rgba(24, 24, 27, 0.28);
2517
- font-family: var(--pluno-pa-font, ${W.fontFamily});
2578
+ font-family: var(--pluno-pa-font, ${j.fontFamily});
2518
2579
  color: var(--pluno-pa-text);
2519
2580
  }
2520
2581
  .pluno-pa-widget__share-dialog {
@@ -2878,12 +2939,48 @@ function Ct(e, t) {
2878
2939
  background: var(--pluno-pa-surface);
2879
2940
  border: 1px solid var(--pluno-pa-divider);
2880
2941
  border-radius: 14px;
2881
- padding: 8px 44px 8px 12px;
2942
+ padding: 8px 44px 8px 38px;
2882
2943
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
2883
2944
  }
2884
2945
  .pluno-pa-widget__composer-inner:focus-within {
2885
2946
  border-color: var(--pluno-pa-accent);
2886
2947
  }
2948
+ .pluno-pa-widget__attachment-input {
2949
+ position: absolute;
2950
+ width: 1px;
2951
+ height: 1px;
2952
+ opacity: 0;
2953
+ pointer-events: none;
2954
+ }
2955
+ .pluno-pa-widget__attach {
2956
+ position: absolute;
2957
+ left: 6px;
2958
+ top: 50%;
2959
+ margin-top: -14px;
2960
+ width: 28px;
2961
+ height: 28px;
2962
+ display: inline-flex;
2963
+ align-items: center;
2964
+ justify-content: center;
2965
+ border: 0;
2966
+ border-radius: 999px;
2967
+ background: transparent;
2968
+ color: var(--pluno-pa-muted);
2969
+ cursor: pointer;
2970
+ transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
2971
+ }
2972
+ .pluno-pa-widget__attach:hover:not(:disabled),
2973
+ .pluno-pa-widget__attach:focus-visible {
2974
+ background: var(--pluno-pa-bubble);
2975
+ color: var(--pluno-pa-accent);
2976
+ }
2977
+ .pluno-pa-widget__attach:disabled {
2978
+ cursor: not-allowed;
2979
+ opacity: 0.45;
2980
+ }
2981
+ .pluno-pa-widget__paperclip-icon--scribble {
2982
+ display: none;
2983
+ }
2887
2984
  .pluno-pa-widget--drag-over .pluno-pa-widget__composer-inner {
2888
2985
  border-color: var(--pluno-pa-accent);
2889
2986
  background: var(--pluno-pa-accent-soft);
@@ -2948,12 +3045,12 @@ function Ct(e, t) {
2948
3045
  display: flex;
2949
3046
  align-items: center;
2950
3047
  justify-content: center;
2951
- column-gap: 0.35em;
2952
- margin-top: 8px;
3048
+ column-gap: 0.3em;
3049
+ margin-top: 5px;
2953
3050
  color: var(--pluno-pa-faint);
2954
3051
  font: inherit;
2955
- font-size: 11px;
2956
- line-height: 1.2;
3052
+ font-size: 10px;
3053
+ line-height: 1.1;
2957
3054
  flex-wrap: wrap;
2958
3055
  text-align: center;
2959
3056
  }
@@ -3071,7 +3168,6 @@ function Ct(e, t) {
3071
3168
  width: min(100%, 320px);
3072
3169
  }
3073
3170
  .pluno-pa-widget__starter-prompts--empty {
3074
- min-height: 96px;
3075
3171
  pointer-events: none;
3076
3172
  }
3077
3173
  .pluno-pa-widget__starter-prompt {
@@ -3091,6 +3187,9 @@ function Ct(e, t) {
3091
3187
  color: var(--pluno-pa-text);
3092
3188
  background: transparent;
3093
3189
  }
3190
+ .pluno-pa-widget__starter-prompt--placeholder {
3191
+ visibility: hidden;
3192
+ }
3094
3193
  .pluno-pa-widget__login {
3095
3194
  border: 0;
3096
3195
  border-radius: 8px;
@@ -3202,7 +3301,7 @@ function Ct(e, t) {
3202
3301
  right: 16px;
3203
3302
  height: 36px;
3204
3303
  z-index: 3;
3205
- background-image: url('${pt}');
3304
+ background-image: url('${ut}');
3206
3305
  background-repeat: repeat-x;
3207
3306
  background-size: 104px 36px;
3208
3307
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3338,6 +3437,9 @@ function Ct(e, t) {
3338
3437
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before {
3339
3438
  background: var(--pluno-pa-accent);
3340
3439
  }
3440
+ .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled {
3441
+ color: var(--pluno-pa-faint);
3442
+ }
3341
3443
  .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
3342
3444
  background: var(--pluno-pa-surface);
3343
3445
  }
@@ -3390,6 +3492,19 @@ function Ct(e, t) {
3390
3492
  opacity: 0.6;
3391
3493
  transform: rotate(5deg);
3392
3494
  }
3495
+ .pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
3496
+ .pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
3497
+ background: transparent;
3498
+ color: var(--pluno-pa-accent);
3499
+ }
3500
+ .pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--standard {
3501
+ display: none;
3502
+ }
3503
+ .pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--scribble {
3504
+ display: block;
3505
+ transform: rotate(-8deg);
3506
+ filter: url(#pluno-pa-scribble-wobble-2);
3507
+ }
3393
3508
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
3394
3509
  transform: rotate(-10deg);
3395
3510
  filter: url(#pluno-pa-scribble-wobble);
@@ -3455,7 +3570,7 @@ function Ct(e, t) {
3455
3570
  right: 12px;
3456
3571
  height: 22px;
3457
3572
  z-index: 1;
3458
- background-image: url('${pt}');
3573
+ background-image: url('${ut}');
3459
3574
  background-repeat: repeat-x;
3460
3575
  background-size: 62px 21.5px;
3461
3576
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3468,28 +3583,28 @@ function Ct(e, t) {
3468
3583
  filter: url(#pluno-pa-scribble-wobble-2);
3469
3584
  }
3470
3585
  `;
3471
- if (oa(e, n))
3586
+ if (ua(e, n))
3472
3587
  return;
3473
3588
  const o = e.ownerDocument.createElement("style");
3474
- o.id = Mt, o.textContent = n, e.appendChild(o), qt(e);
3589
+ o.id = Ut, o.textContent = n, e.appendChild(o), Jt(e);
3475
3590
  }
3476
- function na(e) {
3477
- return e.getElementById(Mt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Rt) === "true";
3591
+ function ca(e) {
3592
+ return e.getElementById(Ut) !== null || e.host instanceof HTMLElement && e.host.getAttribute(zt) === "true";
3478
3593
  }
3479
- function qt(e) {
3480
- e.host instanceof HTMLElement && e.host.setAttribute(Rt, "true");
3594
+ function Jt(e) {
3595
+ e.host instanceof HTMLElement && e.host.setAttribute(zt, "true");
3481
3596
  }
3482
- function oa(e, t) {
3597
+ function ua(e, t) {
3483
3598
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3484
3599
  return !1;
3485
3600
  try {
3486
3601
  const n = new CSSStyleSheet();
3487
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], qt(e), !0;
3602
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Jt(e), !0;
3488
3603
  } catch {
3489
3604
  return !1;
3490
3605
  }
3491
3606
  }
3492
- async function aa() {
3607
+ async function ga() {
3493
3608
  return document.body ? document.body : await new Promise((e) => {
3494
3609
  const t = new MutationObserver(() => {
3495
3610
  document.body && (t.disconnect(), e(document.body));
@@ -3497,49 +3612,49 @@ async function aa() {
3497
3612
  t.observe(document.documentElement, { childList: !0 });
3498
3613
  });
3499
3614
  }
3500
- function Kt(e) {
3615
+ function Qt(e) {
3501
3616
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3502
3617
  }
3503
- function ia(e) {
3618
+ function ha(e) {
3504
3619
  try {
3505
- const t = window.localStorage.getItem(Kt(e));
3620
+ const t = window.localStorage.getItem(Qt(e));
3506
3621
  if (!t)
3507
- return Et();
3622
+ return Pt();
3508
3623
  const n = JSON.parse(t);
3509
3624
  return {
3510
3625
  isOpen: n.isOpen === !0,
3511
3626
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3512
3627
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3513
- launcherPosition: sa(n.launcherPosition) ? n.launcherPosition : null,
3514
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Tt) : [],
3628
+ launcherPosition: wa(n.launcherPosition) ? n.launcherPosition : null,
3629
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
3515
3630
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3516
3631
  };
3517
3632
  } catch {
3518
- return Et();
3633
+ return Pt();
3519
3634
  }
3520
3635
  }
3521
- async function ra(e) {
3636
+ async function ma(e) {
3522
3637
  if (e.loadSharePromptsDisabled)
3523
3638
  return e.loadSharePromptsDisabled();
3524
3639
  try {
3525
- return window.localStorage.getItem(Nt) === "true";
3640
+ return window.localStorage.getItem(Rt) === "true";
3526
3641
  } catch {
3527
3642
  return !1;
3528
3643
  }
3529
3644
  }
3530
- function la(e, t) {
3645
+ function fa(e, t) {
3531
3646
  if (e.persistSharePromptsDisabled) {
3532
3647
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3533
3648
  });
3534
3649
  return;
3535
3650
  }
3536
3651
  try {
3537
- t && window.localStorage.setItem(Nt, "true");
3652
+ t && window.localStorage.setItem(Rt, "true");
3538
3653
  } catch {
3539
3654
  return;
3540
3655
  }
3541
3656
  }
3542
- function Et() {
3657
+ function Pt() {
3543
3658
  return {
3544
3659
  isOpen: !1,
3545
3660
  composerValue: "",
@@ -3549,41 +3664,41 @@ function Et() {
3549
3664
  sharePromptsDisabled: !1
3550
3665
  };
3551
3666
  }
3552
- function pa(e, t) {
3667
+ function ba(e, t) {
3553
3668
  try {
3554
- window.localStorage.setItem(Kt(e), JSON.stringify(t));
3669
+ window.localStorage.setItem(Qt(e), JSON.stringify(t));
3555
3670
  } catch {
3556
3671
  return;
3557
3672
  }
3558
3673
  }
3559
- function sa(e) {
3674
+ function wa(e) {
3560
3675
  if (!e || typeof e != "object")
3561
3676
  return !1;
3562
3677
  const t = e;
3563
3678
  return Number.isFinite(t.x) && Number.isFinite(t.y);
3564
3679
  }
3565
- const St = /* @__PURE__ */ new WeakSet();
3566
- function da(e) {
3680
+ const At = /* @__PURE__ */ new WeakSet();
3681
+ function _a(e) {
3567
3682
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3568
3683
  }
3569
- function kt(e) {
3684
+ function Tt(e) {
3570
3685
  const t = e.pathname.split("/");
3571
3686
  return t[t.length - 1] ?? "";
3572
3687
  }
3573
- function ca(e, t) {
3688
+ function xa(e, t) {
3574
3689
  const n = new URL(e.src, document.baseURI);
3575
- return n.href === t.href || n.pathname === t.pathname ? !0 : kt(n) === kt(t);
3690
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Tt(n) === Tt(t);
3576
3691
  }
3577
3692
  class V extends EventTarget {
3578
3693
  constructor(t, n) {
3579
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Rn, () => {
3694
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
3580
3695
  this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
3581
- }), this.addPreviewListener(On, (o) => {
3696
+ }), this.addPreviewListener(Un, (o) => {
3582
3697
  const a = o;
3583
3698
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3584
- }), this.addPreviewListener(Bn, () => {
3699
+ }), this.addPreviewListener(zn, () => {
3585
3700
  this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3586
- }), this.addPreviewListener(Fn, (o) => {
3701
+ }), this.addPreviewListener($n, (o) => {
3587
3702
  const a = o;
3588
3703
  this.readyState = V.CLOSED, this.dispatchEvent(
3589
3704
  new CloseEvent("close", {
@@ -3593,7 +3708,7 @@ class V extends EventTarget {
3593
3708
  })
3594
3709
  ), this.cleanup();
3595
3710
  }), window.dispatchEvent(
3596
- new CustomEvent(ve(Dn, this.channelId), {
3711
+ new CustomEvent(ye(Rn, this.channelId), {
3597
3712
  detail: { socketId: this.socketId, url: t }
3598
3713
  })
3599
3714
  );
@@ -3609,26 +3724,26 @@ class V extends EventTarget {
3609
3724
  binaryType = "blob";
3610
3725
  bufferedAmount = 0;
3611
3726
  readyState = V.CONNECTING;
3612
- socketId = ua();
3727
+ socketId = va();
3613
3728
  listeners = /* @__PURE__ */ new Map();
3614
3729
  send(t) {
3615
3730
  if (this.readyState !== V.OPEN)
3616
3731
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3617
3732
  window.dispatchEvent(
3618
- new CustomEvent(ve(In, this.channelId), {
3733
+ new CustomEvent(ye(On, this.channelId), {
3619
3734
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3620
3735
  })
3621
3736
  );
3622
3737
  }
3623
3738
  close(t, n) {
3624
3739
  this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
3625
- new CustomEvent(ve(Mn, this.channelId), {
3740
+ new CustomEvent(ye(Bn, this.channelId), {
3626
3741
  detail: { socketId: this.socketId, code: t, reason: n }
3627
3742
  })
3628
3743
  ), this.cleanup());
3629
3744
  }
3630
3745
  addPreviewListener(t, n) {
3631
- const o = ve(t, this.channelId), a = (i) => {
3746
+ const o = ye(t, this.channelId), a = (i) => {
3632
3747
  i.detail?.socketId === this.socketId && n(i);
3633
3748
  };
3634
3749
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -3639,36 +3754,36 @@ class V extends EventTarget {
3639
3754
  this.listeners.clear();
3640
3755
  }
3641
3756
  }
3642
- function ua() {
3643
- const e = window.sessionStorage.getItem(lt);
3757
+ function va() {
3758
+ const e = window.sessionStorage.getItem(ct);
3644
3759
  if (e)
3645
3760
  return e;
3646
3761
  const t = crypto.randomUUID();
3647
- return window.sessionStorage.setItem(lt, t), t;
3762
+ return window.sessionStorage.setItem(ct, t), t;
3648
3763
  }
3649
- function ve(e, t) {
3764
+ function ye(e, t) {
3650
3765
  return `${e}:${t}`;
3651
3766
  }
3652
- function ga(e) {
3767
+ function ya(e) {
3653
3768
  const t = document.currentScript;
3654
3769
  if (t instanceof HTMLScriptElement)
3655
3770
  return [t];
3656
3771
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3657
3772
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3658
- (a) => a instanceof HTMLScriptElement && da(a) && ca(a, o)
3773
+ (a) => a instanceof HTMLScriptElement && _a(a) && xa(a, o)
3659
3774
  );
3660
3775
  }
3661
- function ha(e) {
3662
- for (const t of ga(e)) {
3663
- if (St.has(t) || t.dataset.plunoAutoMount === "false")
3776
+ function Ca(e) {
3777
+ for (const t of ya(e)) {
3778
+ if (At.has(t) || t.dataset.plunoAutoMount === "false")
3664
3779
  continue;
3665
- St.add(t);
3780
+ At.add(t);
3666
3781
  const n = t.dataset.plunoPreviewChannel;
3667
- oo({
3782
+ lo({
3668
3783
  token: t.dataset.plunoToken,
3669
3784
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3670
3785
  backendUrl: t.dataset.plunoBackendUrl,
3671
- webSocketFactory: n ? no(n) : void 0,
3786
+ webSocketFactory: n ? ro(n) : void 0,
3672
3787
  launcherLabel: t.dataset.plunoLauncherLabel,
3673
3788
  accentColor: t.dataset.plunoAccentColor,
3674
3789
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3680,8 +3795,8 @@ function ha(e) {
3680
3795
  });
3681
3796
  }
3682
3797
  }
3683
- ha(import.meta.url);
3798
+ Ca(import.meta.url);
3684
3799
  export {
3685
- no as createProductAgentPreviewBridgeWebSocketFactory,
3686
- oo as mountPlunoProductAgentWidget
3800
+ ro as createProductAgentPreviewBridgeWebSocketFactory,
3801
+ lo as mountPlunoProductAgentWidget
3687
3802
  };