@pluno/product-agent-web 0.1.39 → 0.1.41

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