@pluno/product-agent-web 0.1.31 → 0.1.34

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", kn = 1800, Sn = 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 S = Math.min(1, (performance.now() - C) / kn);
289
+ o = Math.round(f + (s - f) * Mn(S)), e(o), S >= 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(Sn);
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", Bn = "product-agent:sdk-preview-socket-send", On = "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", Gn = "product-agent:sdk-preview-socket-closed", ct = "product-agent:sdk-preview-socket-id", $n = "product-agent:preview-diagnostic", Rt = "pluno.productAgent.sharePromptsDisabled", Ce = 10, Hn = 10 * 1024 * 1024, Bt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Bt).join(","), 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>', jn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Ot = 190, Ft = 41, Vn = 48, qn = 420, Kn = 520, Yn = 0.24, Xn = 680, Zn = 800, Jn = 0.76, R = 8, Ge = 50, Qn = "http://www.w3.org/2000/svg", eo = 11, to = 13, ht = 4, no = 10, oo = 40, ao = "movable-launcher-position-v2", Ut = "pluno-pa-widget-styles", zt = "data-pluno-pa-widget-styles";
340
+ function io(e) {
341
341
  return (t) => new V(t, e);
342
342
  }
343
- async function oo(e = {}) {
343
+ async function ro(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
- Q("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
+ wo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
390
+ const l = await sa(), 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
- }), Q("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"), ee = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
403
- if (!c || !s || !b || !y || !S || !w || !I || !v || !u || !h || !C || !_ || !N || !k || !ee)
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"), S = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"), D = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), T = a.querySelector(".pluno-pa-widget__new-chat"), 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 || !S || !x || !D || !v || !y || !h || !g || !_ || !T || !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 = [], k = null;
409
+ const P = () => {
410
+ Io(v, m, (r) => {
411
+ m = m.filter((u, A) => A !== r), P(), M(w.getState()), U();
412
412
  });
413
- }, M = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
413
+ }, B = 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
+ }), F = window.fetch.bind(window);
429
+ let w;
430
+ w = await sn.init({
431
431
  token: t.token,
432
- tokenProvider: M,
432
+ tokenProvider: B,
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,42 +442,42 @@ async function oo(e = {}) {
442
442
  webSocketFactory: t.webSocketFactory,
443
443
  autoConnect: t.loginRequired ? !1 : void 0
444
444
  });
445
- const A = ia(t), te = new Set(A.openToolGroupKeys), ne = new Set(A.seenShareCandidateIds), me = new Set(ne);
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 = da(t), Ee = new Set(J.openToolGroupKeys), ae = new Set(J.seenShareCandidateIds), fe = new Set(ae);
446
+ let ke = J.sharePromptsDisabled || await ca(t), $ = t.movableLauncher ? J.launcherPosition : null, qe = $ !== null, q = null, Se = !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
+ Se || 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 = $e(a, r);
463
+ return bt(
464
464
  a,
465
- G ?? ro(a, t.position, g),
466
- g
465
+ $ ?? so(a, t.position, u),
466
+ u
467
467
  );
468
- }, F = () => {
469
- pa(t, {
468
+ }, O = () => {
469
+ ga(t, {
470
470
  isOpen: a.classList.contains("pluno-pa-widget--open"),
471
- composerValue: u.value,
472
- openToolGroupKeys: [...te],
473
- launcherPosition: Ve ? G : null,
474
- seenShareCandidateIds: [...ne].slice(-Tt),
475
- sharePromptsDisabled: Ce
471
+ composerValue: g.value,
472
+ openToolGroupKeys: [...Ee],
473
+ launcherPosition: qe ? $ : null,
474
+ seenShareCandidateIds: [...ae].slice(-Mt),
475
+ sharePromptsDisabled: ke
476
476
  });
477
- }, J = (r, g = {}) => {
478
- uo(r, {
479
- debugVersion: to,
480
- launcherPosition: G,
477
+ }, ne = (r, u = {}) => {
478
+ mo(r, {
479
+ debugVersion: ao,
480
+ launcherPosition: $,
481
481
  rootClasses: a.className,
482
482
  rootStyle: {
483
483
  left: a.style.left,
@@ -485,76 +485,76 @@ 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) => {
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);
496
+ }, be = (r = !0) => {
497
+ if (!$)
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
+ ho(a);
504
504
  return;
505
505
  }
506
- so(a, {
507
- x: r.x - g.x,
508
- y: r.y - g.y
506
+ go(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 $ && 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 = po({
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
+ $ = bt(a, r, $e(a)), _e(a, $), ne("Dragging closed launcher", { requestedPosition: u });
527
527
  },
528
528
  persist: () => {
529
- Ve = !0, F(), J("Persisted closed launcher drag position");
529
+ qe = !0, O(), 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, Oe(D, t.billingStatus, w.getState().lastErrorCode), U());
539
539
  } finally {
540
- ke = !1;
540
+ Pe = !1;
541
541
  }
542
542
  }
543
- }, oe = (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 A = be(), K = wt(a, A, t.position);
546
+ if (Xe(K, A), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: A }), 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), O();
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), O(), 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, $ && (be(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), O(), 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) => {
@@ -570,218 +570,227 @@ async function oo(e = {}) {
570
570
  return;
571
571
  const r = s.value;
572
572
  oe(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();
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(ee);
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 = G(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || G(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, S.hidden = !0), S.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
+ G(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
+ k !== null && window.clearTimeout(k), x.textContent = r, x.hidden = !1, k = window.setTimeout(() => {
600
+ x.textContent = "", x.hidden = !0, k = 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
+ k !== null && (window.clearTimeout(k), k = 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());
607
+ const u = await Bo(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(), M(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 || G(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"), Q("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((A) => {
631
+ tt(A instanceof Error ? A.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
632
+ message: A instanceof Error ? A.message : String(A)
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(), te.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(), M(w.getState());
645
+ }), T.addEventListener("click", () => {
646
+ Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g), O(), U(), g.focus(), M(w.getState());
647
+ }), g.addEventListener("input", () => {
648
+ ge(g), O(), U(), M(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(), M(w.getState());
647
656
  }
648
657
  }), a.addEventListener("click", (r) => {
649
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
650
- }), A.composerValue && (u.value = A.composerValue, ue(u)), A.isOpen && oe(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 = () => {
658
+ (r.target instanceof Element ? r.target : null)?.closest("a[href]") && O();
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, M = (r) => {
664
+ if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !G(t.billingStatus) && (re = null), Oe(D, t.billingStatus, re), t.loginRequired) {
665
+ Yo(E, _, T, 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
- ee,
665
- h,
666
- C,
667
- N,
668
+ const u = fo(r), A = u !== Ke;
669
+ Ke = u;
670
+ const K = Q || ee.enabled;
671
+ Q = !1, Ko(
672
+ E,
673
+ b,
674
+ _,
675
+ T,
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
- te,
674
- F,
675
- Qe,
676
- (D) => {
677
- Y = !0, $(!0, "send"), H(), f.sendMessage(D);
678
+ Te,
679
+ Te !== null && Ct(r, g.value.trim().length > 0 || m.length > 0),
680
+ K,
681
+ () => ee.enabled,
682
+ Ee,
683
+ O,
684
+ ot,
685
+ (I) => {
686
+ Q = !0, H(!0, "send"), W(), w.sendMessage(I);
678
687
  },
679
- on && !Ce ? {
680
- dismissedCandidateIds: me,
681
- draftingCandidateId: be,
682
- error: ce,
683
- onSeen: (D) => {
684
- ne.add(D.id), F();
688
+ ln && !ke ? {
689
+ dismissedCandidateIds: fe,
690
+ draftingCandidateId: we,
691
+ error: ue,
692
+ onSeen: (I) => {
693
+ ae.add(I.id), O();
685
694
  },
686
- onDraft: (D) => {
687
- an(D);
695
+ onDraft: (I) => {
696
+ pn(I);
688
697
  },
689
- onDismiss: (D) => {
690
- ne.add(D.id), me.add(D.id), F(), ce = null, O(f.getState());
698
+ onDismiss: (I) => {
699
+ ae.add(I.id), fe.add(I.id), O(), ue = null, M(w.getState());
691
700
  },
692
- onDisable: (D) => {
693
- Ce = !0, ne.add(D.id), me.add(D.id), F(), la(t, !0), ce = null, O(f.getState());
701
+ onDisable: (I) => {
702
+ ke = !0, ae.add(I.id), fe.add(I.id), O(), ua(t, !0), ue = null, M(w.getState());
694
703
  }
695
704
  } : void 0
696
- ), q ? (Z = k.scrollTop, H()) : L && ho(r) && Yt();
705
+ ), K ? (te = E.scrollTop, W()) : A && bo(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, Q("web-sdk.widget", "Agent state supplied appearance", {
707
+ return it = Tn((r) => {
708
+ Te = r, !Se && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) && M(w.getState());
709
+ }, { backendUrl: t.backendUrl, fetcher: F, 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, Q("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")), M(r), U(), u && Qe();
718
+ }), M(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 && !G(t.billingStatus) && (re = null), Oe(
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
- oe(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
+ Se = !0, Ye.disconnect(), et?.disconnect(), window.removeEventListener("resize", Ze), Je(), k !== null && window.clearTimeout(k), 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, M(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
- ne.add(r.id), me.add(r.id), F(), ae?.remove(), ae = qo(g, {
747
+ ae.add(r.id), fe.add(r.id), O(), ie?.remove(), ie = Jo(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, M(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
- }), Q("web-sdk.widget", "Updated widget appearance", {
759
- source: g,
760
+ function Ne(r, u) {
761
+ const A = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, I = r.fontFamily ?? t.fontFamily, Ie = r.scribbleStyle ?? t.scribbleStyle;
762
+ i = mt(A, Ie), ft(a, i, {
763
+ accentColor: A,
764
+ colorScheme: K,
765
+ fontFamily: I,
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: A,
771
+ appliedColorScheme: K,
772
+ appliedFontFamily: I,
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);
771
780
  }
772
- function ut(e, t, n) {
781
+ function ft(e, t, n) {
773
782
  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);
783
+ const o = n.scribbleStyle ? Nt(n.accentColor) : n.accentColor;
784
+ e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? jn : n.fontFamily, n.scribbleStyle && lo(e.ownerDocument);
776
785
  const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
777
786
  for (const i of a)
778
787
  i.src = t;
779
788
  }
780
- function ao(e) {
781
- if (e.getElementById(st))
789
+ function lo(e) {
790
+ if (e.getElementById(gt))
782
791
  return;
783
792
  const t = e.createElement("style");
784
- t.id = st, t.textContent = `@font-face {
793
+ t.id = gt, t.textContent = `@font-face {
785
794
  font-family: "Architects Daughter";
786
795
  font-style: normal;
787
796
  font-weight: 400;
@@ -789,7 +798,7 @@ function ao(e) {
789
798
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
790
799
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
791
800
  }
792
- function io({
801
+ function po({
793
802
  root: e,
794
803
  launcher: t,
795
804
  launcherDragHandle: n,
@@ -798,117 +807,117 @@ function io({
798
807
  persist: i
799
808
  }) {
800
809
  let l = null, p = null, c = null, d = !1, s = null;
801
- const b = () => {
810
+ const f = () => {
802
811
  l = null, p = null, c = null, d = !1, e.classList.remove("pluno-pa-widget--dragging");
803
- }, y = (h) => {
812
+ }, C = (h) => {
804
813
  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
814
  }, S = (h) => {
806
815
  if (l !== h.pointerId || !p || !c)
807
816
  return;
808
817
  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());
818
+ const g = h.clientX - p.x, _ = h.clientY - p.y;
819
+ !d && Math.hypot(g, _) < ht || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
820
+ }, x = (h) => {
821
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
822
+ }, D = (h) => {
823
+ l === h.pointerId && (h.preventDefault(), f());
815
824
  }, v = (h) => {
816
825
  if (!s)
817
826
  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) => {
827
+ const g = Math.hypot(h.clientX - s.x, h.clientY - s.y) <= ht;
828
+ s = null, g && (h.preventDefault(), h.stopPropagation());
829
+ }, y = (h) => {
821
830
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
822
831
  return;
823
- const C = h.shiftKey ? eo : Qn, _ = o();
824
- 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());
832
+ const g = h.shiftKey ? oo : no, _ = o();
833
+ let T = null;
834
+ h.key === "ArrowUp" ? T = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? T = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? T = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (T = { x: _.x + g, y: _.y }), T && (h.preventDefault(), h.stopPropagation(), a(T), i());
826
835
  };
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);
836
+ return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", S), t.addEventListener("pointerup", x), t.addEventListener("pointercancel", D), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
837
+ t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel", D), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
829
838
  };
830
839
  }
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");
840
+ function $e(e, t = !0) {
841
+ const n = se(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
833
842
  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
843
+ width: t && a && o.width > 0 ? o.width : Math.min(Ot, n.width - 36),
844
+ height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Vn : Ft
836
845
  };
837
846
  }
838
- function Ot() {
839
- const e = pe();
847
+ function Gt() {
848
+ const e = se();
840
849
  return {
841
850
  width: Math.min(
842
- le(e.width * jn, Wn, Vn),
843
- e.width - B * 2
851
+ pe(e.width * Yn, qn, Kn),
852
+ e.width - R * 2
844
853
  ),
845
854
  height: Math.min(
846
- le(e.height * Yn, qn, Kn),
847
- e.height - Ue - B
855
+ pe(e.height * Jn, Xn, Zn),
856
+ e.height - Ge - R
848
857
  )
849
858
  };
850
859
  }
851
- function ro(e, t, n) {
860
+ function so(e, t, n) {
852
861
  const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
853
862
  if (Number.isFinite(o) && Number.isFinite(a))
854
863
  return { x: o, y: a };
855
864
  const i = e.getBoundingClientRect();
856
865
  if (i.width > 0 || i.height > 0)
857
866
  return { x: i.left, y: i.top };
858
- const l = pe();
867
+ const l = se();
859
868
  return {
860
869
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
861
870
  y: l.height - 24 - n.height
862
871
  };
863
872
  }
864
- function gt(e, t, n) {
865
- const o = pe(), a = B + lo(e);
873
+ function bt(e, t, n) {
874
+ const o = se(), a = R + co(e);
866
875
  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))
876
+ x: pe(t.x, R, Math.max(R, o.width - n.width - R)),
877
+ y: pe(t.y, a, Math.max(a, o.height - n.height - R))
869
878
  };
870
879
  }
871
- function lo(e) {
872
- return e.classList.contains("pluno-pa-widget--scribble") ? Jn : Zn;
880
+ function co(e) {
881
+ return e.classList.contains("pluno-pa-widget--scribble") ? to : eo;
873
882
  }
874
- function ht(e, t, n) {
875
- const o = ze(e), a = Ot(), i = {
883
+ function wt(e, t, n) {
884
+ const o = $e(e), a = Gt(), i = {
876
885
  x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
877
886
  y: t.y + o.height - a.height
878
887
  };
879
- return po(i);
888
+ return uo(i);
880
889
  }
881
- function po(e) {
882
- const t = pe(), n = Ot();
890
+ function uo(e) {
891
+ const t = se(), n = Gt();
883
892
  return {
884
- x: le(e.x, B, Math.max(B, t.width - n.width - B)),
885
- y: le(
893
+ x: pe(e.x, R, Math.max(R, t.width - n.width - R)),
894
+ y: pe(
886
895
  e.y,
887
- Ue,
888
- Math.max(Ue, t.height - n.height - B)
896
+ Ge,
897
+ Math.max(Ge, t.height - n.height - R)
889
898
  )
890
899
  };
891
900
  }
892
- function we(e, t) {
901
+ function _e(e, t) {
893
902
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
894
903
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
895
904
  return;
896
905
  }
897
906
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
898
907
  }
899
- function so(e, t) {
908
+ function go(e, t) {
900
909
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
901
910
  }
902
- function co(e) {
911
+ function ho(e) {
903
912
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
904
913
  }
905
- function pe() {
914
+ function se() {
906
915
  return {
907
- width: window.innerWidth || document.documentElement.clientWidth || Dt + B * 2,
908
- height: window.innerHeight || document.documentElement.clientHeight || It + B * 2
916
+ width: window.innerWidth || document.documentElement.clientWidth || Ot + R * 2,
917
+ height: window.innerHeight || document.documentElement.clientHeight || Ft + R * 2
909
918
  };
910
919
  }
911
- function De(e) {
920
+ function Me(e) {
912
921
  const t = e.getBoundingClientRect();
913
922
  return {
914
923
  x: Math.round(t.x),
@@ -917,10 +926,10 @@ function De(e) {
917
926
  height: Math.round(t.height)
918
927
  };
919
928
  }
920
- function le(e, t, n) {
929
+ function pe(e, t, n) {
921
930
  return Math.min(Math.max(e, t), n);
922
931
  }
923
- function Q(e, t, n) {
932
+ function Y(e, t, n) {
924
933
  if (typeof window > "u")
925
934
  return;
926
935
  const o = window, a = {
@@ -929,26 +938,26 @@ function Q(e, t, n) {
929
938
  message: t,
930
939
  details: n
931
940
  }, 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 }));
941
+ 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($n, { detail: a }));
933
942
  }
934
- function uo(e, t) {
935
- Q("web-sdk.widget.position", e, t);
943
+ function mo(e, t) {
944
+ Y("web-sdk.widget.position", e, t);
936
945
  }
937
- function Ie(e, t, n) {
946
+ function Re(e, t, n) {
938
947
  const o = t.value.trim();
939
948
  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
949
  }
941
- function ue(e) {
950
+ function ge(e) {
942
951
  e.style.height = "0px";
943
952
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
944
953
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
945
954
  }
946
- function ge(e, t = () => !0) {
955
+ function he(e, t = () => !0) {
947
956
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
948
957
  t() && (e.scrollTop = e.scrollHeight);
949
958
  });
950
959
  }
951
- function go(e) {
960
+ function fo(e) {
952
961
  const t = e.messages[e.messages.length - 1];
953
962
  return [
954
963
  e.messages.length,
@@ -959,37 +968,37 @@ function go(e) {
959
968
  e.lastError ?? ""
960
969
  ].join(":");
961
970
  }
962
- function ho(e) {
971
+ function bo(e) {
963
972
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
964
973
  }
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));
974
+ function wo(e, t, n, o) {
975
+ e.appendChild(Eo()), e.appendChild(_o(t, n, o)), e.appendChild(Wt("pluno-pa-widget__close", "Close", ko(16), !0)), e.appendChild(xo(n));
967
976
  }
968
- function fo(e, t, n) {
977
+ function _o(e, t, n) {
969
978
  const o = document.createElement("form");
970
979
  if (o.className = "pluno-pa-widget__launcher", n) {
971
980
  const i = document.createElement("button");
972
981
  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
982
  }
974
- o.appendChild(Ft("pluno-pa-widget__character--launcher", t));
983
+ o.appendChild(Ht("pluno-pa-widget__character--launcher", t));
975
984
  const a = document.createElement("input");
976
985
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
977
986
  }
978
- function bo(e) {
987
+ function xo(e) {
979
988
  const t = document.createElement("section");
980
989
  t.className = "pluno-pa-widget__panel", t.hidden = !0;
981
990
  const n = document.createElement("div");
982
991
  n.className = "pluno-pa-widget__timeline-wrap";
983
992
  const o = document.createElement("main");
984
- o.className = "pluno-pa-widget__timeline", o.appendChild(_o(e));
993
+ o.className = "pluno-pa-widget__timeline", o.appendChild(yo(e));
985
994
  const a = document.createElement("div");
986
995
  a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
987
996
  const i = document.createElement("div");
988
997
  i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
989
998
  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;
999
+ 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", So(), !0)), t.appendChild(n), t.appendChild(vo()), t;
991
1000
  }
992
- function wo() {
1001
+ function vo() {
993
1002
  const e = document.createElement("form");
994
1003
  e.className = "pluno-pa-widget__composer";
995
1004
  const t = document.createElement("div");
@@ -1000,52 +1009,56 @@ function wo() {
1000
1009
  o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1001
1010
  const a = document.createElement("div");
1002
1011
  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);
1012
+ const i = document.createElement("input");
1013
+ 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
1014
  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;
1015
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Lo()), l.appendChild(Po()), a.appendChild(l);
1016
+ const p = document.createElement("textarea");
1017
+ p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
1018
+ const c = document.createElement("button");
1019
+ c.type = "button", c.className = "pluno-pa-widget__send", c.setAttribute("aria-label", "Send"), c.appendChild(jt()), a.appendChild(c), e.appendChild(a);
1020
+ const d = document.createElement("div");
1021
+ d.className = "pluno-pa-widget__composer-meta";
1022
+ const s = document.createElement("a");
1023
+ 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);
1024
+ const f = document.createElement("span");
1025
+ return f.className = "pluno-pa-widget__ai-disclaimer", f.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(f), e.appendChild(d), e;
1013
1026
  }
1014
- function _o(e) {
1027
+ function yo(e) {
1015
1028
  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;
1029
+ return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild($t()), t;
1017
1030
  }
1018
- function Bt() {
1031
+ function $t() {
1019
1032
  const e = document.createElement("div");
1020
1033
  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
1034
  }
1022
- function xo(e, t) {
1035
+ function Co(e, t) {
1023
1036
  e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
1024
1037
  const n = document.createElement("span");
1025
1038
  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
1039
  }
1027
- function Ft(e, t) {
1040
+ function Ht(e, t) {
1028
1041
  const n = document.createElement("img");
1029
1042
  return n.className = `pluno-pa-widget__character ${e}`, n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1030
1043
  }
1031
- function Ut(e, t, n, o) {
1044
+ function Wt(e, t, n, o) {
1032
1045
  const a = document.createElement("button");
1033
1046
  return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
1034
1047
  }
1035
- function vo() {
1036
- const e = P("svg", {
1048
+ function Eo() {
1049
+ const e = L("svg", {
1037
1050
  class: "pluno-pa-widget__scribble-defs",
1038
1051
  "aria-hidden": "true",
1039
1052
  focusable: "false",
1040
1053
  width: "0",
1041
1054
  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;
1055
+ }), t = L("defs");
1056
+ return t.appendChild(Be("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Be("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Be("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
1044
1057
  }
1045
- function Me(e, t, n) {
1046
- const o = P("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1058
+ function Be(e, t, n) {
1059
+ const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
1047
1060
  return o.appendChild(
1048
- P("feTurbulence", {
1061
+ L("feTurbulence", {
1049
1062
  type: "fractalNoise",
1050
1063
  baseFrequency: "0.012 0.028",
1051
1064
  numOctaves: "3",
@@ -1053,7 +1066,7 @@ function Me(e, t, n) {
1053
1066
  result: "stroke-noise"
1054
1067
  })
1055
1068
  ), o.appendChild(
1056
- P("feDisplacementMap", {
1069
+ L("feDisplacementMap", {
1057
1070
  in: "SourceGraphic",
1058
1071
  in2: "stroke-noise",
1059
1072
  scale: "3.5",
@@ -1062,7 +1075,7 @@ function Me(e, t, n) {
1062
1075
  result: "warped"
1063
1076
  })
1064
1077
  ), o.appendChild(
1065
- P("feTurbulence", {
1078
+ L("feTurbulence", {
1066
1079
  type: "fractalNoise",
1067
1080
  baseFrequency: "0.7",
1068
1081
  numOctaves: "1",
@@ -1070,7 +1083,7 @@ function Me(e, t, n) {
1070
1083
  result: "ink-noise"
1071
1084
  })
1072
1085
  ), o.appendChild(
1073
- P("feDisplacementMap", {
1086
+ L("feDisplacementMap", {
1074
1087
  in: "warped",
1075
1088
  in2: "ink-noise",
1076
1089
  scale: "0.9",
@@ -1079,31 +1092,51 @@ function Me(e, t, n) {
1079
1092
  })
1080
1093
  ), o;
1081
1094
  }
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;
1095
+ function ko(e) {
1096
+ const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
1097
+ return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
1089
1098
  }
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;
1099
+ function So() {
1100
+ const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
1101
+ 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;
1102
+ }
1103
+ function jt() {
1104
+ const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
1105
+ 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;
1106
+ }
1107
+ function Lo() {
1108
+ const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
1109
+ return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
1110
+ L("path", {
1111
+ 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"
1112
+ })
1113
+ ), e;
1114
+ }
1115
+ function Po() {
1116
+ const e = X("0 0 24 24", 19, 19, "none", "currentColor");
1117
+ return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
1118
+ L("path", {
1119
+ 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",
1120
+ stroke: "currentColor",
1121
+ "stroke-width": "2",
1122
+ "stroke-linecap": "round",
1123
+ "stroke-linejoin": "round"
1124
+ })
1125
+ ), e;
1093
1126
  }
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;
1127
+ function Ao() {
1128
+ const e = X("0 0 24 24", 18, 18, "currentColor");
1129
+ return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
1097
1130
  }
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;
1131
+ function To() {
1132
+ const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
1133
+ return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
1101
1134
  }
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;
1135
+ function No() {
1136
+ const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
1137
+ 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
1138
  }
1106
- function se(e, t, n, o, a, i) {
1139
+ function X(e, t, n, o, a, i) {
1107
1140
  const l = {
1108
1141
  viewBox: e,
1109
1142
  width: String(t),
@@ -1111,41 +1144,41 @@ function se(e, t, n, o, a, i) {
1111
1144
  fill: o,
1112
1145
  "aria-hidden": "true"
1113
1146
  };
1114
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), P("svg", l);
1147
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
1115
1148
  }
1116
- function P(e, t = {}) {
1117
- const n = document.createElementNS(Xn, e);
1149
+ function L(e, t = {}) {
1150
+ const n = document.createElementNS(Qn, e);
1118
1151
  for (const [o, a] of Object.entries(t))
1119
1152
  n.setAttribute(o, a);
1120
1153
  return n;
1121
1154
  }
1122
- function mt(e) {
1155
+ function _t(e) {
1123
1156
  for (const t of ["keydown", "keypress", "keyup"])
1124
1157
  e.addEventListener(t, (n) => {
1125
1158
  n.stopPropagation();
1126
1159
  });
1127
1160
  }
1128
- function Lo(e, t, n) {
1161
+ function Io(e, t, n) {
1129
1162
  e.replaceChildren(), e.hidden = t.length === 0;
1130
1163
  for (const [o, a] of t.entries()) {
1131
1164
  const i = document.createElement("div");
1132
- i.className = "pluno-pa-widget__attachment", i.appendChild(Po(a));
1165
+ i.className = "pluno-pa-widget__attachment", i.appendChild(Do(a));
1133
1166
  const l = document.createElement("span");
1134
1167
  l.textContent = a.name, i.appendChild(l);
1135
1168
  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);
1169
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(To()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
1137
1170
  }
1138
1171
  }
1139
- function Po(e) {
1140
- if (Gt(e)) {
1172
+ function Do(e) {
1173
+ if (Vt(e)) {
1141
1174
  const n = document.createElement("img");
1142
1175
  return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
1143
1176
  }
1144
1177
  const t = document.createElement("span");
1145
1178
  return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
1146
1179
  }
1147
- function Ao(e) {
1148
- if (Gt(e)) {
1180
+ function Mo(e) {
1181
+ if (Vt(e)) {
1149
1182
  const a = document.createElement("img");
1150
1183
  return a.src = e.dataUrl, a.alt = e.name, a;
1151
1184
  }
@@ -1156,51 +1189,51 @@ function Ao(e) {
1156
1189
  const o = document.createElement("strong");
1157
1190
  return o.textContent = e.name, t.append(n, o), t;
1158
1191
  }
1159
- function Gt(e) {
1192
+ function Vt(e) {
1160
1193
  return e.mimeType.startsWith("image/");
1161
1194
  }
1162
- function To(e) {
1195
+ function Ro(e) {
1163
1196
  return e === "application/pdf" ? "document.pdf" : "image";
1164
1197
  }
1165
- async function No(e) {
1198
+ async function Bo(e) {
1166
1199
  if (!e)
1167
1200
  return [];
1168
1201
  const t = Array.from(e);
1169
- if (t.length > ye)
1170
- throw new Error(`Attach up to ${ye} files per message.`);
1202
+ if (t.length > Ce)
1203
+ throw new Error(`Attach up to ${Ce} files per message.`);
1171
1204
  return Promise.all(
1172
1205
  t.map(async (n) => {
1173
- const o = Do(n);
1206
+ const o = Oo(n);
1174
1207
  if (!o)
1175
1208
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
1176
- if (n.size > zn)
1209
+ if (n.size > Hn)
1177
1210
  throw new Error("Each Pluno attachment can be up to 10 MB.");
1178
1211
  if (o === "image/gif") {
1179
- const a = new Uint8Array(await Go(n));
1180
- if (Mo(a))
1212
+ const a = new Uint8Array(await Vo(n));
1213
+ if (Uo(a))
1181
1214
  throw new Error("Pluno supports non-animated GIF images.");
1182
1215
  }
1183
1216
  return {
1184
- name: n.name || To(o),
1217
+ name: n.name || Ro(o),
1185
1218
  mimeType: o,
1186
1219
  sizeBytes: n.size,
1187
- dataUrl: Io(await $o(n), o)
1220
+ dataUrl: Fo(await qo(n), o)
1188
1221
  };
1189
1222
  })
1190
1223
  );
1191
1224
  }
1192
- function Do(e) {
1193
- if (Gn.has(e.type))
1225
+ function Oo(e) {
1226
+ if (Bt.has(e.type))
1194
1227
  return e.type;
1195
1228
  const t = e.name.toLowerCase();
1196
1229
  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
1230
  }
1198
- function Io(e, t) {
1231
+ function Fo(e, t) {
1199
1232
  const n = `data:${t};base64,`;
1200
1233
  return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
1201
1234
  }
1202
- function Mo(e) {
1203
- if (e.length < 14 || !Ro(e))
1235
+ function Uo(e) {
1236
+ if (e.length < 14 || !zo(e))
1204
1237
  return !1;
1205
1238
  const t = e[10];
1206
1239
  let n = 13;
@@ -1211,7 +1244,7 @@ function Mo(e) {
1211
1244
  if (n += 1, a === 59)
1212
1245
  return !1;
1213
1246
  if (a === 33) {
1214
- n += 1, n = ft(e, n);
1247
+ n += 1, n = xt(e, n);
1215
1248
  continue;
1216
1249
  }
1217
1250
  if (a !== 44)
@@ -1223,14 +1256,14 @@ function Mo(e) {
1223
1256
  const i = e[n + 8];
1224
1257
  if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= e.length)
1225
1258
  return !1;
1226
- n += 1, n = ft(e, n);
1259
+ n += 1, n = xt(e, n);
1227
1260
  }
1228
1261
  return !1;
1229
1262
  }
1230
- function Ro(e) {
1263
+ function zo(e) {
1231
1264
  return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
1232
1265
  }
1233
- function ft(e, t) {
1266
+ function xt(e, t) {
1234
1267
  for (; t < e.length; ) {
1235
1268
  const n = e[t];
1236
1269
  if (t += 1, n === 0)
@@ -1239,69 +1272,69 @@ function ft(e, t) {
1239
1272
  }
1240
1273
  return t;
1241
1274
  }
1242
- function _e(e) {
1275
+ function xe(e) {
1243
1276
  return !!(e && Array.from(e.types).includes("Files"));
1244
1277
  }
1245
- function Re(e, t, n = null) {
1246
- if (!e || !Ge(t, n)) {
1278
+ function Oe(e, t, n = null) {
1279
+ if (!e || !He(t, n)) {
1247
1280
  e && (e.hidden = !0, e.replaceChildren());
1248
1281
  return;
1249
1282
  }
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));
1283
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", G(t) || Ve(n) ? e.appendChild(Go(t, n)) : qt(t) && e.appendChild($o(t));
1251
1284
  }
1252
- function Oo(e, t) {
1285
+ function Go(e, t) {
1253
1286
  const n = document.createElement("div");
1254
1287
  n.className = "pluno-pa-widget__billing-action-card";
1255
1288
  const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
1256
1289
  a.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(a);
1257
1290
  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;
1291
+ 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
1292
  }
1260
- function Bo(e) {
1293
+ function $o(e) {
1261
1294
  const t = document.createElement("div");
1262
1295
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
1263
1296
  const n = document.createElement("strong");
1264
1297
  n.textContent = "Credits running low", t.appendChild(n);
1265
1298
  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;
1299
+ return o.textContent = Wo(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
1300
  }
1268
- function Ge(e, t) {
1269
- return e !== null && (K(e) || $t(e) || We(t));
1301
+ function He(e, t) {
1302
+ return e !== null && (G(e) || qt(e) || Ve(t));
1270
1303
  }
1271
- function bt(e, t, n) {
1272
- return Ge(t, n) || Fo(t) ? !0 : !Ge(e, n);
1304
+ function vt(e, t, n) {
1305
+ return He(t, n) || Ho(t) ? !0 : !He(e, n);
1273
1306
  }
1274
- function Fo(e) {
1275
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || K(e));
1307
+ function Ho(e) {
1308
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || G(e));
1276
1309
  }
1277
- function K(e) {
1310
+ function G(e) {
1278
1311
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
1279
1312
  }
1280
- function We(e) {
1313
+ function Ve(e) {
1281
1314
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
1282
1315
  }
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;
1316
+ function qt(e) {
1317
+ return !G(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
1285
1318
  }
1286
- function Uo(e) {
1287
- return e.creditsRemaining === null ? null : `${zo(e.creditsRemaining)} credits left`;
1319
+ function Wo(e) {
1320
+ return e.creditsRemaining === null ? null : `${jo(e.creditsRemaining)} credits left`;
1288
1321
  }
1289
- function zo(e) {
1322
+ function jo(e) {
1290
1323
  return new Intl.NumberFormat("en-US", {
1291
1324
  maximumFractionDigits: 0
1292
1325
  }).format(Math.ceil(e));
1293
1326
  }
1294
- function Ht(e, t, n) {
1327
+ function Kt(e, t, n) {
1295
1328
  const o = document.createElement("div");
1296
- return o.className = n, o.appendChild(wt(t, e.pricingUrl)), o.appendChild(wt("Earn credits", e.earnCreditsUrl)), o;
1329
+ return o.className = n, o.appendChild(yt(t, e.pricingUrl)), o.appendChild(yt("Earn credits", e.earnCreditsUrl)), o;
1297
1330
  }
1298
- function wt(e, t) {
1331
+ function yt(e, t) {
1299
1332
  const n = document.createElement("button");
1300
1333
  return n.type = "button", n.textContent = e, n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
1301
1334
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
1302
1335
  }), n;
1303
1336
  }
1304
- function Go(e) {
1337
+ function Vo(e) {
1305
1338
  return new Promise((t, n) => {
1306
1339
  const o = new FileReader();
1307
1340
  o.addEventListener("load", () => {
@@ -1315,7 +1348,7 @@ function Go(e) {
1315
1348
  }), o.readAsArrayBuffer(e);
1316
1349
  });
1317
1350
  }
1318
- function $o(e) {
1351
+ function qo(e) {
1319
1352
  return new Promise((t, n) => {
1320
1353
  const o = new FileReader();
1321
1354
  o.addEventListener("load", () => {
@@ -1329,94 +1362,94 @@ function $o(e) {
1329
1362
  }), o.readAsDataURL(e);
1330
1363
  });
1331
1364
  }
1332
- function _t(e, t) {
1333
- return e.messages.filter((o) => !Wt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1365
+ function Ct(e, t) {
1366
+ return e.messages.filter((o) => !Yt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
1334
1367
  }
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);
1368
+ function Ko(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
1369
+ const D = [...i.messages], v = D.filter((b) => !Yt(b)), y = e.scrollTop;
1370
+ e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null && Co(a, l);
1338
1371
  const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
1339
1372
  if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
1373
+ const b = document.createElement("div");
1374
+ b.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1340
1375
  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);
1376
+ m.className = "pluno-pa-widget__empty-hero";
1377
+ const k = document.createElement("img");
1378
+ k.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", k.src = C(), k.alt = "", k.setAttribute("aria-hidden", "true"), m.appendChild(k), b.appendChild(m), b.appendChild($t());
1379
+ const P = document.createElement("div");
1380
+ 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");
1381
+ for (const B of i.starterPrompts) {
1382
+ const F = document.createElement("button");
1383
+ F.type = "button", F.className = "pluno-pa-widget__starter-prompt", F.textContent = `"${B}"`, F.addEventListener("click", () => {
1384
+ S(B);
1385
+ }), P.appendChild(F);
1386
+ }
1387
+ b.appendChild(P), e.appendChild(b), e.appendChild(t);
1355
1388
  return;
1356
1389
  }
1357
- let C = null, _ = null, N = [];
1358
- const k = () => {
1359
- if (N.length === 0)
1390
+ let g = null, _ = null, T = [];
1391
+ const Z = () => {
1392
+ if (T.length === 0)
1360
1393
  return !1;
1361
- const m = Jo(N, s, b, y());
1362
- return e.appendChild(m), C = null, _ = m, N = [], !0;
1394
+ const b = oa(T, s, f, C());
1395
+ return e.appendChild(b), g = null, _ = b, T = [], !0;
1363
1396
  };
1364
- for (let m = 0; m < v.length; m += 1) {
1365
- const x = v[m];
1366
- if (x.role === "tool") {
1367
- N.push(x);
1397
+ for (let b = 0; b < v.length; b += 1) {
1398
+ const m = v[b];
1399
+ if (m.role === "tool") {
1400
+ T.push(m);
1368
1401
  continue;
1369
1402
  }
1370
- if (x.role === "system")
1403
+ if (m.role === "system")
1371
1404
  continue;
1372
- const M = k(), R = vt(x.content);
1373
- if (x.role === "assistant" && !M) {
1374
- const te = $e(y());
1375
- e.appendChild(te), C = null, _ = te;
1376
- }
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));
1379
- 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;
1405
+ const k = Z(), P = kt(m.content);
1406
+ if (m.role === "assistant" && !k) {
1407
+ const w = We(C());
1408
+ e.appendChild(w), g = null, _ = w;
1409
+ }
1410
+ const B = document.createElement("div");
1411
+ B.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? St(B, P) : B.textContent = P, m.role === "user" && m.attachments?.length && B.appendChild(Xo(m.attachments));
1412
+ const F = document.createElement("div");
1413
+ F.className = "pluno-pa-widget__message-actions", F.appendChild(Et(P)), B.appendChild(F), e.appendChild(B), g = B, _ = null;
1381
1414
  }
1382
- const ee = k();
1415
+ const de = Z();
1383
1416
  if (i.assistantDraft) {
1384
- if (!ee) {
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;
1417
+ if (!de) {
1418
+ const P = We(C());
1419
+ e.appendChild(P), g = null, _ = P;
1420
+ }
1421
+ const b = kt(i.assistantDraft), m = document.createElement("div");
1422
+ m.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", St(m, b);
1423
+ const k = document.createElement("div");
1424
+ k.className = "pluno-pa-widget__message-actions", k.appendChild(Et(b)), m.appendChild(k), e.appendChild(m), g = m, _ = null;
1392
1425
  }
1393
1426
  if (i.isThinking && !i.assistantDraft)
1394
- if (ee) {
1395
- const m = Vt();
1396
- e.appendChild(m), C = null, _ = m;
1427
+ if (de) {
1428
+ const b = Xt();
1429
+ e.appendChild(b), g = null, _ = b;
1397
1430
  } else {
1398
- const m = Qo(y());
1399
- e.appendChild(m), C = null, _ = m;
1431
+ const b = aa(C());
1432
+ e.appendChild(b), g = null, _ = b;
1400
1433
  }
1401
1434
  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;
1435
+ const b = document.createElement("div");
1436
+ b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
1404
1437
  }
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
1438
+ const E = x && !i.isThinking ? xn(D) : null;
1439
+ if (x && E && !x.dismissedCandidateIds.has(E.id)) {
1440
+ const b = Zo(E, {
1441
+ isDrafting: x.draftingCandidateId === E.id,
1442
+ error: x.error,
1443
+ onDraft: x.onDraft,
1444
+ onDismiss: x.onDismiss,
1445
+ onDisable: x.onDisable
1413
1446
  });
1414
- e.appendChild(m), w.onSeen(E), C = null, _ = m;
1447
+ e.appendChild(b), x.onSeen(E), g = null, _ = b;
1415
1448
  }
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;
1449
+ 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
1450
  }
1418
- function Wo(e, t, n, o, a, i) {
1419
- e.replaceChildren(), jt(t, !1), t.disabled = !0, n.hidden = !0;
1451
+ function Yo(e, t, n, o, a, i) {
1452
+ e.replaceChildren(), Zt(t, !1), t.disabled = !0, n.hidden = !0;
1420
1453
  const l = document.createElement("div");
1421
1454
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1422
1455
  const p = document.createElement("img");
@@ -1426,20 +1459,20 @@ function Wo(e, t, n, o, a, i) {
1426
1459
  const d = document.createElement("button");
1427
1460
  d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
1428
1461
  }
1429
- function Vo(e) {
1462
+ function Xo(e) {
1430
1463
  const t = document.createElement("div");
1431
1464
  t.className = "pluno-pa-widget__message-attachments";
1432
1465
  for (const n of e)
1433
- t.appendChild(Ao(n));
1466
+ t.appendChild(Mo(n));
1434
1467
  return t;
1435
1468
  }
1436
- function xt(e) {
1469
+ function Et(e) {
1437
1470
  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) => {
1471
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(No()), t.addEventListener("click", (n) => {
1439
1472
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
1440
1473
  }), t;
1441
1474
  }
1442
- function jo(e, t) {
1475
+ function Zo(e, t) {
1443
1476
  const n = document.createElement("article");
1444
1477
  n.className = "pluno-pa-widget__share-prompt";
1445
1478
  const o = document.createElement("div");
@@ -1461,21 +1494,21 @@ function jo(e, t) {
1461
1494
  const d = document.createElement("button");
1462
1495
  if (d.type = "button", d.disabled = t.isDrafting, d.addEventListener("click", () => {
1463
1496
  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)
1497
+ }), t.isDrafting ? (d.appendChild(je()), d.appendChild(document.createTextNode("Drafting..."))) : d.textContent = "Draft a social post", c.appendChild(d), t.isDrafting)
1465
1498
  p.appendChild(c);
1466
1499
  else {
1467
1500
  const s = document.createElement("button");
1468
1501
  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
1502
  t.onDismiss(e);
1470
1503
  }), 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", () => {
1504
+ const f = document.createElement("button");
1505
+ f.type = "button", f.className = "pluno-pa-widget__share-prompt-disable", f.textContent = "Don't ask again", f.addEventListener("click", () => {
1473
1506
  t.onDisable(e);
1474
- }), p.appendChild(b);
1507
+ }), p.appendChild(f);
1475
1508
  }
1476
1509
  return o.appendChild(p), n.appendChild(o), n;
1477
1510
  }
1478
- function qo(e, t) {
1511
+ function Jo(e, t) {
1479
1512
  const n = document.createElement("div");
1480
1513
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
1481
1514
  v.target === n && t.onClose();
@@ -1494,49 +1527,49 @@ function qo(e, t) {
1494
1527
  d.className = "pluno-pa-widget__share-dialog-step-header";
1495
1528
  const s = document.createElement("strong");
1496
1529
  s.textContent = "1) Copy Screenshot", d.appendChild(s);
1497
- const b = Ko("Copy Screenshot", async () => {
1530
+ const f = Qo("Copy Screenshot", async () => {
1498
1531
  try {
1499
- return await wn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1532
+ return await vn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1500
1533
  } catch {
1501
1534
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1502
1535
  }
1503
1536
  });
1504
- if (d.appendChild(b), c.appendChild(d), e.screenshotDataUrl) {
1537
+ if (d.appendChild(f), c.appendChild(d), e.screenshotDataUrl) {
1505
1538
  const v = document.createElement("div");
1506
1539
  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);
1540
+ const y = document.createElement("img");
1541
+ y.src = e.screenshotDataUrl, y.alt = "Product page with Pluno open", v.appendChild(y), c.appendChild(v);
1509
1542
  }
1510
1543
  o.appendChild(c), o.appendChild(p);
1511
- const y = document.createElement("div");
1512
- y.className = "pluno-pa-widget__share-dialog-step";
1544
+ const C = document.createElement("div");
1545
+ C.className = "pluno-pa-widget__share-dialog-step";
1513
1546
  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);
1547
+ S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", C.appendChild(S);
1548
+ const x = document.createElement("p");
1549
+ x.className = "pluno-pa-widget__share-dialog-hint", x.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(x);
1550
+ const D = document.createElement("footer");
1551
+ D.className = "pluno-pa-widget__share-dialog-platforms";
1552
+ for (const v of ea(e)) {
1553
+ const y = document.createElement("a");
1554
+ y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ta(v.id)), D.appendChild(y);
1522
1555
  }
1523
- if (y.appendChild(I), o.appendChild(y), t.socialPostRewardsUrl) {
1556
+ if (C.appendChild(D), o.appendChild(C), t.socialPostRewardsUrl) {
1524
1557
  const v = document.createElement("div");
1525
1558
  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);
1559
+ const y = document.createElement("strong");
1560
+ y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
1528
1561
  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);
1562
+ 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(na()), v.appendChild(h), o.appendChild(v);
1530
1563
  }
1531
1564
  return n.appendChild(o), n;
1532
1565
  }
1533
- function Ko(e, t) {
1566
+ function Qo(e, t) {
1534
1567
  const n = document.createElement("button");
1535
1568
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
1536
1569
  o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
1537
1570
  }), n;
1538
1571
  }
1539
- function Yo(e) {
1572
+ function ea(e) {
1540
1573
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
1541
1574
  return [
1542
1575
  {
@@ -1556,60 +1589,60 @@ function Yo(e) {
1556
1589
  }
1557
1590
  ];
1558
1591
  }
1559
- function Xo(e) {
1592
+ function ta(e) {
1560
1593
  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);
1594
+ 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" ? (N(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), N(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"), N(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), N(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"), N(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (N(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), N(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), N(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (N(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"), N(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"), N(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"), N(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
1595
  }
1563
- function T(e, t, n) {
1596
+ function N(e, t, n) {
1564
1597
  const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1565
1598
  o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
1566
1599
  }
1567
- function Zo() {
1600
+ function na() {
1568
1601
  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;
1602
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), N(e, "M14 5h5v5"), N(e, "M19 5l-8 8"), N(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
1570
1603
  }
1571
- function Wt(e) {
1572
- return e.role === "tool" && e.toolName === At;
1604
+ function Yt(e) {
1605
+ return e.role === "tool" && e.toolName === Dt;
1573
1606
  }
1574
- function vt(e) {
1607
+ function kt(e) {
1575
1608
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1576
1609
  }
1577
- function Jo(e, t, n, o) {
1610
+ function oa(e, t, n, o) {
1578
1611
  const a = document.createElement("article");
1579
1612
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
1580
1613
  const i = document.createElement("img");
1581
1614
  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);
1615
+ const l = document.createElement("details"), p = ia(e);
1583
1616
  l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
1584
1617
  a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
1585
1618
  });
1586
1619
  const c = document.createElement("summary");
1587
- c.className = "pluno-pa-widget__tool-summary", e.some((b) => b.loading) && c.appendChild(He());
1620
+ c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(je());
1588
1621
  const s = document.createElement("span");
1589
1622
  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) {
1623
+ const f = document.createElement("div");
1624
+ f.className = "pluno-pa-widget__tool-lines";
1625
+ for (const C of e) {
1593
1626
  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);
1627
+ S.className = "pluno-pa-widget__tool-line", C.loading && S.appendChild(je());
1628
+ const x = document.createElement("span");
1629
+ x.textContent = C.content || "Run tool", S.appendChild(x), f.appendChild(S);
1597
1630
  }
1598
- l.appendChild(b);
1631
+ l.appendChild(f);
1599
1632
  }
1600
1633
  return a.appendChild(l), a;
1601
1634
  }
1602
- function $e(e) {
1635
+ function We(e) {
1603
1636
  const t = document.createElement("article");
1604
1637
  t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1605
1638
  const n = document.createElement("img");
1606
1639
  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
1640
  }
1608
- function Qo(e) {
1609
- const t = $e(e);
1610
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Vt()), t;
1641
+ function aa(e) {
1642
+ const t = We(e);
1643
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Xt()), t;
1611
1644
  }
1612
- function Vt() {
1645
+ function Xt() {
1613
1646
  const e = document.createElement("div");
1614
1647
  e.className = "pluno-pa-widget__status";
1615
1648
  const t = document.createElement("span");
@@ -1617,17 +1650,17 @@ function Vt() {
1617
1650
  const n = document.createElement("span");
1618
1651
  return n.textContent = "Thinking...", e.appendChild(n), e;
1619
1652
  }
1620
- function ea(e) {
1653
+ function ia(e) {
1621
1654
  return `tools:${e[0]?.id ?? ""}`;
1622
1655
  }
1623
- function He() {
1656
+ function je() {
1624
1657
  const e = document.createElement("span");
1625
1658
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
1626
1659
  }
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());
1660
+ function Zt(e, t) {
1661
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ao() : jt());
1629
1662
  }
1630
- function yt(e, t) {
1663
+ function St(e, t) {
1631
1664
  const n = t.replace(/\r\n/g, `
1632
1665
  `).split(`
1633
1666
  `);
@@ -1643,22 +1676,22 @@ function yt(e, t) {
1643
1676
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1644
1677
  d.push(n[o]), o += 1;
1645
1678
  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);
1679
+ const s = document.createElement("pre"), f = document.createElement("code");
1680
+ f.textContent = d.join(`
1681
+ `), s.appendChild(f), e.appendChild(s);
1649
1682
  continue;
1650
1683
  }
1651
1684
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1652
1685
  if (l) {
1653
1686
  const d = document.createElement(`h${l[1].length + 2}`);
1654
- xe(d, l[2]), e.appendChild(d), o += 1;
1687
+ ve(d, l[2]), e.appendChild(d), o += 1;
1655
1688
  continue;
1656
1689
  }
1657
1690
  if (/^\s*[-*+]\s+/.test(a)) {
1658
1691
  const d = document.createElement("ul");
1659
1692
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1660
1693
  const s = document.createElement("li");
1661
- xe(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1694
+ ve(s, n[o].replace(/^\s*[-*+]\s+/, "")), d.appendChild(s), o += 1;
1662
1695
  }
1663
1696
  e.appendChild(d);
1664
1697
  continue;
@@ -1667,7 +1700,7 @@ function yt(e, t) {
1667
1700
  const d = document.createElement("ol");
1668
1701
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1669
1702
  const s = document.createElement("li");
1670
- xe(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1703
+ ve(s, n[o].replace(/^\s*\d+\.\s+/, "")), d.appendChild(s), o += 1;
1671
1704
  }
1672
1705
  e.appendChild(d);
1673
1706
  continue;
@@ -1677,11 +1710,11 @@ function yt(e, t) {
1677
1710
  p.push(n[o]), o += 1;
1678
1711
  const c = document.createElement("p");
1679
1712
  p.forEach((d, s) => {
1680
- s > 0 && c.appendChild(document.createElement("br")), xe(c, d);
1713
+ s > 0 && c.appendChild(document.createElement("br")), ve(c, d);
1681
1714
  }), e.appendChild(c);
1682
1715
  }
1683
1716
  }
1684
- function xe(e, t) {
1717
+ function ve(e, t) {
1685
1718
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1686
1719
  let o = 0;
1687
1720
  for (const a of t.matchAll(n)) {
@@ -1699,7 +1732,7 @@ function xe(e, t) {
1699
1732
  p.textContent = l.slice(1, -1), e.appendChild(p);
1700
1733
  } else {
1701
1734
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1702
- if (p && ta(p[2])) {
1735
+ if (p && ra(p[2])) {
1703
1736
  const c = document.createElement("a");
1704
1737
  c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
1705
1738
  } else
@@ -1709,7 +1742,7 @@ function xe(e, t) {
1709
1742
  }
1710
1743
  o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
1711
1744
  }
1712
- function ta(e) {
1745
+ function ra(e) {
1713
1746
  if (e.startsWith("/") || e.startsWith("#"))
1714
1747
  return !0;
1715
1748
  try {
@@ -1719,8 +1752,8 @@ function ta(e) {
1719
1752
  return !1;
1720
1753
  }
1721
1754
  }
1722
- function Ct(e, t) {
1723
- if (na(e))
1755
+ function Lt(e, t) {
1756
+ if (la(e))
1724
1757
  return;
1725
1758
  const n = `
1726
1759
  :host {
@@ -1773,7 +1806,7 @@ function Ct(e, t) {
1773
1806
  --pluno-pa-accent-contrast: #fafafa;
1774
1807
  position: fixed;
1775
1808
  z-index: 2147483645;
1776
- font-family: ${W.fontFamily};
1809
+ font-family: ${j.fontFamily};
1777
1810
  font-size: 14px;
1778
1811
  color: var(--pluno-pa-text);
1779
1812
  width: var(--pluno-pa-launcher-width);
@@ -2514,7 +2547,7 @@ function Ct(e, t) {
2514
2547
  place-items: center;
2515
2548
  padding: 18px;
2516
2549
  background: rgba(24, 24, 27, 0.28);
2517
- font-family: var(--pluno-pa-font, ${W.fontFamily});
2550
+ font-family: var(--pluno-pa-font, ${j.fontFamily});
2518
2551
  color: var(--pluno-pa-text);
2519
2552
  }
2520
2553
  .pluno-pa-widget__share-dialog {
@@ -2878,12 +2911,48 @@ function Ct(e, t) {
2878
2911
  background: var(--pluno-pa-surface);
2879
2912
  border: 1px solid var(--pluno-pa-divider);
2880
2913
  border-radius: 14px;
2881
- padding: 8px 44px 8px 12px;
2914
+ padding: 8px 44px 8px 38px;
2882
2915
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
2883
2916
  }
2884
2917
  .pluno-pa-widget__composer-inner:focus-within {
2885
2918
  border-color: var(--pluno-pa-accent);
2886
2919
  }
2920
+ .pluno-pa-widget__attachment-input {
2921
+ position: absolute;
2922
+ width: 1px;
2923
+ height: 1px;
2924
+ opacity: 0;
2925
+ pointer-events: none;
2926
+ }
2927
+ .pluno-pa-widget__attach {
2928
+ position: absolute;
2929
+ left: 6px;
2930
+ top: 50%;
2931
+ margin-top: -14px;
2932
+ width: 28px;
2933
+ height: 28px;
2934
+ display: inline-flex;
2935
+ align-items: center;
2936
+ justify-content: center;
2937
+ border: 0;
2938
+ border-radius: 999px;
2939
+ background: transparent;
2940
+ color: var(--pluno-pa-muted);
2941
+ cursor: pointer;
2942
+ transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
2943
+ }
2944
+ .pluno-pa-widget__attach:hover:not(:disabled),
2945
+ .pluno-pa-widget__attach:focus-visible {
2946
+ background: var(--pluno-pa-bubble);
2947
+ color: var(--pluno-pa-accent);
2948
+ }
2949
+ .pluno-pa-widget__attach:disabled {
2950
+ cursor: not-allowed;
2951
+ opacity: 0.45;
2952
+ }
2953
+ .pluno-pa-widget__paperclip-icon--scribble {
2954
+ display: none;
2955
+ }
2887
2956
  .pluno-pa-widget--drag-over .pluno-pa-widget__composer-inner {
2888
2957
  border-color: var(--pluno-pa-accent);
2889
2958
  background: var(--pluno-pa-accent-soft);
@@ -2948,12 +3017,12 @@ function Ct(e, t) {
2948
3017
  display: flex;
2949
3018
  align-items: center;
2950
3019
  justify-content: center;
2951
- column-gap: 0.35em;
2952
- margin-top: 8px;
3020
+ column-gap: 0.3em;
3021
+ margin-top: 5px;
2953
3022
  color: var(--pluno-pa-faint);
2954
3023
  font: inherit;
2955
- font-size: 11px;
2956
- line-height: 1.2;
3024
+ font-size: 10px;
3025
+ line-height: 1.1;
2957
3026
  flex-wrap: wrap;
2958
3027
  text-align: center;
2959
3028
  }
@@ -3037,11 +3106,30 @@ function Ct(e, t) {
3037
3106
  text-transform: lowercase;
3038
3107
  }
3039
3108
  .pluno-pa-widget__active-users-counter-dot {
3109
+ flex: 0 0 auto;
3040
3110
  width: 7px;
3041
3111
  height: 7px;
3042
3112
  border-radius: 999px;
3043
3113
  background: #22c55e;
3044
3114
  box-shadow: 0 0 0 4px rgb(34 197 94 / 10%);
3115
+ animation: pluno-pa-active-users-live-pulse 1.7s ease-out infinite;
3116
+ }
3117
+ @keyframes pluno-pa-active-users-live-pulse {
3118
+ 0% {
3119
+ box-shadow: 0 0 0 0 rgb(34 197 94 / 42%);
3120
+ }
3121
+ 70% {
3122
+ box-shadow: 0 0 0 7px rgb(34 197 94 / 0%);
3123
+ }
3124
+ 100% {
3125
+ box-shadow: 0 0 0 0 rgb(34 197 94 / 0%);
3126
+ }
3127
+ }
3128
+ @media (prefers-reduced-motion: reduce) {
3129
+ .pluno-pa-widget__active-users-counter-dot {
3130
+ animation: none;
3131
+ box-shadow: 0 0 0 4px rgb(34 197 94 / 10%);
3132
+ }
3045
3133
  }
3046
3134
  .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
3047
3135
  margin-bottom: -24px;
@@ -3183,7 +3271,7 @@ function Ct(e, t) {
3183
3271
  right: 16px;
3184
3272
  height: 36px;
3185
3273
  z-index: 3;
3186
- background-image: url('${pt}');
3274
+ background-image: url('${ut}');
3187
3275
  background-repeat: repeat-x;
3188
3276
  background-size: 104px 36px;
3189
3277
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3371,6 +3459,19 @@ function Ct(e, t) {
3371
3459
  opacity: 0.6;
3372
3460
  transform: rotate(5deg);
3373
3461
  }
3462
+ .pluno-pa-widget--scribble .pluno-pa-widget__attach:hover:not(:disabled),
3463
+ .pluno-pa-widget--scribble .pluno-pa-widget__attach:focus-visible {
3464
+ background: transparent;
3465
+ color: var(--pluno-pa-accent);
3466
+ }
3467
+ .pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--standard {
3468
+ display: none;
3469
+ }
3470
+ .pluno-pa-widget--scribble .pluno-pa-widget__paperclip-icon--scribble {
3471
+ display: block;
3472
+ transform: rotate(-8deg);
3473
+ filter: url(#pluno-pa-scribble-wobble-2);
3474
+ }
3374
3475
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
3375
3476
  transform: rotate(-10deg);
3376
3477
  filter: url(#pluno-pa-scribble-wobble);
@@ -3436,7 +3537,7 @@ function Ct(e, t) {
3436
3537
  right: 12px;
3437
3538
  height: 22px;
3438
3539
  z-index: 1;
3439
- background-image: url('${pt}');
3540
+ background-image: url('${ut}');
3440
3541
  background-repeat: repeat-x;
3441
3542
  background-size: 62px 21.5px;
3442
3543
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -3449,28 +3550,28 @@ function Ct(e, t) {
3449
3550
  filter: url(#pluno-pa-scribble-wobble-2);
3450
3551
  }
3451
3552
  `;
3452
- if (oa(e, n))
3553
+ if (pa(e, n))
3453
3554
  return;
3454
3555
  const o = e.ownerDocument.createElement("style");
3455
- o.id = Mt, o.textContent = n, e.appendChild(o), qt(e);
3556
+ o.id = Ut, o.textContent = n, e.appendChild(o), Jt(e);
3456
3557
  }
3457
- function na(e) {
3458
- return e.getElementById(Mt) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Rt) === "true";
3558
+ function la(e) {
3559
+ return e.getElementById(Ut) !== null || e.host instanceof HTMLElement && e.host.getAttribute(zt) === "true";
3459
3560
  }
3460
- function qt(e) {
3461
- e.host instanceof HTMLElement && e.host.setAttribute(Rt, "true");
3561
+ function Jt(e) {
3562
+ e.host instanceof HTMLElement && e.host.setAttribute(zt, "true");
3462
3563
  }
3463
- function oa(e, t) {
3564
+ function pa(e, t) {
3464
3565
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
3465
3566
  return !1;
3466
3567
  try {
3467
3568
  const n = new CSSStyleSheet();
3468
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], qt(e), !0;
3569
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Jt(e), !0;
3469
3570
  } catch {
3470
3571
  return !1;
3471
3572
  }
3472
3573
  }
3473
- async function aa() {
3574
+ async function sa() {
3474
3575
  return document.body ? document.body : await new Promise((e) => {
3475
3576
  const t = new MutationObserver(() => {
3476
3577
  document.body && (t.disconnect(), e(document.body));
@@ -3478,49 +3579,49 @@ async function aa() {
3478
3579
  t.observe(document.documentElement, { childList: !0 });
3479
3580
  });
3480
3581
  }
3481
- function Kt(e) {
3582
+ function Qt(e) {
3482
3583
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
3483
3584
  }
3484
- function ia(e) {
3585
+ function da(e) {
3485
3586
  try {
3486
- const t = window.localStorage.getItem(Kt(e));
3587
+ const t = window.localStorage.getItem(Qt(e));
3487
3588
  if (!t)
3488
- return Et();
3589
+ return Pt();
3489
3590
  const n = JSON.parse(t);
3490
3591
  return {
3491
3592
  isOpen: n.isOpen === !0,
3492
3593
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
3493
3594
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
3494
- launcherPosition: sa(n.launcherPosition) ? n.launcherPosition : null,
3495
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Tt) : [],
3595
+ launcherPosition: ha(n.launcherPosition) ? n.launcherPosition : null,
3596
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
3496
3597
  sharePromptsDisabled: n.sharePromptsDisabled === !0
3497
3598
  };
3498
3599
  } catch {
3499
- return Et();
3600
+ return Pt();
3500
3601
  }
3501
3602
  }
3502
- async function ra(e) {
3603
+ async function ca(e) {
3503
3604
  if (e.loadSharePromptsDisabled)
3504
3605
  return e.loadSharePromptsDisabled();
3505
3606
  try {
3506
- return window.localStorage.getItem(Nt) === "true";
3607
+ return window.localStorage.getItem(Rt) === "true";
3507
3608
  } catch {
3508
3609
  return !1;
3509
3610
  }
3510
3611
  }
3511
- function la(e, t) {
3612
+ function ua(e, t) {
3512
3613
  if (e.persistSharePromptsDisabled) {
3513
3614
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
3514
3615
  });
3515
3616
  return;
3516
3617
  }
3517
3618
  try {
3518
- t && window.localStorage.setItem(Nt, "true");
3619
+ t && window.localStorage.setItem(Rt, "true");
3519
3620
  } catch {
3520
3621
  return;
3521
3622
  }
3522
3623
  }
3523
- function Et() {
3624
+ function Pt() {
3524
3625
  return {
3525
3626
  isOpen: !1,
3526
3627
  composerValue: "",
@@ -3530,41 +3631,41 @@ function Et() {
3530
3631
  sharePromptsDisabled: !1
3531
3632
  };
3532
3633
  }
3533
- function pa(e, t) {
3634
+ function ga(e, t) {
3534
3635
  try {
3535
- window.localStorage.setItem(Kt(e), JSON.stringify(t));
3636
+ window.localStorage.setItem(Qt(e), JSON.stringify(t));
3536
3637
  } catch {
3537
3638
  return;
3538
3639
  }
3539
3640
  }
3540
- function sa(e) {
3641
+ function ha(e) {
3541
3642
  if (!e || typeof e != "object")
3542
3643
  return !1;
3543
3644
  const t = e;
3544
3645
  return Number.isFinite(t.x) && Number.isFinite(t.y);
3545
3646
  }
3546
- const St = /* @__PURE__ */ new WeakSet();
3547
- function da(e) {
3647
+ const At = /* @__PURE__ */ new WeakSet();
3648
+ function ma(e) {
3548
3649
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
3549
3650
  }
3550
- function kt(e) {
3651
+ function Tt(e) {
3551
3652
  const t = e.pathname.split("/");
3552
3653
  return t[t.length - 1] ?? "";
3553
3654
  }
3554
- function ca(e, t) {
3655
+ function fa(e, t) {
3555
3656
  const n = new URL(e.src, document.baseURI);
3556
- return n.href === t.href || n.pathname === t.pathname ? !0 : kt(n) === kt(t);
3657
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Tt(n) === Tt(t);
3557
3658
  }
3558
3659
  class V extends EventTarget {
3559
3660
  constructor(t, n) {
3560
- super(), this.channelId = n, this.url = t, this.addPreviewListener(Rn, () => {
3661
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(Fn, () => {
3561
3662
  this.readyState = V.OPEN, this.dispatchEvent(new Event("open"));
3562
- }), this.addPreviewListener(On, (o) => {
3663
+ }), this.addPreviewListener(Un, (o) => {
3563
3664
  const a = o;
3564
3665
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
3565
- }), this.addPreviewListener(Bn, () => {
3666
+ }), this.addPreviewListener(zn, () => {
3566
3667
  this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3567
- }), this.addPreviewListener(Fn, (o) => {
3668
+ }), this.addPreviewListener(Gn, (o) => {
3568
3669
  const a = o;
3569
3670
  this.readyState = V.CLOSED, this.dispatchEvent(
3570
3671
  new CloseEvent("close", {
@@ -3574,7 +3675,7 @@ class V extends EventTarget {
3574
3675
  })
3575
3676
  ), this.cleanup();
3576
3677
  }), window.dispatchEvent(
3577
- new CustomEvent(ve(Dn, this.channelId), {
3678
+ new CustomEvent(ye(Rn, this.channelId), {
3578
3679
  detail: { socketId: this.socketId, url: t }
3579
3680
  })
3580
3681
  );
@@ -3590,26 +3691,26 @@ class V extends EventTarget {
3590
3691
  binaryType = "blob";
3591
3692
  bufferedAmount = 0;
3592
3693
  readyState = V.CONNECTING;
3593
- socketId = ua();
3694
+ socketId = ba();
3594
3695
  listeners = /* @__PURE__ */ new Map();
3595
3696
  send(t) {
3596
3697
  if (this.readyState !== V.OPEN)
3597
3698
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
3598
3699
  window.dispatchEvent(
3599
- new CustomEvent(ve(In, this.channelId), {
3700
+ new CustomEvent(ye(Bn, this.channelId), {
3600
3701
  detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
3601
3702
  })
3602
3703
  );
3603
3704
  }
3604
3705
  close(t, n) {
3605
3706
  this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
3606
- new CustomEvent(ve(Mn, this.channelId), {
3707
+ new CustomEvent(ye(On, this.channelId), {
3607
3708
  detail: { socketId: this.socketId, code: t, reason: n }
3608
3709
  })
3609
3710
  ), this.cleanup());
3610
3711
  }
3611
3712
  addPreviewListener(t, n) {
3612
- const o = ve(t, this.channelId), a = (i) => {
3713
+ const o = ye(t, this.channelId), a = (i) => {
3613
3714
  i.detail?.socketId === this.socketId && n(i);
3614
3715
  };
3615
3716
  this.listeners.set(o, a), window.addEventListener(o, a);
@@ -3620,36 +3721,36 @@ class V extends EventTarget {
3620
3721
  this.listeners.clear();
3621
3722
  }
3622
3723
  }
3623
- function ua() {
3624
- const e = window.sessionStorage.getItem(lt);
3724
+ function ba() {
3725
+ const e = window.sessionStorage.getItem(ct);
3625
3726
  if (e)
3626
3727
  return e;
3627
3728
  const t = crypto.randomUUID();
3628
- return window.sessionStorage.setItem(lt, t), t;
3729
+ return window.sessionStorage.setItem(ct, t), t;
3629
3730
  }
3630
- function ve(e, t) {
3731
+ function ye(e, t) {
3631
3732
  return `${e}:${t}`;
3632
3733
  }
3633
- function ga(e) {
3734
+ function wa(e) {
3634
3735
  const t = document.currentScript;
3635
3736
  if (t instanceof HTMLScriptElement)
3636
3737
  return [t];
3637
3738
  const n = new URL(e, document.baseURI).href, o = new URL(n);
3638
3739
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
3639
- (a) => a instanceof HTMLScriptElement && da(a) && ca(a, o)
3740
+ (a) => a instanceof HTMLScriptElement && ma(a) && fa(a, o)
3640
3741
  );
3641
3742
  }
3642
- function ha(e) {
3643
- for (const t of ga(e)) {
3644
- if (St.has(t) || t.dataset.plunoAutoMount === "false")
3743
+ function _a(e) {
3744
+ for (const t of wa(e)) {
3745
+ if (At.has(t) || t.dataset.plunoAutoMount === "false")
3645
3746
  continue;
3646
- St.add(t);
3747
+ At.add(t);
3647
3748
  const n = t.dataset.plunoPreviewChannel;
3648
- oo({
3749
+ ro({
3649
3750
  token: t.dataset.plunoToken,
3650
3751
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
3651
3752
  backendUrl: t.dataset.plunoBackendUrl,
3652
- webSocketFactory: n ? no(n) : void 0,
3753
+ webSocketFactory: n ? io(n) : void 0,
3653
3754
  launcherLabel: t.dataset.plunoLauncherLabel,
3654
3755
  accentColor: t.dataset.plunoAccentColor,
3655
3756
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -3661,8 +3762,8 @@ function ha(e) {
3661
3762
  });
3662
3763
  }
3663
3764
  }
3664
- ha(import.meta.url);
3765
+ _a(import.meta.url);
3665
3766
  export {
3666
- no as createProductAgentPreviewBridgeWebSocketFactory,
3667
- oo as mountPlunoProductAgentWidget
3767
+ io as createProductAgentPreviewBridgeWebSocketFactory,
3768
+ ro as mountPlunoProductAgentWidget
3668
3769
  };