@pluno/product-agent-web 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { PlunoProductAgent as dt } from "./product-agent-sdk.js";
2
- const ct = "#7c3aed";
3
- function ut(t) {
4
- const e = wt(t);
1
+ import { PlunoProductAgent as Ct } from "./product-agent-sdk.js";
2
+ const Et = "#7c3aed";
3
+ function kt(t) {
4
+ const e = Nt(t);
5
5
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
6
6
  <defs>
7
7
  <linearGradient id="boltFill" x1="420" y1="180" x2="790" y2="1040" gradientUnits="userSpaceOnUse">
@@ -75,23 +75,23 @@ function ut(t) {
75
75
  </g>
76
76
  </svg>`;
77
77
  }
78
- function gt(t) {
79
- return `data:image/svg+xml,${encodeURIComponent(ut(t))}`;
78
+ function St(t) {
79
+ return `data:image/svg+xml,${encodeURIComponent(kt(t))}`;
80
80
  }
81
- const G = "#2c2a1e", ye = [253, 250, 241], ve = 3.5;
82
- function Ve(t) {
83
- const e = qe(t);
84
- if (Ce(q(e), ye) >= ve)
81
+ const H = "#2c2a1e", De = [253, 250, 241], Te = 3.5;
82
+ function et(t) {
83
+ const e = tt(t);
84
+ if (Ie(J(e), De) >= Te)
85
85
  return e;
86
- let o = q(e);
87
- const a = q(G);
88
- for (let i = 0; i < 6; i += 1)
89
- if (o = bt(o, a, 0.22), Ce(o, ye) >= ve)
90
- return de(o);
91
- return de(o);
92
- }
93
- function ht(t) {
94
- const e = Ve(t), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
86
+ let o = J(e);
87
+ const a = J(H);
88
+ for (let r = 0; r < 6; r += 1)
89
+ if (o = Dt(o, a, 0.22), Ie(o, De) >= Te)
90
+ return be(o);
91
+ return be(o);
92
+ }
93
+ function Lt(t) {
94
+ const e = et(t), n = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z";
95
95
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1254 1254" role="img" aria-label="Pluno">
96
96
  <defs>
97
97
  <clipPath id="scribbleBoltClip">
@@ -104,35 +104,35 @@ function ht(t) {
104
104
  </defs>
105
105
  <g filter="url(#scribbleBoltWobble)">
106
106
  <g clip-path="url(#scribbleBoltClip)">
107
- <path d="${ft()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
107
+ <path d="${At()}" fill="none" stroke="${e}" stroke-width="56" stroke-linecap="round" stroke-linejoin="round" opacity="0.9" transform="rotate(-14 627 600)"/>
108
108
  </g>
109
- <path d="${n}" fill="none" stroke="${G}" stroke-width="18" stroke-linejoin="round"/>
109
+ <path d="${n}" fill="none" stroke="${H}" stroke-width="18" stroke-linejoin="round"/>
110
110
  <g transform="rotate(-2 528 463)">
111
- <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${G}" stroke-width="13"/>
112
- <ellipse cx="533" cy="473" rx="45" ry="53" fill="${G}"/>
111
+ <ellipse cx="528" cy="463" rx="73" ry="80" fill="#ffffff" stroke="${H}" stroke-width="13"/>
112
+ <ellipse cx="533" cy="473" rx="45" ry="53" fill="${H}"/>
113
113
  <circle cx="557" cy="447" r="16" fill="#ffffff"/>
114
114
  </g>
115
115
  <g transform="rotate(2 717 462)">
116
- <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${G}" stroke-width="13"/>
117
- <ellipse cx="712" cy="473" rx="45" ry="53" fill="${G}"/>
116
+ <ellipse cx="717" cy="462" rx="73" ry="80" fill="#ffffff" stroke="${H}" stroke-width="13"/>
117
+ <ellipse cx="712" cy="473" rx="45" ry="53" fill="${H}"/>
118
118
  <circle cx="728" cy="447" r="16" fill="#ffffff"/>
119
119
  </g>
120
120
  </g>
121
121
  </svg>`;
122
122
  }
123
- function mt(t) {
124
- return `data:image/svg+xml,${encodeURIComponent(ht(t))}`;
123
+ function Pt(t) {
124
+ return `data:image/svg+xml,${encodeURIComponent(Lt(t))}`;
125
125
  }
126
- function ft() {
126
+ function At() {
127
127
  let n = "M 280 120", o = !1, a = 0;
128
- for (let i = 150; i <= 1170; i += 62) {
129
- const l = (a % 3 - 1) * 18, s = o ? 280 - l : 1020 + l;
130
- n += ` L ${s} ${i}`, o = !o, a += 1;
128
+ for (let r = 150; r <= 1170; r += 62) {
129
+ const l = (a % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
130
+ n += ` L ${p} ${r}`, o = !o, a += 1;
131
131
  }
132
132
  return n;
133
133
  }
134
- function wt(t) {
135
- const e = qe(t), n = ce(q(e));
134
+ function Nt(t) {
135
+ const e = tt(t), n = _e(J(e));
136
136
  return n > 0.86 ? {
137
137
  top: "#ffffff",
138
138
  middle: "#f6f6f6",
@@ -156,81 +156,116 @@ function wt(t) {
156
156
  inner: "#4b4b4b",
157
157
  shadow: "#000000"
158
158
  } : {
159
- top: L(e, 0.28, -0.03),
160
- middle: L(e, 0.08, 0.04),
161
- bottom: L(e, -0.1, 0.02),
162
- edgeStart: L(e, 0.08, 0.08),
163
- edgeMiddle: L(e, -0.08, 0.08),
164
- edgeEnd: L(e, -0.18, 0.05),
165
- glow: L(e, 0.32, -0.12),
166
- highlight: L(e, 0.38, -0.18),
167
- inner: L(e, 0.24, -0.1),
168
- shadow: L(e, -0.25, -0.08)
159
+ top: D(e, 0.28, -0.03),
160
+ middle: D(e, 0.08, 0.04),
161
+ bottom: D(e, -0.1, 0.02),
162
+ edgeStart: D(e, 0.08, 0.08),
163
+ edgeMiddle: D(e, -0.08, 0.08),
164
+ edgeEnd: D(e, -0.18, 0.05),
165
+ glow: D(e, 0.32, -0.12),
166
+ highlight: D(e, 0.38, -0.18),
167
+ inner: D(e, 0.24, -0.1),
168
+ shadow: D(e, -0.25, -0.08)
169
169
  };
170
170
  }
171
- function qe(t) {
171
+ function tt(t) {
172
172
  const e = t.trim();
173
- return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : ct;
173
+ return /^#[0-9a-f]{6}$/i.test(e) ? e.toLowerCase() : /^#[0-9a-f]{3}$/i.test(e) ? `#${e.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : Et;
174
174
  }
175
- function q(t) {
175
+ function J(t) {
176
176
  return [
177
177
  Number.parseInt(t.slice(1, 3), 16),
178
178
  Number.parseInt(t.slice(3, 5), 16),
179
179
  Number.parseInt(t.slice(5, 7), 16)
180
180
  ];
181
181
  }
182
- function de([t, e, n]) {
182
+ function be([t, e, n]) {
183
183
  const o = (a) => Math.max(0, Math.min(255, Math.round(a))).toString(16).padStart(2, "0");
184
184
  return `#${o(t)}${o(e)}${o(n)}`;
185
185
  }
186
- function ce([t, e, n]) {
186
+ function _e([t, e, n]) {
187
187
  const o = (a) => {
188
- const i = a / 255;
189
- return i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
188
+ const r = a / 255;
189
+ return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
190
190
  };
191
191
  return 0.2126 * o(t) + 0.7152 * o(e) + 0.0722 * o(n);
192
192
  }
193
- function Ce(t, e) {
194
- const n = ce(t), o = ce(e), [a, i] = n > o ? [n, o] : [o, n];
195
- return (a + 0.05) / (i + 0.05);
193
+ function Ie(t, e) {
194
+ const n = _e(t), o = _e(e), [a, r] = n > o ? [n, o] : [o, n];
195
+ return (a + 0.05) / (r + 0.05);
196
196
  }
197
- function bt(t, e, n) {
198
- const o = ue(n);
197
+ function Dt(t, e, n) {
198
+ const o = xe(n);
199
199
  return [
200
200
  t[0] + (e[0] - t[0]) * o,
201
201
  t[1] + (e[1] - t[1]) * o,
202
202
  t[2] + (e[2] - t[2]) * o
203
203
  ];
204
204
  }
205
- function L(t, e, n) {
206
- const [o, a, i] = _t(q(t));
207
- return de(xt(o, ue(a + n), ue(i + e)));
205
+ function D(t, e, n) {
206
+ const [o, a, r] = Tt(J(t));
207
+ return be(It(o, xe(a + n), xe(r + e)));
208
208
  }
209
- function _t([t, e, n]) {
210
- const o = t / 255, a = e / 255, i = n / 255, l = Math.max(o, a, i), s = Math.min(o, a, i), u = (l + s) / 2;
211
- if (l === s)
212
- return [0, 0, u];
213
- const h = l - s, c = u > 0.5 ? h / (2 - l - s) : h / (l + s);
214
- return [(l === o ? (a - i) / h + (a < i ? 6 : 0) : l === a ? (i - o) / h + 2 : (o - a) / h + 4) / 6, c, u];
209
+ function Tt([t, e, n]) {
210
+ const o = t / 255, a = e / 255, r = n / 255, l = Math.max(o, a, r), p = Math.min(o, a, r), s = (l + p) / 2;
211
+ if (l === p)
212
+ return [0, 0, s];
213
+ const g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
214
+ return [(l === o ? (a - r) / g + (a < r ? 6 : 0) : l === a ? (r - o) / g + 2 : (o - a) / g + 4) / 6, c, s];
215
215
  }
216
- function xt(t, e, n) {
216
+ function It(t, e, n) {
217
217
  if (e === 0)
218
218
  return [n * 255, n * 255, n * 255];
219
219
  const o = n < 0.5 ? n * (1 + e) : n + e - n * e, a = 2 * n - o;
220
220
  return [
221
- re(a, o, t + 1 / 3) * 255,
222
- re(a, o, t) * 255,
223
- re(a, o, t - 1 / 3) * 255
221
+ he(a, o, t + 1 / 3) * 255,
222
+ he(a, o, t) * 255,
223
+ he(a, o, t - 1 / 3) * 255
224
224
  ];
225
225
  }
226
- function re(t, e, n) {
226
+ function he(t, e, n) {
227
227
  let o = n;
228
228
  return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? t + (e - t) * 6 * o : o < 1 / 2 ? e : o < 2 / 3 ? t + (e - t) * (2 / 3 - o) * 6 : t;
229
229
  }
230
- function ue(t) {
230
+ function xe(t) {
231
231
  return Math.max(0, Math.min(1, t));
232
232
  }
233
- const yt = "product-agent:sdk-preview-socket-connect", vt = "product-agent:sdk-preview-socket-send", Ct = "product-agent:sdk-preview-socket-close", Et = "product-agent:sdk-preview-socket-open", kt = "product-agent:sdk-preview-socket-message", St = "product-agent:sdk-preview-socket-error", Lt = "product-agent:sdk-preview-socket-closed", Ee = "product-agent:sdk-preview-socket-id", Pt = "product-agent:preview-diagnostic", ee = 10, At = 10 * 1024 * 1024, Tt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), D = {
233
+ const nt = "suggest_share_on_socials";
234
+ function Mt(t) {
235
+ for (let e = t.length - 1; e >= 0; e -= 1) {
236
+ const n = t[e];
237
+ if (n.role !== "tool" || n.toolName !== nt)
238
+ continue;
239
+ const o = Me(t, e, "assistant");
240
+ if (!o)
241
+ return null;
242
+ const a = Me(t, o.index, "user");
243
+ return a ? {
244
+ id: `share:${n.callId ?? n.id}`,
245
+ userPrompt: a.content,
246
+ assistantAnswer: o.content
247
+ } : null;
248
+ }
249
+ return null;
250
+ }
251
+ async function Rt(t) {
252
+ const e = await Ot(t);
253
+ if (!navigator.clipboard || typeof ClipboardItem > "u")
254
+ throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
255
+ await navigator.clipboard.write([new ClipboardItem({ [e.type || "image/png"]: e })]);
256
+ }
257
+ function Me(t, e, n) {
258
+ for (let o = e - 1; o >= 0; o -= 1) {
259
+ const a = t[o];
260
+ if (a.role === n && a.content.trim())
261
+ return { index: o, content: a.content.trim() };
262
+ }
263
+ return null;
264
+ }
265
+ async function Ot(t) {
266
+ return await (await fetch(t)).blob();
267
+ }
268
+ const ot = 100, Ft = "product-agent:sdk-preview-socket-connect", Bt = "product-agent:sdk-preview-socket-send", zt = "product-agent:sdk-preview-socket-close", Gt = "product-agent:sdk-preview-socket-open", $t = "product-agent:sdk-preview-socket-message", Ut = "product-agent:sdk-preview-socket-error", Wt = "product-agent:sdk-preview-socket-closed", Re = "product-agent:sdk-preview-socket-id", Ht = "product-agent:preview-diagnostic", at = "pluno.productAgent.sharePromptsDisabled", ie = 10, Vt = 10 * 1024 * 1024, jt = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), M = {
234
269
  launcherLabel: "Ask for anything...",
235
270
  accentColor: "#7c3aed",
236
271
  colorScheme: "light",
@@ -238,19 +273,19 @@ const yt = "product-agent:sdk-preview-socket-connect", vt = "product-agent:sdk-p
238
273
  scribbleStyle: !1,
239
274
  position: "bottom-right",
240
275
  movableLauncher: !1
241
- }, ke = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Nt = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Se = "pluno-pa-scribble-font", Ke = 190, je = 41, It = 48, Rt = 420, Dt = 680, S = 8, Le = 50, Mt = "http://www.w3.org/2000/svg", Ot = 11, Ft = 13, Gt = 4, Bt = 10, $t = 40, zt = "movable-launcher-position-v2";
242
- function Wt(t) {
243
- return (e) => new I(e, t);
276
+ }, Oe = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', qt = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Fe = "pluno-pa-scribble-font", rt = 190, it = 41, Kt = 48, Yt = 420, Xt = 680, N = 8, Be = 50, Zt = "http://www.w3.org/2000/svg", Jt = 11, Qt = 13, en = 4, tn = 10, nn = 40, on = "movable-launcher-position-v2";
277
+ function an(t) {
278
+ return (e) => new R(e, t);
244
279
  }
245
- async function Ut(t = {}) {
280
+ async function rn(t = {}) {
246
281
  const e = {
247
- launcherLabel: t.launcherLabel ?? D.launcherLabel,
248
- accentColor: t.accentColor ?? D.accentColor,
249
- colorScheme: t.colorScheme ?? D.colorScheme,
250
- fontFamily: t.fontFamily ?? D.fontFamily,
251
- scribbleStyle: t.scribbleStyle ?? D.scribbleStyle,
252
- position: t.position ?? D.position,
253
- movableLauncher: t.movableLauncher ?? D.movableLauncher,
282
+ launcherLabel: t.launcherLabel ?? M.launcherLabel,
283
+ accentColor: t.accentColor ?? M.accentColor,
284
+ colorScheme: t.colorScheme ?? M.colorScheme,
285
+ fontFamily: t.fontFamily ?? M.fontFamily,
286
+ scribbleStyle: t.scribbleStyle ?? M.scribbleStyle,
287
+ position: t.position ?? M.position,
288
+ movableLauncher: t.movableLauncher ?? M.movableLauncher,
254
289
  token: t.token,
255
290
  tokenProvider: t.tokenProvider,
256
291
  tokenEndpoint: t.tokenEndpoint,
@@ -260,9 +295,13 @@ async function Ut(t = {}) {
260
295
  webSocketFactory: t.webSocketFactory,
261
296
  loginRequired: t.loginRequired === !0,
262
297
  loginButtonLabel: t.loginButtonLabel ?? "Log in to Pluno",
263
- onLoginClick: t.onLoginClick
298
+ onLoginClick: t.onLoginClick,
299
+ socialPostDraftHandler: t.socialPostDraftHandler,
300
+ socialPostRewardsUrl: t.socialPostRewardsUrl,
301
+ loadSharePromptsDisabled: t.loadSharePromptsDisabled,
302
+ persistSharePromptsDisabled: t.persistSharePromptsDisabled
264
303
  };
265
- O("web-sdk.widget", "Mounting widget with merged options", {
304
+ z("web-sdk.widget", "Mounting widget with merged options", {
266
305
  accentColor: e.accentColor,
267
306
  colorScheme: e.colorScheme,
268
307
  fontFamily: e.fontFamily,
@@ -277,51 +316,51 @@ async function Ut(t = {}) {
277
316
  n.className = "pluno-pa-widget-host";
278
317
  const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
279
318
  a.className = `pluno-pa-widget pluno-pa-widget--${e.position}`;
280
- let i = Pe(e.accentColor, e.scribbleStyle);
281
- Zt(a, e.launcherLabel, i, e.movableLauncher), o.appendChild(a);
282
- const l = await kn(), s = l.ownerDocument;
283
- l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), We(o, e.accentColor), Ae(a, i, {
319
+ let r = ze(e.accentColor, e.scribbleStyle);
320
+ hn(a, e.launcherLabel, r, e.movableLauncher), o.appendChild(a);
321
+ const l = await Xn(), p = l.ownerDocument;
322
+ l.appendChild(n), a.classList.add(`pluno-pa-widget--${e.colorScheme}`), Xe(o, e.accentColor), Ge(a, r, {
284
323
  accentColor: e.accentColor,
285
324
  colorScheme: e.colorScheme,
286
325
  fontFamily: e.fontFamily,
287
326
  scribbleStyle: e.scribbleStyle
288
- }), O("web-sdk.widget", "Applied initial widget appearance", {
327
+ }), z("web-sdk.widget", "Applied initial widget appearance", {
289
328
  accentColor: e.accentColor,
290
329
  colorScheme: e.colorScheme,
291
330
  fontFamily: e.fontFamily,
292
331
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
293
332
  });
294
- const u = a.querySelector(".pluno-pa-widget__launcher"), h = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), c = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), y = a.querySelector(".pluno-pa-widget__close"), k = a.querySelector(".pluno-pa-widget__composer"), v = a.querySelector(".pluno-pa-widget__attachment-error"), d = a.querySelector(".pluno-pa-widget__attachments"), p = a.querySelector(".pluno-pa-widget__input"), m = a.querySelector(".pluno-pa-widget__send"), b = a.querySelector(".pluno-pa-widget__new-chat"), w = a.querySelector(".pluno-pa-widget__timeline");
295
- if (!u || !c || !f || !y || !k || !v || !d || !p || !m || !b || !w)
333
+ const s = a.querySelector(".pluno-pa-widget__launcher"), g = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), c = a.querySelector(".pluno-pa-widget__launcher-input"), b = a.querySelector(".pluno-pa-widget__panel"), _ = a.querySelector(".pluno-pa-widget__close"), x = a.querySelector(".pluno-pa-widget__composer"), y = a.querySelector(".pluno-pa-widget__attachment-error"), h = a.querySelector(".pluno-pa-widget__attachments"), d = a.querySelector(".pluno-pa-widget__input"), w = a.querySelector(".pluno-pa-widget__send"), m = a.querySelector(".pluno-pa-widget__new-chat"), f = a.querySelector(".pluno-pa-widget__timeline");
334
+ if (!s || !c || !b || !_ || !x || !y || !h || !d || !w || !m || !f)
296
335
  throw new Error("Failed to mount Pluno widget");
297
- if (e.movableLauncher && !h)
336
+ if (e.movableLauncher && !g)
298
337
  throw new Error("Failed to mount Pluno widget drag handle");
299
- De(c), De(p);
300
- let x = [], P = null;
301
- const F = () => {
302
- sn(d, x, (r) => {
303
- x = x.filter((g, E) => E !== r), F(), N();
338
+ Ve(c), Ve(d);
339
+ let v = [], k = null;
340
+ const E = () => {
341
+ kn(h, v, (i) => {
342
+ v = v.filter((u, L) => L !== i), E(), I();
304
343
  });
305
- }, ot = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
344
+ }, q = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (async () => {
306
345
  if (!e.tokenEndpoint)
307
346
  throw new Error("Pluno widget requires token or tokenEndpoint");
308
- const r = await fetch(e.tokenEndpoint, {
347
+ const i = await fetch(e.tokenEndpoint, {
309
348
  method: "POST",
310
349
  credentials: "include",
311
350
  headers: { "content-type": "application/json" },
312
351
  body: JSON.stringify({ origin: location.origin, url: location.href })
313
352
  });
314
- if (!r.ok)
353
+ if (!i.ok)
315
354
  throw new Error("Failed to load Pluno token");
316
- const g = await r.json();
317
- if (!g.token)
355
+ const u = await i.json();
356
+ if (!u.token)
318
357
  throw new Error("Pluno token endpoint did not return a token");
319
- return g.token;
358
+ return u.token;
320
359
  });
321
360
  let C;
322
- C = await dt.init({
361
+ C = await Ct.init({
323
362
  token: e.token,
324
- tokenProvider: ot,
363
+ tokenProvider: q,
325
364
  backendUrl: e.backendUrl,
326
365
  metadata: () => ({
327
366
  ...e.metadata ?? {},
@@ -331,30 +370,32 @@ async function Ut(t = {}) {
331
370
  webSocketFactory: e.webSocketFactory,
332
371
  autoConnect: e.loginRequired ? !1 : void 0
333
372
  });
334
- const z = Sn(e), K = new Set(z.openToolGroupKeys);
335
- let A = e.movableLauncher ? z.launcherPosition : null, he = A !== null, R = null, me = !1;
336
- const at = () => {
337
- me || typeof document > "u" || (We(o, e.accentColor), n.isConnected || s.body?.appendChild(n));
338
- }, fe = new MutationObserver(at);
339
- fe.observe(s.documentElement, { childList: !0, subtree: !0 });
340
- const ne = (r = !0) => {
341
- const g = Te(a, r);
342
- return Ne(
373
+ const F = Zn(e), pe = new Set(F.openToolGroupKeys), G = new Set(F.seenShareCandidateIds), Q = new Set(G);
374
+ let se = F.sharePromptsDisabled || await Jn(e), T = e.movableLauncher ? F.launcherPosition : null, Ce = T !== null, O = null, Ee = !1;
375
+ const mt = () => {
376
+ Ee || typeof document > "u" || (Xe(o, e.accentColor), n.isConnected || p.body?.appendChild(n));
377
+ }, ke = new MutationObserver(mt);
378
+ ke.observe(p.documentElement, { childList: !0, subtree: !0 });
379
+ const de = (i = !0) => {
380
+ const u = $e(a, i);
381
+ return Ue(
343
382
  a,
344
- A ?? Kt(a, e.position, g),
345
- g
383
+ T ?? dn(a, e.position, u),
384
+ u
346
385
  );
347
- }, T = () => {
348
- Ln(e, {
386
+ }, A = () => {
387
+ eo(e, {
349
388
  isOpen: a.classList.contains("pluno-pa-widget--open"),
350
- composerValue: p.value,
351
- openToolGroupKeys: [...K],
352
- launcherPosition: he ? A : null
389
+ composerValue: d.value,
390
+ openToolGroupKeys: [...pe],
391
+ launcherPosition: Ce ? T : null,
392
+ seenShareCandidateIds: [...G].slice(-ot),
393
+ sharePromptsDisabled: se
353
394
  });
354
- }, M = (r, g = {}) => {
355
- Xt(r, {
356
- debugVersion: zt,
357
- launcherPosition: A,
395
+ }, B = (i, u = {}) => {
396
+ gn(i, {
397
+ debugVersion: on,
398
+ launcherPosition: T,
358
399
  rootClasses: a.className,
359
400
  rootStyle: {
360
401
  left: a.style.left,
@@ -362,125 +403,125 @@ async function Ut(t = {}) {
362
403
  right: a.style.right,
363
404
  bottom: a.style.bottom
364
405
  },
365
- rootRect: le(a),
366
- launcherRect: le(u),
367
- panelRect: le(f),
368
- viewport: B(),
369
- panelHidden: f.hidden,
370
- closeHidden: y.hidden,
371
- ...g
406
+ rootRect: me(a),
407
+ launcherRect: me(s),
408
+ panelRect: me(b),
409
+ viewport: V(),
410
+ panelHidden: b.hidden,
411
+ closeHidden: _.hidden,
412
+ ...u
372
413
  });
373
- }, j = (r = !0) => {
374
- if (!A)
375
- return X(a, null), ne(r);
376
- const g = ne(r);
377
- return X(a, g), M("Applied stored closed launcher position", { visibleLauncherPosition: g }), g;
378
- }, we = (r, g) => {
379
- if (!r || !g) {
380
- Re(a);
414
+ }, ee = (i = !0) => {
415
+ if (!T)
416
+ return ne(a, null), de(i);
417
+ const u = de(i);
418
+ return ne(a, u), B("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
419
+ }, Se = (i, u) => {
420
+ if (!i || !u) {
421
+ He(a);
381
422
  return;
382
423
  }
383
- Yt(a, {
384
- x: r.x - g.x,
385
- y: r.y - g.y
424
+ un(a, {
425
+ x: i.x - u.x,
426
+ y: i.y - u.y
386
427
  });
387
- }, be = () => {
388
- const r = j();
428
+ }, Le = () => {
429
+ const i = ee();
389
430
  if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
390
- const g = Ie(r);
391
- we(g, r), M("Applied open panel position after viewport resize", { openPanelPosition: g });
392
- } else A && M("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
431
+ const u = We(i);
432
+ Se(u, i), B("Applied open panel position after viewport resize", { openPanelPosition: u });
433
+ } else T && B("Applied visible launcher position after viewport resize", { visibleLauncherPosition: i });
393
434
  };
394
- let _e = () => {
435
+ let Pe = () => {
395
436
  };
396
- e.movableLauncher && h ? (j(), window.addEventListener("resize", be), _e = Vt({
437
+ e.movableLauncher && g ? (ee(), window.addEventListener("resize", Le), Pe = pn({
397
438
  root: a,
398
- launcherDragHandle: h,
399
- getPosition: () => ne(),
400
- setPosition: (r) => {
401
- const g = r;
402
- A = Ne(a, r, Te(a)), X(a, A), M("Dragging closed launcher", { requestedPosition: g });
439
+ launcherDragHandle: g,
440
+ getPosition: () => de(),
441
+ setPosition: (i) => {
442
+ const u = i;
443
+ T = Ue(a, i, $e(a)), ne(a, T), B("Dragging closed launcher", { requestedPosition: u });
403
444
  },
404
445
  persist: () => {
405
- he = !0, T(), M("Persisted closed launcher drag position");
446
+ Ce = !0, A(), B("Persisted closed launcher drag position");
406
447
  }
407
- })) : X(a, null);
408
- const W = (r = "", g = !0) => {
409
- if (R !== null && (window.clearTimeout(R), R = null), f.hidden = !1, y.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
410
- const E = j(), H = Ie(E);
411
- we(H, E), M("Opening launcher at clamped open panel position", { openPanelPosition: H, visibleLauncherPosition: E });
448
+ })) : ne(a, null);
449
+ const $ = (i = "", u = !0) => {
450
+ if (O !== null && (window.clearTimeout(O), O = null), b.hidden = !1, _.hidden = !1, a.classList.remove("pluno-pa-widget--closing"), e.movableLauncher) {
451
+ const L = ee(), X = We(L);
452
+ Se(X, L), B("Opening launcher at clamped open panel position", { openPanelPosition: X, visibleLauncherPosition: L });
412
453
  } else
413
- Re(a);
414
- if (!g) {
415
- a.classList.add("pluno-pa-widget--open"), u.hidden = !0, r && (p.value = r, V(p)), w.scrollTop = w.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T();
454
+ He(a);
455
+ if (!u) {
456
+ a.classList.add("pluno-pa-widget--open"), s.hidden = !0, i && (d.value = i, Z(d)), f.scrollTop = f.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), A();
416
457
  return;
417
458
  }
418
459
  window.requestAnimationFrame(() => {
419
- a.classList.add("pluno-pa-widget--open"), r && (p.value = r, V(p)), w.scrollTop = w.scrollHeight, p.focus(), p.setSelectionRange(p.value.length, p.value.length), T(), R = window.setTimeout(() => {
420
- u.hidden = !0, w.scrollTop = w.scrollHeight;
460
+ a.classList.add("pluno-pa-widget--open"), i && (d.value = i, Z(d)), f.scrollTop = f.scrollHeight, d.focus(), d.setSelectionRange(d.value.length, d.value.length), A(), O = window.setTimeout(() => {
461
+ s.hidden = !0, f.scrollTop = f.scrollHeight;
421
462
  }, 220);
422
463
  });
423
- }, it = () => {
424
- R !== null && (window.clearTimeout(R), R = null), u.hidden = !1, A && (j(!1), M("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), T(), R = window.setTimeout(() => {
425
- f.hidden = !0, y.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
464
+ }, ft = () => {
465
+ O !== null && (window.clearTimeout(O), O = null), s.hidden = !1, T && (ee(!1), B("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), A(), O = window.setTimeout(() => {
466
+ b.hidden = !0, _.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
426
467
  }, 220);
427
468
  };
428
- u.addEventListener("submit", (r) => {
429
- r.preventDefault(), W(c.value), c.value = "";
430
- }), h?.addEventListener("click", (r) => {
431
- r.preventDefault(), r.stopPropagation();
432
- }), u.addEventListener("click", (r) => {
433
- r.target !== c && (W(c.value), c.value = "");
469
+ s.addEventListener("submit", (i) => {
470
+ i.preventDefault(), $(c.value), c.value = "";
471
+ }), g?.addEventListener("click", (i) => {
472
+ i.preventDefault(), i.stopPropagation();
473
+ }), s.addEventListener("click", (i) => {
474
+ i.target !== c && ($(c.value), c.value = "");
434
475
  }), c.addEventListener("focus", () => {
435
- W(c.value), c.value = "";
476
+ $(c.value), c.value = "";
436
477
  }), c.addEventListener("input", () => {
437
478
  if (!c.value)
438
479
  return;
439
- const r = c.value;
440
- W(r), c.value = "";
441
- }), y.addEventListener("click", it);
442
- const N = () => {
443
- m.disabled = !C.getState().isThinking && p.value.trim().length === 0 && x.length === 0;
480
+ const i = c.value;
481
+ $(i), c.value = "";
482
+ }), _.addEventListener("click", ft);
483
+ const I = () => {
484
+ w.disabled = !C.getState().isThinking && d.value.trim().length === 0 && v.length === 0;
444
485
  };
445
- e.loginRequired && (c.readOnly = !0, c.placeholder = e.loginButtonLabel, p.placeholder = e.loginButtonLabel, k.hidden = !0), k.addEventListener("submit", (r) => {
446
- if (r.preventDefault(), e.loginRequired) {
486
+ e.loginRequired && (c.readOnly = !0, c.placeholder = e.loginButtonLabel, d.placeholder = e.loginButtonLabel, x.hidden = !0), x.addEventListener("submit", (i) => {
487
+ if (i.preventDefault(), e.loginRequired) {
447
488
  e.onLoginClick?.();
448
489
  return;
449
490
  }
450
- x = pe(C, p, x), F(), N();
491
+ v = fe(C, d, v), E(), I();
451
492
  });
452
- let U = 0;
453
- const rt = () => {
454
- U = 0, a.classList.remove("pluno-pa-widget--drag-over");
455
- }, lt = (r) => {
456
- P !== null && window.clearTimeout(P), v.textContent = r, v.hidden = !1, P = window.setTimeout(() => {
457
- v.textContent = "", v.hidden = !0, P = null;
493
+ let K = 0;
494
+ const wt = () => {
495
+ K = 0, a.classList.remove("pluno-pa-widget--drag-over");
496
+ }, bt = (i) => {
497
+ k !== null && window.clearTimeout(k), y.textContent = i, y.hidden = !1, k = window.setTimeout(() => {
498
+ y.textContent = "", y.hidden = !0, k = null;
458
499
  }, 3e3);
459
- }, pt = () => {
460
- P !== null && (window.clearTimeout(P), P = null), v.textContent = "", v.hidden = !0;
461
- }, st = async (r) => {
462
- if (r.length === 0)
500
+ }, _t = () => {
501
+ k !== null && (window.clearTimeout(k), k = null), y.textContent = "", y.hidden = !0;
502
+ }, xt = async (i) => {
503
+ if (i.length === 0)
463
504
  return;
464
- const g = await gn(r);
465
- if (x.length + g.length > ee)
466
- throw new Error(`Attach up to ${ee} files per message.`);
467
- x = [...x, ...g], F(), pt(), N();
505
+ const u = await An(i);
506
+ if (v.length + u.length > ie)
507
+ throw new Error(`Attach up to ${ie} files per message.`);
508
+ v = [...v, ...u], E(), _t(), I();
468
509
  };
469
- a.addEventListener("dragenter", (r) => {
470
- !Z(r.dataTransfer) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), U += 1, a.classList.add("pluno-pa-widget--drag-over"));
471
- }), a.addEventListener("dragover", (r) => {
472
- const g = r.dataTransfer;
473
- !Z(g) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), g.dropEffect = "copy");
474
- }), a.addEventListener("dragleave", (r) => {
475
- Z(r.dataTransfer) && (r.stopPropagation(), U = Math.max(0, U - 1), U === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
476
- }), a.addEventListener("drop", (r) => {
477
- const g = r.dataTransfer;
478
- !Z(g) || e.loginRequired || (r.preventDefault(), r.stopPropagation(), rt(), st(g.files).catch((E) => {
479
- lt(E instanceof Error ? E.message : "Failed to attach file"), O("web-sdk.widget", "Attachment failed", {
480
- message: E instanceof Error ? E.message : String(E)
510
+ a.addEventListener("dragenter", (i) => {
511
+ !oe(i.dataTransfer) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), K += 1, a.classList.add("pluno-pa-widget--drag-over"));
512
+ }), a.addEventListener("dragover", (i) => {
513
+ const u = i.dataTransfer;
514
+ !oe(u) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), u.dropEffect = "copy");
515
+ }), a.addEventListener("dragleave", (i) => {
516
+ oe(i.dataTransfer) && (i.stopPropagation(), K = Math.max(0, K - 1), K === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
517
+ }), a.addEventListener("drop", (i) => {
518
+ const u = i.dataTransfer;
519
+ !oe(u) || e.loginRequired || (i.preventDefault(), i.stopPropagation(), wt(), xt(u.files).catch((L) => {
520
+ bt(L instanceof Error ? L.message : "Failed to attach file"), z("web-sdk.widget", "Attachment failed", {
521
+ message: L instanceof Error ? L.message : String(L)
481
522
  });
482
523
  }));
483
- }), m.addEventListener("click", () => {
524
+ }), w.addEventListener("click", () => {
484
525
  if (e.loginRequired) {
485
526
  e.onLoginClick?.();
486
527
  return;
@@ -489,79 +530,135 @@ async function Ut(t = {}) {
489
530
  C.stop();
490
531
  return;
491
532
  }
492
- x = pe(C, p, x), F(), N();
493
- }), b.addEventListener("click", () => {
494
- C.startNewSession(), K.clear(), p.value = "", x = [], F(), V(p), T(), N(), p.focus();
495
- }), p.addEventListener("input", () => {
496
- V(p), T(), N();
497
- }), p.addEventListener("keydown", (r) => {
498
- if (!(r.key !== "Enter" || r.shiftKey)) {
499
- if (r.preventDefault(), e.loginRequired) {
533
+ v = fe(C, d, v), E(), I();
534
+ }), m.addEventListener("click", () => {
535
+ C.startNewSession(), pe.clear(), d.value = "", v = [], E(), Z(d), A(), I(), d.focus();
536
+ }), d.addEventListener("input", () => {
537
+ Z(d), A(), I();
538
+ }), d.addEventListener("keydown", (i) => {
539
+ if (!(i.key !== "Enter" || i.shiftKey)) {
540
+ if (i.preventDefault(), e.loginRequired) {
500
541
  e.onLoginClick?.();
501
542
  return;
502
543
  }
503
- x = pe(C, p, x), F(), N();
504
- }
505
- }), a.addEventListener("click", (r) => {
506
- (r.target instanceof Element ? r.target : null)?.closest("a[href]") && T();
507
- }), z.composerValue && (p.value = z.composerValue, V(p)), z.isOpen && W(p.value, !1);
508
- const Y = () => i;
509
- let oe = C.getState().appearance !== null;
510
- return C.on("state", (r) => {
511
- r.appearance ? (oe = !0, O("web-sdk.widget", "Agent state supplied appearance", {
512
- appearance: r.appearance
513
- }), ae(r.appearance, "agent.state.appearance")) : oe && (oe = !1, O("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
544
+ v = fe(C, d, v), E(), I();
545
+ }
546
+ }), a.addEventListener("click", (i) => {
547
+ (i.target instanceof Element ? i.target : null)?.closest("a[href]") && A();
548
+ }), F.composerValue && (d.value = F.composerValue, Z(d)), F.isOpen && $(d.value, !1);
549
+ const Ae = () => r;
550
+ let ce = C.getState().appearance !== null, te = null, Y = null, U = null;
551
+ const vt = !!e.socialPostDraftHandler, W = (i) => {
552
+ if (e.loginRequired) {
553
+ Fn(f, w, m, Ae, e.loginButtonLabel, e.onLoginClick);
554
+ return;
555
+ }
556
+ On(
557
+ f,
558
+ w,
559
+ m,
560
+ i,
561
+ pe,
562
+ A,
563
+ Ae,
564
+ (u) => {
565
+ C.sendMessage(u);
566
+ },
567
+ vt && !se ? {
568
+ dismissedCandidateIds: Q,
569
+ draftingCandidateId: te,
570
+ error: Y,
571
+ onSeen: (u) => {
572
+ G.add(u.id), A();
573
+ },
574
+ onDraft: (u) => {
575
+ yt(u);
576
+ },
577
+ onDismiss: (u) => {
578
+ G.add(u.id), Q.add(u.id), A(), Y = null, W(C.getState());
579
+ },
580
+ onDisable: (u) => {
581
+ se = !0, G.add(u.id), Q.add(u.id), A(), Qn(e, !0), Y = null, W(C.getState());
582
+ }
583
+ } : void 0
584
+ );
585
+ };
586
+ return C.on("state", (i) => {
587
+ i.appearance ? (ce = !0, z("web-sdk.widget", "Agent state supplied appearance", {
588
+ appearance: i.appearance
589
+ }), ue(i.appearance, "agent.state.appearance")) : ce && (ce = !1, z("web-sdk.widget", "Agent state cleared appearance; reverting to configured widget options", {
514
590
  fallbackAccentColor: e.accentColor,
515
591
  fallbackColorScheme: e.colorScheme,
516
592
  fallbackFontFamily: e.fontFamily
517
- }), ae({}, "agent.state.appearance-cleared")), e.loginRequired ? Fe(w, m, b, Y, e.loginButtonLabel, e.onLoginClick) : Oe(w, m, b, r, K, T, Y, (g) => {
518
- C.sendMessage(g);
519
- }), N();
520
- }), e.loginRequired ? Fe(w, m, b, Y, e.loginButtonLabel, e.onLoginClick) : Oe(w, m, b, C.getState(), K, T, Y, (r) => {
521
- C.sendMessage(r);
522
- }), N(), {
593
+ }), ue({}, "agent.state.appearance-cleared")), W(i), I();
594
+ }), W(C.getState()), I(), {
523
595
  agent: C,
524
- updateAppearance: (r) => {
525
- r.scribbleStyle !== void 0 && (e.scribbleStyle = r.scribbleStyle), ae(r, "widgetHandle.updateAppearance");
596
+ updateAppearance: (i) => {
597
+ i.scribbleStyle !== void 0 && (e.scribbleStyle = i.scribbleStyle), ue(i, "widgetHandle.updateAppearance");
598
+ },
599
+ openPanel: () => {
600
+ $(d.value, !1);
526
601
  },
527
602
  destroy: () => {
528
- me = !0, fe.disconnect(), e.movableLauncher && window.removeEventListener("resize", be), _e(), P !== null && window.clearTimeout(P), C.destroy(), n.remove();
603
+ Ee = !0, ke.disconnect(), e.movableLauncher && window.removeEventListener("resize", Le), Pe(), k !== null && window.clearTimeout(k), U?.remove(), C.destroy(), n.remove();
529
604
  }
530
605
  };
531
- function ae(r, g) {
532
- const E = r.accentColor ?? e.accentColor, H = r.colorScheme ?? e.colorScheme, xe = r.fontFamily ?? e.fontFamily, ie = r.scribbleStyle ?? e.scribbleStyle;
533
- i = Pe(E, ie), Ae(a, i, {
534
- accentColor: E,
535
- colorScheme: H,
536
- fontFamily: xe,
537
- scribbleStyle: ie
538
- }), O("web-sdk.widget", "Updated widget appearance", {
539
- source: g,
540
- inputAppearance: r,
541
- appliedAccentColor: E,
542
- appliedColorScheme: H,
543
- appliedFontFamily: xe,
544
- appliedScribbleStyle: ie,
606
+ async function yt(i) {
607
+ if (!te) {
608
+ te = i.id, Y = null, W(C.getState());
609
+ try {
610
+ if (!e.socialPostDraftHandler)
611
+ throw new Error("Social post drafting is not available here.");
612
+ const u = await e.socialPostDraftHandler(i);
613
+ if (!u.linkedinPost || !u.xPost)
614
+ throw new Error("Pluno did not return a complete social post draft.");
615
+ G.add(i.id), Q.add(i.id), A(), U?.remove(), U = Gn(u, {
616
+ socialPostRewardsUrl: e.socialPostRewardsUrl,
617
+ onClose: () => {
618
+ U?.remove(), U = null;
619
+ }
620
+ }), a.appendChild(U);
621
+ } catch (u) {
622
+ Y = u instanceof Error ? u.message : "Could not draft social post.";
623
+ } finally {
624
+ te = null, W(C.getState());
625
+ }
626
+ }
627
+ }
628
+ function ue(i, u) {
629
+ const L = i.accentColor ?? e.accentColor, X = i.colorScheme ?? e.colorScheme, Ne = i.fontFamily ?? e.fontFamily, ge = i.scribbleStyle ?? e.scribbleStyle;
630
+ r = ze(L, ge), Ge(a, r, {
631
+ accentColor: L,
632
+ colorScheme: X,
633
+ fontFamily: Ne,
634
+ scribbleStyle: ge
635
+ }), z("web-sdk.widget", "Updated widget appearance", {
636
+ source: u,
637
+ inputAppearance: i,
638
+ appliedAccentColor: L,
639
+ appliedColorScheme: X,
640
+ appliedFontFamily: Ne,
641
+ appliedScribbleStyle: ge,
545
642
  cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
546
643
  });
547
644
  }
548
645
  }
549
- function Pe(t, e) {
550
- return e ? mt(t) : gt(t);
646
+ function ze(t, e) {
647
+ return e ? Pt(t) : St(t);
551
648
  }
552
- function Ae(t, e, n) {
649
+ function Ge(t, e, n) {
553
650
  t.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), t.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), t.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
554
- const o = n.scribbleStyle ? Ve(n.accentColor) : n.accentColor;
555
- t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? Nt : n.fontFamily, n.scribbleStyle && Ht(t.ownerDocument);
651
+ const o = n.scribbleStyle ? et(n.accentColor) : n.accentColor;
652
+ t.style.setProperty("--pluno-pa-accent", o), t.style.fontFamily = n.scribbleStyle ? qt : n.fontFamily, n.scribbleStyle && ln(t.ownerDocument);
556
653
  const a = Array.from(t.querySelectorAll(".pluno-pa-widget__character"));
557
- for (const i of a)
558
- i.src = e;
654
+ for (const r of a)
655
+ r.src = e;
559
656
  }
560
- function Ht(t) {
561
- if (t.getElementById(Se))
657
+ function ln(t) {
658
+ if (t.getElementById(Fe))
562
659
  return;
563
660
  const e = t.createElement("style");
564
- e.id = Se, e.textContent = `@font-face {
661
+ e.id = Fe, e.textContent = `@font-face {
565
662
  font-family: "Architects Daughter";
566
663
  font-style: normal;
567
664
  font-weight: 400;
@@ -569,107 +666,107 @@ function Ht(t) {
569
666
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
570
667
  }`, t.head.appendChild(e), t.fonts?.load('16px "Architects Daughter"');
571
668
  }
572
- function Vt({
669
+ function pn({
573
670
  root: t,
574
671
  launcherDragHandle: e,
575
672
  getPosition: n,
576
673
  setPosition: o,
577
674
  persist: a
578
675
  }) {
579
- let i = null, l = null, s = null, u = !1;
580
- const h = () => {
581
- i = null, l = null, s = null, u = !1, t.classList.remove("pluno-pa-widget--dragging");
582
- }, c = (d) => {
583
- t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (d.preventDefault(), d.stopPropagation(), i = d.pointerId, l = { x: d.clientX, y: d.clientY }, s = n(), u = !1, e.setPointerCapture?.(d.pointerId));
584
- }, f = (d) => {
585
- if (i !== d.pointerId || !l || !s)
676
+ let r = null, l = null, p = null, s = !1;
677
+ const g = () => {
678
+ r = null, l = null, p = null, s = !1, t.classList.remove("pluno-pa-widget--dragging");
679
+ }, c = (h) => {
680
+ t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), r = h.pointerId, l = { x: h.clientX, y: h.clientY }, p = n(), s = !1, e.setPointerCapture?.(h.pointerId));
681
+ }, b = (h) => {
682
+ if (r !== h.pointerId || !l || !p)
586
683
  return;
587
- d.preventDefault();
588
- const p = d.clientX - l.x, m = d.clientY - l.y;
589
- !u && Math.hypot(p, m) < Gt || (u = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: s.x + p, y: s.y + m }));
590
- }, y = (d) => {
591
- i === d.pointerId && (d.preventDefault(), d.stopPropagation(), u && a(), h());
592
- }, k = (d) => {
593
- i === d.pointerId && (d.preventDefault(), h());
594
- }, v = (d) => {
684
+ h.preventDefault();
685
+ const d = h.clientX - l.x, w = h.clientY - l.y;
686
+ !s && Math.hypot(d, w) < en || (s = !0, t.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + d, y: p.y + w }));
687
+ }, _ = (h) => {
688
+ r === h.pointerId && (h.preventDefault(), h.stopPropagation(), s && a(), g());
689
+ }, x = (h) => {
690
+ r === h.pointerId && (h.preventDefault(), g());
691
+ }, y = (h) => {
595
692
  if (t.classList.contains("pluno-pa-widget--open") || t.classList.contains("pluno-pa-widget--closing"))
596
693
  return;
597
- const p = d.shiftKey ? $t : Bt, m = n();
598
- let b = null;
599
- d.key === "ArrowUp" ? b = { x: m.x, y: m.y - p } : d.key === "ArrowDown" ? b = { x: m.x, y: m.y + p } : d.key === "ArrowLeft" ? b = { x: m.x - p, y: m.y } : d.key === "ArrowRight" && (b = { x: m.x + p, y: m.y }), b && (d.preventDefault(), d.stopPropagation(), o(b), a());
694
+ const d = h.shiftKey ? nn : tn, w = n();
695
+ let m = null;
696
+ h.key === "ArrowUp" ? m = { x: w.x, y: w.y - d } : h.key === "ArrowDown" ? m = { x: w.x, y: w.y + d } : h.key === "ArrowLeft" ? m = { x: w.x - d, y: w.y } : h.key === "ArrowRight" && (m = { x: w.x + d, y: w.y }), m && (h.preventDefault(), h.stopPropagation(), o(m), a());
600
697
  };
601
- return e.addEventListener("pointerdown", c), e.addEventListener("pointermove", f), e.addEventListener("pointerup", y), e.addEventListener("pointercancel", k), e.addEventListener("keydown", v), () => {
602
- e.removeEventListener("pointerdown", c), e.removeEventListener("pointermove", f), e.removeEventListener("pointerup", y), e.removeEventListener("pointercancel", k), e.removeEventListener("keydown", v);
698
+ return e.addEventListener("pointerdown", c), e.addEventListener("pointermove", b), e.addEventListener("pointerup", _), e.addEventListener("pointercancel", x), e.addEventListener("keydown", y), () => {
699
+ e.removeEventListener("pointerdown", c), e.removeEventListener("pointermove", b), e.removeEventListener("pointerup", _), e.removeEventListener("pointercancel", x), e.removeEventListener("keydown", y);
603
700
  };
604
701
  }
605
- function Te(t, e = !0) {
606
- const n = B(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
702
+ function $e(t, e = !0) {
703
+ const n = V(), o = t.getBoundingClientRect(), a = !t.classList.contains("pluno-pa-widget--open") && !t.classList.contains("pluno-pa-widget--closing");
607
704
  return {
608
- width: e && a && o.width > 0 ? o.width : Math.min(Ke, n.width - 36),
609
- height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? It : je
705
+ width: e && a && o.width > 0 ? o.width : Math.min(rt, n.width - 36),
706
+ height: e && a && o.height > 0 ? o.height : t.classList.contains("pluno-pa-widget--scribble") ? Kt : it
610
707
  };
611
708
  }
612
- function qt() {
613
- const t = B();
709
+ function sn() {
710
+ const t = V();
614
711
  return {
615
- width: Math.min(Rt, t.width - 28),
616
- height: Math.min(Dt, t.height - 28)
712
+ width: Math.min(Yt, t.width - 28),
713
+ height: Math.min(Xt, t.height - 28)
617
714
  };
618
715
  }
619
- function Kt(t, e, n) {
716
+ function dn(t, e, n) {
620
717
  const o = Number.parseFloat(t.style.left), a = Number.parseFloat(t.style.top);
621
718
  if (Number.isFinite(o) && Number.isFinite(a))
622
719
  return { x: o, y: a };
623
- const i = t.getBoundingClientRect();
624
- if (i.width > 0 || i.height > 0)
625
- return { x: i.left, y: i.top };
626
- const l = B();
720
+ const r = t.getBoundingClientRect();
721
+ if (r.width > 0 || r.height > 0)
722
+ return { x: r.left, y: r.top };
723
+ const l = V();
627
724
  return {
628
725
  x: e === "bottom-left" ? 26 : l.width - 26 - n.width,
629
726
  y: l.height - 24 - n.height
630
727
  };
631
728
  }
632
- function Ne(t, e, n) {
633
- const o = B(), a = S + jt(t);
729
+ function Ue(t, e, n) {
730
+ const o = V(), a = N + cn(t);
634
731
  return {
635
- x: te(e.x, S, Math.max(S, o.width - n.width - S)),
636
- y: te(e.y, a, Math.max(a, o.height - n.height - S))
732
+ x: le(e.x, N, Math.max(N, o.width - n.width - N)),
733
+ y: le(e.y, a, Math.max(a, o.height - n.height - N))
637
734
  };
638
735
  }
639
- function jt(t) {
640
- return t.classList.contains("pluno-pa-widget--scribble") ? Ft : Ot;
736
+ function cn(t) {
737
+ return t.classList.contains("pluno-pa-widget--scribble") ? Qt : Jt;
641
738
  }
642
- function Ie(t) {
643
- const e = B(), n = qt();
739
+ function We(t) {
740
+ const e = V(), n = sn();
644
741
  return {
645
- x: te(t.x, S, Math.max(S, e.width - n.width - S)),
646
- y: te(
742
+ x: le(t.x, N, Math.max(N, e.width - n.width - N)),
743
+ y: le(
647
744
  t.y,
648
- Le,
649
- Math.max(Le, e.height - n.height - S)
745
+ Be,
746
+ Math.max(Be, e.height - n.height - N)
650
747
  )
651
748
  };
652
749
  }
653
- function X(t, e) {
750
+ function ne(t, e) {
654
751
  if (t.classList.toggle("pluno-pa-widget--custom-position", e !== null), !e) {
655
752
  t.style.removeProperty("left"), t.style.removeProperty("top"), t.style.removeProperty("right"), t.style.removeProperty("bottom");
656
753
  return;
657
754
  }
658
755
  t.style.left = `${e.x}px`, t.style.top = `${e.y}px`, t.style.right = "auto", t.style.bottom = "auto";
659
756
  }
660
- function Yt(t, e) {
757
+ function un(t, e) {
661
758
  t.style.setProperty("--pluno-pa-panel-offset-x", `${e.x}px`), t.style.setProperty("--pluno-pa-panel-offset-y", `${e.y}px`);
662
759
  }
663
- function Re(t) {
760
+ function He(t) {
664
761
  t.style.removeProperty("--pluno-pa-panel-offset-x"), t.style.removeProperty("--pluno-pa-panel-offset-y");
665
762
  }
666
- function B() {
763
+ function V() {
667
764
  return {
668
- width: window.innerWidth || document.documentElement.clientWidth || Ke + S * 2,
669
- height: window.innerHeight || document.documentElement.clientHeight || je + S * 2
765
+ width: window.innerWidth || document.documentElement.clientWidth || rt + N * 2,
766
+ height: window.innerHeight || document.documentElement.clientHeight || it + N * 2
670
767
  };
671
768
  }
672
- function le(t) {
769
+ function me(t) {
673
770
  const e = t.getBoundingClientRect();
674
771
  return {
675
772
  x: Math.round(e.x),
@@ -678,10 +775,10 @@ function le(t) {
678
775
  height: Math.round(e.height)
679
776
  };
680
777
  }
681
- function te(t, e, n) {
778
+ function le(t, e, n) {
682
779
  return Math.min(Math.max(t, e), n);
683
780
  }
684
- function O(t, e, n) {
781
+ function z(t, e, n) {
685
782
  if (typeof window > "u")
686
783
  return;
687
784
  const o = window, a = {
@@ -689,43 +786,43 @@ function O(t, e, n) {
689
786
  source: t,
690
787
  message: e,
691
788
  details: n
692
- }, i = o.__plunoProductAgentDiagnostics__ ?? [];
693
- i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Pt, { detail: a }));
789
+ }, r = o.__plunoProductAgentDiagnostics__ ?? [];
790
+ r.push(a), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent(Ht, { detail: a }));
694
791
  }
695
- function Xt(t, e) {
696
- O("web-sdk.widget.position", t, e);
792
+ function gn(t, e) {
793
+ z("web-sdk.widget.position", t, e);
697
794
  }
698
- function pe(t, e, n) {
795
+ function fe(t, e, n) {
699
796
  const o = e.value.trim();
700
797
  return !o && n.length === 0 ? n : (e.value = "", e.style.height = "22px", e.style.overflowY = "hidden", t.sendMessage(o, { attachments: n.length > 0 ? n : void 0 }), e.dispatchEvent(new Event("input", { bubbles: !0 })), []);
701
798
  }
702
- function V(t) {
799
+ function Z(t) {
703
800
  t.style.height = "0px";
704
801
  const e = Math.max(22, Math.min(t.scrollHeight, 140));
705
802
  t.style.height = `${e}px`, t.style.overflowY = t.scrollHeight > 140 ? "auto" : "hidden";
706
803
  }
707
- function Zt(t, e, n, o) {
708
- t.appendChild(nn()), t.appendChild(Jt(e, n, o)), t.appendChild(Ze("pluno-pa-widget__close", "Close", on(16), !0)), t.appendChild(Qt(n));
804
+ function hn(t, e, n, o) {
805
+ t.appendChild(_n()), t.appendChild(mn(e, n, o)), t.appendChild(st("pluno-pa-widget__close", "Close", xn(16), !0)), t.appendChild(fn(n));
709
806
  }
710
- function Jt(t, e, n) {
807
+ function mn(t, e, n) {
711
808
  const o = document.createElement("form");
712
809
  if (o.className = "pluno-pa-widget__launcher", n) {
713
- const i = document.createElement("button");
714
- 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);
810
+ const r = document.createElement("button");
811
+ r.type = "button", r.className = "pluno-pa-widget__launcher-drag-handle", r.setAttribute("aria-label", "Move Pluno launcher"), r.title = "Move Pluno launcher", o.appendChild(r);
715
812
  }
716
- o.appendChild(Xe("pluno-pa-widget__character--launcher", e));
813
+ o.appendChild(pt("pluno-pa-widget__character--launcher", e));
717
814
  const a = document.createElement("input");
718
815
  return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = t, a.setAttribute("aria-label", t), o.appendChild(a), o;
719
816
  }
720
- function Qt(t) {
817
+ function fn(t) {
721
818
  const e = document.createElement("section");
722
819
  e.className = "pluno-pa-widget__panel", e.hidden = !0;
723
820
  const n = document.createElement("div");
724
821
  n.className = "pluno-pa-widget__timeline-wrap";
725
822
  const o = document.createElement("main");
726
- return o.className = "pluno-pa-widget__timeline", o.appendChild(tn(t)), n.appendChild(o), n.appendChild(Ze("pluno-pa-widget__new-chat", "New chat", an(), !0)), e.appendChild(n), e.appendChild(en()), e;
823
+ return o.className = "pluno-pa-widget__timeline", o.appendChild(bn(t)), n.appendChild(o), n.appendChild(st("pluno-pa-widget__new-chat", "New chat", vn(), !0)), e.appendChild(n), e.appendChild(wn()), e;
727
824
  }
728
- function en() {
825
+ function wn() {
729
826
  const t = document.createElement("form");
730
827
  t.className = "pluno-pa-widget__composer";
731
828
  const e = document.createElement("div");
@@ -736,45 +833,45 @@ function en() {
736
833
  o.className = "pluno-pa-widget__composer-inner";
737
834
  const a = document.createElement("textarea");
738
835
  a.className = "pluno-pa-widget__input", a.rows = 1, a.placeholder = "Ask for anything...", o.appendChild(a);
739
- const i = document.createElement("button");
740
- i.type = "button", i.className = "pluno-pa-widget__send", i.setAttribute("aria-label", "Send"), i.appendChild(Je()), o.appendChild(i), t.appendChild(o);
836
+ const r = document.createElement("button");
837
+ r.type = "button", r.className = "pluno-pa-widget__send", r.setAttribute("aria-label", "Send"), r.appendChild(dt()), o.appendChild(r), t.appendChild(o);
741
838
  const l = document.createElement("div");
742
839
  l.className = "pluno-pa-widget__composer-meta";
743
- const s = document.createElement("a");
744
- s.className = "pluno-pa-widget__powered-by", s.href = "https://pluno.ai", s.target = "_blank", s.rel = "noopener noreferrer", s.textContent = "Powered by Pluno.ai", l.appendChild(s);
745
- const u = document.createElement("span");
746
- return u.className = "pluno-pa-widget__ai-disclaimer", u.textContent = "AI can make mistakes", l.appendChild(u), t.appendChild(l), t;
840
+ const p = document.createElement("a");
841
+ p.className = "pluno-pa-widget__powered-by", p.href = "https://pluno.ai", p.target = "_blank", p.rel = "noopener noreferrer", p.textContent = "Powered by Pluno.ai.", l.appendChild(p);
842
+ const s = document.createElement("span");
843
+ return s.className = "pluno-pa-widget__ai-disclaimer", s.textContent = "AI can make mistakes. Verify outputs.", l.appendChild(s), t.appendChild(l), t;
747
844
  }
748
- function tn(t) {
845
+ function bn(t) {
749
846
  const e = document.createElement("div");
750
- return e.className = "pluno-pa-widget__empty-state", e.appendChild(Xe("pluno-pa-widget__character--empty", t)), e.appendChild(Ye()), e;
847
+ return e.className = "pluno-pa-widget__empty-state", e.appendChild(pt("pluno-pa-widget__character--empty", t)), e.appendChild(lt()), e;
751
848
  }
752
- function Ye() {
849
+ function lt() {
753
850
  const t = document.createElement("div");
754
851
  return t.className = "pluno-pa-widget__empty", t.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), t.appendChild(document.createElement("br")), t.appendChild(document.createTextNode("What do you want to do today?")), t;
755
852
  }
756
- function Xe(t, e) {
853
+ function pt(t, e) {
757
854
  const n = document.createElement("img");
758
855
  return n.className = `pluno-pa-widget__character ${t}`, n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
759
856
  }
760
- function Ze(t, e, n, o) {
857
+ function st(t, e, n, o) {
761
858
  const a = document.createElement("button");
762
859
  return a.type = "button", a.className = t, a.setAttribute("aria-label", e), a.title = e, a.hidden = o, a.appendChild(n), a;
763
860
  }
764
- function nn() {
765
- const t = _("svg", {
861
+ function _n() {
862
+ const t = S("svg", {
766
863
  class: "pluno-pa-widget__scribble-defs",
767
864
  "aria-hidden": "true",
768
865
  focusable: "false",
769
866
  width: "0",
770
867
  height: "0"
771
- }), e = _("defs");
772
- return e.appendChild(se("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(se("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(se("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
868
+ }), e = S("defs");
869
+ return e.appendChild(we("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(we("pluno-pa-scribble-wobble-2", "5", "15")), e.appendChild(we("pluno-pa-scribble-wobble-3", "9", "19")), t.appendChild(e), t;
773
870
  }
774
- function se(t, e, n) {
775
- const o = _("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
871
+ function we(t, e, n) {
872
+ const o = S("filter", { id: t, x: "-8%", y: "-8%", width: "116%", height: "116%" });
776
873
  return o.appendChild(
777
- _("feTurbulence", {
874
+ S("feTurbulence", {
778
875
  type: "fractalNoise",
779
876
  baseFrequency: "0.012 0.028",
780
877
  numOctaves: "3",
@@ -782,7 +879,7 @@ function se(t, e, n) {
782
879
  result: "stroke-noise"
783
880
  })
784
881
  ), o.appendChild(
785
- _("feDisplacementMap", {
882
+ S("feDisplacementMap", {
786
883
  in: "SourceGraphic",
787
884
  in2: "stroke-noise",
788
885
  scale: "3.5",
@@ -791,7 +888,7 @@ function se(t, e, n) {
791
888
  result: "warped"
792
889
  })
793
890
  ), o.appendChild(
794
- _("feTurbulence", {
891
+ S("feTurbulence", {
795
892
  type: "fractalNoise",
796
893
  baseFrequency: "0.7",
797
894
  numOctaves: "1",
@@ -799,7 +896,7 @@ function se(t, e, n) {
799
896
  result: "ink-noise"
800
897
  })
801
898
  ), o.appendChild(
802
- _("feDisplacementMap", {
899
+ S("feDisplacementMap", {
803
900
  in: "warped",
804
901
  in2: "ink-noise",
805
902
  scale: "0.9",
@@ -808,31 +905,31 @@ function se(t, e, n) {
808
905
  })
809
906
  ), o;
810
907
  }
811
- function on(t) {
812
- const e = $("0 0 24 24", t, t, "none", "currentColor", "2.25");
813
- return e.appendChild(_("path", { d: "m6 9 6 6 6-6" })), e;
908
+ function xn(t) {
909
+ const e = j("0 0 24 24", t, t, "none", "currentColor", "2.25");
910
+ return e.appendChild(S("path", { d: "m6 9 6 6 6-6" })), e;
814
911
  }
815
- function an() {
816
- const t = $("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
817
- return t.appendChild(_("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), t.appendChild(_("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
912
+ function vn() {
913
+ const t = j("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
914
+ return t.appendChild(S("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), t.appendChild(S("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), t;
818
915
  }
819
- function Je() {
820
- const t = $("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
821
- return t.appendChild(_("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(_("polyline", { points: "5 12 12 5 19 12" })), t;
916
+ function dt() {
917
+ const t = j("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
918
+ return t.appendChild(S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), t.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), t;
822
919
  }
823
- function rn() {
824
- const t = $("0 0 24 24", 18, 18, "currentColor");
825
- return t.appendChild(_("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
920
+ function yn() {
921
+ const t = j("0 0 24 24", 18, 18, "currentColor");
922
+ return t.appendChild(S("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), t;
826
923
  }
827
- function ln() {
828
- const t = $("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
829
- return t.appendChild(_("path", { d: "M18 6 6 18" })), t.appendChild(_("path", { d: "m6 6 12 12" })), t;
924
+ function Cn() {
925
+ const t = j("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
926
+ return t.appendChild(S("path", { d: "M18 6 6 18" })), t.appendChild(S("path", { d: "m6 6 12 12" })), t;
830
927
  }
831
- function pn() {
832
- const t = $("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
833
- return t.appendChild(_("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(_("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
928
+ function En() {
929
+ const t = j("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
930
+ return t.appendChild(S("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), t.appendChild(S("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), t;
834
931
  }
835
- function $(t, e, n, o, a, i) {
932
+ function j(t, e, n, o, a, r) {
836
933
  const l = {
837
934
  viewBox: t,
838
935
  width: String(e),
@@ -840,41 +937,41 @@ function $(t, e, n, o, a, i) {
840
937
  fill: o,
841
938
  "aria-hidden": "true"
842
939
  };
843
- return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), _("svg", l);
940
+ return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), S("svg", l);
844
941
  }
845
- function _(t, e = {}) {
846
- const n = document.createElementNS(Mt, t);
942
+ function S(t, e = {}) {
943
+ const n = document.createElementNS(Zt, t);
847
944
  for (const [o, a] of Object.entries(e))
848
945
  n.setAttribute(o, a);
849
946
  return n;
850
947
  }
851
- function De(t) {
948
+ function Ve(t) {
852
949
  for (const e of ["keydown", "keypress", "keyup"])
853
950
  t.addEventListener(e, (n) => {
854
951
  n.stopPropagation();
855
952
  });
856
953
  }
857
- function sn(t, e, n) {
954
+ function kn(t, e, n) {
858
955
  t.replaceChildren(), t.hidden = e.length === 0;
859
956
  for (const [o, a] of e.entries()) {
860
- const i = document.createElement("div");
861
- i.className = "pluno-pa-widget__attachment", i.appendChild(dn(a));
957
+ const r = document.createElement("div");
958
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Sn(a));
862
959
  const l = document.createElement("span");
863
- l.textContent = a.name, i.appendChild(l);
864
- const s = document.createElement("button");
865
- s.type = "button", s.setAttribute("aria-label", `Remove ${a.name}`), s.appendChild(ln()), s.addEventListener("click", () => n(o)), i.appendChild(s), t.appendChild(i);
960
+ l.textContent = a.name, r.appendChild(l);
961
+ const p = document.createElement("button");
962
+ p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Cn()), p.addEventListener("click", () => n(o)), r.appendChild(p), t.appendChild(r);
866
963
  }
867
964
  }
868
- function dn(t) {
869
- if (Qe(t)) {
965
+ function Sn(t) {
966
+ if (ct(t)) {
870
967
  const n = document.createElement("img");
871
968
  return n.src = t.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
872
969
  }
873
970
  const e = document.createElement("span");
874
971
  return e.className = "pluno-pa-widget__attachment-file", e.textContent = "PDF", e;
875
972
  }
876
- function cn(t) {
877
- if (Qe(t)) {
973
+ function Ln(t) {
974
+ if (ct(t)) {
878
975
  const a = document.createElement("img");
879
976
  return a.src = t.dataUrl, a.alt = t.name, a;
880
977
  }
@@ -885,51 +982,51 @@ function cn(t) {
885
982
  const o = document.createElement("strong");
886
983
  return o.textContent = t.name, e.append(n, o), e;
887
984
  }
888
- function Qe(t) {
985
+ function ct(t) {
889
986
  return t.mimeType.startsWith("image/");
890
987
  }
891
- function un(t) {
988
+ function Pn(t) {
892
989
  return t === "application/pdf" ? "document.pdf" : "image";
893
990
  }
894
- async function gn(t) {
991
+ async function An(t) {
895
992
  if (!t)
896
993
  return [];
897
994
  const e = Array.from(t);
898
- if (e.length > ee)
899
- throw new Error(`Attach up to ${ee} files per message.`);
995
+ if (e.length > ie)
996
+ throw new Error(`Attach up to ${ie} files per message.`);
900
997
  return Promise.all(
901
998
  e.map(async (n) => {
902
- const o = hn(n);
999
+ const o = Nn(n);
903
1000
  if (!o)
904
1001
  throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
905
- if (n.size > At)
1002
+ if (n.size > Vt)
906
1003
  throw new Error("Each Pluno attachment can be up to 10 MB.");
907
1004
  if (o === "image/gif") {
908
- const a = new Uint8Array(await bn(n));
909
- if (fn(a))
1005
+ const a = new Uint8Array(await Mn(n));
1006
+ if (Tn(a))
910
1007
  throw new Error("Pluno supports non-animated GIF images.");
911
1008
  }
912
1009
  return {
913
- name: n.name || un(o),
1010
+ name: n.name || Pn(o),
914
1011
  mimeType: o,
915
1012
  sizeBytes: n.size,
916
- dataUrl: mn(await _n(n), o)
1013
+ dataUrl: Dn(await Rn(n), o)
917
1014
  };
918
1015
  })
919
1016
  );
920
1017
  }
921
- function hn(t) {
922
- if (Tt.has(t.type))
1018
+ function Nn(t) {
1019
+ if (jt.has(t.type))
923
1020
  return t.type;
924
1021
  const e = t.name.toLowerCase();
925
1022
  return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
926
1023
  }
927
- function mn(t, e) {
1024
+ function Dn(t, e) {
928
1025
  const n = `data:${e};base64,`;
929
1026
  return t.startsWith(n) ? t : t.replace(/^data:[^;]*;base64,/, n);
930
1027
  }
931
- function fn(t) {
932
- if (t.length < 14 || !wn(t))
1028
+ function Tn(t) {
1029
+ if (t.length < 14 || !In(t))
933
1030
  return !1;
934
1031
  const e = t[10];
935
1032
  let n = 13;
@@ -940,7 +1037,7 @@ function fn(t) {
940
1037
  if (n += 1, a === 59)
941
1038
  return !1;
942
1039
  if (a === 33) {
943
- n += 1, n = Me(t, n);
1040
+ n += 1, n = je(t, n);
944
1041
  continue;
945
1042
  }
946
1043
  if (a !== 44)
@@ -949,17 +1046,17 @@ function fn(t) {
949
1046
  return !0;
950
1047
  if (n + 9 >= t.length)
951
1048
  return !1;
952
- const i = t[n + 8];
953
- if (n += 9, i & 128 && (n += 3 * 2 ** ((i & 7) + 1)), n >= t.length)
1049
+ const r = t[n + 8];
1050
+ if (n += 9, r & 128 && (n += 3 * 2 ** ((r & 7) + 1)), n >= t.length)
954
1051
  return !1;
955
- n += 1, n = Me(t, n);
1052
+ n += 1, n = je(t, n);
956
1053
  }
957
1054
  return !1;
958
1055
  }
959
- function wn(t) {
1056
+ function In(t) {
960
1057
  return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
961
1058
  }
962
- function Me(t, e) {
1059
+ function je(t, e) {
963
1060
  for (; e < t.length; ) {
964
1061
  const n = t[e];
965
1062
  if (e += 1, n === 0)
@@ -968,10 +1065,10 @@ function Me(t, e) {
968
1065
  }
969
1066
  return e;
970
1067
  }
971
- function Z(t) {
1068
+ function oe(t) {
972
1069
  return !!(t && Array.from(t.types).includes("Files"));
973
1070
  }
974
- function bn(t) {
1071
+ function Mn(t) {
975
1072
  return new Promise((e, n) => {
976
1073
  const o = new FileReader();
977
1074
  o.addEventListener("load", () => {
@@ -985,7 +1082,7 @@ function bn(t) {
985
1082
  }), o.readAsArrayBuffer(t);
986
1083
  });
987
1084
  }
988
- function _n(t) {
1085
+ function Rn(t) {
989
1086
  return new Promise((e, n) => {
990
1087
  const o = new FileReader();
991
1088
  o.addEventListener("load", () => {
@@ -999,135 +1096,280 @@ function _n(t) {
999
1096
  }), o.readAsDataURL(t);
1000
1097
  });
1001
1098
  }
1002
- function Oe(t, e, n, o, a, i, l, s) {
1003
- const u = [...o.messages];
1004
- t.replaceChildren(), tt(e, o.isThinking);
1005
- const h = u.length > 0 || !!o.assistantDraft || o.isThinking;
1006
- if (n.hidden = !h, u.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
1007
- const d = document.createElement("div");
1008
- d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1009
- const p = document.createElement("img");
1010
- p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = l(), p.alt = "", p.setAttribute("aria-hidden", "true"), d.appendChild(p), d.appendChild(Ye());
1099
+ function On(t, e, n, o, a, r, l, p, s) {
1100
+ const g = [...o.messages], c = g.filter((m) => !Vn(m));
1101
+ t.replaceChildren(), gt(e, o.isThinking);
1102
+ const b = c.length > 0 || !!o.assistantDraft || o.isThinking;
1103
+ if (n.hidden = !b, c.length === 0 && !o.assistantDraft && !o.lastError && !o.isThinking) {
1011
1104
  const m = document.createElement("div");
1012
- m.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && m.setAttribute("aria-hidden", "true");
1013
- for (const b of o.starterPrompts) {
1014
- const w = document.createElement("button");
1015
- w.type = "button", w.className = "pluno-pa-widget__starter-prompt", w.textContent = `"${b}"`, w.addEventListener("click", () => {
1016
- s(b);
1017
- }), m.appendChild(w);
1018
- }
1019
- d.appendChild(m), t.appendChild(d);
1105
+ m.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1106
+ const f = document.createElement("img");
1107
+ f.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", f.src = l(), f.alt = "", f.setAttribute("aria-hidden", "true"), m.appendChild(f), m.appendChild(lt());
1108
+ const v = document.createElement("div");
1109
+ v.className = o.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", o.starterPrompts.length === 0 && v.setAttribute("aria-hidden", "true");
1110
+ for (const k of o.starterPrompts) {
1111
+ const E = document.createElement("button");
1112
+ E.type = "button", E.className = "pluno-pa-widget__starter-prompt", E.textContent = `"${k}"`, E.addEventListener("click", () => {
1113
+ p(k);
1114
+ }), v.appendChild(E);
1115
+ }
1116
+ m.appendChild(v), t.appendChild(m);
1020
1117
  return;
1021
1118
  }
1022
- let c = null, f = null, y = [];
1023
- const k = () => {
1119
+ let _ = null, x = null, y = [];
1120
+ const h = () => {
1024
1121
  if (y.length === 0)
1025
1122
  return !1;
1026
- const d = yn(y, a, i, l());
1027
- return t.appendChild(d), c = null, f = d, y = [], !0;
1123
+ const m = jn(y, a, r, l());
1124
+ return t.appendChild(m), _ = null, x = m, y = [], !0;
1028
1125
  };
1029
- for (let d = 0; d < u.length; d += 1) {
1030
- const p = u[d];
1031
- if (p.role === "tool") {
1032
- y.push(p);
1126
+ for (let m = 0; m < c.length; m += 1) {
1127
+ const f = c[m];
1128
+ if (f.role === "tool") {
1129
+ y.push(f);
1033
1130
  continue;
1034
1131
  }
1035
- if (p.role === "system")
1132
+ if (f.role === "system")
1036
1133
  continue;
1037
- const m = k(), b = Be(p.content);
1038
- if (p.role === "assistant" && !m) {
1039
- const x = ge(l());
1040
- t.appendChild(x), c = null, f = x;
1041
- }
1042
- const w = document.createElement("div");
1043
- w.className = `pluno-pa-widget__message pluno-pa-widget__message--${p.role}`, p.role === "assistant" ? ze(w, b) : w.textContent = b, p.role === "user" && p.attachments?.length && w.appendChild(xn(p.attachments)), w.appendChild(Ge(b)), t.appendChild(w), c = w, f = null;
1134
+ const v = h(), k = Ke(f.content);
1135
+ if (f.role === "assistant" && !v) {
1136
+ const C = ve(l());
1137
+ t.appendChild(C), _ = null, x = C;
1138
+ }
1139
+ const E = document.createElement("div");
1140
+ E.className = `pluno-pa-widget__message pluno-pa-widget__message--${f.role}`, f.role === "assistant" ? Ye(E, k) : E.textContent = k, f.role === "user" && f.attachments?.length && E.appendChild(Bn(f.attachments));
1141
+ const q = document.createElement("div");
1142
+ q.className = "pluno-pa-widget__message-actions", q.appendChild(qe(k)), E.appendChild(q), t.appendChild(E), _ = E, x = null;
1044
1143
  }
1045
- const v = k();
1144
+ const d = h();
1046
1145
  if (o.assistantDraft) {
1047
- if (!v) {
1048
- const m = ge(l());
1049
- t.appendChild(m), c = null, f = m;
1050
- }
1051
- const d = Be(o.assistantDraft), p = document.createElement("div");
1052
- p.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", ze(p, d), p.appendChild(Ge(d)), t.appendChild(p), c = p, f = null;
1146
+ if (!d) {
1147
+ const k = ve(l());
1148
+ t.appendChild(k), _ = null, x = k;
1149
+ }
1150
+ const m = Ke(o.assistantDraft), f = document.createElement("div");
1151
+ f.className = "pluno-pa-widget__message pluno-pa-widget__message--assistant", Ye(f, m);
1152
+ const v = document.createElement("div");
1153
+ v.className = "pluno-pa-widget__message-actions", v.appendChild(qe(m)), f.appendChild(v), t.appendChild(f), _ = f, x = null;
1053
1154
  }
1054
1155
  if (o.isThinking && !o.assistantDraft)
1055
- if (v) {
1056
- const d = et();
1057
- t.appendChild(d), c = null, f = d;
1156
+ if (d) {
1157
+ const m = ut();
1158
+ t.appendChild(m), _ = null, x = m;
1058
1159
  } else {
1059
- const d = vn(l());
1060
- t.appendChild(d), c = null, f = d;
1160
+ const m = qn(l());
1161
+ t.appendChild(m), _ = null, x = m;
1061
1162
  }
1062
1163
  if (o.lastError) {
1063
- const d = document.createElement("div");
1064
- d.className = "pluno-pa-widget__error", d.textContent = o.lastError, t.appendChild(d), c = d, f = null;
1164
+ const m = document.createElement("div");
1165
+ m.className = "pluno-pa-widget__error", m.textContent = o.lastError, t.appendChild(m), _ = m, x = null;
1166
+ }
1167
+ const w = s && !o.isThinking ? Mt(g) : null;
1168
+ if (s && w && !s.dismissedCandidateIds.has(w.id)) {
1169
+ const m = zn(w, {
1170
+ isDrafting: s.draftingCandidateId === w.id,
1171
+ error: s.error,
1172
+ onDraft: s.onDraft,
1173
+ onDismiss: s.onDismiss,
1174
+ onDisable: s.onDisable
1175
+ });
1176
+ t.appendChild(m), s.onSeen(w), _ = null, x = m;
1065
1177
  }
1066
- c?.classList.add("pluno-pa-widget__message--bottom-reserve"), f?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
1178
+ _?.classList.add("pluno-pa-widget__message--bottom-reserve"), x?.classList.add("pluno-pa-widget__bottom-reserve-compact"), t.scrollTop = t.scrollHeight;
1067
1179
  }
1068
- function Fe(t, e, n, o, a, i) {
1069
- t.replaceChildren(), tt(e, !1), e.disabled = !0, n.hidden = !0;
1180
+ function Fn(t, e, n, o, a, r) {
1181
+ t.replaceChildren(), gt(e, !1), e.disabled = !0, n.hidden = !0;
1070
1182
  const l = document.createElement("div");
1071
1183
  l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
1072
- const s = document.createElement("img");
1073
- s.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", s.src = o(), s.alt = "", s.setAttribute("aria-hidden", "true"), l.appendChild(s);
1074
- const u = document.createElement("div");
1075
- u.className = "pluno-pa-widget__empty", u.textContent = "Log in to use Pluno on this page.", l.appendChild(u);
1076
- const h = document.createElement("button");
1077
- h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = a, h.addEventListener("click", () => i?.()), l.appendChild(h), t.appendChild(l);
1078
- }
1079
- function xn(t) {
1184
+ const p = document.createElement("img");
1185
+ p.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", p.src = o(), p.alt = "", p.setAttribute("aria-hidden", "true"), l.appendChild(p);
1186
+ const s = document.createElement("div");
1187
+ s.className = "pluno-pa-widget__empty", s.textContent = "Log in to use Pluno on this page.", l.appendChild(s);
1188
+ const g = document.createElement("button");
1189
+ g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = a, g.addEventListener("click", () => r?.()), l.appendChild(g), t.appendChild(l);
1190
+ }
1191
+ function Bn(t) {
1080
1192
  const e = document.createElement("div");
1081
1193
  e.className = "pluno-pa-widget__message-attachments";
1082
1194
  for (const n of t)
1083
- e.appendChild(cn(n));
1195
+ e.appendChild(Ln(n));
1084
1196
  return e;
1085
1197
  }
1086
- function Ge(t) {
1198
+ function qe(t) {
1087
1199
  const e = document.createElement("button");
1088
- return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(pn()), e.addEventListener("click", (n) => {
1200
+ return e.type = "button", e.className = "pluno-pa-widget__message-copy", e.setAttribute("aria-label", "Copy message"), e.title = "Copy message", e.appendChild(En()), e.addEventListener("click", (n) => {
1089
1201
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(t);
1090
1202
  }), e;
1091
1203
  }
1092
- function Be(t) {
1204
+ function zn(t, e) {
1205
+ const n = document.createElement("article");
1206
+ n.className = "pluno-pa-widget__share-prompt";
1207
+ const o = document.createElement("div");
1208
+ o.className = "pluno-pa-widget__share-prompt-body";
1209
+ const a = document.createElement("div");
1210
+ a.className = "pluno-pa-widget__share-prompt-copy";
1211
+ const r = document.createElement("strong");
1212
+ r.textContent = "Share this win?", a.appendChild(r);
1213
+ const l = document.createElement("span");
1214
+ if (l.textContent = e.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", a.appendChild(l), e.error) {
1215
+ const c = document.createElement("span");
1216
+ c.className = "pluno-pa-widget__share-prompt-error", c.textContent = e.error, a.appendChild(c);
1217
+ }
1218
+ o.appendChild(a);
1219
+ const p = document.createElement("div");
1220
+ p.className = "pluno-pa-widget__share-prompt-actions";
1221
+ const s = document.createElement("div");
1222
+ s.className = "pluno-pa-widget__share-prompt-primary-actions";
1223
+ const g = document.createElement("button");
1224
+ if (g.type = "button", g.disabled = e.isDrafting, g.addEventListener("click", () => {
1225
+ e.onDraft(t);
1226
+ }), e.isDrafting ? (g.appendChild(ye()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), e.isDrafting)
1227
+ p.appendChild(s);
1228
+ else {
1229
+ const c = document.createElement("button");
1230
+ c.type = "button", c.className = "pluno-pa-widget__share-prompt-dismiss", c.setAttribute("aria-label", "Dismiss share prompt"), c.title = "Dismiss", c.textContent = "Dismiss", c.addEventListener("click", () => {
1231
+ e.onDismiss(t);
1232
+ }), s.appendChild(c), p.appendChild(s);
1233
+ const b = document.createElement("button");
1234
+ b.type = "button", b.className = "pluno-pa-widget__share-prompt-disable", b.textContent = "Don't ask again", b.addEventListener("click", () => {
1235
+ e.onDisable(t);
1236
+ }), p.appendChild(b);
1237
+ }
1238
+ return o.appendChild(p), n.appendChild(o), n;
1239
+ }
1240
+ function Gn(t, e) {
1241
+ const n = document.createElement("div");
1242
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (h) => {
1243
+ h.target === n && e.onClose();
1244
+ });
1245
+ const o = document.createElement("section");
1246
+ o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
1247
+ const a = document.createElement("header"), r = document.createElement("strong");
1248
+ r.textContent = "Share this win", a.appendChild(r);
1249
+ const l = document.createElement("button");
1250
+ l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", e.onClose), a.appendChild(l), o.appendChild(a);
1251
+ const p = document.createElement("p");
1252
+ p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
1253
+ const s = document.createElement("div");
1254
+ s.className = "pluno-pa-widget__share-dialog-step";
1255
+ const g = document.createElement("div");
1256
+ g.className = "pluno-pa-widget__share-dialog-step-header";
1257
+ const c = document.createElement("strong");
1258
+ c.textContent = "1) Copy Screenshot", g.appendChild(c);
1259
+ const b = $n("Copy Screenshot", async () => {
1260
+ try {
1261
+ return await Rt(t.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
1262
+ } catch {
1263
+ return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
1264
+ }
1265
+ });
1266
+ if (g.appendChild(b), s.appendChild(g), t.screenshotDataUrl) {
1267
+ const h = document.createElement("div");
1268
+ h.className = "pluno-pa-widget__share-dialog-screenshot";
1269
+ const d = document.createElement("img");
1270
+ d.src = t.screenshotDataUrl, d.alt = "Product page with Pluno open", h.appendChild(d), s.appendChild(h);
1271
+ }
1272
+ o.appendChild(s), o.appendChild(p);
1273
+ const _ = document.createElement("div");
1274
+ _.className = "pluno-pa-widget__share-dialog-step";
1275
+ const x = document.createElement("strong");
1276
+ x.className = "pluno-pa-widget__share-dialog-step-title", x.textContent = "2) Share on", _.appendChild(x);
1277
+ const y = document.createElement("footer");
1278
+ y.className = "pluno-pa-widget__share-dialog-platforms";
1279
+ for (const h of Un(t)) {
1280
+ const d = document.createElement("a");
1281
+ d.href = h.href, d.target = "_blank", d.rel = "noopener noreferrer", d.title = h.label, d.setAttribute("aria-label", `Open ${h.label}`), d.appendChild(Wn(h.id)), y.appendChild(d);
1282
+ }
1283
+ if (_.appendChild(y), o.appendChild(_), e.socialPostRewardsUrl) {
1284
+ const h = document.createElement("div");
1285
+ h.className = "pluno-pa-widget__share-dialog-step";
1286
+ const d = document.createElement("strong");
1287
+ d.className = "pluno-pa-widget__share-dialog-step-title", d.textContent = "3) Submit post to get 2000 free credits!", h.appendChild(d);
1288
+ const w = document.createElement("a");
1289
+ w.className = "pluno-pa-widget__share-dialog-reward-link", w.href = e.socialPostRewardsUrl, w.target = "_blank", w.rel = "noopener noreferrer", w.appendChild(document.createTextNode("Submit post URL")), w.appendChild(Hn()), h.appendChild(w), o.appendChild(h);
1290
+ }
1291
+ return n.appendChild(o), n;
1292
+ }
1293
+ function $n(t, e) {
1294
+ const n = document.createElement("button");
1295
+ return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = t, n.addEventListener("click", async (o) => {
1296
+ o.preventDefault(), o.stopPropagation(), await e() && (n.textContent = "Copied ✓");
1297
+ }), n;
1298
+ }
1299
+ function Un(t) {
1300
+ const e = t.linkedinPost.trim(), n = t.xPost.trim();
1301
+ return [
1302
+ {
1303
+ id: "linkedin",
1304
+ label: "LinkedIn",
1305
+ href: `https://www.linkedin.com/feed/?shareActive=true&text=${encodeURIComponent(e)}`
1306
+ },
1307
+ {
1308
+ id: "x",
1309
+ label: "X",
1310
+ href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(n)}`
1311
+ },
1312
+ {
1313
+ id: "instagram",
1314
+ label: "Instagram Story",
1315
+ href: "https://www.instagram.com/create/story/"
1316
+ }
1317
+ ];
1318
+ }
1319
+ function Wn(t) {
1320
+ const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1321
+ return e.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), e.setAttribute("viewBox", "0 0 32 32"), e.setAttribute("aria-hidden", "true"), t === "linkedin" ? (P(e, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), P(e, "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"), P(e, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), P(e, "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"), P(e, "M20 18c.1 2.2.1 4.7 0 7.2"), e) : t === "x" ? (P(e, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), P(e, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), P(e, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), e) : (P(e, "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"), P(e, "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"), P(e, "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"), P(e, "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"), e);
1322
+ }
1323
+ function P(t, e, n) {
1324
+ const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
1325
+ o.setAttribute("d", e), n && o.setAttribute("opacity", n), t.appendChild(o);
1326
+ }
1327
+ function Hn() {
1328
+ const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1329
+ return t.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), t.setAttribute("viewBox", "0 0 24 24"), t.setAttribute("aria-hidden", "true"), P(t, "M14 5h5v5"), P(t, "M19 5l-8 8"), P(t, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), t;
1330
+ }
1331
+ function Vn(t) {
1332
+ return t.role === "tool" && t.toolName === nt;
1333
+ }
1334
+ function Ke(t) {
1093
1335
  return t.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
1094
1336
  }
1095
- function yn(t, e, n, o) {
1337
+ function jn(t, e, n, o) {
1096
1338
  const a = document.createElement("article");
1097
1339
  a.className = "pluno-pa-widget__tool-group", a.title = new Date(t[t.length - 1].createdAt).toLocaleString();
1098
- const i = document.createElement("img");
1099
- i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
1100
- const l = document.createElement("details"), s = Cn(t);
1101
- l.open = e.has(s), l.addEventListener("toggle", () => {
1102
- l.open ? e.add(s) : e.delete(s), n();
1340
+ const r = document.createElement("img");
1341
+ r.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", r.src = o, r.alt = "", r.setAttribute("aria-hidden", "true"), a.appendChild(r);
1342
+ const l = document.createElement("details"), p = Kn(t);
1343
+ l.open = e.has(p), l.addEventListener("toggle", () => {
1344
+ l.open ? e.add(p) : e.delete(p), n();
1103
1345
  });
1104
- const u = document.createElement("summary");
1105
- u.className = "pluno-pa-widget__tool-summary", t.some((f) => f.loading) && u.appendChild($e());
1346
+ const s = document.createElement("summary");
1347
+ s.className = "pluno-pa-widget__tool-summary", t.some((b) => b.loading) && s.appendChild(ye());
1106
1348
  const c = document.createElement("span");
1107
- if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = t[t.length - 1].content || "Run tool", u.appendChild(c), l.appendChild(u), t.length > 0) {
1108
- const f = document.createElement("div");
1109
- f.className = "pluno-pa-widget__tool-lines";
1110
- for (const y of t) {
1111
- const k = document.createElement("div");
1112
- k.className = "pluno-pa-widget__tool-line", y.loading && k.appendChild($e());
1113
- const v = document.createElement("span");
1114
- v.textContent = y.content || "Run tool", k.appendChild(v), f.appendChild(k);
1115
- }
1116
- l.appendChild(f);
1349
+ if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = t[t.length - 1].content || "Run tool", s.appendChild(c), l.appendChild(s), t.length > 0) {
1350
+ const b = document.createElement("div");
1351
+ b.className = "pluno-pa-widget__tool-lines";
1352
+ for (const _ of t) {
1353
+ const x = document.createElement("div");
1354
+ x.className = "pluno-pa-widget__tool-line", _.loading && x.appendChild(ye());
1355
+ const y = document.createElement("span");
1356
+ y.textContent = _.content || "Run tool", x.appendChild(y), b.appendChild(x);
1357
+ }
1358
+ l.appendChild(b);
1117
1359
  }
1118
1360
  return a.appendChild(l), a;
1119
1361
  }
1120
- function ge(t) {
1362
+ function ve(t) {
1121
1363
  const e = document.createElement("article");
1122
1364
  e.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker";
1123
1365
  const n = document.createElement("img");
1124
1366
  return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = t, n.alt = "", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e;
1125
1367
  }
1126
- function vn(t) {
1127
- const e = ge(t);
1128
- return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(et()), e;
1368
+ function qn(t) {
1369
+ const e = ve(t);
1370
+ return e.classList.add("pluno-pa-widget__thinking-marker"), e.appendChild(ut()), e;
1129
1371
  }
1130
- function et() {
1372
+ function ut() {
1131
1373
  const t = document.createElement("div");
1132
1374
  t.className = "pluno-pa-widget__status";
1133
1375
  const e = document.createElement("span");
@@ -1135,17 +1377,17 @@ function et() {
1135
1377
  const n = document.createElement("span");
1136
1378
  return n.textContent = "Thinking...", t.appendChild(n), t;
1137
1379
  }
1138
- function Cn(t) {
1380
+ function Kn(t) {
1139
1381
  return `tools:${t.map((e) => e.id).join("|")}`;
1140
1382
  }
1141
- function $e() {
1383
+ function ye() {
1142
1384
  const t = document.createElement("span");
1143
1385
  return t.className = "pluno-pa-widget__spinner", t.setAttribute("aria-hidden", "true"), t;
1144
1386
  }
1145
- function tt(t, e) {
1146
- t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? rn() : Je());
1387
+ function gt(t, e) {
1388
+ t.setAttribute("aria-label", e ? "Stop" : "Send"), t.classList.toggle("pluno-pa-widget__send--stop", e), t.replaceChildren(e ? yn() : dt());
1147
1389
  }
1148
- function ze(t, e) {
1390
+ function Ye(t, e) {
1149
1391
  const n = e.replace(/\r\n/g, `
1150
1392
  `).split(`
1151
1393
  `);
@@ -1157,77 +1399,77 @@ function ze(t, e) {
1157
1399
  continue;
1158
1400
  }
1159
1401
  if (a.match(/^```(\w+)?\s*$/)) {
1160
- const h = [];
1402
+ const g = [];
1161
1403
  for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
1162
- h.push(n[o]), o += 1;
1404
+ g.push(n[o]), o += 1;
1163
1405
  o += o < n.length ? 1 : 0;
1164
- const c = document.createElement("pre"), f = document.createElement("code");
1165
- f.textContent = h.join(`
1166
- `), c.appendChild(f), t.appendChild(c);
1406
+ const c = document.createElement("pre"), b = document.createElement("code");
1407
+ b.textContent = g.join(`
1408
+ `), c.appendChild(b), t.appendChild(c);
1167
1409
  continue;
1168
1410
  }
1169
1411
  const l = a.match(/^(#{1,3})\s+(.+)$/);
1170
1412
  if (l) {
1171
- const h = document.createElement(`h${l[1].length + 2}`);
1172
- J(h, l[2]), t.appendChild(h), o += 1;
1413
+ const g = document.createElement(`h${l[1].length + 2}`);
1414
+ ae(g, l[2]), t.appendChild(g), o += 1;
1173
1415
  continue;
1174
1416
  }
1175
1417
  if (/^\s*[-*+]\s+/.test(a)) {
1176
- const h = document.createElement("ul");
1418
+ const g = document.createElement("ul");
1177
1419
  for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
1178
1420
  const c = document.createElement("li");
1179
- J(c, n[o].replace(/^\s*[-*+]\s+/, "")), h.appendChild(c), o += 1;
1421
+ ae(c, n[o].replace(/^\s*[-*+]\s+/, "")), g.appendChild(c), o += 1;
1180
1422
  }
1181
- t.appendChild(h);
1423
+ t.appendChild(g);
1182
1424
  continue;
1183
1425
  }
1184
1426
  if (/^\s*\d+\.\s+/.test(a)) {
1185
- const h = document.createElement("ol");
1427
+ const g = document.createElement("ol");
1186
1428
  for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
1187
1429
  const c = document.createElement("li");
1188
- J(c, n[o].replace(/^\s*\d+\.\s+/, "")), h.appendChild(c), o += 1;
1430
+ ae(c, n[o].replace(/^\s*\d+\.\s+/, "")), g.appendChild(c), o += 1;
1189
1431
  }
1190
- t.appendChild(h);
1432
+ t.appendChild(g);
1191
1433
  continue;
1192
1434
  }
1193
- const s = [a];
1435
+ const p = [a];
1194
1436
  for (o += 1; o < n.length && n[o].trim() && !/^```/.test(n[o]) && !/^(#{1,3})\s+/.test(n[o]) && !/^\s*[-*+]\s+/.test(n[o]) && !/^\s*\d+\.\s+/.test(n[o]); )
1195
- s.push(n[o]), o += 1;
1196
- const u = document.createElement("p");
1197
- s.forEach((h, c) => {
1198
- c > 0 && u.appendChild(document.createElement("br")), J(u, h);
1199
- }), t.appendChild(u);
1437
+ p.push(n[o]), o += 1;
1438
+ const s = document.createElement("p");
1439
+ p.forEach((g, c) => {
1440
+ c > 0 && s.appendChild(document.createElement("br")), ae(s, g);
1441
+ }), t.appendChild(s);
1200
1442
  }
1201
1443
  }
1202
- function J(t, e) {
1444
+ function ae(t, e) {
1203
1445
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
1204
1446
  let o = 0;
1205
1447
  for (const a of e.matchAll(n)) {
1206
- const i = a.index ?? 0;
1207
- i > o && t.appendChild(document.createTextNode(e.slice(o, i)));
1448
+ const r = a.index ?? 0;
1449
+ r > o && t.appendChild(document.createTextNode(e.slice(o, r)));
1208
1450
  const l = a[0];
1209
1451
  if (l.startsWith("`")) {
1210
- const s = document.createElement("code");
1211
- s.textContent = l.slice(1, -1), t.appendChild(s);
1452
+ const p = document.createElement("code");
1453
+ p.textContent = l.slice(1, -1), t.appendChild(p);
1212
1454
  } else if (l.startsWith("**")) {
1213
- const s = document.createElement("strong");
1214
- s.textContent = l.slice(2, -2), t.appendChild(s);
1455
+ const p = document.createElement("strong");
1456
+ p.textContent = l.slice(2, -2), t.appendChild(p);
1215
1457
  } else if (l.startsWith("*")) {
1216
- const s = document.createElement("em");
1217
- s.textContent = l.slice(1, -1), t.appendChild(s);
1458
+ const p = document.createElement("em");
1459
+ p.textContent = l.slice(1, -1), t.appendChild(p);
1218
1460
  } else {
1219
- const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1220
- if (s && En(s[2])) {
1221
- const u = document.createElement("a");
1222
- u.href = s[2], u.target = "_top", u.rel = "noreferrer", u.textContent = s[1], t.appendChild(u);
1461
+ const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
1462
+ if (p && Yn(p[2])) {
1463
+ const s = document.createElement("a");
1464
+ s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], t.appendChild(s);
1223
1465
  } else
1224
1466
  t.appendChild(document.createTextNode(l));
1225
1467
  }
1226
- o = i + l.length;
1468
+ o = r + l.length;
1227
1469
  }
1228
1470
  o < e.length && t.appendChild(document.createTextNode(e.slice(o)));
1229
1471
  }
1230
- function En(t) {
1472
+ function Yn(t) {
1231
1473
  if (t.startsWith("/") || t.startsWith("#"))
1232
1474
  return !0;
1233
1475
  try {
@@ -1237,7 +1479,7 @@ function En(t) {
1237
1479
  return !1;
1238
1480
  }
1239
1481
  }
1240
- function We(t, e) {
1482
+ function Xe(t, e) {
1241
1483
  if (t.getElementById("pluno-pa-widget-styles"))
1242
1484
  return;
1243
1485
  const n = t.ownerDocument.createElement("style");
@@ -1292,7 +1534,7 @@ function We(t, e) {
1292
1534
  --pluno-pa-accent-contrast: #fafafa;
1293
1535
  position: fixed;
1294
1536
  z-index: 2147483645;
1295
- font-family: ${D.fontFamily};
1537
+ font-family: ${M.fontFamily};
1296
1538
  font-size: 14px;
1297
1539
  color: var(--pluno-pa-text);
1298
1540
  width: var(--pluno-pa-launcher-width);
@@ -1399,10 +1641,10 @@ function We(t, e) {
1399
1641
  }
1400
1642
  .pluno-pa-widget__character--launcher {
1401
1643
  position: absolute;
1402
- left: 10px;
1644
+ left: 8px;
1403
1645
  top: 50%;
1404
- width: 34px;
1405
- height: 34px;
1646
+ width: 38px;
1647
+ height: 38px;
1406
1648
  transform: translateY(-50%);
1407
1649
  pointer-events: none;
1408
1650
  }
@@ -1413,7 +1655,7 @@ function We(t, e) {
1413
1655
  outline: none;
1414
1656
  background: transparent;
1415
1657
  color: var(--pluno-pa-text);
1416
- padding: 0 12px 0 44px;
1658
+ padding: 0 12px 0 48px;
1417
1659
  font: inherit;
1418
1660
  font-size: 15px;
1419
1661
  line-height: 22px;
@@ -1688,20 +1930,45 @@ function We(t, e) {
1688
1930
  transform: translateY(-2px);
1689
1931
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease, color 120ms ease;
1690
1932
  }
1933
+ .pluno-pa-widget__message-actions {
1934
+ position: absolute;
1935
+ bottom: -30px;
1936
+ z-index: 3;
1937
+ display: inline-flex;
1938
+ gap: 6px;
1939
+ opacity: 0;
1940
+ pointer-events: none;
1941
+ transform: translateY(-2px);
1942
+ transition: opacity 120ms ease, transform 120ms ease;
1943
+ }
1944
+ .pluno-pa-widget__message-actions .pluno-pa-widget__message-copy {
1945
+ position: static;
1946
+ opacity: 1;
1947
+ pointer-events: auto;
1948
+ transform: none;
1949
+ }
1691
1950
  .pluno-pa-widget__message--user::after {
1692
1951
  right: 0;
1693
1952
  }
1694
1953
  .pluno-pa-widget__message--user .pluno-pa-widget__message-copy {
1695
1954
  right: 4px;
1696
1955
  }
1956
+ .pluno-pa-widget__message--user .pluno-pa-widget__message-actions {
1957
+ right: 4px;
1958
+ }
1697
1959
  .pluno-pa-widget__message--assistant::after {
1698
1960
  left: 0;
1699
1961
  }
1700
1962
  .pluno-pa-widget__message--assistant .pluno-pa-widget__message-copy {
1701
1963
  left: 2px;
1702
1964
  }
1965
+ .pluno-pa-widget__message--assistant .pluno-pa-widget__message-actions {
1966
+ left: 2px;
1967
+ }
1703
1968
  .pluno-pa-widget__message:hover .pluno-pa-widget__message-copy,
1704
- .pluno-pa-widget__message-copy:focus-visible {
1969
+ .pluno-pa-widget__message-copy:focus-visible,
1970
+ .pluno-pa-widget__message:hover .pluno-pa-widget__message-actions,
1971
+ .pluno-pa-widget__message-actions:focus-within {
1705
1972
  opacity: 1;
1706
1973
  pointer-events: auto;
1707
1974
  transform: translateY(0);
@@ -1793,9 +2060,9 @@ function We(t, e) {
1793
2060
  margin-bottom: -8px;
1794
2061
  }
1795
2062
  .pluno-pa-widget__character--tool-group {
1796
- width: 33px;
1797
- height: 33px;
1798
- margin-top: -7px;
2063
+ width: 36px;
2064
+ height: 36px;
2065
+ margin-top: -8px;
1799
2066
  }
1800
2067
  .pluno-pa-widget__assistant-marker {
1801
2068
  min-height: 19px;
@@ -1867,6 +2134,313 @@ function We(t, e) {
1867
2134
  @keyframes pluno-pa-spin {
1868
2135
  to { transform: rotate(360deg); }
1869
2136
  }
2137
+ .pluno-pa-widget__share-prompt {
2138
+ align-self: stretch;
2139
+ display: block;
2140
+ color: var(--pluno-pa-muted);
2141
+ font-size: 12px;
2142
+ line-height: 1.35;
2143
+ margin-top: -4px;
2144
+ }
2145
+ .pluno-pa-widget__share-prompt-body {
2146
+ min-width: 0;
2147
+ display: grid;
2148
+ gap: 8px;
2149
+ border: 1px solid var(--pluno-pa-divider);
2150
+ border-radius: 8px;
2151
+ background: color-mix(in srgb, var(--pluno-pa-surface) 78%, transparent);
2152
+ padding: 8px;
2153
+ }
2154
+ .pluno-pa-widget__share-prompt-copy {
2155
+ min-width: 0;
2156
+ display: grid;
2157
+ gap: 2px;
2158
+ }
2159
+ .pluno-pa-widget__share-prompt-copy strong {
2160
+ color: var(--pluno-pa-text);
2161
+ font-size: 12px;
2162
+ line-height: 1.25;
2163
+ font-weight: 650;
2164
+ }
2165
+ .pluno-pa-widget__share-prompt-copy span {
2166
+ color: var(--pluno-pa-muted);
2167
+ font-size: 11px;
2168
+ line-height: 1.35;
2169
+ }
2170
+ .pluno-pa-widget__share-prompt-copy .pluno-pa-widget__share-prompt-error {
2171
+ color: #ef4444;
2172
+ }
2173
+ .pluno-pa-widget__share-prompt-actions {
2174
+ display: flex;
2175
+ align-items: center;
2176
+ justify-content: space-between;
2177
+ gap: 6px;
2178
+ }
2179
+ .pluno-pa-widget__share-prompt-primary-actions {
2180
+ min-width: 0;
2181
+ display: flex;
2182
+ align-items: center;
2183
+ gap: 6px;
2184
+ }
2185
+ .pluno-pa-widget__share-prompt-actions button {
2186
+ min-height: 28px;
2187
+ border: 1px solid var(--pluno-pa-divider);
2188
+ border-radius: 8px;
2189
+ background: var(--pluno-pa-bg);
2190
+ color: var(--pluno-pa-text);
2191
+ padding: 0 8px;
2192
+ font-size: 12px;
2193
+ font-weight: 650;
2194
+ line-height: 1;
2195
+ cursor: pointer;
2196
+ }
2197
+ .pluno-pa-widget__share-prompt-actions button:first-child {
2198
+ display: inline-flex;
2199
+ align-items: center;
2200
+ gap: 7px;
2201
+ border-color: color-mix(in srgb, var(--pluno-pa-accent) 45%, var(--pluno-pa-divider));
2202
+ background: var(--pluno-pa-bg);
2203
+ color: var(--pluno-pa-text);
2204
+ }
2205
+ .pluno-pa-widget__share-prompt-actions button:first-child:disabled {
2206
+ cursor: default;
2207
+ opacity: 0.78;
2208
+ }
2209
+ .pluno-pa-widget__share-prompt-dismiss {
2210
+ width: auto;
2211
+ padding: 0 8px !important;
2212
+ background: var(--pluno-pa-surface);
2213
+ color: var(--pluno-pa-muted);
2214
+ }
2215
+ .pluno-pa-widget__share-prompt-disable {
2216
+ border: 0;
2217
+ background: transparent;
2218
+ color: color-mix(in srgb, var(--pluno-pa-muted) 72%, transparent);
2219
+ padding: 0;
2220
+ font: inherit;
2221
+ font-size: 10px;
2222
+ font-weight: 500;
2223
+ line-height: 1.2;
2224
+ cursor: pointer;
2225
+ }
2226
+ .pluno-pa-widget__share-prompt-disable:hover,
2227
+ .pluno-pa-widget__share-prompt-disable:focus-visible {
2228
+ color: var(--pluno-pa-muted);
2229
+ text-decoration: underline;
2230
+ }
2231
+ .pluno-pa-widget__share-dialog-backdrop {
2232
+ position: fixed;
2233
+ inset: 0;
2234
+ z-index: 2147483647;
2235
+ display: grid;
2236
+ place-items: center;
2237
+ padding: 18px;
2238
+ background: rgba(24, 24, 27, 0.28);
2239
+ font-family: var(--pluno-pa-font, ${M.fontFamily});
2240
+ color: var(--pluno-pa-text);
2241
+ }
2242
+ .pluno-pa-widget__share-dialog {
2243
+ --pluno-pa-share-paper: #fff9df;
2244
+ --pluno-pa-share-ink: #2c2a1e;
2245
+ --pluno-pa-share-muted: rgba(44, 42, 30, 0.66);
2246
+ --pluno-pa-share-rule: rgba(44, 42, 30, 0.24);
2247
+ --pluno-pa-share-highlight: color-mix(in srgb, var(--pluno-pa-accent) 22%, #fff9df);
2248
+ position: relative;
2249
+ isolation: isolate;
2250
+ width: min(390px, calc(100vw - 36px));
2251
+ max-height: min(650px, calc(100vh - 36px));
2252
+ display: flex;
2253
+ flex-direction: column;
2254
+ gap: 12px;
2255
+ border: 2px solid transparent;
2256
+ border-radius: 31px 25px 29px 23px / 23px 33px 22px 31px;
2257
+ background:
2258
+ linear-gradient(rgba(44, 42, 30, 0.045) 1px, transparent 1px),
2259
+ linear-gradient(90deg, rgba(44, 42, 30, 0.035) 1px, transparent 1px),
2260
+ var(--pluno-pa-share-paper);
2261
+ background-size: 26px 26px, 26px 26px, auto;
2262
+ color: var(--pluno-pa-share-ink);
2263
+ font-family: "Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Segoe Print", cursive;
2264
+ transform: rotate(-0.25deg);
2265
+ box-shadow: 0 24px 58px rgba(44, 42, 30, 0.22);
2266
+ padding: 14px;
2267
+ }
2268
+ .pluno-pa-widget__share-dialog::before,
2269
+ .pluno-pa-widget__share-dialog::after {
2270
+ content: "";
2271
+ position: absolute;
2272
+ inset: -3px;
2273
+ z-index: -1;
2274
+ border: 2px solid var(--pluno-pa-share-ink);
2275
+ border-radius: inherit;
2276
+ filter: url(#pluno-pa-scribble-wobble);
2277
+ pointer-events: none;
2278
+ }
2279
+ .pluno-pa-widget__share-dialog::after {
2280
+ inset: -7px -5px -4px -6px;
2281
+ opacity: 0.42;
2282
+ transform: rotate(1.6deg);
2283
+ filter: url(#pluno-pa-scribble-wobble-2);
2284
+ }
2285
+ .pluno-pa-widget__share-dialog header,
2286
+ .pluno-pa-widget__share-dialog footer {
2287
+ display: flex;
2288
+ align-items: center;
2289
+ justify-content: space-between;
2290
+ gap: 10px;
2291
+ }
2292
+ .pluno-pa-widget__share-dialog header strong {
2293
+ color: var(--pluno-pa-share-ink);
2294
+ font-size: 18px;
2295
+ line-height: 1.1;
2296
+ }
2297
+ .pluno-pa-widget__share-dialog header button {
2298
+ width: 30px;
2299
+ height: 30px;
2300
+ border: 2px solid var(--pluno-pa-share-ink);
2301
+ border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
2302
+ background: var(--pluno-pa-share-paper);
2303
+ color: var(--pluno-pa-share-ink);
2304
+ cursor: pointer;
2305
+ }
2306
+ .pluno-pa-widget__share-dialog-screenshot {
2307
+ position: relative;
2308
+ overflow: hidden;
2309
+ width: 100%;
2310
+ aspect-ratio: 16 / 10;
2311
+ max-height: 180px;
2312
+ border: 2px solid var(--pluno-pa-share-rule);
2313
+ border-radius: 18px 15px 17px 13px / 14px 18px 13px 17px;
2314
+ background: var(--pluno-pa-surface);
2315
+ }
2316
+ .pluno-pa-widget__share-dialog-screenshot img {
2317
+ width: 100%;
2318
+ height: 100%;
2319
+ display: block;
2320
+ object-fit: contain;
2321
+ filter: saturate(0.94) contrast(1.02);
2322
+ background: #0f0f10;
2323
+ }
2324
+ .pluno-pa-widget__share-dialog-step {
2325
+ display: flex;
2326
+ flex-direction: column;
2327
+ gap: 8px;
2328
+ }
2329
+ .pluno-pa-widget__share-dialog-step-header {
2330
+ display: flex;
2331
+ align-items: center;
2332
+ justify-content: space-between;
2333
+ gap: 10px;
2334
+ }
2335
+ .pluno-pa-widget__share-dialog-step-header strong,
2336
+ .pluno-pa-widget__share-dialog-step-title {
2337
+ color: var(--pluno-pa-share-ink);
2338
+ font-size: 15px;
2339
+ font-weight: 750;
2340
+ line-height: 1.2;
2341
+ }
2342
+ .pluno-pa-widget__share-dialog-status {
2343
+ min-height: 16px;
2344
+ margin: -2px 0 0;
2345
+ color: var(--pluno-pa-share-muted);
2346
+ font-size: 12px;
2347
+ line-height: 1.3;
2348
+ }
2349
+ .pluno-pa-widget__share-dialog-status[hidden] {
2350
+ display: none;
2351
+ }
2352
+ .pluno-pa-widget__share-dialog-copy {
2353
+ display: inline-flex;
2354
+ align-items: center;
2355
+ justify-content: center;
2356
+ min-height: 31px;
2357
+ border: 2px solid var(--pluno-pa-share-ink);
2358
+ border-radius: 41% 59% 44% 56% / 57% 43% 58% 42%;
2359
+ background: var(--pluno-pa-share-paper);
2360
+ color: var(--pluno-pa-share-ink);
2361
+ padding: 5px 10px;
2362
+ font-size: 13px;
2363
+ font-weight: 700;
2364
+ line-height: 1;
2365
+ transform: rotate(1deg);
2366
+ transition: opacity 120ms ease, transform 120ms ease;
2367
+ cursor: pointer;
2368
+ }
2369
+ .pluno-pa-widget__share-dialog-copy:hover {
2370
+ transform: translateY(0) rotate(-1deg);
2371
+ }
2372
+ .pluno-pa-widget__share-dialog-platforms {
2373
+ display: grid;
2374
+ grid-template-columns: repeat(3, minmax(0, 1fr));
2375
+ gap: 10px;
2376
+ padding-inline: 10px;
2377
+ }
2378
+ .pluno-pa-widget__share-dialog-platforms a {
2379
+ display: inline-flex;
2380
+ align-items: center;
2381
+ justify-content: center;
2382
+ width: 100%;
2383
+ min-height: 44px;
2384
+ border: 2px solid var(--pluno-pa-share-ink);
2385
+ border-radius: 47% 53% 45% 55% / 55% 45% 54% 46%;
2386
+ background: var(--pluno-pa-share-highlight);
2387
+ color: var(--pluno-pa-share-ink);
2388
+ font-size: 16px;
2389
+ font-weight: 800;
2390
+ text-decoration: none;
2391
+ transform: rotate(-1.5deg);
2392
+ }
2393
+ .pluno-pa-widget__share-dialog-platform-logo {
2394
+ width: 24px;
2395
+ height: 24px;
2396
+ display: block;
2397
+ overflow: visible;
2398
+ fill: none;
2399
+ stroke: currentColor;
2400
+ stroke-linecap: round;
2401
+ stroke-linejoin: round;
2402
+ stroke-width: 2.2;
2403
+ }
2404
+ .pluno-pa-widget__share-dialog-platforms a:nth-child(even) {
2405
+ transform: rotate(1.5deg);
2406
+ }
2407
+ .pluno-pa-widget__share-dialog-platforms a:hover {
2408
+ background: var(--pluno-pa-share-paper);
2409
+ color: var(--pluno-pa-accent);
2410
+ }
2411
+ .pluno-pa-widget__share-dialog-reward-link {
2412
+ display: inline-flex;
2413
+ align-self: flex-start;
2414
+ align-items: center;
2415
+ justify-content: center;
2416
+ gap: 5px;
2417
+ min-height: 34px;
2418
+ border: 2px solid var(--pluno-pa-share-ink);
2419
+ border-radius: 43% 57% 45% 55% / 56% 44% 57% 43%;
2420
+ background: var(--pluno-pa-share-highlight);
2421
+ color: var(--pluno-pa-share-ink);
2422
+ padding: 6px 12px;
2423
+ font-size: 13px;
2424
+ font-weight: 800;
2425
+ line-height: 1;
2426
+ text-decoration: none;
2427
+ transform: rotate(0.8deg);
2428
+ }
2429
+ .pluno-pa-widget__share-dialog-external-icon {
2430
+ width: 13px;
2431
+ height: 13px;
2432
+ display: block;
2433
+ fill: none;
2434
+ stroke: currentColor;
2435
+ stroke-linecap: round;
2436
+ stroke-linejoin: round;
2437
+ stroke-width: 2.25;
2438
+ }
2439
+ .pluno-pa-widget__share-dialog-reward-link:hover {
2440
+ background: var(--pluno-pa-share-paper);
2441
+ color: var(--pluno-pa-accent);
2442
+ transform: rotate(-0.8deg);
2443
+ }
1870
2444
  .pluno-pa-widget__composer {
1871
2445
  flex: 0 0 auto;
1872
2446
  margin: 0;
@@ -2030,13 +2604,15 @@ function We(t, e) {
2030
2604
  .pluno-pa-widget__composer-meta {
2031
2605
  display: flex;
2032
2606
  align-items: center;
2033
- justify-content: space-between;
2034
- gap: 10px;
2607
+ justify-content: center;
2608
+ column-gap: 0.35em;
2035
2609
  margin-top: 8px;
2036
2610
  color: var(--pluno-pa-faint);
2037
2611
  font: inherit;
2038
2612
  font-size: 11px;
2039
2613
  line-height: 1.2;
2614
+ flex-wrap: wrap;
2615
+ text-align: center;
2040
2616
  }
2041
2617
  .pluno-pa-widget__powered-by {
2042
2618
  color: inherit;
@@ -2048,8 +2624,6 @@ function We(t, e) {
2048
2624
  }
2049
2625
  .pluno-pa-widget__ai-disclaimer {
2050
2626
  color: inherit;
2051
- text-align: right;
2052
- white-space: nowrap;
2053
2627
  }
2054
2628
  .pluno-pa-widget__empty,
2055
2629
  .pluno-pa-widget__status,
@@ -2074,8 +2648,8 @@ function We(t, e) {
2074
2648
  padding: 0;
2075
2649
  }
2076
2650
  .pluno-pa-widget__character--empty {
2077
- width: 88px;
2078
- height: 88px;
2651
+ width: 96px;
2652
+ height: 96px;
2079
2653
  margin-bottom: -4px;
2080
2654
  }
2081
2655
  .pluno-pa-widget__empty-state--starter {
@@ -2233,7 +2807,7 @@ function We(t, e) {
2233
2807
  right: 16px;
2234
2808
  height: 36px;
2235
2809
  z-index: 3;
2236
- background-image: url('${ke}');
2810
+ background-image: url('${Oe}');
2237
2811
  background-repeat: repeat-x;
2238
2812
  background-size: 104px 36px;
2239
2813
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -2271,16 +2845,16 @@ function We(t, e) {
2271
2845
  font-size: 28px;
2272
2846
  }
2273
2847
  .pluno-pa-widget--scribble .pluno-pa-widget__character--empty {
2274
- width: 132px;
2275
- height: 132px;
2848
+ width: 160px;
2849
+ height: 160px;
2276
2850
  }
2277
2851
  .pluno-pa-widget--scribble .pluno-pa-widget__empty-state--starter .pluno-pa-widget__character--empty {
2278
- margin-bottom: -36px;
2852
+ margin-bottom: -42px;
2279
2853
  }
2280
2854
  .pluno-pa-widget--scribble .pluno-pa-widget__character--tool-group {
2281
- width: 50px;
2282
- height: 50px;
2283
- margin-top: -11px;
2855
+ width: 60px;
2856
+ height: 60px;
2857
+ margin-top: -14px;
2284
2858
  }
2285
2859
  .pluno-pa-widget--scribble .pluno-pa-widget__tool-group {
2286
2860
  align-items: center;
@@ -2305,13 +2879,22 @@ function We(t, e) {
2305
2879
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner {
2306
2880
  border-radius: var(--pluno-pa-scribble-wobble);
2307
2881
  }
2882
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body {
2883
+ position: relative;
2884
+ border-radius: var(--pluno-pa-scribble-wobble);
2885
+ }
2886
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
2887
+ position: relative;
2888
+ }
2308
2889
  .pluno-pa-widget--scribble .pluno-pa-widget__message--user,
2309
2890
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner,
2310
2891
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher,
2311
2892
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
2312
2893
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
2313
2894
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
2314
- .pluno-pa-widget--scribble .pluno-pa-widget__close {
2895
+ .pluno-pa-widget--scribble .pluno-pa-widget__close,
2896
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body,
2897
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button {
2315
2898
  isolation: isolate;
2316
2899
  border: 2px solid transparent;
2317
2900
  background: transparent;
@@ -2323,7 +2906,9 @@ function We(t, e) {
2323
2906
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before,
2324
2907
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
2325
2908
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
2326
- .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
2909
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
2910
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body::before,
2911
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
2327
2912
  content: "";
2328
2913
  position: absolute;
2329
2914
  inset: -2px;
@@ -2346,7 +2931,8 @@ function We(t, e) {
2346
2931
  }
2347
2932
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::before,
2348
2933
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::before,
2349
- .pluno-pa-widget--scribble .pluno-pa-widget__close::before {
2934
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
2935
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
2350
2936
  background: var(--pluno-pa-bg);
2351
2937
  }
2352
2938
  .pluno-pa-widget--scribble .pluno-pa-widget__composer-inner:focus-within {
@@ -2358,13 +2944,15 @@ function We(t, e) {
2358
2944
  .pluno-pa-widget--scribble .pluno-pa-widget__send,
2359
2945
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat,
2360
2946
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
2361
- .pluno-pa-widget--scribble .pluno-pa-widget__close {
2947
+ .pluno-pa-widget--scribble .pluno-pa-widget__close,
2948
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable) {
2362
2949
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
2363
2950
  }
2364
2951
  .pluno-pa-widget--scribble .pluno-pa-widget__send::after,
2365
2952
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after,
2366
2953
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
2367
- .pluno-pa-widget--scribble .pluno-pa-widget__close::after {
2954
+ .pluno-pa-widget--scribble .pluno-pa-widget__close::after,
2955
+ .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::after {
2368
2956
  content: "";
2369
2957
  position: absolute;
2370
2958
  inset: -3px;
@@ -2374,7 +2962,7 @@ function We(t, e) {
2374
2962
  filter: url(#pluno-pa-scribble-wobble-2);
2375
2963
  pointer-events: none;
2376
2964
  opacity: 0.6;
2377
- transform: rotate(12deg);
2965
+ transform: rotate(5deg);
2378
2966
  }
2379
2967
  .pluno-pa-widget--scribble .pluno-pa-widget__new-chat::after {
2380
2968
  transform: rotate(-10deg);
@@ -2410,10 +2998,14 @@ function We(t, e) {
2410
2998
  height: 48px;
2411
2999
  }
2412
3000
  .pluno-pa-widget--scribble .pluno-pa-widget__character--launcher {
3001
+ left: 5px;
3002
+ width: 44px;
3003
+ height: 44px;
2413
3004
  margin-top: 3px;
2414
3005
  }
2415
3006
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-input {
2416
3007
  margin-top: 2px;
3008
+ padding-left: 54px;
2417
3009
  }
2418
3010
  .pluno-pa-widget--scribble .pluno-pa-widget__launcher-drag-handle {
2419
3011
  top: -13px;
@@ -2437,7 +3029,7 @@ function We(t, e) {
2437
3029
  right: 12px;
2438
3030
  height: 22px;
2439
3031
  z-index: 1;
2440
- background-image: url('${ke}');
3032
+ background-image: url('${Oe}');
2441
3033
  background-repeat: repeat-x;
2442
3034
  background-size: 62px 21.5px;
2443
3035
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -2451,7 +3043,7 @@ function We(t, e) {
2451
3043
  }
2452
3044
  `, t.appendChild(n);
2453
3045
  }
2454
- async function kn() {
3046
+ async function Xn() {
2455
3047
  return document.body ? document.body : await new Promise((t) => {
2456
3048
  const e = new MutationObserver(() => {
2457
3049
  document.body && (e.disconnect(), t(document.body));
@@ -2459,62 +3051,95 @@ async function kn() {
2459
3051
  e.observe(document.documentElement, { childList: !0 });
2460
3052
  });
2461
3053
  }
2462
- function nt(t) {
3054
+ function ht(t) {
2463
3055
  return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
2464
3056
  }
2465
- function Sn(t) {
3057
+ function Zn(t) {
2466
3058
  try {
2467
- const e = window.localStorage.getItem(nt(t));
3059
+ const e = window.localStorage.getItem(ht(t));
2468
3060
  if (!e)
2469
- return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
3061
+ return Ze();
2470
3062
  const n = JSON.parse(e);
2471
3063
  return {
2472
3064
  isOpen: n.isOpen === !0,
2473
3065
  composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
2474
3066
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
2475
- launcherPosition: Pn(n.launcherPosition) ? n.launcherPosition : null
3067
+ launcherPosition: to(n.launcherPosition) ? n.launcherPosition : null,
3068
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-ot) : [],
3069
+ sharePromptsDisabled: n.sharePromptsDisabled === !0
2476
3070
  };
2477
3071
  } catch {
2478
- return { isOpen: !1, composerValue: "", openToolGroupKeys: [], launcherPosition: null };
3072
+ return Ze();
3073
+ }
3074
+ }
3075
+ async function Jn(t) {
3076
+ if (t.loadSharePromptsDisabled)
3077
+ return t.loadSharePromptsDisabled();
3078
+ try {
3079
+ return window.localStorage.getItem(at) === "true";
3080
+ } catch {
3081
+ return !1;
2479
3082
  }
2480
3083
  }
2481
- function Ln(t, e) {
3084
+ function Qn(t, e) {
3085
+ if (t.persistSharePromptsDisabled) {
3086
+ Promise.resolve(t.persistSharePromptsDisabled(e)).catch(() => {
3087
+ });
3088
+ return;
3089
+ }
2482
3090
  try {
2483
- window.localStorage.setItem(nt(t), JSON.stringify(e));
3091
+ e && window.localStorage.setItem(at, "true");
2484
3092
  } catch {
2485
3093
  return;
2486
3094
  }
2487
3095
  }
2488
- function Pn(t) {
3096
+ function Ze() {
3097
+ return {
3098
+ isOpen: !1,
3099
+ composerValue: "",
3100
+ openToolGroupKeys: [],
3101
+ launcherPosition: null,
3102
+ seenShareCandidateIds: [],
3103
+ sharePromptsDisabled: !1
3104
+ };
3105
+ }
3106
+ function eo(t, e) {
3107
+ try {
3108
+ window.localStorage.setItem(ht(t), JSON.stringify(e));
3109
+ } catch {
3110
+ return;
3111
+ }
3112
+ }
3113
+ function to(t) {
2489
3114
  if (!t || typeof t != "object")
2490
3115
  return !1;
2491
3116
  const e = t;
2492
3117
  return Number.isFinite(e.x) && Number.isFinite(e.y);
2493
3118
  }
2494
- const Ue = /* @__PURE__ */ new WeakSet();
2495
- function An(t) {
3119
+ const Je = /* @__PURE__ */ new WeakSet();
3120
+ function no(t) {
2496
3121
  return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
2497
3122
  }
2498
- function He(t) {
3123
+ function Qe(t) {
2499
3124
  const e = t.pathname.split("/");
2500
3125
  return e[e.length - 1] ?? "";
2501
3126
  }
2502
- function Tn(t, e) {
3127
+ function oo(t, e) {
2503
3128
  const n = new URL(t.src, document.baseURI);
2504
- return n.href === e.href || n.pathname === e.pathname ? !0 : He(n) === He(e);
3129
+ return n.href === e.href || n.pathname === e.pathname ? !0 : Qe(n) === Qe(e);
2505
3130
  }
2506
- class I extends EventTarget {
3131
+ class R extends EventTarget {
2507
3132
  constructor(e, n) {
2508
- super(), this.channelId = n, this.url = e, this.addPreviewListener(Et, () => {
2509
- this.readyState = I.OPEN, this.dispatchEvent(new Event("open"));
2510
- }), this.addPreviewListener(kt, (o) => {
3133
+ super(), this.channelId = n, this.url = e, this.addPreviewListener(Gt, () => {
3134
+ this.readyState = R.OPEN, this.dispatchEvent(new Event("open"));
3135
+ }), this.addPreviewListener($t, (o) => {
2511
3136
  const a = o;
2512
3137
  this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
2513
- }), this.addPreviewListener(St, () => {
2514
- this.readyState = I.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
2515
- }), this.addPreviewListener(Lt, (o) => {
3138
+ }), this.addPreviewListener(Ut, () => {
3139
+ this.readyState = R.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
3140
+ }), this.addPreviewListener(Wt, (o) => {
2516
3141
  const a = o;
2517
- this.readyState = I.CLOSED, this.dispatchEvent(
3142
+ this.readyState = R.CLOSED, this.dispatchEvent(
2518
3143
  new CloseEvent("close", {
2519
3144
  code: a.detail?.code ?? 1e3,
2520
3145
  reason: a.detail?.reason ?? "",
@@ -2522,7 +3147,7 @@ class I extends EventTarget {
2522
3147
  })
2523
3148
  ), this.cleanup();
2524
3149
  }), window.dispatchEvent(
2525
- new CustomEvent(Q(yt, this.channelId), {
3150
+ new CustomEvent(re(Ft, this.channelId), {
2526
3151
  detail: { socketId: this.socketId, url: e }
2527
3152
  })
2528
3153
  );
@@ -2537,28 +3162,28 @@ class I extends EventTarget {
2537
3162
  extensions = "";
2538
3163
  binaryType = "blob";
2539
3164
  bufferedAmount = 0;
2540
- readyState = I.CONNECTING;
2541
- socketId = Nn();
3165
+ readyState = R.CONNECTING;
3166
+ socketId = ao();
2542
3167
  listeners = /* @__PURE__ */ new Map();
2543
3168
  send(e) {
2544
- if (this.readyState !== I.OPEN)
3169
+ if (this.readyState !== R.OPEN)
2545
3170
  throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
2546
3171
  window.dispatchEvent(
2547
- new CustomEvent(Q(vt, this.channelId), {
3172
+ new CustomEvent(re(Bt, this.channelId), {
2548
3173
  detail: { socketId: this.socketId, data: typeof e == "string" ? e : String(e) }
2549
3174
  })
2550
3175
  );
2551
3176
  }
2552
3177
  close(e, n) {
2553
- this.readyState !== I.CLOSED && (this.readyState = I.CLOSING, window.dispatchEvent(
2554
- new CustomEvent(Q(Ct, this.channelId), {
3178
+ this.readyState !== R.CLOSED && (this.readyState = R.CLOSING, window.dispatchEvent(
3179
+ new CustomEvent(re(zt, this.channelId), {
2555
3180
  detail: { socketId: this.socketId, code: e, reason: n }
2556
3181
  })
2557
3182
  ), this.cleanup());
2558
3183
  }
2559
3184
  addPreviewListener(e, n) {
2560
- const o = Q(e, this.channelId), a = (i) => {
2561
- i.detail?.socketId === this.socketId && n(i);
3185
+ const o = re(e, this.channelId), a = (r) => {
3186
+ r.detail?.socketId === this.socketId && n(r);
2562
3187
  };
2563
3188
  this.listeners.set(o, a), window.addEventListener(o, a);
2564
3189
  }
@@ -2568,36 +3193,36 @@ class I extends EventTarget {
2568
3193
  this.listeners.clear();
2569
3194
  }
2570
3195
  }
2571
- function Nn() {
2572
- const t = window.sessionStorage.getItem(Ee);
3196
+ function ao() {
3197
+ const t = window.sessionStorage.getItem(Re);
2573
3198
  if (t)
2574
3199
  return t;
2575
3200
  const e = crypto.randomUUID();
2576
- return window.sessionStorage.setItem(Ee, e), e;
3201
+ return window.sessionStorage.setItem(Re, e), e;
2577
3202
  }
2578
- function Q(t, e) {
3203
+ function re(t, e) {
2579
3204
  return `${t}:${e}`;
2580
3205
  }
2581
- function In(t) {
3206
+ function ro(t) {
2582
3207
  const e = document.currentScript;
2583
3208
  if (e instanceof HTMLScriptElement)
2584
3209
  return [e];
2585
3210
  const n = new URL(t, document.baseURI).href, o = new URL(n);
2586
3211
  return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
2587
- (a) => a instanceof HTMLScriptElement && An(a) && Tn(a, o)
3212
+ (a) => a instanceof HTMLScriptElement && no(a) && oo(a, o)
2588
3213
  );
2589
3214
  }
2590
- function Rn(t) {
2591
- for (const e of In(t)) {
2592
- if (Ue.has(e) || e.dataset.plunoAutoMount === "false")
3215
+ function io(t) {
3216
+ for (const e of ro(t)) {
3217
+ if (Je.has(e) || e.dataset.plunoAutoMount === "false")
2593
3218
  continue;
2594
- Ue.add(e);
3219
+ Je.add(e);
2595
3220
  const n = e.dataset.plunoPreviewChannel;
2596
- Ut({
3221
+ rn({
2597
3222
  token: e.dataset.plunoToken,
2598
3223
  tokenEndpoint: e.dataset.plunoTokenEndpoint,
2599
3224
  backendUrl: e.dataset.plunoBackendUrl,
2600
- webSocketFactory: n ? Wt(n) : void 0,
3225
+ webSocketFactory: n ? an(n) : void 0,
2601
3226
  launcherLabel: e.dataset.plunoLauncherLabel,
2602
3227
  accentColor: e.dataset.plunoAccentColor,
2603
3228
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -2609,8 +3234,8 @@ function Rn(t) {
2609
3234
  });
2610
3235
  }
2611
3236
  }
2612
- Rn(import.meta.url);
3237
+ io(import.meta.url);
2613
3238
  export {
2614
- Wt as createProductAgentPreviewBridgeWebSocketFactory,
2615
- Ut as mountPlunoProductAgentWidget
3239
+ an as createProductAgentPreviewBridgeWebSocketFactory,
3240
+ rn as mountPlunoProductAgentWidget
2616
3241
  };