@pluno/product-agent-web 0.1.63 → 0.1.65

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,27 +1,27 @@
1
- import { PlunoProductAgent as So } from "./product-agent-sdk.js";
2
- const Eo = "#7c3aed", nt = "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", ot = "#2c2a1e", en = [253, 250, 241], tn = 3.5;
3
- function Rn(e) {
4
- const t = Mn(e);
5
- if (nn(Ge(t), en) >= tn)
1
+ import { PlunoProductAgent as qo } from "./product-agent-sdk.js";
2
+ const jo = "#7c3aed", pt = "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", st = "#2c2a1e", fn = [253, 250, 241], wn = 3.5;
3
+ function Kn(e) {
4
+ const t = Yn(e);
5
+ if (bn(Ke(t), fn) >= wn)
6
6
  return t;
7
- let n = Ge(t);
8
- const i = Ge(ot);
7
+ let o = Ke(t);
8
+ const i = Ke(st);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (n = Io(n, i, 0.22), nn(n, en) >= tn)
11
- return At(n);
12
- return At(n);
10
+ if (o = Yo(o, i, 0.22), bn(o, fn) >= wn)
11
+ return Ft(o);
12
+ return Ft(o);
13
13
  }
14
- function ko() {
15
- let o = "M 280 120", n = !1, i = 0;
14
+ function Vo() {
15
+ let n = "M 280 120", o = !1, i = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
- const l = (i % 3 - 1) * 18, p = n ? 280 - l : 1020 + l;
18
- o += ` L ${p} ${r}`, n = !n, i += 1;
17
+ const l = (i % 3 - 1) * 18, p = o ? 280 - l : 1020 + l;
18
+ n += ` L ${p} ${r}`, o = !o, i += 1;
19
19
  }
20
- return o;
20
+ return n;
21
21
  }
22
- function Lo(e) {
23
- const t = Mn(e), o = Nt(Ge(t));
24
- return o > 0.86 ? {
22
+ function Ko(e) {
23
+ const t = Yn(e), n = Ht(Ke(t));
24
+ return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
27
27
  bottom: "#e7e7e7",
@@ -32,7 +32,7 @@ function Lo(e) {
32
32
  highlight: "#ffffff",
33
33
  inner: "#f4f4f4",
34
34
  shadow: "#9d9d9d"
35
- } : o < 0.05 ? {
35
+ } : n < 0.05 ? {
36
36
  top: "#3d3d3d",
37
37
  middle: "#171717",
38
38
  bottom: "#030303",
@@ -44,179 +44,179 @@ function Lo(e) {
44
44
  inner: "#4b4b4b",
45
45
  shadow: "#000000"
46
46
  } : {
47
- top: J(t, 0.28, -0.03),
48
- middle: J(t, 0.08, 0.04),
49
- bottom: J(t, -0.1, 0.02),
50
- edgeStart: J(t, 0.08, 0.08),
51
- edgeMiddle: J(t, -0.08, 0.08),
52
- edgeEnd: J(t, -0.18, 0.05),
53
- glow: J(t, 0.32, -0.12),
54
- highlight: J(t, 0.38, -0.18),
55
- inner: J(t, 0.24, -0.1),
56
- shadow: J(t, -0.25, -0.08)
47
+ top: ne(t, 0.28, -0.03),
48
+ middle: ne(t, 0.08, 0.04),
49
+ bottom: ne(t, -0.1, 0.02),
50
+ edgeStart: ne(t, 0.08, 0.08),
51
+ edgeMiddle: ne(t, -0.08, 0.08),
52
+ edgeEnd: ne(t, -0.18, 0.05),
53
+ glow: ne(t, 0.32, -0.12),
54
+ highlight: ne(t, 0.38, -0.18),
55
+ inner: ne(t, 0.24, -0.1),
56
+ shadow: ne(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Mn(e) {
59
+ function Yn(e) {
60
60
  const t = e.trim();
61
- return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => o + o).join("").toLowerCase()}` : Eo;
61
+ return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[0-9a-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => n + n).join("").toLowerCase()}` : jo;
62
62
  }
63
- function Ge(e) {
63
+ function Ke(e) {
64
64
  return [
65
65
  Number.parseInt(e.slice(1, 3), 16),
66
66
  Number.parseInt(e.slice(3, 5), 16),
67
67
  Number.parseInt(e.slice(5, 7), 16)
68
68
  ];
69
69
  }
70
- function At([e, t, o]) {
71
- const n = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
- return `#${n(e)}${n(t)}${n(o)}`;
70
+ function Ft([e, t, n]) {
71
+ const o = (i) => Math.max(0, Math.min(255, Math.round(i))).toString(16).padStart(2, "0");
72
+ return `#${o(e)}${o(t)}${o(n)}`;
73
73
  }
74
- function Nt([e, t, o]) {
75
- const n = (i) => {
74
+ function Ht([e, t, n]) {
75
+ const o = (i) => {
76
76
  const r = i / 255;
77
77
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
- return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
79
+ return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
80
80
  }
81
- function nn(e, t) {
82
- const o = Nt(e), n = Nt(t), [i, r] = o > n ? [o, n] : [n, o];
81
+ function bn(e, t) {
82
+ const n = Ht(e), o = Ht(t), [i, r] = n > o ? [n, o] : [o, n];
83
83
  return (i + 0.05) / (r + 0.05);
84
84
  }
85
- function Io(e, t, o) {
86
- const n = Tt(o);
85
+ function Yo(e, t, n) {
86
+ const o = Wt(n);
87
87
  return [
88
- e[0] + (t[0] - e[0]) * n,
89
- e[1] + (t[1] - e[1]) * n,
90
- e[2] + (t[2] - e[2]) * n
88
+ e[0] + (t[0] - e[0]) * o,
89
+ e[1] + (t[1] - e[1]) * o,
90
+ e[2] + (t[2] - e[2]) * o
91
91
  ];
92
92
  }
93
- function J(e, t, o) {
94
- const [n, i, r] = Ao(Ge(e));
95
- return At(No(n, Tt(i + o), Tt(r + t)));
93
+ function ne(e, t, n) {
94
+ const [o, i, r] = Xo(Ke(e));
95
+ return Ft(Zo(o, Wt(i + n), Wt(r + t)));
96
96
  }
97
- function Ao([e, t, o]) {
98
- const n = e / 255, i = t / 255, r = o / 255, l = Math.max(n, i, r), p = Math.min(n, i, r), d = (l + p) / 2;
97
+ function Xo([e, t, n]) {
98
+ const o = e / 255, i = t / 255, r = n / 255, l = Math.max(o, i, r), p = Math.min(o, i, r), d = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, d];
101
- const u = l - p, c = d > 0.5 ? u / (2 - l - p) : u / (l + p);
102
- return [(l === n ? (i - r) / u + (i < r ? 6 : 0) : l === i ? (r - n) / u + 2 : (n - i) / u + 4) / 6, c, d];
101
+ const c = l - p, u = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
+ return [(l === o ? (i - r) / c + (i < r ? 6 : 0) : l === i ? (r - o) / c + 2 : (o - i) / c + 4) / 6, u, d];
103
103
  }
104
- function No(e, t, o) {
104
+ function Zo(e, t, n) {
105
105
  if (t === 0)
106
- return [o * 255, o * 255, o * 255];
107
- const n = o < 0.5 ? o * (1 + t) : o + t - o * t, i = 2 * o - n;
106
+ return [n * 255, n * 255, n * 255];
107
+ const o = n < 0.5 ? n * (1 + t) : n + t - n * t, i = 2 * n - o;
108
108
  return [
109
- vt(i, n, e + 1 / 3) * 255,
110
- vt(i, n, e) * 255,
111
- vt(i, n, e - 1 / 3) * 255
109
+ At(i, o, e + 1 / 3) * 255,
110
+ At(i, o, e) * 255,
111
+ At(i, o, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function vt(e, t, o) {
115
- let n = o;
116
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
114
+ function At(e, t, n) {
115
+ let o = n;
116
+ return o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? e + (t - e) * 6 * o : o < 1 / 2 ? t : o < 2 / 3 ? e + (t - e) * (2 / 3 - o) * 6 : e;
117
117
  }
118
- function Tt(e) {
118
+ function Wt(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const zn = "suggest_share_on_socials";
122
- function To(e) {
121
+ const Xn = "suggest_share_on_socials";
122
+ function Jo(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
- const o = e[t];
125
- if (o.role !== "tool" || o.toolName !== zn)
124
+ const n = e[t];
125
+ if (n.role !== "tool" || n.toolName !== Xn)
126
126
  continue;
127
- const n = on(e, t, "assistant");
128
- if (!n)
127
+ const o = _n(e, t, "assistant");
128
+ if (!o)
129
129
  return null;
130
- const i = on(e, n.index, "user");
130
+ const i = _n(e, o.index, "user");
131
131
  return i ? {
132
- id: `share:${o.callId ?? o.id}`,
132
+ id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: i.content,
134
- assistantAnswer: n.content
134
+ assistantAnswer: o.content
135
135
  } : null;
136
136
  }
137
137
  return null;
138
138
  }
139
- async function Po(e) {
140
- const t = await Do(e);
139
+ async function Qo(e) {
140
+ const t = await ei(e);
141
141
  if (!navigator.clipboard || typeof ClipboardItem > "u")
142
142
  throw new Error("Image copy is not supported in this browser. Download the screenshot instead.");
143
143
  await navigator.clipboard.write([new ClipboardItem({ [t.type || "image/png"]: t })]);
144
144
  }
145
- function on(e, t, o) {
146
- for (let n = t - 1; n >= 0; n -= 1) {
147
- const i = e[n];
148
- if (i.role === o && i.content.trim())
149
- return { index: n, content: i.content.trim() };
145
+ function _n(e, t, n) {
146
+ for (let o = t - 1; o >= 0; o -= 1) {
147
+ const i = e[o];
148
+ if (i.role === n && i.content.trim())
149
+ return { index: o, content: i.content.trim() };
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Do(e) {
153
+ async function ei(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const Ro = "https://app.pluno.ai", Mo = "/api/product-agent/embed/active-users", zo = 1800, Oo = 15e3, Uo = 250, Bo = 1e3, Fo = 3e4;
157
- function Ho(e, t = {}) {
158
- let o = !1, n = null, i = null, r = null;
156
+ const ti = "https://app.pluno.ai", ni = "/api/product-agent/embed/active-users", oi = 1800, ii = 15e3, ai = 250, ri = 1e3, li = 3e4;
157
+ function pi(e, t = {}) {
158
+ let n = !1, o = null, i = null, r = null;
159
159
  const l = () => {
160
160
  r !== null && (window.clearInterval(r), r = null);
161
- }, p = (c) => {
162
- o || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
- u();
164
- }, $o(c)));
165
- }, d = (c) => {
166
- if (l(), n === null) {
167
- n = c, e(c);
161
+ }, p = (u) => {
162
+ n || (i !== null && window.clearTimeout(i), i = window.setTimeout(() => {
163
+ c();
164
+ }, ci(u)));
165
+ }, d = (u) => {
166
+ if (l(), o === null) {
167
+ o = u, e(u);
168
168
  return;
169
169
  }
170
- const g = n, S = performance.now();
170
+ const m = o, E = performance.now();
171
171
  r = window.setInterval(() => {
172
- if (o) {
172
+ if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const b = Math.min(1, (performance.now() - S) / zo);
177
- n = Math.round(g + (c - g) * qo(b)), e(n), b >= 1 && (n = c, e(c), l());
178
- }, Uo);
179
- }, u = async () => {
176
+ const v = Math.min(1, (performance.now() - E) / oi);
177
+ o = Math.round(m + (u - m) * ui(v)), e(o), v >= 1 && (o = u, e(u), l());
178
+ }, ai);
179
+ }, c = async () => {
180
180
  try {
181
- const c = await Wo(t);
182
- if (o)
181
+ const u = await si(t);
182
+ if (n)
183
183
  return;
184
- d(c.count), p(c.refreshAfterMs);
184
+ d(u.count), p(u.refreshAfterMs);
185
185
  } catch {
186
- p(Oo);
186
+ p(ii);
187
187
  }
188
188
  };
189
- return u(), () => {
190
- o = !0, i !== null && window.clearTimeout(i), l();
189
+ return c(), () => {
190
+ n = !0, i !== null && window.clearTimeout(i), l();
191
191
  };
192
192
  }
193
- async function Wo(e) {
193
+ async function si(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const o = await (e.fetcher ?? fetch)(new URL(Mo, Go(e.backendUrl ?? Ro)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(ni, di(e.backendUrl ?? ti)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
- if (!o.ok)
200
+ if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const n = await o.json(), i = an(n.count), r = an(n.refreshAfterMs ?? n.refresh_after_ms);
202
+ const o = await n.json(), i = xn(o.count), r = xn(o.refreshAfterMs ?? o.refresh_after_ms);
203
203
  if (i === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: i, refreshAfterMs: r };
206
206
  }
207
- function an(e) {
207
+ function xn(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Go(e) {
210
+ function di(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function $o(e) {
214
- return Math.min(Fo, Math.max(Bo, e));
213
+ function ci(e) {
214
+ return Math.min(li, Math.max(ri, e));
215
215
  }
216
- function qo(e) {
216
+ function ui(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-connect", Yo = "product-agent:sdk-preview-socket-send", Xo = "product-agent:sdk-preview-socket-close", Zo = "product-agent:sdk-preview-socket-open", Jo = "product-agent:sdk-preview-socket-message", Qo = "product-agent:sdk-preview-socket-error", ei = "product-agent:sdk-preview-socket-closed", rn = "product-agent:sdk-preview-socket-id", ti = "data-pluno-sdk-preview-channel", ni = "product-agent:preview-diagnostic", Un = "pluno.productAgent.sharePromptsDisabled", oi = 3, ln = 'dialog[open], [aria-modal="true"], [role="dialog"]', ii = 400, ai = 5e3, ri = 500, pn = "Close the page's popup to chat", li = "No recent chats for this page yet.", Q = {
219
+ const Zn = 100, gi = 1e4, hi = 5e3, mi = "product-agent:sdk-preview-socket-connect", fi = "product-agent:sdk-preview-socket-send", wi = "product-agent:sdk-preview-socket-close", bi = "product-agent:sdk-preview-socket-open", _i = "product-agent:sdk-preview-socket-message", xi = "product-agent:sdk-preview-socket-error", yi = "product-agent:sdk-preview-socket-closed", yn = "product-agent:sdk-preview-socket-id", vi = "data-pluno-sdk-preview-channel", Ci = "product-agent:preview-diagnostic", Jn = "pluno.productAgent.sharePromptsDisabled", Si = 3, vn = 'dialog[open], [aria-modal="true"], [role="dialog"]', Ei = 400, ki = 5e3, Li = 500, Cn = "Close the page's popup to chat", Pi = "No recent chats for this page yet.", oe = {
220
220
  launcherLabel: "Ask for anything...",
221
221
  accentColor: "#7c3aed",
222
222
  colorScheme: "light",
@@ -224,7 +224,7 @@ const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-conne
224
224
  scribbleStyle: !1,
225
225
  position: "bottom-right",
226
226
  movableLauncher: !1
227
- }, pi = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', sn = "pluno-pa-scribble-font", Bn = 190, Fn = 41, dn = 22, si = 16, di = 24, ci = 1, ui = 48, gi = 420, hi = 520, mi = 0.24, fi = 680, bi = 800, wi = 0.76, W = 8, Pt = 50, Hn = "http://www.w3.org/2000/svg", cn = 26, un = 8, _i = 36, gn = [
227
+ }, Ii = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Sn = "pluno-pa-scribble-font", Qn = 190, eo = 41, En = 22, Ai = 16, Ni = 24, Ti = 1, Di = 48, Jt = 420, Ri = 520, zi = 0.24, Qt = 680, Mi = 800, Oi = 0.76, I = 8, Ce = 50, to = "http://www.w3.org/2000/svg", Gt = 26, $t = 8, Bi = 36, qt = 16, Ui = 4, kn = [
228
228
  {
229
229
  ellipseCx: "17.5",
230
230
  ellipseCy: "24.5",
@@ -261,20 +261,20 @@ const On = 100, jo = 1e4, Vo = 5e3, Ko = "product-agent:sdk-preview-socket-conne
261
261
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
262
262
  pathStrokeWidth: "2.45"
263
263
  }
264
- ], xi = 11, yi = 13, hn = 4, vi = 10, Ci = 40, Si = "movable-launcher-position-v2", Wn = "pluno-pa-widget-styles", Gn = "data-pluno-pa-widget-styles";
265
- let mn = 0;
266
- function Ei(e) {
267
- return (t) => new re(t, e);
264
+ ], Fi = 11, Hi = 13, jt = 4, no = 10, oo = 40, Wi = "movable-launcher-position-v2", io = "pluno-pa-widget-styles", ao = "data-pluno-pa-widget-styles";
265
+ let Ln = 0;
266
+ function Gi(e) {
267
+ return (t) => new se(t, e);
268
268
  }
269
- async function ki(e = {}) {
269
+ async function $i(e = {}) {
270
270
  const t = {
271
- launcherLabel: e.launcherLabel ?? Q.launcherLabel,
272
- accentColor: e.accentColor ?? Q.accentColor,
273
- colorScheme: e.colorScheme ?? Q.colorScheme,
274
- fontFamily: e.fontFamily ?? Q.fontFamily,
275
- scribbleStyle: e.scribbleStyle ?? Q.scribbleStyle,
276
- position: e.position ?? Q.position,
277
- movableLauncher: e.movableLauncher ?? Q.movableLauncher,
271
+ launcherLabel: e.launcherLabel ?? oe.launcherLabel,
272
+ accentColor: e.accentColor ?? oe.accentColor,
273
+ colorScheme: e.colorScheme ?? oe.colorScheme,
274
+ fontFamily: e.fontFamily ?? oe.fontFamily,
275
+ scribbleStyle: e.scribbleStyle ?? oe.scribbleStyle,
276
+ position: e.position ?? oe.position,
277
+ movableLauncher: e.movableLauncher ?? oe.movableLauncher,
278
278
  token: e.token,
279
279
  tokenProvider: e.tokenProvider,
280
280
  tokenEndpoint: e.tokenEndpoint,
@@ -308,7 +308,7 @@ async function ki(e = {}) {
308
308
  showLauncherMinimizeButton: e.showLauncherMinimizeButton === !0,
309
309
  taskNotifications: e.taskNotifications
310
310
  };
311
- K(
311
+ J(
312
312
  "web-sdk.widget",
313
313
  "Mounting widget with merged options",
314
314
  {
@@ -323,41 +323,41 @@ async function ki(e = {}) {
323
323
  initialStarterPromptCount: t.initialStarterPrompts?.length ?? 0
324
324
  }
325
325
  );
326
- const o = document.createElement("div");
327
- o.className = "pluno-pa-widget-host", o.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && o.setAttribute(
328
- ti,
326
+ const n = document.createElement("div");
327
+ n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), t.sdkPreviewChannelId && n.setAttribute(
328
+ vi,
329
329
  t.sdkPreviewChannelId
330
330
  );
331
- const n = o.attachShadow({ mode: "open" }), i = document.createElement("div");
331
+ const o = n.attachShadow({ mode: "open" }), i = document.createElement("div");
332
332
  i.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, i.setAttribute("data-pluno-product-agent-ui-root", "widget");
333
- let r = fn(
333
+ let r = Pn(
334
334
  t.accentColor,
335
335
  t.scribbleStyle
336
336
  );
337
- Ki(
337
+ ga(
338
338
  i,
339
339
  t.launcherLabel,
340
340
  r,
341
341
  t.movableLauncher,
342
342
  t.showLauncherMinimizeButton
343
- ), n.appendChild(i);
344
- const l = $a(t);
345
- let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null;
346
- i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), xe(
343
+ ), o.appendChild(i);
344
+ const l = sr(t);
345
+ let p = t.movableLauncher ? l.launcherPosition : null, d = p !== null, c = l.panelSize, u = null;
346
+ i.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && i.classList.add("pluno-pa-widget--scribble"), t.initialDisplayState === "minimized" && (i.classList.add("pluno-pa-widget--minimized"), ve(
347
347
  i,
348
- Ct(
348
+ Tt(
349
349
  i,
350
350
  p,
351
351
  t.position
352
352
  )
353
- )), Nn(n, t.accentColor), bn(i, r, {
353
+ )), $n(o, t.accentColor), In(i, r, {
354
354
  accentColor: t.accentColor,
355
355
  colorScheme: t.colorScheme,
356
356
  fontFamily: t.fontFamily,
357
357
  scribbleStyle: t.scribbleStyle
358
358
  });
359
- const u = await Ga(), c = u.ownerDocument;
360
- u.appendChild(o), K(
359
+ const m = await pr(), E = m.ownerDocument;
360
+ m.appendChild(n), J(
361
361
  "web-sdk.widget",
362
362
  "Applied initial widget appearance",
363
363
  {
@@ -367,78 +367,82 @@ async function ki(e = {}) {
367
367
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
368
368
  }
369
369
  );
370
- const g = i.querySelector(
370
+ const v = i.querySelector(
371
371
  ".pluno-pa-widget__launcher"
372
- ), S = i.querySelector(
372
+ ), z = i.querySelector(
373
373
  ".pluno-pa-widget__launcher-drag-handle"
374
374
  ), b = i.querySelector(
375
375
  ".pluno-pa-widget__launcher-input"
376
- ), H = i.querySelector(
376
+ ), g = i.querySelector(
377
377
  ".pluno-pa-widget__launcher-minimize"
378
- ), k = i.querySelector(".pluno-pa-widget__panel"), y = i.querySelector(
378
+ ), w = i.querySelector(".pluno-pa-widget__panel"), h = i.querySelector(
379
+ ".pluno-pa-widget__scribble-spirals--panel"
380
+ ), P = Array.from(
381
+ i.querySelectorAll(".pluno-pa-widget__resize-handle")
382
+ ), A = i.querySelector(
379
383
  ".pluno-pa-widget__close"
380
- ), v = i.querySelector(
384
+ ), k = i.querySelector(
381
385
  ".pluno-pa-widget__composer"
382
- ), h = i.querySelector(
386
+ ), F = i.querySelector(
383
387
  ".pluno-pa-widget__attachment-error"
384
- ), N = i.querySelector(
388
+ ), H = i.querySelector(
385
389
  ".pluno-pa-widget__billing-status"
386
- ), D = i.querySelector(
390
+ ), $ = i.querySelector(
387
391
  ".pluno-pa-widget__attachments"
388
- ), L = i.querySelector(
392
+ ), Q = i.querySelector(
389
393
  ".pluno-pa-widget__attachment-input"
390
- ), Pe = i.querySelector(
394
+ ), ze = i.querySelector(
391
395
  ".pluno-pa-widget__attach"
392
- ), f = i.querySelector(
396
+ ), x = i.querySelector(
393
397
  ".pluno-pa-widget__input"
394
- ), R = i.querySelector(
398
+ ), de = i.querySelector(
395
399
  ".pluno-pa-widget__send"
396
- ), ce = i.querySelector(
400
+ ), Ye = i.querySelector(
397
401
  ".pluno-pa-widget__top-actions"
398
- ), ue = i.querySelector(
402
+ ), X = i.querySelector(
399
403
  ".pluno-pa-widget__history"
400
- ), ye = i.querySelector(
404
+ ), C = i.querySelector(
401
405
  ".pluno-pa-widget__history-panel"
402
- ), G = i.querySelector(
406
+ ), T = i.querySelector(
403
407
  ".pluno-pa-widget__history-list"
404
- ), $e = i.querySelector(
408
+ ), Se = i.querySelector(
405
409
  ".pluno-pa-widget__history-close"
406
- ), Y = i.querySelector(
410
+ ), q = i.querySelector(
407
411
  ".pluno-pa-widget__history-status"
408
- ), x = i.querySelector(
412
+ ), R = i.querySelector(
409
413
  ".pluno-pa-widget__timeline-jump"
410
- ), z = i.querySelector(
414
+ ), D = i.querySelector(
411
415
  ".pluno-pa-widget__active-users-counter"
412
- ), I = i.querySelector(
416
+ ), N = i.querySelector(
413
417
  ".pluno-pa-widget__timeline"
414
- ), $ = i.querySelector(
418
+ ), ht = i.querySelector(
415
419
  ".pluno-pa-widget__timeline-bottom-sentinel"
416
- ), A = i.querySelector(
420
+ ), Me = i.querySelector(
417
421
  ".pluno-pa-widget__notify-suggestion"
418
- ), T = i.querySelector(
422
+ ), vo = i.querySelector(
419
423
  ".pluno-pa-widget__notify-suggestion-enable"
420
- ), ge = i.querySelector(
424
+ ), Co = i.querySelector(
421
425
  ".pluno-pa-widget__notify-suggestion-later"
422
- ), ao = i.querySelector(
426
+ ), So = i.querySelector(
423
427
  ".pluno-pa-widget__notify-suggestion-never"
424
428
  );
425
- if (!g || !b || !k || !y || !v || !h || !N || !D || !L || !Pe || !f || !R || !ce || !ue || !ye || !G || !$e || !Y || !x || !z || !I || !$)
429
+ if (!v || !b || !w || !A || !k || !F || !H || !$ || !Q || !ze || !x || !de || !Ye || !X || !C || !T || !Se || !q || !R || !D || !N || !ht)
426
430
  throw new Error("Failed to mount Pluno widget");
427
- if (t.movableLauncher && !S)
431
+ if (t.movableLauncher && !z)
428
432
  throw new Error("Failed to mount Pluno widget drag handle");
429
- vn(b), vn(f);
430
- let B = [], ie = null;
431
- const ve = () => {
432
- ga(
433
- D,
434
- B,
433
+ Mn(b), Mn(x);
434
+ let W = [], le = null;
435
+ const Ee = () => {
436
+ Ta(
437
+ $,
438
+ W,
435
439
  (a) => {
436
- B = B.filter(
440
+ W = W.filter(
437
441
  (s, _) => _ !== a
438
- ), ve(), F(w.getState()), q();
442
+ ), Ee(), G(y.getState()), j();
439
443
  }
440
444
  );
441
- }, ro = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
445
+ }, Eo = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
442
446
  if (!t.tokenEndpoint)
443
447
  throw new Error("Pluno widget requires token or tokenEndpoint");
444
448
  const a = await fetch(t.tokenEndpoint, {
@@ -456,15 +460,15 @@ async function ki(e = {}) {
456
460
  if (!s.token)
457
461
  throw new Error("Pluno token endpoint did not return a token");
458
462
  return s.token;
459
- }), lo = window.fetch.bind(window);
460
- let w;
461
- w = await So.init({
463
+ }), ko = window.fetch.bind(window);
464
+ let y;
465
+ y = await qo.init({
462
466
  token: t.token,
463
- tokenProvider: ro,
467
+ tokenProvider: Eo,
464
468
  backendUrl: t.backendUrl,
465
469
  metadata: () => ({
466
470
  ...t.metadata ?? {},
467
- ...!w.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
471
+ ...!y.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
468
472
  }),
469
473
  initialStarterPrompts: t.initialStarterPrompts,
470
474
  clientId: t.clientId,
@@ -474,118 +478,119 @@ async function ki(e = {}) {
474
478
  prepareAttachmentUpload: t.prepareAttachmentUpload,
475
479
  autoConnect: t.loginRequired || t.signupRequired ? !1 : void 0
476
480
  });
477
- const lt = new Set(l.openToolGroupKeys), Ce = new Set(
481
+ const mt = new Set(l.openToolGroupKeys), ke = new Set(
478
482
  l.seenShareCandidateIds
479
- ), qe = new Set(Ce);
480
- let pt = l.sharePromptsDisabled || await qa(t), V = null, Se = !1, he = !1, me = {
483
+ ), Xe = new Set(ke);
484
+ let ft = l.sharePromptsDisabled || await dr(t), Z = null, Le = !1, fe = !1, we = {
481
485
  enabled: !0
482
- }, fe = 0, Ft = "", le = !1, ae = !1, pe = [], st = null, De = null;
483
- const X = (a, s) => {
484
- me = { enabled: a, reason: s };
485
- }, Z = () => {
486
- x.hidden = !0;
487
- }, po = () => {
488
- x.hidden = !1;
489
- }, so = (a = "jump") => {
490
- X(!0, a), Z(), We(I, () => me.enabled), fe = I.scrollTop;
491
- }, be = () => {
492
- if (ue.hidden = t.loginRequired, ye.hidden = !le, ue.setAttribute("aria-expanded", String(le)), G.classList.toggle(
486
+ }, be = 0, nn = "", ce = !1, pe = !1, ue = [], wt = null, Oe = null;
487
+ const ee = (a, s) => {
488
+ we = { enabled: a, reason: s };
489
+ }, te = () => {
490
+ R.hidden = !0;
491
+ }, Lo = () => {
492
+ R.hidden = !1;
493
+ }, Po = (a = "jump") => {
494
+ ee(!0, a), te(), Ve(N, () => we.enabled), be = N.scrollTop;
495
+ }, _e = () => {
496
+ if (X.hidden = t.loginRequired, C.hidden = !ce, X.setAttribute("aria-expanded", String(ce)), T.classList.toggle(
493
497
  "pluno-pa-widget__history-list--center",
494
- ae && pe.length === 0
495
- ), G.replaceChildren(), ae && pe.length === 0) {
498
+ pe && ue.length === 0
499
+ ), T.replaceChildren(), pe && ue.length === 0) {
496
500
  const a = document.createElement("p");
497
- a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", G.appendChild(a);
501
+ a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", T.appendChild(a);
498
502
  }
499
- for (const a of pe) {
503
+ for (const a of ue) {
500
504
  const s = document.createElement("button");
501
- s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = ae;
505
+ s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = pe;
502
506
  const _ = document.createElement("span");
503
- _.className = "pluno-pa-widget__history-item-title", _.textContent = qi(a);
504
- const E = document.createElement("time");
505
- E.className = "pluno-pa-widget__history-time", E.dateTime = a.lastActiveAt, E.textContent = Vi(
507
+ _.className = "pluno-pa-widget__history-item-title", _.textContent = da(a);
508
+ const L = document.createElement("time");
509
+ L.className = "pluno-pa-widget__history-time", L.dateTime = a.lastActiveAt, L.textContent = ua(
506
510
  a.lastActiveAt,
507
511
  Date.now()
508
512
  );
509
- const P = document.createElement("small");
510
- P.className = "pluno-pa-widget__history-path", P.textContent = ji(a), s.append(_, E, P), s.addEventListener("click", () => {
511
- le = !1, De = null, be(), X(!0, "newSession"), Z(), w.loadSession(a.id), F(w.getState());
512
- }), G.appendChild(s);
513
+ const M = document.createElement("small");
514
+ M.className = "pluno-pa-widget__history-path", M.textContent = ca(a), s.append(_, L, M), s.addEventListener("click", () => {
515
+ ce = !1, Oe = null, _e(), ee(!0, "newSession"), te(), y.loadSession(a.id), G(y.getState());
516
+ }), T.appendChild(s);
513
517
  }
514
- if (ae && pe.length > 0) {
518
+ if (pe && ue.length > 0) {
515
519
  const a = document.createElement("p");
516
- a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", G.appendChild(a);
520
+ a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", T.appendChild(a);
517
521
  }
518
- Y.textContent = De ?? (!ae && pe.length === 0 ? "No recent chats for this page yet." : ""), Y.hidden = Y.textContent.length === 0;
519
- }, Ht = async (a) => {
520
- if (!ae) {
521
- ae = !0, De = null, be();
522
+ q.textContent = Oe ?? (!pe && ue.length === 0 ? "No recent chats for this page yet." : ""), q.hidden = q.textContent.length === 0;
523
+ }, on = async (a) => {
524
+ if (!pe) {
525
+ pe = !0, Oe = null, _e();
522
526
  try {
523
- const s = await w.listSessions({ cursor: a, limit: 20 });
524
- pe = a ? [...pe, ...s.sessions] : s.sessions, st = s.nextCursor;
527
+ const s = await y.listSessions({ cursor: a, limit: 20 });
528
+ ue = a ? [...ue, ...s.sessions] : s.sessions, wt = s.nextCursor;
525
529
  } catch (s) {
526
- K(
530
+ J(
527
531
  "web-sdk.widget",
528
532
  "Failed to load session history",
529
533
  {
530
534
  message: s instanceof Error ? s.message : String(s)
531
535
  }
532
- ), De = li;
536
+ ), Oe = Pi;
533
537
  } finally {
534
- ae = !1, be();
538
+ pe = !1, _e();
535
539
  }
536
540
  }
537
- }, co = () => {
538
- !st || ae || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && Ht(st);
539
- }, uo = () => {
540
- Se || typeof document > "u" || (Nn(n, t.accentColor), o.isConnected || c.body?.appendChild(o));
541
- }, Wt = new MutationObserver(uo);
542
- Wt.observe(c.documentElement, {
541
+ }, Io = () => {
542
+ !wt || pe || T.scrollHeight - T.scrollTop - T.clientHeight <= 24 && on(wt);
543
+ }, Ao = () => {
544
+ Le || typeof document > "u" || ($n(o, t.accentColor), n.isConnected || E.body?.appendChild(n));
545
+ }, an = new MutationObserver(Ao);
546
+ an.observe(E.documentElement, {
543
547
  childList: !0,
544
548
  subtree: !0
545
549
  });
546
- const dt = (a = !0) => {
547
- const s = it(i, a);
548
- return Dt(
550
+ const Be = (a = !0) => {
551
+ const s = dt(i, a);
552
+ return Vt(
549
553
  i,
550
- p ? qn(p, s) : Pi(
554
+ p ? ro(p, s) : Ji(
551
555
  i,
552
556
  t.position,
553
557
  s
554
558
  ),
555
559
  s
556
560
  );
557
- }, O = () => {
558
- const a = Fi(n, b, f);
559
- Va(t, {
561
+ }, B = () => {
562
+ const a = aa(o, b, x);
563
+ ur(t, {
560
564
  isOpen: i.classList.contains("pluno-pa-widget--open"),
561
- composerValue: f.value,
565
+ composerValue: x.value,
562
566
  focusedInput: a,
563
567
  focusedInputAt: a ? Date.now() : null,
564
- openToolGroupKeys: [...lt],
568
+ openToolGroupKeys: [...mt],
565
569
  launcherPosition: d ? p : null,
566
- seenShareCandidateIds: [...Ce].slice(
567
- -On
570
+ panelSize: c,
571
+ seenShareCandidateIds: [...ke].slice(
572
+ -Zn
568
573
  ),
569
- sharePromptsDisabled: pt
574
+ sharePromptsDisabled: ft
570
575
  });
571
- }, je = (a) => {
576
+ }, Ze = (a) => {
572
577
  t.onDisplayStateChange?.(a);
573
- }, Re = (a, s = !0) => {
578
+ }, Ue = (a, s = !0) => {
574
579
  if (a === "shown") {
575
- i.classList.remove("pluno-pa-widget--minimized"), g.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Me(!1), s && je("shown");
580
+ i.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), !i.classList.contains("pluno-pa-widget--open") && !i.classList.contains("pluno-pa-widget--closing") && Fe(!1), s && Ze("shown");
576
581
  return;
577
582
  }
578
- V !== null && (window.clearTimeout(V), V = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), g.hidden = !1, k.hidden = !0, y.hidden = !0, g.tabIndex = 0, f.value = "", xe(
583
+ Z !== null && (window.clearTimeout(Z), Z = null), i.classList.remove("pluno-pa-widget--open"), i.classList.remove("pluno-pa-widget--closing"), i.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, w.hidden = !0, A.hidden = !0, v.tabIndex = 0, x.value = "", ve(
579
584
  i,
580
- Ct(
585
+ Tt(
581
586
  i,
582
587
  p,
583
588
  t.position
584
589
  )
585
- ), _n(i), O(), s && je("minimized");
586
- }, we = (a, s = {}) => {
587
- Bi(a, {
588
- debugVersion: Si,
590
+ ), Dn(i), B(), s && Ze("minimized");
591
+ }, xe = (a, s = {}) => {
592
+ ia(a, {
593
+ debugVersion: Wi,
589
594
  launcherPosition: p,
590
595
  rootClasses: i.className,
591
596
  rootStyle: {
@@ -594,35 +599,35 @@ async function ki(e = {}) {
594
599
  right: i.style.right,
595
600
  bottom: i.style.bottom
596
601
  },
597
- rootRect: St(i),
598
- launcherRect: St(g),
599
- panelRect: St(k),
600
- viewport: ne(),
601
- panelHidden: k.hidden,
602
- closeHidden: y.hidden,
602
+ rootRect: Rt(i),
603
+ launcherRect: Rt(v),
604
+ panelRect: Rt(w),
605
+ viewport: Y(),
606
+ panelHidden: w.hidden,
607
+ closeHidden: A.hidden,
603
608
  ...s
604
609
  });
605
- }, Me = (a = !0) => {
610
+ }, Fe = (a = !0) => {
606
611
  if (!p)
607
- return xe(i, null), dt(a);
608
- const s = dt(a);
609
- return xe(i, s), we("Applied stored closed launcher position", {
612
+ return ve(i, null), Be(a);
613
+ const s = Be(a);
614
+ return ve(i, s), xe("Applied stored closed launcher position", {
610
615
  visibleLauncherPosition: s
611
616
  }), s;
612
- }, Gt = (a, s) => {
617
+ }, bt = (a, s) => {
613
618
  if (!a || !s) {
614
- _n(i);
619
+ Dn(i);
615
620
  return;
616
621
  }
617
- Ui(i, {
622
+ oa(i, {
618
623
  x: a.x - s.x,
619
624
  y: a.y - s.y
620
625
  });
621
- }, $t = () => {
626
+ }, rn = () => {
622
627
  if (i.classList.contains("pluno-pa-widget--minimized")) {
623
- xe(
628
+ ve(
624
629
  i,
625
- Ct(
630
+ Tt(
626
631
  i,
627
632
  p,
628
633
  t.position
@@ -630,118 +635,164 @@ async function ki(e = {}) {
630
635
  );
631
636
  return;
632
637
  }
633
- const a = Me();
638
+ const a = Fe();
634
639
  if (i.classList.contains("pluno-pa-widget--open") || i.classList.contains("pluno-pa-widget--closing")) {
635
- const s = wn(
636
- i,
637
- a,
638
- t.position
640
+ Nt(i, c);
641
+ const s = Re(c);
642
+ Mt(
643
+ h,
644
+ s.width
639
645
  );
640
- Gt(s, a), we(
646
+ const _ = lt(
647
+ u ?? Dt(
648
+ i,
649
+ a,
650
+ t.position,
651
+ c
652
+ ),
653
+ s
654
+ );
655
+ u && (u = _), bt(_, a), xe(
641
656
  "Applied open panel position after viewport resize",
642
- { openPanelPosition: s }
657
+ { openPanelPosition: _ }
643
658
  );
644
- } else p && we(
659
+ } else p && xe(
645
660
  "Applied visible launcher position after viewport resize",
646
661
  { visibleLauncherPosition: a }
647
662
  );
648
663
  };
649
- let qt = () => {
664
+ let ln = () => {
650
665
  };
651
- window.addEventListener("resize", $t), t.movableLauncher && S ? (Me(), qt = Ti({
666
+ window.addEventListener("resize", rn), t.movableLauncher && z ? (Fe(), ln = Yi({
652
667
  root: i,
653
- launcher: g,
654
- launcherDragHandle: S,
655
- getPosition: () => dt(),
668
+ launcher: v,
669
+ launcherDragHandle: z,
670
+ getPosition: () => Be(),
656
671
  setPosition: (a) => {
657
- const s = a, _ = it(i), E = Dt(
672
+ const s = a, _ = dt(i), L = Vt(
658
673
  i,
659
674
  a,
660
675
  _
661
676
  );
662
- p = Ri(
663
- E,
677
+ p = ea(
678
+ L,
664
679
  _
665
- ), xe(i, E), we("Dragging closed launcher", {
680
+ ), ve(i, L), xe("Dragging closed launcher", {
666
681
  requestedPosition: s
667
682
  });
668
683
  },
669
684
  persist: () => {
670
- d = !0, O(), we("Persisted closed launcher drag position");
685
+ d = !0, B(), xe("Persisted closed launcher drag position");
671
686
  }
672
- })) : xe(i, null);
673
- let ct = !1;
674
- const jt = async () => {
675
- if (!(!t.billingStatusLoader || ct)) {
676
- ct = !0;
687
+ })) : ve(i, null), Nt(i, c);
688
+ const No = () => {
689
+ const a = Re(c), s = Be();
690
+ return {
691
+ position: lt(
692
+ u ?? Dt(
693
+ i,
694
+ s,
695
+ t.position,
696
+ c
697
+ ),
698
+ a
699
+ ),
700
+ size: a
701
+ };
702
+ }, To = (a) => {
703
+ c = ut(a.size), Nt(i, c), Mt(
704
+ h,
705
+ Re(c).width
706
+ ), u = lt(
707
+ a.position,
708
+ Re(c)
709
+ );
710
+ const s = Be();
711
+ bt(u, s);
712
+ }, Do = P.length > 0 ? Xi({
713
+ root: i,
714
+ handles: P,
715
+ getBounds: No,
716
+ setBounds: To,
717
+ persist: B
718
+ }) : () => {
719
+ };
720
+ let _t = !1;
721
+ const pn = async () => {
722
+ if (!(!t.billingStatusLoader || _t)) {
723
+ _t = !0;
677
724
  try {
678
725
  const a = await t.billingStatusLoader();
679
- Sn(
726
+ Bn(
680
727
  t.billingStatus,
681
728
  a,
682
- w.getState().lastErrorCode
683
- ) && (t.billingStatus = a, Lt(
684
- N,
729
+ y.getState().lastErrorCode
730
+ ) && (t.billingStatus = a, Bt(
731
+ H,
685
732
  t.billingStatus,
686
- w.getState().lastErrorCode
687
- ), q());
733
+ y.getState().lastErrorCode
734
+ ), j());
688
735
  } finally {
689
- ct = !1;
736
+ _t = !1;
690
737
  }
691
738
  }
692
- }, se = (a = "", s = !0) => {
693
- jt(), Oe && (Oe = !1, gt()), V !== null && (window.clearTimeout(V), V = null), Re("shown", !1), k.hidden = !1, y.hidden = !1, i.classList.remove("pluno-pa-widget--closing");
694
- const _ = Me(), E = wn(
739
+ }, ge = (a = "", s = !0) => {
740
+ pn(), We && (We = !1, yt()), i.classList.contains("pluno-pa-widget--open") || (u = null), Z !== null && (window.clearTimeout(Z), Z = null), Ue("shown", !1), w.hidden = !1, A.hidden = !1, Mt(
741
+ h,
742
+ Re(c).width
743
+ ), i.classList.remove("pluno-pa-widget--closing");
744
+ const _ = Fe(), L = Dt(
695
745
  i,
696
746
  _,
697
- t.position
747
+ t.position,
748
+ c
698
749
  );
699
- if (Gt(E, _), we("Opening launcher at clamped open panel position", {
700
- openPanelPosition: E,
750
+ if (bt(L, _), xe("Opening launcher at clamped open panel position", {
751
+ openPanelPosition: L,
701
752
  visibleLauncherPosition: _
702
- }), X(!0, "open"), Z(), !s) {
703
- i.classList.add("pluno-pa-widget--open"), g.hidden = !0, a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0);
753
+ }), ee(!0, "open"), te(), !s) {
754
+ i.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (x.value = a, je(x)), Ve(N, () => we.enabled), be = N.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), B(), Ze("shown"), t.onPanelOpenChange?.(!0);
704
755
  return;
705
756
  }
706
757
  window.requestAnimationFrame(() => {
707
- i.classList.add("pluno-pa-widget--open"), a && (f.value = a, He(f)), We(I, () => me.enabled), fe = I.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), O(), je("shown"), t.onPanelOpenChange?.(!0), V = window.setTimeout(() => {
708
- g.hidden = !0, We(I, () => me.enabled), fe = I.scrollTop;
758
+ i.classList.add("pluno-pa-widget--open"), a && (x.value = a, je(x)), Ve(N, () => we.enabled), be = N.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), B(), Ze("shown"), t.onPanelOpenChange?.(!0), Z = window.setTimeout(() => {
759
+ v.hidden = !0, Ve(N, () => we.enabled), be = N.scrollTop;
709
760
  }, 220);
710
761
  });
711
- }, go = () => {
712
- V !== null && (window.clearTimeout(V), V = null), g.hidden = !1, p && (Me(!1), we("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), O(), t.onPanelOpenChange?.(!1), V = window.setTimeout(() => {
713
- k.hidden = !0, y.hidden = !0, i.classList.remove("pluno-pa-widget--closing");
762
+ }, Ro = () => {
763
+ Z !== null && (window.clearTimeout(Z), Z = null), v.hidden = !1, p && (Fe(!1), xe("Closing launcher at stored position")), i.classList.remove("pluno-pa-widget--open"), i.classList.add("pluno-pa-widget--closing"), B(), t.onPanelOpenChange?.(!1), Z = window.setTimeout(() => {
764
+ w.hidden = !0, A.hidden = !0, u = null, i.classList.remove("pluno-pa-widget--closing");
714
765
  }, 220);
715
766
  };
716
- g.addEventListener("submit", (a) => {
717
- a.preventDefault(), se(b.value), b.value = "";
718
- }), S?.addEventListener("click", (a) => {
767
+ v.addEventListener("submit", (a) => {
768
+ a.preventDefault(), ge(b.value), b.value = "";
769
+ }), z?.addEventListener("click", (a) => {
719
770
  a.preventDefault(), a.stopPropagation();
720
- }), g.addEventListener("click", (a) => {
721
- a.target === b && !S || (se(b.value), b.value = "");
771
+ }), v.addEventListener("click", (a) => {
772
+ a.target === b && !z || (ge(b.value), b.value = "");
722
773
  }), b.addEventListener("focus", () => {
723
- se(b.value), b.value = "";
774
+ ge(b.value), b.value = "";
724
775
  }), b.addEventListener("input", () => {
725
776
  if (!b.value)
726
777
  return;
727
778
  const a = b.value;
728
- se(a), b.value = "";
779
+ ge(a), b.value = "";
729
780
  });
730
- let ut = null, Ve = null, _e = null;
731
- const Vt = (a) => a === b || a === f, ho = (a) => {
781
+ let xt = null, Je = null, ye = null;
782
+ const sn = (a) => a === b || a === x, zo = (a) => {
732
783
  if (!(a instanceof Element) || a.getRootNode() === i.getRootNode())
733
784
  return null;
734
785
  let s = a;
735
786
  for (; s; ) {
736
- const _ = s.closest(ln);
787
+ const _ = s.closest(vn);
737
788
  if (_)
738
789
  return _;
739
- const E = s.getRootNode();
740
- s = E instanceof ShadowRoot ? E.host : null;
790
+ const L = s.getRootNode();
791
+ s = L instanceof ShadowRoot ? L.host : null;
741
792
  }
742
793
  return null;
743
- }, mo = (a) => {
744
- if (!a.isConnected || !a.matches(ln))
794
+ }, Mo = (a) => {
795
+ if (!a.isConnected || !a.matches(vn))
745
796
  return !1;
746
797
  if (!(a instanceof HTMLElement))
747
798
  return !0;
@@ -751,66 +802,66 @@ async function ki(e = {}) {
751
802
  return a.checkVisibility();
752
803
  const s = window.getComputedStyle(a);
753
804
  return s.display !== "none" && s.visibility !== "hidden";
754
- }, Kt = (a) => {
755
- ze !== a && (ze = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ye(), a !== null ? _e = window.setInterval(() => {
756
- const s = ze;
757
- (!s || !mo(s)) && Kt(null);
758
- }, ri) : _e !== null && (window.clearInterval(_e), _e = null, Ve = null));
759
- }, fo = () => {
760
- _e !== null && (window.clearInterval(_e), _e = null);
805
+ }, dn = (a) => {
806
+ He !== a && (He = a, i.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), et(), a !== null ? ye = window.setInterval(() => {
807
+ const s = He;
808
+ (!s || !Mo(s)) && dn(null);
809
+ }, Li) : ye !== null && (window.clearInterval(ye), ye = null, Je = null));
810
+ }, Oo = () => {
811
+ ye !== null && (window.clearInterval(ye), ye = null);
761
812
  };
762
813
  i.addEventListener("focusin", (a) => {
763
- Vt(a.target) && (ut = Date.now(), O());
814
+ sn(a.target) && (xt = Date.now(), B());
764
815
  }), i.addEventListener("focusout", (a) => {
765
- if (!Vt(a.target) || ze !== null)
816
+ if (!sn(a.target) || He !== null)
766
817
  return;
767
- const s = ut;
768
- if (ut = null, s === null || Date.now() - s > ii)
818
+ const s = xt;
819
+ if (xt = null, s === null || Date.now() - s > Ei)
769
820
  return;
770
- const _ = ho(a.relatedTarget);
821
+ const _ = zo(a.relatedTarget);
771
822
  if (!_)
772
823
  return;
773
- const E = Date.now();
774
- if (Ve !== null && E - Ve <= ai) {
775
- Kt(_);
824
+ const L = Date.now();
825
+ if (Je !== null && L - Je <= ki) {
826
+ dn(_);
776
827
  return;
777
828
  }
778
- Ve = E;
779
- }), g.addEventListener("keydown", (a) => {
780
- !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), se());
781
- }), H?.addEventListener("pointerdown", (a) => {
829
+ Je = L;
830
+ }), v.addEventListener("keydown", (a) => {
831
+ !i.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), ge());
832
+ }), g?.addEventListener("pointerdown", (a) => {
782
833
  a.stopPropagation();
783
- }), H?.addEventListener("click", (a) => {
784
- a.preventDefault(), a.stopPropagation(), Re("minimized");
785
- }), y.addEventListener("click", go), I.addEventListener("scroll", () => {
786
- I.scrollTop < fe - 1 && X(!1, "userScroll"), fe = I.scrollTop;
787
- }), x.addEventListener("click", () => {
788
- so();
834
+ }), g?.addEventListener("click", (a) => {
835
+ a.preventDefault(), a.stopPropagation(), Ue("minimized");
836
+ }), A.addEventListener("click", Ro), N.addEventListener("scroll", () => {
837
+ N.scrollTop < be - 1 && ee(!1, "userScroll"), be = N.scrollTop;
838
+ }), R.addEventListener("click", () => {
839
+ Po();
789
840
  });
790
- const Yt = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
841
+ const cn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
791
842
  ([a]) => {
792
- a?.isIntersecting && (X(!0, "bottom"), Z());
843
+ a?.isIntersecting && (ee(!0, "bottom"), te());
793
844
  },
794
- { root: I, threshold: 0 }
845
+ { root: N, threshold: 0 }
795
846
  );
796
- Yt?.observe($);
797
- const Ke = () => t.loginRequired || t.signupRequired;
798
- let ze = null, Oe = !1;
799
- const Ye = () => {
800
- const a = Ke(), s = ze !== null;
801
- b.readOnly = a || s, f.readOnly = s, b.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Oe ? "New update" : t.launcherLabel, f.placeholder = s ? pn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Q.launcherLabel, v.hidden = a;
802
- }, q = () => {
803
- R.disabled = te(t.billingStatus) || !w.getState().isThinking && f.value.trim().length === 0 && B.length === 0, Pe.disabled = Ke() || te(t.billingStatus);
847
+ cn?.observe(ht);
848
+ const Qe = () => t.loginRequired || t.signupRequired;
849
+ let He = null, We = !1;
850
+ const et = () => {
851
+ const a = Qe(), s = He !== null;
852
+ b.readOnly = a || s, x.readOnly = s, b.placeholder = s ? Cn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : We ? "New update" : t.launcherLabel, x.placeholder = s ? Cn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : oe.launcherLabel, k.hidden = a;
853
+ }, j = () => {
854
+ de.disabled = ae(t.billingStatus) || !y.getState().isThinking && x.value.trim().length === 0 && W.length === 0, ze.disabled = Qe() || ae(t.billingStatus);
804
855
  };
805
- Ye();
806
- const gt = () => {
807
- const a = w.getState().isThinking;
856
+ et();
857
+ const yt = () => {
858
+ const a = y.getState().isThinking;
808
859
  i.classList.toggle("pluno-pa-widget--thinking", a), i.classList.toggle(
809
860
  "pluno-pa-widget--unread",
810
- !a && Oe
811
- ), Ye();
861
+ !a && We
862
+ ), et();
812
863
  };
813
- gt(), v.addEventListener("submit", (a) => {
864
+ yt(), k.addEventListener("submit", (a) => {
814
865
  if (a.preventDefault(), t.loginRequired) {
815
866
  t.onLoginClick?.();
816
867
  return;
@@ -819,157 +870,157 @@ async function ki(e = {}) {
819
870
  t.onSignupClick?.();
820
871
  return;
821
872
  }
822
- te(t.billingStatus) || (he = !0, X(!0, "send"), Z(), B = Et(
823
- w,
824
- f,
825
- B
826
- ), ve(), q());
873
+ ae(t.billingStatus) || (fe = !0, ee(!0, "send"), te(), W = zt(
874
+ y,
875
+ x,
876
+ W
877
+ ), Ee(), j());
827
878
  });
828
- let Ue = 0;
829
- const bo = () => {
830
- Ue = 0, i.classList.remove("pluno-pa-widget--drag-over");
831
- }, ht = (a) => {
832
- ie !== null && window.clearTimeout(ie), h.textContent = a, h.hidden = !1, ie = window.setTimeout(() => {
833
- h.textContent = "", h.hidden = !0, ie = null;
879
+ let Ge = 0;
880
+ const Bo = () => {
881
+ Ge = 0, i.classList.remove("pluno-pa-widget--drag-over");
882
+ }, vt = (a) => {
883
+ le !== null && window.clearTimeout(le), F.textContent = a, F.hidden = !1, le = window.setTimeout(() => {
884
+ F.textContent = "", F.hidden = !0, le = null;
834
885
  }, 3e3);
835
- }, wo = () => {
836
- ie !== null && (window.clearTimeout(ie), ie = null), h.textContent = "", h.hidden = !0;
837
- }, mt = async (a) => {
886
+ }, Uo = () => {
887
+ le !== null && (window.clearTimeout(le), le = null), F.textContent = "", F.hidden = !0;
888
+ }, Ct = async (a) => {
838
889
  if (a.length === 0)
839
890
  return;
840
- const s = fa(w, a);
841
- B = [...B, ...s], ve(), wo(), q(), F(w.getState()), i.classList.contains("pluno-pa-widget--open") || se();
891
+ const s = za(y, a);
892
+ W = [...W, ...s], Ee(), Uo(), j(), G(y.getState()), i.classList.contains("pluno-pa-widget--open") || ge();
842
893
  };
843
- Pe.addEventListener("click", () => {
844
- t.loginRequired || te(t.billingStatus) || L.click();
845
- }), L.addEventListener("change", () => {
846
- const a = Array.from(L.files ?? []);
847
- L.value = "", mt(a).catch((s) => {
848
- ht(
894
+ ze.addEventListener("click", () => {
895
+ t.loginRequired || ae(t.billingStatus) || Q.click();
896
+ }), Q.addEventListener("change", () => {
897
+ const a = Array.from(Q.files ?? []);
898
+ Q.value = "", Ct(a).catch((s) => {
899
+ vt(
849
900
  s instanceof Error ? s.message : "Failed to attach file"
850
- ), K("web-sdk.widget", "Attachment failed", {
901
+ ), J("web-sdk.widget", "Attachment failed", {
851
902
  message: s instanceof Error ? s.message : String(s)
852
903
  });
853
904
  });
854
905
  }), i.addEventListener("dragenter", (a) => {
855
- !Qe(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ue += 1, i.classList.add("pluno-pa-widget--drag-over"));
906
+ !it(a.dataTransfer) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ge += 1, i.classList.add("pluno-pa-widget--drag-over"));
856
907
  }), i.addEventListener("dragover", (a) => {
857
908
  const s = a.dataTransfer;
858
- !Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
909
+ !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
859
910
  }), i.addEventListener("dragleave", (a) => {
860
- Qe(a.dataTransfer) && (a.stopPropagation(), Ue = Math.max(0, Ue - 1), Ue === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
911
+ it(a.dataTransfer) && (a.stopPropagation(), Ge = Math.max(0, Ge - 1), Ge === 0 && i.classList.remove("pluno-pa-widget--drag-over"));
861
912
  }), i.addEventListener("drop", (a) => {
862
913
  const s = a.dataTransfer;
863
- !Qe(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), bo(), mt(s.files).catch((_) => {
864
- ht(
914
+ !it(s) || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Bo(), Ct(s.files).catch((_) => {
915
+ vt(
865
916
  _ instanceof Error ? _.message : "Failed to attach file"
866
- ), K("web-sdk.widget", "Attachment failed", {
917
+ ), J("web-sdk.widget", "Attachment failed", {
867
918
  message: _ instanceof Error ? _.message : String(_)
868
919
  });
869
920
  }));
870
921
  }), i.addEventListener("paste", (a) => {
871
922
  const s = a.clipboardData, _ = Array.from(s?.files ?? []);
872
- _.length === 0 || t.loginRequired || (a.preventDefault(), a.stopPropagation(), mt(_).catch((E) => {
873
- ht(
874
- E instanceof Error ? E.message : "Failed to attach file"
875
- ), K("web-sdk.widget", "Attachment failed", {
876
- message: E instanceof Error ? E.message : String(E)
923
+ _.length === 0 || t.loginRequired || (a.preventDefault(), a.stopPropagation(), Ct(_).catch((L) => {
924
+ vt(
925
+ L instanceof Error ? L.message : "Failed to attach file"
926
+ ), J("web-sdk.widget", "Attachment failed", {
927
+ message: L instanceof Error ? L.message : String(L)
877
928
  });
878
929
  }));
879
- }), R.addEventListener("click", () => {
930
+ }), de.addEventListener("click", () => {
880
931
  if (t.loginRequired) {
881
932
  t.onLoginClick?.();
882
933
  return;
883
934
  }
884
- if (w.getState().isThinking) {
885
- w.stop();
935
+ if (y.getState().isThinking) {
936
+ y.stop();
886
937
  return;
887
938
  }
888
- he = !0, X(!0, "send"), Z(), B = Et(
889
- w,
890
- f,
891
- B
892
- ), ve(), q(), F(w.getState());
893
- }), ue.addEventListener("click", () => {
894
- le = !le, De = null, be(), le && pe.length === 0 && Ht(null);
895
- }), $e.addEventListener("click", () => {
896
- le = !1, be();
897
- }), G.addEventListener("scroll", co), f.addEventListener("input", () => {
898
- He(f), O(), q(), yo();
899
- }), f.addEventListener("keydown", (a) => {
939
+ fe = !0, ee(!0, "send"), te(), W = zt(
940
+ y,
941
+ x,
942
+ W
943
+ ), Ee(), j(), G(y.getState());
944
+ }), X.addEventListener("click", () => {
945
+ ce = !ce, Oe = null, _e(), ce && ue.length === 0 && on(null);
946
+ }), Se.addEventListener("click", () => {
947
+ ce = !1, _e();
948
+ }), T.addEventListener("scroll", Io), x.addEventListener("input", () => {
949
+ je(x), B(), j(), Wo();
950
+ }), x.addEventListener("keydown", (a) => {
900
951
  if (!(a.key !== "Enter" || a.shiftKey)) {
901
952
  if (a.preventDefault(), t.loginRequired) {
902
953
  t.onLoginClick?.();
903
954
  return;
904
955
  }
905
- he = !0, X(!0, "send"), Z(), B = Et(
906
- w,
907
- f,
908
- B
909
- ), ve(), q(), F(w.getState());
956
+ fe = !0, ee(!0, "send"), te(), W = zt(
957
+ y,
958
+ x,
959
+ W
960
+ ), Ee(), j(), G(y.getState());
910
961
  }
911
962
  }), i.addEventListener("click", (a) => {
912
- (a.target instanceof Element ? a.target : null)?.closest("a[href]") && O();
913
- }), l.composerValue && (f.value = l.composerValue, He(f)), t.initialDisplayState === "minimized" ? Re("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && se(f.value, !1), Hi(l, i, b, f);
914
- const Xe = () => r;
915
- let ft = w.getState().appearance !== null, Ze = null, Be = null, Ee = null, Xt = w.getState().isThinking, ke = null;
916
- const Fe = t.taskNotifications;
917
- let Le = null, Ie = !1;
918
- const Zt = () => {
919
- Le !== null && (window.clearTimeout(Le), Le = null);
920
- }, Je = () => {
921
- A && (A.hidden = !0);
922
- }, Jt = () => w.getState().assistantDraft.trim().length > 0, _o = async () => {
923
- if (!Fe || !A || Ie || Se || !w.getState().isThinking || Jt())
963
+ (a.target instanceof Element ? a.target : null)?.closest("a[href]") && B();
964
+ }), l.composerValue && (x.value = l.composerValue, je(x)), t.initialDisplayState === "minimized" ? Ue("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && ge(x.value, !1), ra(l, i, b, x);
965
+ const tt = () => r;
966
+ let St = y.getState().appearance !== null, nt = null, $e = null, Pe = null, un = y.getState().isThinking, Ie = null;
967
+ const qe = t.taskNotifications;
968
+ let Ae = null, Ne = !1;
969
+ const gn = () => {
970
+ Ae !== null && (window.clearTimeout(Ae), Ae = null);
971
+ }, ot = () => {
972
+ Me && (Me.hidden = !0);
973
+ }, hn = () => y.getState().assistantDraft.trim().length > 0, Fo = async () => {
974
+ if (!qe || !Me || Ne || Le || !y.getState().isThinking || hn())
924
975
  return;
925
976
  let a;
926
977
  try {
927
- a = await Fe.getState();
978
+ a = await qe.getState();
928
979
  } catch {
929
980
  return;
930
981
  }
931
- a.enabled || a.neverSuggest || !w.getState().isThinking || Jt() || Ie || Se || (A.hidden = !1);
982
+ a.enabled || a.neverSuggest || !y.getState().isThinking || hn() || Ne || Le || (Me.hidden = !1);
932
983
  };
933
- T?.addEventListener("click", () => {
934
- Ie = !0, Je(), Fe?.enable().catch(() => {
984
+ vo?.addEventListener("click", () => {
985
+ Ne = !0, ot(), qe?.enable().catch(() => {
935
986
  });
936
- }), ge?.addEventListener("click", () => {
937
- Ie = !0, Je();
938
- }), ao?.addEventListener("click", () => {
939
- Ie = !0, Je(), Fe?.dismissForever().catch(() => {
987
+ }), Co?.addEventListener("click", () => {
988
+ Ne = !0, ot();
989
+ }), So?.addEventListener("click", () => {
990
+ Ne = !0, ot(), qe?.dismissForever().catch(() => {
940
991
  });
941
992
  });
942
- let Ae = null, Qt = () => {
993
+ let Te = null, mn = () => {
943
994
  };
944
- const xo = !!t.socialPostDraftHandler, bt = /* @__PURE__ */ new Map(), wt = () => f.value.trim().length > 0 || B.length > 0, yo = () => {
945
- const a = Ae !== null && It(w.getState(), wt());
946
- z.hidden = !a, a && Ae !== null && Vn(z, Ae);
995
+ const Ho = !!t.socialPostDraftHandler, Et = /* @__PURE__ */ new Map(), kt = () => x.value.trim().length > 0 || W.length > 0, Wo = () => {
996
+ const a = Te !== null && Ut(y.getState(), kt());
997
+ D.hidden = !a, a && Te !== null && po(D, Te);
947
998
  };
948
- let Ne = null;
949
- const vo = () => {
950
- he = !0, X(!0, "newSession"), Z(), le = !1, be(), w.startNewSession(), lt.clear(), f.value = "", B = [], ve(), He(f), O(), q(), f.focus(), F(w.getState());
951
- }, _t = (a) => {
999
+ let De = null;
1000
+ const Go = () => {
1001
+ fe = !0, ee(!0, "newSession"), te(), ce = !1, _e(), y.startNewSession(), mt.clear(), x.value = "", W = [], Ee(), je(x), B(), j(), x.focus(), G(y.getState());
1002
+ }, Lt = (a) => {
952
1003
  if (!a) {
953
- Ne?.remove(), Ne = null;
1004
+ De?.remove(), De = null;
954
1005
  return;
955
1006
  }
956
- Ne || (Ne = rt(
1007
+ De || (De = gt(
957
1008
  "pluno-pa-widget__new-chat",
958
1009
  "New chat",
959
- aa(),
1010
+ Sa(),
960
1011
  !1
961
- ), Ne.addEventListener("click", vo), ce.insertBefore(Ne, ue));
962
- }, F = (a) => {
963
- if (be(), Bt(a.lastErrorCode) ? ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
964
- N,
1012
+ ), De.addEventListener("click", Go), Ye.insertBefore(De, X));
1013
+ }, G = (a) => {
1014
+ if (_e(), tn(a.lastErrorCode) ? Ie = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Ie = null), Bt(
1015
+ H,
965
1016
  t.billingStatus,
966
- ke
1017
+ Ie
967
1018
  ), t.loginRequired) {
968
- bt.clear(), In(
969
- I,
970
- R,
971
- _t,
972
- Xe,
1019
+ Et.clear(), Wn(
1020
+ N,
1021
+ de,
1022
+ Lt,
1023
+ tt,
973
1024
  "Log in to use Pluno on this page.",
974
1025
  t.loginButtonLabel,
975
1026
  t.loginUrl,
@@ -978,11 +1029,11 @@ async function ki(e = {}) {
978
1029
  return;
979
1030
  }
980
1031
  if (t.signupRequired) {
981
- bt.clear(), In(
982
- I,
983
- R,
984
- _t,
985
- Xe,
1032
+ Et.clear(), Wn(
1033
+ N,
1034
+ de,
1035
+ Lt,
1036
+ tt,
986
1037
  "Complete signup to unlock your free trial credits.",
987
1038
  t.signupButtonLabel,
988
1039
  t.signupUrl,
@@ -990,67 +1041,67 @@ async function ki(e = {}) {
990
1041
  );
991
1042
  return;
992
1043
  }
993
- const s = Gi(a), _ = s !== Ft;
994
- Ft = s;
995
- const E = he || me.enabled;
996
- he = !1, Ca(
997
- I,
998
- $,
999
- R,
1000
- _t,
1001
- z,
1044
+ const s = pa(a), _ = s !== nn;
1045
+ nn = s;
1046
+ const L = fe || we.enabled;
1047
+ fe = !1, Wa(
1048
+ N,
1049
+ ht,
1050
+ de,
1051
+ Lt,
1052
+ D,
1002
1053
  a,
1003
- Ae,
1004
- Ae !== null && It(a, wt()),
1005
- E,
1006
- () => me.enabled,
1007
- lt,
1008
- bt,
1009
- O,
1010
- Xe,
1011
- (P) => {
1012
- he = !0, X(!0, "send"), Z(), w.sendMessage(P);
1054
+ Te,
1055
+ Te !== null && Ut(a, kt()),
1056
+ L,
1057
+ () => we.enabled,
1058
+ mt,
1059
+ Et,
1060
+ B,
1061
+ tt,
1062
+ (M) => {
1063
+ fe = !0, ee(!0, "send"), te(), y.sendMessage(M);
1013
1064
  },
1014
- xo && !pt ? {
1015
- dismissedCandidateIds: qe,
1016
- draftingCandidateId: Ze,
1017
- error: Be,
1018
- characterIconOptions: Xe(),
1019
- onSeen: (P) => {
1020
- Ce.add(P.id), O();
1065
+ Ho && !ft ? {
1066
+ dismissedCandidateIds: Xe,
1067
+ draftingCandidateId: nt,
1068
+ error: $e,
1069
+ characterIconOptions: tt(),
1070
+ onSeen: (M) => {
1071
+ ke.add(M.id), B();
1021
1072
  },
1022
- onDraft: (P) => {
1023
- Co(P);
1073
+ onDraft: (M) => {
1074
+ $o(M);
1024
1075
  },
1025
- onDismiss: (P) => {
1026
- Ce.add(P.id), qe.add(P.id), O(), Be = null, F(w.getState());
1076
+ onDismiss: (M) => {
1077
+ ke.add(M.id), Xe.add(M.id), B(), $e = null, G(y.getState());
1027
1078
  },
1028
- onDisable: (P) => {
1029
- pt = !0, Ce.add(P.id), qe.add(P.id), O(), ja(t, !0), Be = null, F(w.getState());
1079
+ onDisable: (M) => {
1080
+ ft = !0, ke.add(M.id), Xe.add(M.id), B(), cr(t, !0), $e = null, G(y.getState());
1030
1081
  }
1031
1082
  } : void 0
1032
- ), E ? (fe = I.scrollTop, Z()) : _ && $i(a) && po();
1083
+ ), L ? (be = N.scrollTop, te()) : _ && sa(a) && Lo();
1033
1084
  };
1034
- return Qt = Ho(
1085
+ return mn = pi(
1035
1086
  (a) => {
1036
- Ae = a, !Se && It(w.getState(), wt()) && F(w.getState());
1087
+ Te = a, !Le && Ut(y.getState(), kt()) && G(y.getState());
1037
1088
  },
1038
1089
  {
1039
1090
  backendUrl: t.backendUrl,
1040
- fetcher: lo,
1091
+ fetcher: ko,
1041
1092
  loader: t.activeUsersLoader
1042
1093
  }
1043
- ), w.on("state", (a) => {
1044
- const s = Xt && !a.isThinking;
1045
- Xt = a.isThinking, a.isThinking && !a.assistantDraft.trim() && Fe && !Ie && Le === null && A?.hidden !== !1 && (Le = window.setTimeout(() => {
1046
- Le = null, _o();
1047
- }, jo)), (!a.isThinking || a.assistantDraft.trim()) && (Zt(), Je()), s && !i.classList.contains("pluno-pa-widget--open") && (Oe = !0), gt(), a.appearance ? (ft = !0, K(
1094
+ ), y.on("state", (a) => {
1095
+ const s = un && !a.isThinking;
1096
+ un = a.isThinking, a.isThinking && !a.assistantDraft.trim() && qe && !Ne && Ae === null && Me?.hidden !== !1 && (Ae = window.setTimeout(() => {
1097
+ Ae = null, Fo();
1098
+ }, gi)), (!a.isThinking || a.assistantDraft.trim()) && (gn(), ot()), s && !i.classList.contains("pluno-pa-widget--open") && (We = !0), yt(), a.appearance ? (St = !0, J(
1048
1099
  "web-sdk.widget",
1049
1100
  "Agent state supplied appearance",
1050
1101
  {
1051
1102
  appearance: a.appearance
1052
1103
  }
1053
- ), xt(a.appearance, "agent.state.appearance")) : ft && (ft = !1, K(
1104
+ ), Pt(a.appearance, "agent.state.appearance")) : St && (St = !1, J(
1054
1105
  "web-sdk.widget",
1055
1106
  "Agent state cleared appearance; reverting to configured widget options",
1056
1107
  {
@@ -1058,28 +1109,28 @@ async function ki(e = {}) {
1058
1109
  fallbackColorScheme: t.colorScheme,
1059
1110
  fallbackFontFamily: t.fontFamily
1060
1111
  }
1061
- ), xt({}, "agent.state.appearance-cleared")), F(a), q(), s && jt();
1062
- }), F(w.getState()), q(), {
1063
- agent: w,
1112
+ ), Pt({}, "agent.state.appearance-cleared")), G(a), j(), s && pn();
1113
+ }), G(y.getState()), j(), {
1114
+ agent: y,
1064
1115
  updateAppearance: (a) => {
1065
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), xt(a, "widgetHandle.updateAppearance");
1116
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Pt(a, "widgetHandle.updateAppearance");
1066
1117
  },
1067
1118
  updateBillingStatus: (a) => {
1068
1119
  const s = a ?? null;
1069
- Sn(
1120
+ Bn(
1070
1121
  t.billingStatus,
1071
1122
  s,
1072
- ke
1073
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !te(t.billingStatus) && (ke = null), Lt(
1123
+ Ie
1124
+ ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !ae(t.billingStatus) && (Ie = null), Bt(
1074
1125
  i.querySelector(".pluno-pa-widget__billing-status"),
1075
1126
  t.billingStatus,
1076
- ke
1077
- ), q());
1127
+ Ie
1128
+ ), j());
1078
1129
  },
1079
1130
  updateAuthGate: (a) => {
1080
- const s = Ke();
1081
- t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), Ye(), F(w.getState()), q(), s && !Ke() && w.connect().catch((_) => {
1082
- K(
1131
+ const s = Qe();
1132
+ t.loginRequired = a.loginRequired === !0, t.signupRequired = a.signupRequired === !0, a.loginButtonLabel !== void 0 && (t.loginButtonLabel = a.loginButtonLabel), a.loginUrl !== void 0 && (t.loginUrl = a.loginUrl), a.signupButtonLabel !== void 0 && (t.signupButtonLabel = a.signupButtonLabel), a.signupUrl !== void 0 && (t.signupUrl = a.signupUrl), et(), G(y.getState()), j(), s && !Qe() && y.connect().catch((_) => {
1133
+ J(
1083
1134
  "web-sdk.widget",
1084
1135
  "Failed to connect after auth gate cleared",
1085
1136
  {
@@ -1089,70 +1140,70 @@ async function ki(e = {}) {
1089
1140
  });
1090
1141
  },
1091
1142
  openPanel: () => {
1092
- se(f.value, !1);
1143
+ ge(x.value, !1);
1093
1144
  },
1094
1145
  updateDisplayState: (a) => {
1095
1146
  if (a === "shown") {
1096
- Re("shown", !1);
1147
+ Ue("shown", !1);
1097
1148
  return;
1098
1149
  }
1099
- Re("minimized", !1);
1150
+ Ue("minimized", !1);
1100
1151
  },
1101
1152
  destroy: () => {
1102
- Se || (O(), Se = !0, Wt.disconnect(), Yt?.disconnect(), fo(), window.removeEventListener("resize", $t), qt(), ie !== null && window.clearTimeout(ie), Zt(), Qt(), Ee?.remove(), w.destroy(), o.remove());
1153
+ Le || (B(), Le = !0, an.disconnect(), cn?.disconnect(), Oo(), window.removeEventListener("resize", rn), ln(), Do(), le !== null && window.clearTimeout(le), gn(), mn(), Pe?.remove(), y.destroy(), n.remove());
1103
1154
  }
1104
1155
  };
1105
- async function Co(a) {
1106
- if (!Ze) {
1107
- Ze = a.id, Be = null, F(w.getState());
1156
+ async function $o(a) {
1157
+ if (!nt) {
1158
+ nt = a.id, $e = null, G(y.getState());
1108
1159
  try {
1109
1160
  if (!t.socialPostDraftHandler)
1110
1161
  throw new Error("Social post drafting is not available here.");
1111
1162
  const s = await t.socialPostDraftHandler(a);
1112
1163
  if (!s.linkedinPost || !s.xPost)
1113
1164
  throw new Error("Pluno did not return a complete social post draft.");
1114
- Ce.add(a.id), qe.add(a.id), O(), Ee?.remove(), Ee = Ta(s, {
1165
+ ke.add(a.id), Xe.add(a.id), B(), Pe?.remove(), Pe = Xa(s, {
1115
1166
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1116
1167
  onClose: () => {
1117
- Ee?.remove(), Ee = null;
1168
+ Pe?.remove(), Pe = null;
1118
1169
  }
1119
- }), i.appendChild(Ee);
1170
+ }), i.appendChild(Pe);
1120
1171
  } catch (s) {
1121
- Be = s instanceof Error ? s.message : "Could not draft social post.";
1172
+ $e = s instanceof Error ? s.message : "Could not draft social post.";
1122
1173
  } finally {
1123
- Ze = null, F(w.getState());
1174
+ nt = null, G(y.getState());
1124
1175
  }
1125
1176
  }
1126
1177
  }
1127
- function xt(a, s) {
1128
- const _ = a.accentColor ?? t.accentColor, E = a.colorScheme ?? t.colorScheme, P = a.fontFamily ?? t.fontFamily, yt = a.scribbleStyle ?? t.scribbleStyle;
1129
- r = fn(
1178
+ function Pt(a, s) {
1179
+ const _ = a.accentColor ?? t.accentColor, L = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, It = a.scribbleStyle ?? t.scribbleStyle;
1180
+ r = Pn(
1130
1181
  _,
1131
- yt
1132
- ), bn(i, r, {
1182
+ It
1183
+ ), In(i, r, {
1133
1184
  accentColor: _,
1134
- colorScheme: E,
1135
- fontFamily: P,
1136
- scribbleStyle: yt
1137
- }), K("web-sdk.widget", "Updated widget appearance", {
1185
+ colorScheme: L,
1186
+ fontFamily: M,
1187
+ scribbleStyle: It
1188
+ }), J("web-sdk.widget", "Updated widget appearance", {
1138
1189
  source: s,
1139
1190
  inputAppearance: a,
1140
1191
  appliedAccentColor: _,
1141
- appliedColorScheme: E,
1142
- appliedFontFamily: P,
1143
- appliedScribbleStyle: yt,
1192
+ appliedColorScheme: L,
1193
+ appliedFontFamily: M,
1194
+ appliedScribbleStyle: It,
1144
1195
  cssAccent: i.style.getPropertyValue("--pluno-pa-accent")
1145
1196
  });
1146
1197
  }
1147
1198
  }
1148
- function fn(e, t) {
1199
+ function Pn(e, t) {
1149
1200
  return { accentColor: e, scribbleStyle: t };
1150
1201
  }
1151
- function Li(e) {
1152
- const t = Ii(e);
1153
- return t === null ? "#fafafa" : Ai(t) > 0.5 ? "#18181b" : "#fafaf9";
1202
+ function qi(e) {
1203
+ const t = ji(e);
1204
+ return t === null ? "#fafafa" : Vi(t) > 0.5 ? "#18181b" : "#fafaf9";
1154
1205
  }
1155
- function Ii(e) {
1206
+ function ji(e) {
1156
1207
  const t = e.trim();
1157
1208
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1158
1209
  Number.parseInt(t.slice(1, 3), 16),
@@ -1164,42 +1215,42 @@ function Ii(e) {
1164
1215
  Number.parseInt(t[3] + t[3], 16)
1165
1216
  ] : null;
1166
1217
  }
1167
- function Ai([e, t, o]) {
1168
- const n = (i) => {
1218
+ function Vi([e, t, n]) {
1219
+ const o = (i) => {
1169
1220
  const r = i / 255;
1170
1221
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1171
1222
  };
1172
- return 0.2126 * n(e) + 0.7152 * n(t) + 0.0722 * n(o);
1223
+ return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
1173
1224
  }
1174
- function bn(e, t, o) {
1225
+ function In(e, t, n) {
1175
1226
  e.classList.toggle(
1176
1227
  "pluno-pa-widget--dark",
1177
- o.colorScheme === "dark"
1228
+ n.colorScheme === "dark"
1178
1229
  ), e.classList.toggle(
1179
1230
  "pluno-pa-widget--light",
1180
- o.colorScheme !== "dark"
1181
- ), e.classList.toggle("pluno-pa-widget--scribble", o.scribbleStyle);
1182
- const n = o.scribbleStyle ? Rn(o.accentColor) : o.accentColor;
1183
- e.style.setProperty("--pluno-pa-accent", n), o.scribbleStyle ? e.style.setProperty(
1231
+ n.colorScheme !== "dark"
1232
+ ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1233
+ const o = n.scribbleStyle ? Kn(n.accentColor) : n.accentColor;
1234
+ e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty(
1184
1235
  "--pluno-pa-accent-contrast",
1185
- Li(n)
1186
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = o.scribbleStyle ? pi : o.fontFamily, o.scribbleStyle && Ni(e.ownerDocument);
1236
+ qi(o)
1237
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ii : n.fontFamily, n.scribbleStyle && Ki(e.ownerDocument);
1187
1238
  const i = Array.from(
1188
1239
  e.querySelectorAll(".pluno-pa-widget__character")
1189
1240
  );
1190
1241
  for (const r of i)
1191
1242
  r.replaceWith(
1192
- de(
1243
+ me(
1193
1244
  Array.from(r.classList).join(" "),
1194
1245
  t
1195
1246
  )
1196
1247
  );
1197
1248
  }
1198
- function Ni(e) {
1199
- if (e.getElementById(sn))
1249
+ function Ki(e) {
1250
+ if (e.getElementById(Sn))
1200
1251
  return;
1201
1252
  const t = e.createElement("style");
1202
- t.id = sn, t.textContent = `@font-face {
1253
+ t.id = Sn, t.textContent = `@font-face {
1203
1254
  font-family: "Architects Daughter";
1204
1255
  font-style: normal;
1205
1256
  font-weight: 400;
@@ -1207,201 +1258,353 @@ function Ni(e) {
1207
1258
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1208
1259
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1209
1260
  }
1210
- function Ti({
1261
+ function Yi({
1211
1262
  root: e,
1212
1263
  launcher: t,
1213
- launcherDragHandle: o,
1214
- getPosition: n,
1264
+ launcherDragHandle: n,
1265
+ getPosition: o,
1215
1266
  setPosition: i,
1216
1267
  persist: r
1217
1268
  }) {
1218
- let l = null, p = null, d = null, u = !1, c = null;
1219
- const g = () => {
1220
- l = null, p = null, d = null, u = !1, e.classList.remove("pluno-pa-widget--dragging");
1221
- }, S = (h) => {
1222
- e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, d = n(), u = !1, t.setPointerCapture?.(h.pointerId));
1223
- }, b = (h) => {
1269
+ let l = null, p = null, d = null, c = !1, u = null;
1270
+ const m = () => {
1271
+ l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1272
+ }, E = (h) => {
1273
+ e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (h.preventDefault(), h.stopPropagation(), l = h.pointerId, p = { x: h.clientX, y: h.clientY }, d = o(), c = !1, t.setPointerCapture?.(h.pointerId));
1274
+ }, v = (h) => {
1224
1275
  if (l !== h.pointerId || !p || !d)
1225
1276
  return;
1226
1277
  h.preventDefault();
1227
- const N = h.clientX - p.x, D = h.clientY - p.y;
1228
- !u && Math.hypot(N, D) < hn || (u = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + N, y: d.y + D }));
1229
- }, H = (h) => {
1230
- l === h.pointerId && (h.preventDefault(), h.stopPropagation(), u && (c = { x: h.clientX, y: h.clientY }, r()), g());
1231
- }, k = (h) => {
1232
- l === h.pointerId && (h.preventDefault(), g());
1233
- }, y = (h) => {
1234
- if (!c)
1278
+ const P = h.clientX - p.x, A = h.clientY - p.y;
1279
+ !c && Math.hypot(P, A) < jt || (c = !0, e.classList.add("pluno-pa-widget--dragging"), i({ x: d.x + P, y: d.y + A }));
1280
+ }, z = (h) => {
1281
+ l === h.pointerId && (h.preventDefault(), h.stopPropagation(), c && (u = { x: h.clientX, y: h.clientY }, r()), m());
1282
+ }, b = (h) => {
1283
+ l === h.pointerId && (h.preventDefault(), m());
1284
+ }, g = (h) => {
1285
+ if (!u)
1235
1286
  return;
1236
- const N = Math.hypot(
1237
- h.clientX - c.x,
1238
- h.clientY - c.y
1239
- ) <= hn;
1240
- c = null, N && (h.preventDefault(), h.stopPropagation());
1241
- }, v = (h) => {
1287
+ const P = Math.hypot(
1288
+ h.clientX - u.x,
1289
+ h.clientY - u.y
1290
+ ) <= jt;
1291
+ u = null, P && (h.preventDefault(), h.stopPropagation());
1292
+ }, w = (h) => {
1242
1293
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1243
1294
  return;
1244
- const N = h.shiftKey ? Ci : vi, D = n();
1245
- let L = null;
1246
- h.key === "ArrowUp" ? L = { x: D.x, y: D.y - N } : h.key === "ArrowDown" ? L = { x: D.x, y: D.y + N } : h.key === "ArrowLeft" ? L = { x: D.x - N, y: D.y } : h.key === "ArrowRight" && (L = { x: D.x + N, y: D.y }), L && (h.preventDefault(), h.stopPropagation(), i(L), r());
1295
+ const P = h.shiftKey ? oo : no, A = o();
1296
+ let k = null;
1297
+ h.key === "ArrowUp" ? k = { x: A.x, y: A.y - P } : h.key === "ArrowDown" ? k = { x: A.x, y: A.y + P } : h.key === "ArrowLeft" ? k = { x: A.x - P, y: A.y } : h.key === "ArrowRight" && (k = { x: A.x + P, y: A.y }), k && (h.preventDefault(), h.stopPropagation(), i(k), r());
1247
1298
  };
1248
- return t.addEventListener("pointerdown", S), t.addEventListener("pointermove", b), t.addEventListener("pointerup", H), t.addEventListener("pointercancel", k), t.addEventListener("click", y, !0), o.addEventListener("keydown", v), () => {
1249
- t.removeEventListener("pointerdown", S), t.removeEventListener("pointermove", b), t.removeEventListener("pointerup", H), t.removeEventListener("pointercancel", k), t.removeEventListener("click", y, !0), o.removeEventListener("keydown", v);
1299
+ return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", v), t.addEventListener("pointerup", z), t.addEventListener("pointercancel", b), t.addEventListener("click", g, !0), n.addEventListener("keydown", w), () => {
1300
+ t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", v), t.removeEventListener("pointerup", z), t.removeEventListener("pointercancel", b), t.removeEventListener("click", g, !0), n.removeEventListener("keydown", w);
1250
1301
  };
1251
1302
  }
1252
- function it(e, t = !0) {
1253
- const o = ne();
1303
+ function Xi({
1304
+ root: e,
1305
+ handles: t,
1306
+ getBounds: n,
1307
+ setBounds: o,
1308
+ persist: i
1309
+ }) {
1310
+ let r = null, l = null, p = null, d = null, c = !1;
1311
+ const u = () => {
1312
+ r = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1313
+ }, m = (g) => {
1314
+ const w = g.currentTarget, h = w.dataset.resizeDirection;
1315
+ !e.classList.contains("pluno-pa-widget--open") || !An(h) || (g.preventDefault(), g.stopPropagation(), r = g.pointerId, l = h, p = { x: g.clientX, y: g.clientY }, d = n(), c = !1, w.setPointerCapture?.(g.pointerId));
1316
+ }, E = (g) => {
1317
+ if (r !== g.pointerId || !l || !p || !d)
1318
+ return;
1319
+ g.preventDefault(), g.stopPropagation();
1320
+ const w = g.clientX - p.x, h = g.clientY - p.y;
1321
+ !c && Math.hypot(w, h) < jt || (c = !0, e.classList.add("pluno-pa-widget--resizing"), o(
1322
+ Nn(d, l, w, h)
1323
+ ));
1324
+ }, v = (g) => {
1325
+ r === g.pointerId && (g.preventDefault(), g.stopPropagation(), c && i(), u());
1326
+ }, z = (g) => {
1327
+ r === g.pointerId && (g.preventDefault(), u());
1328
+ }, b = (g) => {
1329
+ const h = g.currentTarget.dataset.resizeDirection, P = g.shiftKey ? oo : no, A = n();
1330
+ let k = 0, F = 0;
1331
+ An(h) && (g.key === "ArrowLeft" ? k = -P : g.key === "ArrowRight" ? k = P : g.key === "ArrowUp" ? F = -P : g.key === "ArrowDown" && (F = P), !(k === 0 && F === 0) && (g.preventDefault(), g.stopPropagation(), o(Nn(A, h, k, F)), i()));
1332
+ };
1333
+ for (const g of t)
1334
+ g.addEventListener("pointerdown", m), g.addEventListener("pointermove", E), g.addEventListener("pointerup", v), g.addEventListener("pointercancel", z), g.addEventListener("keydown", b);
1335
+ return () => {
1336
+ for (const g of t)
1337
+ g.removeEventListener("pointerdown", m), g.removeEventListener("pointermove", E), g.removeEventListener("pointerup", v), g.removeEventListener("pointercancel", z), g.removeEventListener("keydown", b);
1338
+ };
1339
+ }
1340
+ function An(e) {
1341
+ return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1342
+ }
1343
+ function Nn(e, t, n, o) {
1344
+ const i = Y(), r = Tn({
1345
+ leading: e.position.x,
1346
+ length: e.size.width,
1347
+ delta: n,
1348
+ resizeLeading: t.endsWith("left") || t === "left",
1349
+ resizeTrailing: t.endsWith("right") || t === "right",
1350
+ minLeading: I,
1351
+ maxTrailing: i.width - I,
1352
+ minLength: Math.min(
1353
+ Jt,
1354
+ i.width - I * 2
1355
+ )
1356
+ }), l = Tn({
1357
+ leading: e.position.y,
1358
+ length: e.size.height,
1359
+ delta: o,
1360
+ resizeLeading: t.startsWith("top") || t === "top",
1361
+ resizeTrailing: t.startsWith("bottom") || t === "bottom",
1362
+ minLeading: Ce,
1363
+ maxTrailing: i.height - I,
1364
+ minLength: Math.min(
1365
+ Qt,
1366
+ i.height - Ce - I
1367
+ )
1368
+ });
1369
+ return {
1370
+ position: { x: r.leading, y: l.leading },
1371
+ size: { width: r.length, height: l.length }
1372
+ };
1373
+ }
1374
+ function Tn({
1375
+ leading: e,
1376
+ length: t,
1377
+ delta: n,
1378
+ resizeLeading: o,
1379
+ resizeTrailing: i,
1380
+ minLeading: r,
1381
+ maxTrailing: l,
1382
+ minLength: p
1383
+ }) {
1384
+ const d = e + t;
1385
+ if (o) {
1386
+ const c = e + n;
1387
+ if (c >= r) {
1388
+ const m = K(c, r, d - p);
1389
+ return { leading: m, length: d - m };
1390
+ }
1391
+ const u = K(
1392
+ d + r - c,
1393
+ d,
1394
+ l
1395
+ );
1396
+ return { leading: r, length: u - r };
1397
+ }
1398
+ if (i) {
1399
+ const c = d + n;
1400
+ if (c <= l) {
1401
+ const m = K(
1402
+ c,
1403
+ e + p,
1404
+ l
1405
+ );
1406
+ return { leading: e, length: m - e };
1407
+ }
1408
+ const u = K(
1409
+ e - (c - l),
1410
+ r,
1411
+ e
1412
+ );
1413
+ return { leading: u, length: l - u };
1414
+ }
1415
+ return { leading: e, length: t };
1416
+ }
1417
+ function dt(e, t = !0) {
1418
+ const n = Y();
1254
1419
  if (e.classList.contains("pluno-pa-widget--minimized"))
1255
1420
  return e.classList.contains("pluno-pa-widget--scribble") ? {
1256
- width: si,
1257
- height: di
1258
- } : { width: dn, height: dn };
1259
- const n = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1421
+ width: Ai,
1422
+ height: Ni
1423
+ } : { width: En, height: En };
1424
+ const o = e.getBoundingClientRect(), i = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1260
1425
  return {
1261
- width: t && i && n.width > 0 ? n.width : Math.min(Bn, o.width - 36),
1262
- height: t && i && n.height > 0 ? n.height : e.classList.contains("pluno-pa-widget--scribble") ? ui : Fn
1426
+ width: t && i && o.width > 0 ? o.width : Math.min(Qn, n.width - 36),
1427
+ height: t && i && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? Di : eo
1263
1428
  };
1264
1429
  }
1265
- function $n() {
1266
- const e = ne();
1430
+ function Zi() {
1431
+ const e = Y();
1267
1432
  return {
1268
1433
  width: Math.min(
1269
- Te(
1270
- e.width * mi,
1271
- gi,
1272
- hi
1434
+ K(
1435
+ e.width * zi,
1436
+ Jt,
1437
+ Ri
1273
1438
  ),
1274
- e.width - W * 2
1439
+ e.width - I * 2
1275
1440
  ),
1276
1441
  height: Math.min(
1277
- Te(
1278
- e.height * wi,
1279
- fi,
1280
- bi
1442
+ K(
1443
+ e.height * Oi,
1444
+ Qt,
1445
+ Mi
1446
+ ),
1447
+ e.height - Ce - I
1448
+ )
1449
+ };
1450
+ }
1451
+ function Re(e = null) {
1452
+ return e ? ut(e) : Zi();
1453
+ }
1454
+ function ut(e) {
1455
+ const t = Y();
1456
+ return {
1457
+ width: K(
1458
+ e.width,
1459
+ Math.min(
1460
+ Jt,
1461
+ t.width - I * 2
1462
+ ),
1463
+ Math.max(
1464
+ I,
1465
+ t.width - I * 2
1466
+ )
1467
+ ),
1468
+ height: K(
1469
+ e.height,
1470
+ Math.min(
1471
+ Qt,
1472
+ t.height - Ce - I
1281
1473
  ),
1282
- e.height - Pt - W
1474
+ Math.max(
1475
+ I,
1476
+ t.height - Ce - I
1477
+ )
1283
1478
  )
1284
1479
  };
1285
1480
  }
1286
- function Pi(e, t, o) {
1287
- const n = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1288
- if (Number.isFinite(n) && Number.isFinite(i))
1289
- return { x: n, y: i };
1481
+ function Nt(e, t) {
1482
+ if (!t) {
1483
+ e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1484
+ return;
1485
+ }
1486
+ const n = ut(t);
1487
+ e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1488
+ }
1489
+ function Ji(e, t, n) {
1490
+ const o = Number.parseFloat(e.style.left), i = Number.parseFloat(e.style.top);
1491
+ if (Number.isFinite(o) && Number.isFinite(i))
1492
+ return { x: o, y: i };
1290
1493
  const r = e.getBoundingClientRect();
1291
1494
  if (r.width > 0 || r.height > 0)
1292
1495
  return { x: r.left, y: r.top };
1293
- const l = ne();
1496
+ const l = Y();
1294
1497
  return {
1295
- x: t === "bottom-left" ? 26 : l.width - 26 - o.width,
1296
- y: l.height - 24 - o.height
1498
+ x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1499
+ y: l.height - 24 - n.height
1297
1500
  };
1298
1501
  }
1299
- function Ct(e, t, o) {
1300
- const n = it(e, !1);
1301
- return t ? Dt(
1502
+ function Tt(e, t, n) {
1503
+ const o = dt(e, !1);
1504
+ return t ? Vt(
1302
1505
  e,
1303
- qn(t, n),
1304
- n
1305
- ) : Di(o === "bottom-left" ? "bottom-left" : "bottom-right", n, ci);
1506
+ ro(t, o),
1507
+ o
1508
+ ) : Qi(n === "bottom-left" ? "bottom-left" : "bottom-right", o, Ti);
1306
1509
  }
1307
- function Di(e, t, o) {
1308
- const n = ne();
1510
+ function Qi(e, t, n) {
1511
+ const o = Y();
1309
1512
  return {
1310
- x: e.endsWith("right") ? Math.max(0, n.width - t.width - o) : o,
1311
- y: e.startsWith("bottom") ? Math.max(0, n.height - t.height - o) : o
1513
+ x: e.endsWith("right") ? Math.max(0, o.width - t.width - n) : n,
1514
+ y: e.startsWith("bottom") ? Math.max(0, o.height - t.height - n) : n
1312
1515
  };
1313
1516
  }
1314
- function Dt(e, t, o) {
1315
- const n = ne(), i = W + zi(e);
1517
+ function Vt(e, t, n) {
1518
+ const o = Y(), i = I + na(e);
1316
1519
  return {
1317
- x: Te(
1520
+ x: K(
1318
1521
  t.x,
1319
- W,
1522
+ I,
1320
1523
  Math.max(
1321
- W,
1322
- n.width - o.width - W
1524
+ I,
1525
+ o.width - n.width - I
1323
1526
  )
1324
1527
  ),
1325
- y: Te(
1528
+ y: K(
1326
1529
  t.y,
1327
1530
  i,
1328
1531
  Math.max(
1329
1532
  i,
1330
- n.height - o.height - W
1533
+ o.height - n.height - I
1331
1534
  )
1332
1535
  )
1333
1536
  };
1334
1537
  }
1335
- function qn(e, t) {
1336
- const o = ne();
1538
+ function ro(e, t) {
1539
+ const n = Y();
1337
1540
  return {
1338
- x: e.anchor.endsWith("right") ? o.width - t.width - e.x : e.x,
1339
- y: e.anchor.startsWith("bottom") ? o.height - t.height - e.y : e.y
1541
+ x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1542
+ y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1340
1543
  };
1341
1544
  }
1342
- function Ri(e, t) {
1343
- const o = Mi(e, t), n = ne();
1545
+ function ea(e, t) {
1546
+ const n = ta(e, t), o = Y();
1344
1547
  return {
1345
- anchor: o,
1346
- x: o.endsWith("right") ? n.width - e.x - t.width : e.x,
1347
- y: o.startsWith("bottom") ? n.height - e.y - t.height : e.y
1548
+ anchor: n,
1549
+ x: n.endsWith("right") ? o.width - e.x - t.width : e.x,
1550
+ y: n.startsWith("bottom") ? o.height - e.y - t.height : e.y
1348
1551
  };
1349
1552
  }
1350
- function Mi(e, t) {
1351
- const o = ne(), n = e.x + t.width / 2, r = e.y + t.height / 2 <= o.height / 2 ? "top" : "bottom", l = n <= o.width / 2 ? "left" : "right";
1553
+ function ta(e, t) {
1554
+ const n = Y(), o = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = o <= n.width / 2 ? "left" : "right";
1352
1555
  return `${r}-${l}`;
1353
1556
  }
1354
- function zi(e) {
1355
- return e.classList.contains("pluno-pa-widget--scribble") ? yi : xi;
1557
+ function na(e) {
1558
+ return e.classList.contains("pluno-pa-widget--scribble") ? Hi : Fi;
1356
1559
  }
1357
- function wn(e, t, o) {
1358
- const n = it(e), i = $n(), r = {
1359
- x: o === "bottom-left" ? t.x : t.x + n.width - i.width,
1360
- y: t.y + n.height - i.height
1560
+ function Dt(e, t, n, o = null) {
1561
+ const i = dt(e), r = Re(o), l = {
1562
+ x: n === "bottom-left" ? t.x : t.x + i.width - r.width,
1563
+ y: t.y + i.height - r.height
1361
1564
  };
1362
- return Oi(r);
1565
+ return lt(l, r);
1363
1566
  }
1364
- function Oi(e) {
1365
- const t = ne(), o = $n();
1567
+ function lt(e, t) {
1568
+ const n = Y();
1366
1569
  return {
1367
- x: Te(
1570
+ x: K(
1368
1571
  e.x,
1369
- W,
1572
+ I,
1370
1573
  Math.max(
1371
- W,
1372
- t.width - o.width - W
1574
+ I,
1575
+ n.width - t.width - I
1373
1576
  )
1374
1577
  ),
1375
- y: Te(
1578
+ y: K(
1376
1579
  e.y,
1377
- Pt,
1580
+ Ce,
1378
1581
  Math.max(
1379
- Pt,
1380
- t.height - o.height - W
1582
+ Ce,
1583
+ n.height - t.height - I
1381
1584
  )
1382
1585
  )
1383
1586
  };
1384
1587
  }
1385
- function xe(e, t) {
1588
+ function ve(e, t) {
1386
1589
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1387
1590
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1388
1591
  return;
1389
1592
  }
1390
1593
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1391
1594
  }
1392
- function Ui(e, t) {
1595
+ function oa(e, t) {
1393
1596
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1394
1597
  }
1395
- function _n(e) {
1598
+ function Dn(e) {
1396
1599
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1397
1600
  }
1398
- function ne() {
1601
+ function Y() {
1399
1602
  return {
1400
- width: window.innerWidth || document.documentElement.clientWidth || Bn + W * 2,
1401
- height: window.innerHeight || document.documentElement.clientHeight || Fn + W * 2
1603
+ width: window.innerWidth || document.documentElement.clientWidth || Qn + I * 2,
1604
+ height: window.innerHeight || document.documentElement.clientHeight || eo + I * 2
1402
1605
  };
1403
1606
  }
1404
- function St(e) {
1607
+ function Rt(e) {
1405
1608
  const t = e.getBoundingClientRect();
1406
1609
  return {
1407
1610
  x: Math.round(t.x),
@@ -1410,57 +1613,57 @@ function St(e) {
1410
1613
  height: Math.round(t.height)
1411
1614
  };
1412
1615
  }
1413
- function Te(e, t, o) {
1414
- return Math.min(Math.max(e, t), o);
1616
+ function K(e, t, n) {
1617
+ return Math.min(Math.max(e, t), n);
1415
1618
  }
1416
- function K(e, t, o) {
1619
+ function J(e, t, n) {
1417
1620
  if (typeof window > "u")
1418
1621
  return;
1419
- const n = window, i = {
1622
+ const o = window, i = {
1420
1623
  at: (/* @__PURE__ */ new Date()).toISOString(),
1421
1624
  source: e,
1422
1625
  message: t,
1423
- details: o
1424
- }, r = n.__plunoProductAgentDiagnostics__ ?? [];
1425
- r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1426
- new CustomEvent(ni, { detail: i })
1626
+ details: n
1627
+ }, r = o.__plunoProductAgentDiagnostics__ ?? [];
1628
+ r.push(i), r.length > 120 && r.splice(0, r.length - 120), o.__plunoProductAgentDiagnostics__ = r, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1629
+ new CustomEvent(Ci, { detail: i })
1427
1630
  );
1428
1631
  }
1429
- function Bi(e, t) {
1430
- K("web-sdk.widget.position", e, t);
1632
+ function ia(e, t) {
1633
+ J("web-sdk.widget.position", e, t);
1431
1634
  }
1432
- function Et(e, t, o) {
1433
- const n = t.value.trim();
1434
- return !n && o.length === 0 ? o : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(n, {
1435
- attachments: o.length > 0 ? o.map(Wi) : void 0
1635
+ function zt(e, t, n) {
1636
+ const o = t.value.trim();
1637
+ return !o && n.length === 0 ? n : (t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1638
+ attachments: n.length > 0 ? n.map(la) : void 0
1436
1639
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1437
1640
  }
1438
- function Fi(e, t, o) {
1439
- const n = e.activeElement;
1440
- return n === o ? "composer" : n === t ? "launcher" : null;
1641
+ function aa(e, t, n) {
1642
+ const o = e.activeElement;
1643
+ return o === n ? "composer" : o === t ? "launcher" : null;
1441
1644
  }
1442
- function Hi(e, t, o, n) {
1443
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Vo)
1645
+ function ra(e, t, n, o) {
1646
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > hi)
1444
1647
  return;
1445
- const i = e.focusedInput === "composer" ? n : o;
1446
- i === n && !t.classList.contains("pluno-pa-widget--open") || i === o && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1648
+ const i = e.focusedInput === "composer" ? o : n;
1649
+ i === o && !t.classList.contains("pluno-pa-widget--open") || i === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1447
1650
  !i.isConnected || i.readOnly || (i.focus(), i.setSelectionRange(i.value.length, i.value.length));
1448
1651
  });
1449
1652
  }
1450
- function Wi(e) {
1653
+ function la(e) {
1451
1654
  return e;
1452
1655
  }
1453
- function He(e) {
1656
+ function je(e) {
1454
1657
  e.style.height = "0px";
1455
1658
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1456
1659
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1457
1660
  }
1458
- function We(e, t = () => !0) {
1661
+ function Ve(e, t = () => !0) {
1459
1662
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1460
1663
  t() && (e.scrollTop = e.scrollHeight);
1461
1664
  });
1462
1665
  }
1463
- function Gi(e) {
1666
+ function pa(e) {
1464
1667
  const t = e.messages[e.messages.length - 1];
1465
1668
  return [
1466
1669
  e.messages.length,
@@ -1471,69 +1674,69 @@ function Gi(e) {
1471
1674
  e.lastError ?? ""
1472
1675
  ].join(":");
1473
1676
  }
1474
- function $i(e) {
1677
+ function sa(e) {
1475
1678
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1476
1679
  }
1477
- function qi(e) {
1680
+ function da(e) {
1478
1681
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1479
1682
  }
1480
- function ji(e) {
1683
+ function ca(e) {
1481
1684
  const t = e.currentPage;
1482
1685
  if (typeof t?.url == "string" && t.url.trim())
1483
1686
  try {
1484
- const o = new URL(t.url);
1485
- return `${o.pathname || "/"}${o.search}`;
1687
+ const n = new URL(t.url);
1688
+ return `${n.pathname || "/"}${n.search}`;
1486
1689
  } catch {
1487
1690
  return t.url;
1488
1691
  }
1489
1692
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1490
1693
  }
1491
- function Vi(e, t) {
1492
- const o = new Date(e).getTime();
1493
- if (!Number.isFinite(o))
1694
+ function ua(e, t) {
1695
+ const n = new Date(e).getTime();
1696
+ if (!Number.isFinite(n))
1494
1697
  return "now";
1495
- const n = Math.max(0, t - o), i = [
1698
+ const o = Math.max(0, t - n), i = [
1496
1699
  ["day", 864e5],
1497
1700
  ["hour", 36e5],
1498
1701
  ["min", 6e4]
1499
1702
  ];
1500
1703
  for (const [r, l] of i)
1501
- if (n >= l) {
1502
- const p = Math.max(1, Math.floor(n / l));
1704
+ if (o >= l) {
1705
+ const p = Math.max(1, Math.floor(o / l));
1503
1706
  return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1504
1707
  }
1505
1708
  return "now";
1506
1709
  }
1507
- function Ki(e, t, o, n, i) {
1508
- e.appendChild(oa()), e.appendChild(
1509
- Yi(
1710
+ function ga(e, t, n, o, i) {
1711
+ e.appendChild(va()), e.appendChild(
1712
+ ha(
1510
1713
  t,
1511
- o,
1512
1714
  n,
1715
+ o,
1513
1716
  i
1514
1717
  )
1515
1718
  ), e.appendChild(
1516
- rt(
1719
+ gt(
1517
1720
  "pluno-pa-widget__close",
1518
1721
  "Close",
1519
- ia(16),
1722
+ Ca(16),
1520
1723
  !0
1521
1724
  )
1522
- ), e.appendChild(Xi(o));
1725
+ ), e.appendChild(ma(n));
1523
1726
  }
1524
- function Yi(e, t, o, n) {
1727
+ function ha(e, t, n, o) {
1525
1728
  const i = document.createElement("form");
1526
- if (i.className = "pluno-pa-widget__launcher", n && i.classList.add("pluno-pa-widget__launcher--minimizable"), o) {
1729
+ if (i.className = "pluno-pa-widget__launcher", o && i.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1527
1730
  const d = document.createElement("button");
1528
1731
  d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", i.appendChild(d);
1529
1732
  }
1530
1733
  i.appendChild(
1531
- Yn(
1734
+ co(
1532
1735
  "pluno-pa-widget__scribble-spirals--launcher",
1533
1736
  10
1534
1737
  )
1535
1738
  ), i.appendChild(
1536
- de(
1739
+ me(
1537
1740
  "pluno-pa-widget__character--launcher",
1538
1741
  t
1539
1742
  )
@@ -1542,136 +1745,155 @@ function Yi(e, t, o, n) {
1542
1745
  r.className = "pluno-pa-widget__launcher-run-indicator", i.appendChild(r);
1543
1746
  const l = document.createElement("input");
1544
1747
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), i.appendChild(l);
1545
- const p = at("Working...");
1546
- if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), n) {
1748
+ const p = ct("Working...");
1749
+ if (p.classList.add("pluno-pa-widget__status--launcher"), i.appendChild(p), o) {
1547
1750
  const d = document.createElement("button");
1548
1751
  d.type = "button", d.className = "pluno-pa-widget__launcher-minimize", d.textContent = "-", d.setAttribute("aria-label", "Minimize Pluno on this site"), d.title = "Minimize Pluno on this site", i.appendChild(d);
1549
1752
  }
1550
1753
  return i;
1551
1754
  }
1552
- function Xi(e) {
1755
+ function ma(e) {
1553
1756
  const t = document.createElement("section");
1554
1757
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1555
- Yn("pluno-pa-widget__scribble-spirals--panel", 16)
1758
+ co("pluno-pa-widget__scribble-spirals--panel", 16)
1556
1759
  );
1557
- const o = document.createElement("div");
1558
- o.className = "pluno-pa-widget__timeline-wrap";
1559
- const n = document.createElement("main");
1560
- n.className = "pluno-pa-widget__timeline", n.appendChild(ea(e));
1760
+ const n = document.createElement("div");
1761
+ n.className = "pluno-pa-widget__timeline-wrap";
1762
+ const o = document.createElement("main");
1763
+ o.className = "pluno-pa-widget__timeline", o.appendChild(_a(e));
1561
1764
  const i = document.createElement("div");
1562
- i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), n.appendChild(i), o.appendChild(n);
1765
+ i.className = "pluno-pa-widget__timeline-bottom-sentinel", i.setAttribute("aria-hidden", "true"), o.appendChild(i), n.appendChild(o);
1563
1766
  const r = document.createElement("div");
1564
- r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, o.appendChild(r);
1767
+ r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, n.appendChild(r);
1565
1768
  const l = document.createElement("button");
1566
- l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, o.appendChild(l);
1769
+ l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1567
1770
  const p = document.createElement("div");
1568
1771
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
1569
- rt(
1772
+ gt(
1570
1773
  "pluno-pa-widget__history",
1571
- Rt(),
1572
- ra(),
1774
+ Kt(),
1775
+ Ea(),
1573
1776
  !0
1574
1777
  )
1575
- ), o.appendChild(p), o.appendChild(Qi()), t.appendChild(o), t.appendChild(Zi()), t.appendChild(Ji()), t;
1778
+ ), n.appendChild(p), n.appendChild(ba()), t.appendChild(n), t.appendChild(fa()), t.appendChild(wa()), t.appendChild(he("left", "Resize Pluno from left")), t.appendChild(
1779
+ he("right", "Resize Pluno from right")
1780
+ ), t.appendChild(he("top", "Resize Pluno from top")), t.appendChild(
1781
+ he("bottom", "Resize Pluno from bottom")
1782
+ ), t.appendChild(
1783
+ he("top-left", "Resize Pluno from top left")
1784
+ ), t.appendChild(
1785
+ he("top-right", "Resize Pluno from top right")
1786
+ ), t.appendChild(
1787
+ he("bottom-left", "Resize Pluno from bottom left")
1788
+ ), t.appendChild(
1789
+ he("bottom-right", "Resize Pluno from bottom right")
1790
+ ), t;
1576
1791
  }
1577
- function Zi() {
1792
+ function he(e, t) {
1793
+ const n = document.createElement("button");
1794
+ return n.type = "button", n.className = [
1795
+ "pluno-pa-widget__resize-handle",
1796
+ `pluno-pa-widget__resize-handle--${e}`
1797
+ ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1798
+ }
1799
+ function fa() {
1578
1800
  const e = document.createElement("div");
1579
1801
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
1580
1802
  const t = document.createElement("span");
1581
1803
  t.className = "pluno-pa-widget__notify-suggestion-label", t.textContent = "This may take a moment. Get notified when it's done?";
1582
- const o = document.createElement("div");
1583
- o.className = "pluno-pa-widget__notify-suggestion-actions";
1584
- const n = document.createElement("button");
1585
- n.type = "button", n.className = "pluno-pa-widget__notify-suggestion-enable", n.textContent = "Notify me";
1804
+ const n = document.createElement("div");
1805
+ n.className = "pluno-pa-widget__notify-suggestion-actions";
1806
+ const o = document.createElement("button");
1807
+ o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-enable", o.textContent = "Notify me";
1586
1808
  const i = document.createElement("button");
1587
1809
  i.type = "button", i.className = "pluno-pa-widget__notify-suggestion-later", i.textContent = "Later";
1588
1810
  const r = document.createElement("button");
1589
- return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", o.append(n, i, r), e.append(t, o), e;
1811
+ return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(o, i, r), e.append(t, n), e;
1590
1812
  }
1591
- function Ji() {
1813
+ function wa() {
1592
1814
  const e = document.createElement("form");
1593
1815
  e.className = "pluno-pa-widget__composer";
1594
1816
  const t = document.createElement("div");
1595
1817
  t.className = "pluno-pa-widget__billing-status", t.hidden = !0, e.appendChild(t);
1596
- const o = document.createElement("div");
1597
- o.className = "pluno-pa-widget__attachment-error", o.hidden = !0, e.appendChild(o);
1598
1818
  const n = document.createElement("div");
1599
- n.className = "pluno-pa-widget__attachments", n.hidden = !0, e.appendChild(n);
1819
+ n.className = "pluno-pa-widget__attachment-error", n.hidden = !0, e.appendChild(n);
1820
+ const o = document.createElement("div");
1821
+ o.className = "pluno-pa-widget__attachments", o.hidden = !0, e.appendChild(o);
1600
1822
  const i = document.createElement("div");
1601
1823
  i.className = "pluno-pa-widget__composer-inner";
1602
1824
  const r = document.createElement("input");
1603
1825
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), i.appendChild(r);
1604
1826
  const l = document.createElement("button");
1605
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(pa()), l.appendChild(sa()), i.appendChild(l);
1827
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(La()), l.appendChild(Pa()), i.appendChild(l);
1606
1828
  const p = document.createElement("textarea");
1607
1829
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", i.appendChild(p);
1608
1830
  const d = document.createElement("button");
1609
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(Xn()), i.appendChild(d), e.appendChild(i);
1610
- const u = document.createElement("div");
1611
- u.className = "pluno-pa-widget__composer-meta";
1612
- const c = document.createElement("a");
1613
- c.className = "pluno-pa-widget__powered-by", c.href = "https://pluno.ai", c.target = "_blank", c.rel = "noopener noreferrer", c.textContent = "Powered by Pluno.ai.", u.appendChild(c);
1614
- const g = document.createElement("span");
1615
- return g.className = "pluno-pa-widget__ai-disclaimer", g.textContent = "AI can make mistakes. Verify outputs.", u.appendChild(g), e.appendChild(u), e;
1831
+ d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(go()), i.appendChild(d), e.appendChild(i);
1832
+ const c = document.createElement("div");
1833
+ c.className = "pluno-pa-widget__composer-meta";
1834
+ const u = document.createElement("a");
1835
+ u.className = "pluno-pa-widget__powered-by", u.href = "https://pluno.ai", u.target = "_blank", u.rel = "noopener noreferrer", u.textContent = "Powered by Pluno.ai.", c.appendChild(u);
1836
+ const m = document.createElement("span");
1837
+ return m.className = "pluno-pa-widget__ai-disclaimer", m.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(m), e.appendChild(c), e;
1616
1838
  }
1617
- function Rt() {
1839
+ function Kt() {
1618
1840
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
1619
1841
  }
1620
- function Qi() {
1842
+ function ba() {
1621
1843
  const e = document.createElement("section");
1622
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Rt());
1844
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Kt());
1623
1845
  const t = document.createElement("div");
1624
1846
  t.className = "pluno-pa-widget__history-header";
1625
- const o = document.createElement("strong");
1626
- o.textContent = Rt();
1627
- const n = rt(
1847
+ const n = document.createElement("strong");
1848
+ n.textContent = Kt();
1849
+ const o = gt(
1628
1850
  "pluno-pa-widget__history-close",
1629
1851
  "Close recent chats",
1630
- la(),
1852
+ ka(),
1631
1853
  !1
1632
1854
  );
1633
- t.append(o, n);
1855
+ t.append(n, o);
1634
1856
  const i = document.createElement("div");
1635
1857
  i.className = "pluno-pa-widget__history-list";
1636
1858
  const r = document.createElement("p");
1637
1859
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, i, r), e;
1638
1860
  }
1639
- function ea(e) {
1861
+ function _a(e) {
1640
1862
  const t = document.createElement("div");
1641
1863
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
1642
- de(
1864
+ me(
1643
1865
  "pluno-pa-widget__character--empty",
1644
1866
  e
1645
1867
  )
1646
- ), t.appendChild(jn()), t;
1868
+ ), t.appendChild(lo()), t;
1647
1869
  }
1648
- function jn() {
1870
+ function lo() {
1649
1871
  const e = document.createElement("div");
1650
1872
  return e.className = "pluno-pa-widget__empty", e.appendChild(document.createTextNode("Hey there, I'm Pluno 👋")), e.appendChild(document.createElement("br")), e.appendChild(document.createTextNode("What do you want to do today?")), e;
1651
1873
  }
1652
- function Vn(e, t) {
1874
+ function po(e, t) {
1653
1875
  e.replaceChildren(), e.setAttribute(
1654
1876
  "aria-label",
1655
1877
  `${t.toLocaleString("en-US")} users currently active`
1656
1878
  );
1657
- const o = document.createElement("span");
1658
- o.className = "pluno-pa-widget__active-users-counter-dot", o.setAttribute("aria-hidden", "true"), e.appendChild(o), e.appendChild(
1879
+ const n = document.createElement("span");
1880
+ n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(
1659
1881
  document.createTextNode(
1660
1882
  `${t.toLocaleString("en-US")} users currently active`
1661
1883
  )
1662
1884
  );
1663
1885
  }
1664
- function de(e, t) {
1665
- const o = `pluno-pa-character-${mn}`;
1666
- mn += 1;
1667
- const n = t.scribbleStyle ? na(t.accentColor, o) : ta(t.accentColor, o), i = e.split(/\s+/).filter(Boolean);
1668
- return n.setAttribute(
1886
+ function me(e, t) {
1887
+ const n = `pluno-pa-character-${Ln}`;
1888
+ Ln += 1;
1889
+ const o = t.scribbleStyle ? ya(t.accentColor, n) : xa(t.accentColor, n), i = e.split(/\s+/).filter(Boolean);
1890
+ return o.setAttribute(
1669
1891
  "class",
1670
1892
  i.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
1671
- ), n.setAttribute("aria-hidden", "true"), n.setAttribute("focusable", "false"), n.removeAttribute("role"), n.removeAttribute("aria-label"), n;
1893
+ ), o.setAttribute("aria-hidden", "true"), o.setAttribute("focusable", "false"), o.removeAttribute("role"), o.removeAttribute("aria-label"), o;
1672
1894
  }
1673
- function ta(e, t) {
1674
- const o = Lo(e), n = {
1895
+ function xa(e, t) {
1896
+ const n = Ko(e), o = {
1675
1897
  boltFill: `${t}-boltFill`,
1676
1898
  boltEdge: `${t}-boltEdge`,
1677
1899
  boltGlow: `${t}-boltGlow`,
@@ -1682,171 +1904,171 @@ function ta(e, t) {
1682
1904
  eyeShadow: `${t}-eyeShadow`,
1683
1905
  pupilGloss: `${t}-pupilGloss`,
1684
1906
  boltClip: `${t}-boltClip`
1685
- }, i = Kn(), r = m(i, "defs"), l = m(r, "linearGradient", {
1686
- id: n.boltFill,
1907
+ }, i = so(), r = f(i, "defs"), l = f(r, "linearGradient", {
1908
+ id: o.boltFill,
1687
1909
  x1: "420",
1688
1910
  y1: "180",
1689
1911
  x2: "790",
1690
1912
  y2: "1040",
1691
1913
  gradientUnits: "userSpaceOnUse"
1692
1914
  });
1693
- M(l, "0", o.top), M(l, "0.36", o.middle), M(l, "0.72", o.bottom), M(l, "1", o.bottom);
1694
- const p = m(r, "linearGradient", {
1695
- id: n.boltEdge,
1915
+ O(l, "0", n.top), O(l, "0.36", n.middle), O(l, "0.72", n.bottom), O(l, "1", n.bottom);
1916
+ const p = f(r, "linearGradient", {
1917
+ id: o.boltEdge,
1696
1918
  x1: "470",
1697
1919
  y1: "145",
1698
1920
  x2: "900",
1699
1921
  y2: "980",
1700
1922
  gradientUnits: "userSpaceOnUse"
1701
1923
  });
1702
- M(p, "0", o.edgeStart), M(p, "0.32", o.edgeMiddle), M(p, "0.78", o.edgeEnd), M(p, "1", o.edgeEnd);
1703
- const d = m(r, "radialGradient", {
1704
- id: n.boltGlow,
1924
+ O(p, "0", n.edgeStart), O(p, "0.32", n.edgeMiddle), O(p, "0.78", n.edgeEnd), O(p, "1", n.edgeEnd);
1925
+ const d = f(r, "radialGradient", {
1926
+ id: o.boltGlow,
1705
1927
  cx: "50%",
1706
1928
  cy: "22%",
1707
1929
  r: "82%"
1708
1930
  });
1709
- M(d, "0", o.glow, "0.72"), M(d, "0.5", o.middle, "0.44"), M(d, "1", o.bottom, "0");
1710
- const u = m(r, "radialGradient", {
1711
- id: n.eyeWhite,
1931
+ O(d, "0", n.glow, "0.72"), O(d, "0.5", n.middle, "0.44"), O(d, "1", n.bottom, "0");
1932
+ const c = f(r, "radialGradient", {
1933
+ id: o.eyeWhite,
1712
1934
  cx: "35%",
1713
1935
  cy: "25%",
1714
1936
  r: "70%"
1715
1937
  });
1716
- M(u, "0", "#ffffff"), M(u, "0.72", "#ffffff"), M(u, "1", "#e5e5e5");
1717
- const c = m(r, "radialGradient", {
1718
- id: n.pupil,
1938
+ O(c, "0", "#ffffff"), O(c, "0.72", "#ffffff"), O(c, "1", "#e5e5e5");
1939
+ const u = f(r, "radialGradient", {
1940
+ id: o.pupil,
1719
1941
  cx: "42%",
1720
1942
  cy: "38%",
1721
1943
  r: "65%"
1722
1944
  });
1723
- M(c, "0", "#2a1f10"), M(c, "0.52", "#080604"), M(c, "1", "#000000");
1724
- const g = m(r, "filter", {
1725
- id: n.softDropShadow,
1945
+ O(u, "0", "#2a1f10"), O(u, "0.52", "#080604"), O(u, "1", "#000000");
1946
+ const m = f(r, "filter", {
1947
+ id: o.softDropShadow,
1726
1948
  x: "-18%",
1727
1949
  y: "-12%",
1728
1950
  width: "136%",
1729
1951
  height: "136%",
1730
1952
  "color-interpolation-filters": "sRGB"
1731
1953
  });
1732
- m(g, "feDropShadow", {
1954
+ f(m, "feDropShadow", {
1733
1955
  dx: "0",
1734
1956
  dy: "12",
1735
1957
  stdDeviation: "18",
1736
- "flood-color": o.shadow,
1958
+ "flood-color": n.shadow,
1737
1959
  "flood-opacity": "0.24"
1738
1960
  });
1739
- const S = m(r, "filter", {
1740
- id: n.innerDepth,
1961
+ const E = f(r, "filter", {
1962
+ id: o.innerDepth,
1741
1963
  x: "-8%",
1742
1964
  y: "-8%",
1743
1965
  width: "116%",
1744
1966
  height: "116%",
1745
1967
  "color-interpolation-filters": "sRGB"
1746
1968
  });
1747
- m(S, "feGaussianBlur", {
1969
+ f(E, "feGaussianBlur", {
1748
1970
  in: "SourceAlpha",
1749
1971
  stdDeviation: "8",
1750
1972
  result: "blur"
1751
- }), m(S, "feOffset", {
1973
+ }), f(E, "feOffset", {
1752
1974
  dx: "-7",
1753
1975
  dy: "-9",
1754
1976
  result: "topLeft"
1755
- }), m(S, "feComposite", {
1977
+ }), f(E, "feComposite", {
1756
1978
  in: "topLeft",
1757
1979
  in2: "SourceAlpha",
1758
1980
  operator: "arithmetic",
1759
1981
  k2: "-1",
1760
1982
  k3: "1",
1761
1983
  result: "innerShadow"
1762
- }), m(S, "feColorMatrix", {
1984
+ }), f(E, "feColorMatrix", {
1763
1985
  in: "innerShadow",
1764
1986
  type: "matrix",
1765
1987
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
1766
1988
  result: "innerLight"
1767
- }), m(S, "feBlend", {
1989
+ }), f(E, "feBlend", {
1768
1990
  in: "SourceGraphic",
1769
1991
  in2: "innerLight",
1770
1992
  mode: "screen"
1771
1993
  });
1772
- const b = m(r, "filter", {
1773
- id: n.eyeShadow,
1994
+ const v = f(r, "filter", {
1995
+ id: o.eyeShadow,
1774
1996
  x: "-24%",
1775
1997
  y: "-20%",
1776
1998
  width: "148%",
1777
1999
  height: "148%",
1778
2000
  "color-interpolation-filters": "sRGB"
1779
2001
  });
1780
- m(b, "feDropShadow", {
2002
+ f(v, "feDropShadow", {
1781
2003
  dx: "0",
1782
2004
  dy: "8",
1783
2005
  stdDeviation: "5",
1784
- "flood-color": o.shadow,
2006
+ "flood-color": n.shadow,
1785
2007
  "flood-opacity": "0.3"
1786
2008
  });
1787
- const H = m(r, "filter", {
1788
- id: n.pupilGloss,
2009
+ const z = f(r, "filter", {
2010
+ id: o.pupilGloss,
1789
2011
  x: "-15%",
1790
2012
  y: "-15%",
1791
2013
  width: "130%",
1792
2014
  height: "130%",
1793
2015
  "color-interpolation-filters": "sRGB"
1794
2016
  });
1795
- m(H, "feDropShadow", {
2017
+ f(z, "feDropShadow", {
1796
2018
  dx: "0",
1797
2019
  dy: "3",
1798
2020
  stdDeviation: "3",
1799
2021
  "flood-color": "#000000",
1800
2022
  "flood-opacity": "0.22"
1801
2023
  });
1802
- const k = m(r, "clipPath", { id: n.boltClip });
1803
- m(k, "path", { d: nt });
1804
- const y = m(i, "g", {
1805
- filter: j(n.softDropShadow)
2024
+ const b = f(r, "clipPath", { id: o.boltClip });
2025
+ f(b, "path", { d: pt });
2026
+ const g = f(i, "g", {
2027
+ filter: V(o.softDropShadow)
1806
2028
  });
1807
- m(y, "path", {
1808
- d: nt,
1809
- fill: j(n.boltEdge)
2029
+ f(g, "path", {
2030
+ d: pt,
2031
+ fill: V(o.boltEdge)
1810
2032
  });
1811
- const v = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
1812
- m(y, "path", {
1813
- d: v,
1814
- fill: j(n.boltFill),
1815
- filter: j(n.innerDepth)
1816
- }), m(y, "path", {
1817
- d: v,
1818
- fill: j(n.boltGlow),
2033
+ const w = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
2034
+ f(g, "path", {
2035
+ d: w,
2036
+ fill: V(o.boltFill),
2037
+ filter: V(o.innerDepth)
2038
+ }), f(g, "path", {
2039
+ d: w,
2040
+ fill: V(o.boltGlow),
1819
2041
  opacity: "0.74"
1820
2042
  });
1821
- const h = m(y, "g", {
1822
- "clip-path": j(n.boltClip),
2043
+ const h = f(g, "g", {
2044
+ "clip-path": V(o.boltClip),
1823
2045
  opacity: "0.42"
1824
2046
  });
1825
- m(h, "path", {
2047
+ f(h, "path", {
1826
2048
  d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
1827
2049
  fill: "none",
1828
- stroke: o.highlight,
2050
+ stroke: n.highlight,
1829
2051
  "stroke-width": "22",
1830
2052
  "stroke-linecap": "round",
1831
2053
  opacity: "0.65"
1832
- }), m(h, "path", {
2054
+ }), f(h, "path", {
1833
2055
  d: "M556 685 L501 994",
1834
2056
  fill: "none",
1835
- stroke: o.highlight,
2057
+ stroke: n.highlight,
1836
2058
  "stroke-width": "20",
1837
2059
  "stroke-linecap": "round",
1838
2060
  opacity: "0.55"
1839
- }), m(h, "path", {
2061
+ }), f(h, "path", {
1840
2062
  d: "M858 160 C882 166 893 181 883 204",
1841
2063
  fill: "none",
1842
- stroke: o.inner,
2064
+ stroke: n.inner,
1843
2065
  "stroke-width": "18",
1844
2066
  "stroke-linecap": "round",
1845
2067
  opacity: "0.48"
1846
2068
  });
1847
- const N = m(i, "g", { filter: j(n.eyeShadow) });
1848
- return xn(
1849
- N,
2069
+ const P = f(i, "g", { filter: V(o.eyeShadow) });
2070
+ return Rn(
2071
+ P,
1850
2072
  "rotate(-2 528 463)",
1851
2073
  "528",
1852
2074
  "463",
@@ -1854,9 +2076,9 @@ function ta(e, t) {
1854
2076
  "473",
1855
2077
  "557",
1856
2078
  "447",
1857
- n
1858
- ), xn(
1859
- N,
2079
+ o
2080
+ ), Rn(
2081
+ P,
1860
2082
  "rotate(2 717 462)",
1861
2083
  "717",
1862
2084
  "462",
@@ -1864,55 +2086,55 @@ function ta(e, t) {
1864
2086
  "473",
1865
2087
  "728",
1866
2088
  "447",
1867
- n
2089
+ o
1868
2090
  ), i;
1869
2091
  }
1870
- function na(e, t) {
1871
- const o = Rn(e), n = {
2092
+ function ya(e, t) {
2093
+ const n = Kn(e), o = {
1872
2094
  clip: `${t}-scribbleBoltClip`,
1873
2095
  wobble: `${t}-scribbleBoltWobble`
1874
- }, i = Kn(), r = m(i, "defs"), l = m(r, "clipPath", { id: n.clip });
1875
- m(l, "path", { d: nt });
1876
- const p = m(r, "filter", {
1877
- id: n.wobble,
2096
+ }, i = so(), r = f(i, "defs"), l = f(r, "clipPath", { id: o.clip });
2097
+ f(l, "path", { d: pt });
2098
+ const p = f(r, "filter", {
2099
+ id: o.wobble,
1878
2100
  x: "-10%",
1879
2101
  y: "-10%",
1880
2102
  width: "120%",
1881
2103
  height: "120%",
1882
2104
  "color-interpolation-filters": "sRGB"
1883
2105
  });
1884
- m(p, "feTurbulence", {
2106
+ f(p, "feTurbulence", {
1885
2107
  type: "fractalNoise",
1886
2108
  baseFrequency: "0.011",
1887
2109
  numOctaves: "3",
1888
2110
  seed: "7",
1889
2111
  result: "noise"
1890
- }), m(p, "feDisplacementMap", {
2112
+ }), f(p, "feDisplacementMap", {
1891
2113
  in: "SourceGraphic",
1892
2114
  in2: "noise",
1893
2115
  scale: "16",
1894
2116
  xChannelSelector: "R",
1895
2117
  yChannelSelector: "G"
1896
2118
  });
1897
- const d = m(i, "g", { filter: j(n.wobble) }), u = m(d, "g", {
1898
- "clip-path": j(n.clip)
2119
+ const d = f(i, "g", { filter: V(o.wobble) }), c = f(d, "g", {
2120
+ "clip-path": V(o.clip)
1899
2121
  });
1900
- return m(u, "path", {
1901
- d: ko(),
2122
+ return f(c, "path", {
2123
+ d: Vo(),
1902
2124
  fill: "none",
1903
- stroke: o,
2125
+ stroke: n,
1904
2126
  "stroke-width": "56",
1905
2127
  "stroke-linecap": "round",
1906
2128
  "stroke-linejoin": "round",
1907
2129
  opacity: "0.9",
1908
2130
  transform: "rotate(-14 627 600)"
1909
- }), m(d, "path", {
1910
- d: nt,
2131
+ }), f(d, "path", {
2132
+ d: pt,
1911
2133
  fill: "none",
1912
- stroke: ot,
2134
+ stroke: st,
1913
2135
  "stroke-width": "18",
1914
2136
  "stroke-linejoin": "round"
1915
- }), yn(
2137
+ }), zn(
1916
2138
  d,
1917
2139
  "rotate(-2 528 463)",
1918
2140
  "528",
@@ -1921,7 +2143,7 @@ function na(e, t) {
1921
2143
  "473",
1922
2144
  "557",
1923
2145
  "447"
1924
- ), yn(
2146
+ ), zn(
1925
2147
  d,
1926
2148
  "rotate(2 717 462)",
1927
2149
  "717",
@@ -1932,139 +2154,161 @@ function na(e, t) {
1932
2154
  "447"
1933
2155
  ), i;
1934
2156
  }
1935
- function Kn() {
1936
- return C("svg", {
1937
- xmlns: Hn,
2157
+ function so() {
2158
+ return S("svg", {
2159
+ xmlns: to,
1938
2160
  viewBox: "0 0 1254 1254"
1939
2161
  });
1940
2162
  }
1941
- function xn(e, t, o, n, i, r, l, p, d) {
1942
- const u = m(e, "g", { transform: t });
1943
- m(u, "ellipse", {
1944
- cx: o,
1945
- cy: n,
2163
+ function Rn(e, t, n, o, i, r, l, p, d) {
2164
+ const c = f(e, "g", { transform: t });
2165
+ f(c, "ellipse", {
2166
+ cx: n,
2167
+ cy: o,
1946
2168
  rx: "73",
1947
2169
  ry: "80",
1948
- fill: j(d.eyeWhite)
1949
- }), m(u, "ellipse", {
2170
+ fill: V(d.eyeWhite)
2171
+ }), f(c, "ellipse", {
1950
2172
  cx: i,
1951
2173
  cy: r,
1952
2174
  rx: "49",
1953
2175
  ry: "57",
1954
- fill: j(d.pupil),
1955
- filter: j(d.pupilGloss)
1956
- }), m(u, "circle", {
2176
+ fill: V(d.pupil),
2177
+ filter: V(d.pupilGloss)
2178
+ }), f(c, "circle", {
1957
2179
  cx: l,
1958
2180
  cy: p,
1959
2181
  r: "18",
1960
2182
  fill: "#ffffff"
1961
2183
  });
1962
2184
  }
1963
- function yn(e, t, o, n, i, r, l, p) {
1964
- const d = m(e, "g", { transform: t });
1965
- m(d, "ellipse", {
1966
- cx: o,
1967
- cy: n,
2185
+ function zn(e, t, n, o, i, r, l, p) {
2186
+ const d = f(e, "g", { transform: t });
2187
+ f(d, "ellipse", {
2188
+ cx: n,
2189
+ cy: o,
1968
2190
  rx: "73",
1969
2191
  ry: "80",
1970
2192
  fill: "#ffffff",
1971
- stroke: ot,
2193
+ stroke: st,
1972
2194
  "stroke-width": "13"
1973
- }), m(d, "ellipse", {
2195
+ }), f(d, "ellipse", {
1974
2196
  cx: i,
1975
2197
  cy: r,
1976
2198
  rx: "45",
1977
2199
  ry: "53",
1978
- fill: ot
1979
- }), m(d, "circle", {
2200
+ fill: st
2201
+ }), f(d, "circle", {
1980
2202
  cx: l,
1981
2203
  cy: p,
1982
2204
  r: "16",
1983
2205
  fill: "#ffffff"
1984
2206
  });
1985
2207
  }
1986
- function m(e, t, o = {}) {
1987
- const n = C(t, o);
1988
- return e.appendChild(n), n;
2208
+ function f(e, t, n = {}) {
2209
+ const o = S(t, n);
2210
+ return e.appendChild(o), o;
1989
2211
  }
1990
- function M(e, t, o, n) {
1991
- const i = { offset: t, "stop-color": o };
1992
- n !== void 0 && (i["stop-opacity"] = n), m(e, "stop", i);
2212
+ function O(e, t, n, o) {
2213
+ const i = { offset: t, "stop-color": n };
2214
+ o !== void 0 && (i["stop-opacity"] = o), f(e, "stop", i);
1993
2215
  }
1994
- function j(e) {
2216
+ function V(e) {
1995
2217
  return `url(#${e})`;
1996
2218
  }
1997
- function rt(e, t, o, n) {
2219
+ function gt(e, t, n, o) {
1998
2220
  const i = document.createElement("button");
1999
- return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = n, i.appendChild(o), i;
2221
+ return i.type = "button", i.className = e, i.setAttribute("aria-label", t), i.title = t, i.hidden = o, i.appendChild(n), i;
2000
2222
  }
2001
- function oa() {
2002
- const e = C("svg", {
2223
+ function va() {
2224
+ const e = S("svg", {
2003
2225
  class: "pluno-pa-widget__scribble-defs",
2004
2226
  "aria-hidden": "true",
2005
2227
  focusable: "false",
2006
2228
  width: "0",
2007
2229
  height: "0"
2008
- }), t = C("defs");
2009
- return t.appendChild(kt("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2010
- kt("pluno-pa-scribble-wobble-2", "5", "15")
2230
+ }), t = S("defs");
2231
+ return t.appendChild(Ot("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2232
+ Ot("pluno-pa-scribble-wobble-2", "5", "15")
2011
2233
  ), t.appendChild(
2012
- kt("pluno-pa-scribble-wobble-3", "9", "19")
2234
+ Ot("pluno-pa-scribble-wobble-3", "9", "19")
2013
2235
  ), e.appendChild(t), e;
2014
2236
  }
2015
- function Yn(e, t) {
2016
- const o = t * cn + un * 2, n = C("svg", {
2237
+ function co(e, t) {
2238
+ const n = S("svg", {
2017
2239
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2018
- viewBox: `0 0 ${o} ${_i}`,
2019
2240
  preserveAspectRatio: "xMidYMid meet",
2020
2241
  "aria-hidden": "true",
2021
2242
  focusable: "false"
2022
2243
  });
2023
- for (let i = 0; i < t; i += 1) {
2024
- const r = gn[i % gn.length], l = C("g", {
2025
- transform: `translate(${un + i * cn} 0)`
2244
+ return uo(n, t), n;
2245
+ }
2246
+ function Mt(e, t) {
2247
+ if (!e)
2248
+ return;
2249
+ const n = Math.max(
2250
+ 0,
2251
+ t - qt * 2
2252
+ ), o = Math.max(
2253
+ Ui,
2254
+ Math.floor(
2255
+ (n - $t * 2) / Gt
2256
+ )
2257
+ );
2258
+ uo(e, o);
2259
+ }
2260
+ function uo(e, t) {
2261
+ if (e.dataset.spiralCount === `${t}`)
2262
+ return;
2263
+ const n = t * Gt + $t * 2;
2264
+ e.dataset.spiralCount = `${t}`, e.setAttribute(
2265
+ "viewBox",
2266
+ `0 0 ${n} ${Bi}`
2267
+ ), e.replaceChildren();
2268
+ for (let o = 0; o < t; o += 1) {
2269
+ const i = kn[o % kn.length], r = S("g", {
2270
+ transform: `translate(${$t + o * Gt} 0)`
2026
2271
  });
2027
- l.appendChild(
2028
- C("ellipse", {
2029
- cx: r.ellipseCx,
2030
- cy: r.ellipseCy,
2031
- rx: r.ellipseRx,
2032
- ry: r.ellipseRy,
2272
+ r.appendChild(
2273
+ S("ellipse", {
2274
+ cx: i.ellipseCx,
2275
+ cy: i.ellipseCy,
2276
+ rx: i.ellipseRx,
2277
+ ry: i.ellipseRy,
2033
2278
  fill: "none",
2034
2279
  stroke: "#2c2a1e",
2035
- "stroke-width": r.strokeWidth,
2280
+ "stroke-width": i.strokeWidth,
2036
2281
  opacity: "0.8"
2037
2282
  })
2038
- ), l.appendChild(
2039
- C("path", {
2040
- d: r.path,
2283
+ ), r.appendChild(
2284
+ S("path", {
2285
+ d: i.path,
2041
2286
  fill: "none",
2042
2287
  stroke: "#2c2a1e",
2043
- "stroke-width": r.pathStrokeWidth,
2288
+ "stroke-width": i.pathStrokeWidth,
2044
2289
  "stroke-linecap": "round"
2045
2290
  })
2046
- ), n.appendChild(l);
2291
+ ), e.appendChild(r);
2047
2292
  }
2048
- return n;
2049
2293
  }
2050
- function kt(e, t, o) {
2051
- const n = C("filter", {
2294
+ function Ot(e, t, n) {
2295
+ const o = S("filter", {
2052
2296
  id: e,
2053
2297
  x: "-8%",
2054
2298
  y: "-8%",
2055
2299
  width: "116%",
2056
2300
  height: "116%"
2057
2301
  });
2058
- return n.appendChild(
2059
- C("feTurbulence", {
2302
+ return o.appendChild(
2303
+ S("feTurbulence", {
2060
2304
  type: "fractalNoise",
2061
2305
  baseFrequency: "0.012 0.028",
2062
2306
  numOctaves: "3",
2063
2307
  seed: t,
2064
2308
  result: "stroke-noise"
2065
2309
  })
2066
- ), n.appendChild(
2067
- C("feDisplacementMap", {
2310
+ ), o.appendChild(
2311
+ S("feDisplacementMap", {
2068
2312
  in: "SourceGraphic",
2069
2313
  in2: "stroke-noise",
2070
2314
  scale: "3.5",
@@ -2072,26 +2316,26 @@ function kt(e, t, o) {
2072
2316
  yChannelSelector: "G",
2073
2317
  result: "warped"
2074
2318
  })
2075
- ), n.appendChild(
2076
- C("feTurbulence", {
2319
+ ), o.appendChild(
2320
+ S("feTurbulence", {
2077
2321
  type: "fractalNoise",
2078
2322
  baseFrequency: "0.7",
2079
2323
  numOctaves: "1",
2080
- seed: o,
2324
+ seed: n,
2081
2325
  result: "ink-noise"
2082
2326
  })
2083
- ), n.appendChild(
2084
- C("feDisplacementMap", {
2327
+ ), o.appendChild(
2328
+ S("feDisplacementMap", {
2085
2329
  in: "warped",
2086
2330
  in2: "ink-noise",
2087
2331
  scale: "0.9",
2088
2332
  xChannelSelector: "R",
2089
2333
  yChannelSelector: "G"
2090
2334
  })
2091
- ), n;
2335
+ ), o;
2092
2336
  }
2093
- function ia(e) {
2094
- const t = oe(
2337
+ function Ca(e) {
2338
+ const t = re(
2095
2339
  "0 0 24 24",
2096
2340
  e,
2097
2341
  e,
@@ -2099,10 +2343,10 @@ function ia(e) {
2099
2343
  "currentColor",
2100
2344
  "2.25"
2101
2345
  );
2102
- return t.appendChild(C("path", { d: "m6 9 6 6 6-6" })), t;
2346
+ return t.appendChild(S("path", { d: "m6 9 6 6 6-6" })), t;
2103
2347
  }
2104
- function aa() {
2105
- const e = oe(
2348
+ function Sa() {
2349
+ const e = re(
2106
2350
  "0 0 24 24",
2107
2351
  17,
2108
2352
  17,
@@ -2111,17 +2355,17 @@ function aa() {
2111
2355
  "2.25"
2112
2356
  );
2113
2357
  return e.appendChild(
2114
- C("path", {
2358
+ S("path", {
2115
2359
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
2116
2360
  })
2117
2361
  ), e.appendChild(
2118
- C("path", {
2362
+ S("path", {
2119
2363
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
2120
2364
  })
2121
2365
  ), e;
2122
2366
  }
2123
- function ra() {
2124
- const e = oe(
2367
+ function Ea() {
2368
+ const e = re(
2125
2369
  "0 0 24 24",
2126
2370
  17,
2127
2371
  17,
@@ -2129,10 +2373,10 @@ function ra() {
2129
2373
  "currentColor",
2130
2374
  "2.25"
2131
2375
  );
2132
- return e.appendChild(C("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(C("path", { d: "M3 4v5h5" })), e.appendChild(C("path", { d: "M12 7v5l3 2" })), e;
2376
+ return e.appendChild(S("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(S("path", { d: "M3 4v5h5" })), e.appendChild(S("path", { d: "M12 7v5l3 2" })), e;
2133
2377
  }
2134
- function la() {
2135
- const e = oe(
2378
+ function ka() {
2379
+ const e = re(
2136
2380
  "0 0 24 24",
2137
2381
  15,
2138
2382
  15,
@@ -2140,10 +2384,10 @@ function la() {
2140
2384
  "currentColor",
2141
2385
  "2.4"
2142
2386
  );
2143
- return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2387
+ return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
2144
2388
  }
2145
- function Xn() {
2146
- const e = oe(
2389
+ function go() {
2390
+ const e = re(
2147
2391
  "0 0 24 24",
2148
2392
  14,
2149
2393
  14,
@@ -2152,11 +2396,11 @@ function Xn() {
2152
2396
  "2.75"
2153
2397
  );
2154
2398
  return e.appendChild(
2155
- C("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2156
- ), e.appendChild(C("polyline", { points: "5 12 12 5 19 12" })), e;
2399
+ S("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2400
+ ), e.appendChild(S("polyline", { points: "5 12 12 5 19 12" })), e;
2157
2401
  }
2158
- function pa() {
2159
- const e = oe(
2402
+ function La() {
2403
+ const e = re(
2160
2404
  "0 0 24 24",
2161
2405
  16,
2162
2406
  16,
@@ -2168,18 +2412,18 @@ function pa() {
2168
2412
  "class",
2169
2413
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
2170
2414
  ), e.appendChild(
2171
- C("path", {
2415
+ S("path", {
2172
2416
  d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
2173
2417
  })
2174
2418
  ), e;
2175
2419
  }
2176
- function sa() {
2177
- const e = oe("0 0 24 24", 19, 19, "none", "currentColor");
2420
+ function Pa() {
2421
+ const e = re("0 0 24 24", 19, 19, "none", "currentColor");
2178
2422
  return e.setAttribute(
2179
2423
  "class",
2180
2424
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
2181
2425
  ), e.appendChild(
2182
- C("path", {
2426
+ S("path", {
2183
2427
  d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
2184
2428
  stroke: "currentColor",
2185
2429
  "stroke-width": "2",
@@ -2188,10 +2432,10 @@ function sa() {
2188
2432
  })
2189
2433
  ), e;
2190
2434
  }
2191
- function da() {
2192
- const e = oe("0 0 24 24", 18, 18, "currentColor");
2435
+ function Ia() {
2436
+ const e = re("0 0 24 24", 18, 18, "currentColor");
2193
2437
  return e.appendChild(
2194
- C("rect", {
2438
+ S("rect", {
2195
2439
  x: "6",
2196
2440
  y: "6",
2197
2441
  width: "12",
@@ -2200,8 +2444,8 @@ function da() {
2200
2444
  })
2201
2445
  ), e;
2202
2446
  }
2203
- function ca() {
2204
- const e = oe(
2447
+ function Aa() {
2448
+ const e = re(
2205
2449
  "0 0 24 24",
2206
2450
  12,
2207
2451
  12,
@@ -2209,10 +2453,10 @@ function ca() {
2209
2453
  "currentColor",
2210
2454
  "2.4"
2211
2455
  );
2212
- return e.appendChild(C("path", { d: "M18 6 6 18" })), e.appendChild(C("path", { d: "m6 6 12 12" })), e;
2456
+ return e.appendChild(S("path", { d: "M18 6 6 18" })), e.appendChild(S("path", { d: "m6 6 12 12" })), e;
2213
2457
  }
2214
- function ua() {
2215
- const e = oe(
2458
+ function Na() {
2459
+ const e = re(
2216
2460
  "0 0 24 24",
2217
2461
  13,
2218
2462
  13,
@@ -2221,7 +2465,7 @@ function ua() {
2221
2465
  "2.25"
2222
2466
  );
2223
2467
  return e.appendChild(
2224
- C("rect", {
2468
+ S("rect", {
2225
2469
  width: "14",
2226
2470
  height: "14",
2227
2471
  x: "8",
@@ -2230,341 +2474,341 @@ function ua() {
2230
2474
  ry: "2"
2231
2475
  })
2232
2476
  ), e.appendChild(
2233
- C("path", {
2477
+ S("path", {
2234
2478
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2235
2479
  })
2236
2480
  ), e;
2237
2481
  }
2238
- function oe(e, t, o, n, i, r) {
2482
+ function re(e, t, n, o, i, r) {
2239
2483
  const l = {
2240
2484
  viewBox: e,
2241
2485
  width: String(t),
2242
- height: String(o),
2243
- fill: n,
2486
+ height: String(n),
2487
+ fill: o,
2244
2488
  "aria-hidden": "true"
2245
2489
  };
2246
- return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), C("svg", l);
2490
+ return i && (l.stroke = i, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), S("svg", l);
2247
2491
  }
2248
- function C(e, t = {}) {
2249
- const o = document.createElementNS(Hn, e);
2250
- for (const [n, i] of Object.entries(t))
2251
- o.setAttribute(n, i);
2252
- return o;
2492
+ function S(e, t = {}) {
2493
+ const n = document.createElementNS(to, e);
2494
+ for (const [o, i] of Object.entries(t))
2495
+ n.setAttribute(o, i);
2496
+ return n;
2253
2497
  }
2254
- function vn(e) {
2498
+ function Mn(e) {
2255
2499
  for (const t of ["keydown", "keypress", "keyup"])
2256
- e.addEventListener(t, (o) => {
2257
- o.stopPropagation();
2500
+ e.addEventListener(t, (n) => {
2501
+ n.stopPropagation();
2258
2502
  });
2259
2503
  }
2260
- function ga(e, t, o) {
2504
+ function Ta(e, t, n) {
2261
2505
  e.replaceChildren(), e.hidden = t.length === 0;
2262
- for (const [n, i] of t.entries()) {
2506
+ for (const [o, i] of t.entries()) {
2263
2507
  const r = document.createElement("div");
2264
- r.className = "pluno-pa-widget__attachment", r.appendChild(ha(i));
2508
+ r.className = "pluno-pa-widget__attachment", r.appendChild(Da(i));
2265
2509
  const l = document.createElement("span");
2266
2510
  l.textContent = i.name, r.appendChild(l);
2267
2511
  const p = document.createElement("button");
2268
- p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(ca()), p.addEventListener("click", () => o(n)), r.appendChild(p), e.appendChild(r);
2512
+ p.type = "button", p.setAttribute("aria-label", `Remove ${i.name}`), p.appendChild(Aa()), p.addEventListener("click", () => n(o)), r.appendChild(p), e.appendChild(r);
2269
2513
  }
2270
2514
  }
2271
- function ha(e) {
2272
- const t = Ut(e), o = Zn(e);
2273
- if (t === "image" && o) {
2274
- const n = document.createElement("img");
2275
- return n.src = o, n.alt = "", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n;
2515
+ function Da(e) {
2516
+ const t = en(e), n = ho(e);
2517
+ if (t === "image" && n) {
2518
+ const o = document.createElement("img");
2519
+ return o.src = n, o.alt = "", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o;
2276
2520
  }
2277
- if (t === "video" && o) {
2278
- const n = document.createElement("video");
2279
- return n.src = o, n.muted = !0, n.preload = "metadata", n.setAttribute("aria-hidden", "true"), n.addEventListener("error", () => n.replaceWith(ee(e))), n.addEventListener("stalled", () => n.replaceWith(ee(e))), n;
2521
+ if (t === "video" && n) {
2522
+ const o = document.createElement("video");
2523
+ return o.src = n, o.muted = !0, o.preload = "metadata", o.setAttribute("aria-hidden", "true"), o.addEventListener("error", () => o.replaceWith(ie(e))), o.addEventListener("stalled", () => o.replaceWith(ie(e))), o;
2280
2524
  }
2281
- return ee(e);
2525
+ return ie(e);
2282
2526
  }
2283
- function ma(e) {
2284
- const t = Ut(e), o = Zn(e);
2285
- if (t === "image" && o) {
2286
- const n = document.createElement("img");
2287
- return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.alt = e.name, n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n;
2527
+ function Ra(e) {
2528
+ const t = en(e), n = ho(e);
2529
+ if (t === "image" && n) {
2530
+ const o = document.createElement("img");
2531
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.alt = e.name, o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o;
2288
2532
  }
2289
- if (t === "pdf" && o) {
2290
- const n = document.createElement("object");
2291
- return n.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", n.data = o, n.type = "application/pdf", n.setAttribute("aria-label", e.name), n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.appendChild(ee(e, "message")), n;
2533
+ if (t === "pdf" && n) {
2534
+ const o = document.createElement("object");
2535
+ return o.className = "pluno-pa-widget__message-attachment-preview pluno-pa-widget__message-attachment-preview--pdf", o.data = n, o.type = "application/pdf", o.setAttribute("aria-label", e.name), o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.appendChild(ie(e, "message")), o;
2292
2536
  }
2293
- if (t === "video" && o) {
2294
- const n = document.createElement("video");
2295
- return n.className = "pluno-pa-widget__message-attachment-preview", n.src = o, n.muted = !0, n.preload = "metadata", n.addEventListener("error", () => n.replaceWith(ee(e, "message"))), n.addEventListener("stalled", () => n.replaceWith(ee(e, "message"))), n;
2537
+ if (t === "video" && n) {
2538
+ const o = document.createElement("video");
2539
+ return o.className = "pluno-pa-widget__message-attachment-preview", o.src = n, o.muted = !0, o.preload = "metadata", o.addEventListener("error", () => o.replaceWith(ie(e, "message"))), o.addEventListener("stalled", () => o.replaceWith(ie(e, "message"))), o;
2296
2540
  }
2297
- return ee(e, "message");
2541
+ return ie(e, "message");
2298
2542
  }
2299
- function ee(e, t = "composer") {
2543
+ function ie(e, t = "composer") {
2300
2544
  if (t === "composer") {
2301
2545
  const r = document.createElement("span");
2302
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = Cn(e), r;
2546
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = On(e), r;
2303
2547
  }
2304
- const o = document.createElement("div");
2305
- o.className = "pluno-pa-widget__message-attachment-file";
2306
- const n = document.createElement("span");
2307
- n.textContent = Cn(e);
2548
+ const n = document.createElement("div");
2549
+ n.className = "pluno-pa-widget__message-attachment-file";
2550
+ const o = document.createElement("span");
2551
+ o.textContent = On(e);
2308
2552
  const i = document.createElement("strong");
2309
- return i.textContent = e.name, o.append(n, i), o;
2553
+ return i.textContent = e.name, n.append(o, i), n;
2310
2554
  }
2311
- function Ut(e) {
2555
+ function en(e) {
2312
2556
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2313
2557
  }
2314
- function Zn(e) {
2558
+ function ho(e) {
2315
2559
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2316
2560
  }
2317
- function Cn(e) {
2318
- const t = Ut(e);
2561
+ function On(e) {
2562
+ const t = en(e);
2319
2563
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2320
2564
  }
2321
- function fa(e, t) {
2322
- return t ? Array.from(t).map((n) => ({
2323
- ...e.createLocalAttachment(n),
2324
- previewUrl: ba(n)
2565
+ function za(e, t) {
2566
+ return t ? Array.from(t).map((o) => ({
2567
+ ...e.createLocalAttachment(o),
2568
+ previewUrl: Ma(o)
2325
2569
  })) : [];
2326
2570
  }
2327
- function ba(e) {
2571
+ function Ma(e) {
2328
2572
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2329
2573
  }
2330
- function Qe(e) {
2574
+ function it(e) {
2331
2575
  return !!(e && Array.from(e.types).includes("Files"));
2332
2576
  }
2333
- function Lt(e, t, o = null) {
2334
- if (!e || !Mt(t, o)) {
2577
+ function Bt(e, t, n = null) {
2578
+ if (!e || !Yt(t, n)) {
2335
2579
  e && (e.hidden = !0, e.replaceChildren());
2336
2580
  return;
2337
2581
  }
2338
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", te(t) || Bt(o) ? e.appendChild(
2339
- wa(t, o)
2340
- ) : Jn(t) && e.appendChild(_a(t));
2582
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", ae(t) || tn(n) ? e.appendChild(
2583
+ Oa(t, n)
2584
+ ) : mo(t) && e.appendChild(Ba(t));
2341
2585
  }
2342
- function wa(e, t) {
2343
- const o = document.createElement("div");
2344
- o.className = "pluno-pa-widget__billing-action-card";
2345
- const n = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2346
- i.textContent = n ? "Credits used up" : "Billing needs attention", o.appendChild(i);
2586
+ function Oa(e, t) {
2587
+ const n = document.createElement("div");
2588
+ n.className = "pluno-pa-widget__billing-action-card";
2589
+ const o = e.limitExceeded || t === "limit_exceeded", i = document.createElement("strong");
2590
+ i.textContent = o ? "Credits used up" : "Billing needs attention", n.appendChild(i);
2347
2591
  const r = document.createElement("span");
2348
- return r.textContent = n ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", o.appendChild(r), o.appendChild(
2349
- Qn(
2592
+ return r.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(r), n.appendChild(
2593
+ fo(
2350
2594
  e,
2351
2595
  "Upgrade plan",
2352
2596
  "pluno-pa-widget__billing-action-card-actions"
2353
2597
  )
2354
- ), o;
2598
+ ), n;
2355
2599
  }
2356
- function _a(e) {
2600
+ function Ba(e) {
2357
2601
  const t = document.createElement("div");
2358
2602
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2359
- const o = document.createElement("strong");
2360
- o.textContent = "Credits running low", t.appendChild(o);
2361
- const n = document.createElement("span");
2362
- return n.textContent = ya(e) ?? "Credits are running low for this period.", t.appendChild(n), t.appendChild(
2363
- Qn(
2603
+ const n = document.createElement("strong");
2604
+ n.textContent = "Credits running low", t.appendChild(n);
2605
+ const o = document.createElement("span");
2606
+ return o.textContent = Fa(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(
2607
+ fo(
2364
2608
  e,
2365
2609
  "Upgrade",
2366
2610
  "pluno-pa-widget__billing-action-card-actions"
2367
2611
  )
2368
2612
  ), t;
2369
2613
  }
2370
- function Mt(e, t) {
2371
- return e !== null && (te(e) || Jn(e) || Bt(t));
2614
+ function Yt(e, t) {
2615
+ return e !== null && (ae(e) || mo(e) || tn(t));
2372
2616
  }
2373
- function Sn(e, t, o) {
2374
- return Mt(t, o) || xa(t) ? !0 : !Mt(e, o);
2617
+ function Bn(e, t, n) {
2618
+ return Yt(t, n) || Ua(t) ? !0 : !Yt(e, n);
2375
2619
  }
2376
- function xa(e) {
2377
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || te(e));
2620
+ function Ua(e) {
2621
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || ae(e));
2378
2622
  }
2379
- function te(e) {
2623
+ function ae(e) {
2380
2624
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2381
2625
  }
2382
- function Bt(e) {
2626
+ function tn(e) {
2383
2627
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2384
2628
  }
2385
- function Jn(e) {
2386
- return !te(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2629
+ function mo(e) {
2630
+ return !ae(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2387
2631
  }
2388
- function ya(e) {
2389
- return e.creditsRemaining === null ? null : `${va(e.creditsRemaining)} credits left`;
2632
+ function Fa(e) {
2633
+ return e.creditsRemaining === null ? null : `${Ha(e.creditsRemaining)} credits left`;
2390
2634
  }
2391
- function va(e) {
2635
+ function Ha(e) {
2392
2636
  return new Intl.NumberFormat("en-US", {
2393
2637
  maximumFractionDigits: 0
2394
2638
  }).format(Math.ceil(e));
2395
2639
  }
2396
- function Qn(e, t, o) {
2397
- const n = document.createElement("div");
2398
- return n.className = o, n.appendChild(
2399
- En(t, e.pricingUrl)
2400
- ), n.appendChild(
2401
- En("Earn credits", e.earnCreditsUrl)
2402
- ), n;
2640
+ function fo(e, t, n) {
2641
+ const o = document.createElement("div");
2642
+ return o.className = n, o.appendChild(
2643
+ Un(t, e.pricingUrl)
2644
+ ), o.appendChild(
2645
+ Un("Earn credits", e.earnCreditsUrl)
2646
+ ), o;
2403
2647
  }
2404
- function En(e, t) {
2405
- const o = document.createElement("button");
2406
- if (o.type = "button", e === "Earn credits") {
2407
- const n = document.createElement("span");
2408
- n.className = "pluno-pa-widget__billing-action-card-earn-credits-label", n.textContent = e, o.appendChild(n);
2648
+ function Un(e, t) {
2649
+ const n = document.createElement("button");
2650
+ if (n.type = "button", e === "Earn credits") {
2651
+ const o = document.createElement("span");
2652
+ o.className = "pluno-pa-widget__billing-action-card-earn-credits-label", o.textContent = e, n.appendChild(o);
2409
2653
  } else
2410
- o.textContent = e;
2411
- return o.disabled = t.trim().length === 0, o.addEventListener("click", () => {
2654
+ n.textContent = e;
2655
+ return n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
2412
2656
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2413
- }), o;
2657
+ }), n;
2414
2658
  }
2415
- function It(e, t) {
2659
+ function Ut(e, t) {
2416
2660
  return e.messages.filter(
2417
- (n) => !eo(n)
2661
+ (o) => !wo(o)
2418
2662
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2419
2663
  }
2420
- function Ca(e, t, o, n, i, r, l, p, d, u, c, g, S, b, H, k) {
2421
- const y = La(r), v = y.filter(
2422
- (x) => !eo(x)
2423
- ), h = e.scrollTop, N = [], D = /* @__PURE__ */ new Set(), L = (x) => {
2424
- N.push(x);
2664
+ function Wa(e, t, n, o, i, r, l, p, d, c, u, m, E, v, z, b) {
2665
+ const g = ja(r), w = g.filter(
2666
+ (C) => !wo(C)
2667
+ ), h = e.scrollTop, P = [], A = /* @__PURE__ */ new Set(), k = (C) => {
2668
+ P.push(C);
2425
2669
  };
2426
- no(o, r.isThinking), i.hidden = !p, p && l !== null && Vn(i, l);
2427
- const Pe = v.length > 0 || !!r.assistantDraft || r.isThinking;
2428
- if (n(Pe), v.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2429
- const x = document.createElement("div");
2430
- x.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2431
- const z = document.createElement("div");
2432
- z.className = "pluno-pa-widget__empty-hero";
2433
- const I = de(
2670
+ _o(n, r.isThinking), i.hidden = !p, p && l !== null && po(i, l);
2671
+ const F = w.length > 0 || !!r.assistantDraft || r.isThinking;
2672
+ if (o(F), w.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2673
+ const C = document.createElement("div");
2674
+ C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2675
+ const T = document.createElement("div");
2676
+ T.className = "pluno-pa-widget__empty-hero";
2677
+ const Se = me(
2434
2678
  "pluno-pa-widget__character--empty",
2435
- b()
2679
+ v()
2436
2680
  );
2437
- z.appendChild(I), x.appendChild(z), x.appendChild(jn());
2438
- const $ = document.createElement("div");
2439
- if ($.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && $.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2440
- for (const A of r.starterPrompts) {
2441
- const T = document.createElement("button");
2442
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt", T.textContent = `"${A}"`, T.addEventListener("click", () => {
2443
- H(A);
2444
- }), $.appendChild(T);
2681
+ T.appendChild(Se), C.appendChild(T), C.appendChild(lo());
2682
+ const q = document.createElement("div");
2683
+ if (q.className = r.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", r.starterPrompts.length === 0 && !r.starterPromptsLoading && q.setAttribute("aria-hidden", "true"), r.starterPrompts.length > 0)
2684
+ for (const R of r.starterPrompts) {
2685
+ const D = document.createElement("button");
2686
+ D.type = "button", D.className = "pluno-pa-widget__starter-prompt", D.textContent = `"${R}"`, D.addEventListener("click", () => {
2687
+ z(R);
2688
+ }), q.appendChild(D);
2445
2689
  }
2446
2690
  else if (r.starterPromptsLoading) {
2447
- const A = document.createElement("button");
2448
- A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", A.disabled = !0, A.tabIndex = -1, A.textContent = "Generating example tasks...", $.appendChild(A);
2691
+ const R = document.createElement("button");
2692
+ R.type = "button", R.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", R.disabled = !0, R.tabIndex = -1, R.textContent = "Generating example tasks...", q.appendChild(R);
2449
2693
  } else
2450
- for (let A = 0; A < oi; A += 1) {
2451
- const T = document.createElement("button");
2452
- T.type = "button", T.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", T.disabled = !0, T.tabIndex = -1, T.textContent = "", $.appendChild(T);
2694
+ for (let R = 0; R < Si; R += 1) {
2695
+ const D = document.createElement("button");
2696
+ D.type = "button", D.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", D.disabled = !0, D.tabIndex = -1, D.textContent = "", q.appendChild(D);
2453
2697
  }
2454
- x.appendChild($), g.clear(), L(x), L(t), kn(e, N);
2698
+ C.appendChild(q), m.clear(), k(C), k(t), Fn(e, P);
2455
2699
  return;
2456
2700
  }
2457
- let f = null, R = null, ce = [];
2458
- const ue = v.some(zt), ye = () => {
2459
- if (ce.length === 0)
2701
+ let H = null, $ = null, Q = [];
2702
+ const ze = w.some(Xt), x = () => {
2703
+ if (Q.length === 0)
2460
2704
  return !1;
2461
- const x = Oa(
2462
- ce,
2463
- c,
2464
- S,
2465
- b()
2705
+ const C = nr(
2706
+ Q,
2707
+ u,
2708
+ E,
2709
+ v()
2466
2710
  );
2467
- return L(x), f = null, R = x, ce = [], !0;
2711
+ return k(C), H = null, $ = C, Q = [], !0;
2468
2712
  };
2469
- for (let x = 0; x < v.length; x += 1) {
2470
- const z = v[x];
2471
- if (z.role === "tool") {
2472
- ce.push(z);
2713
+ for (let C = 0; C < w.length; C += 1) {
2714
+ const T = w[C];
2715
+ if (T.role === "tool") {
2716
+ Q.push(T);
2473
2717
  continue;
2474
2718
  }
2475
- if (zt(z)) {
2476
- if (ye()) {
2477
- const ge = at();
2478
- L(ge), f = null, R = ge;
2719
+ if (Xt(T)) {
2720
+ if (x()) {
2721
+ const N = ct();
2722
+ k(N), H = null, $ = N;
2479
2723
  } else {
2480
- const ge = An(b());
2481
- L(ge), f = null, R = ge;
2724
+ const N = Gn(v());
2725
+ k(N), H = null, $ = N;
2482
2726
  }
2483
2727
  continue;
2484
2728
  }
2485
- if (z.role === "system")
2729
+ if (T.role === "system")
2486
2730
  continue;
2487
- const I = ye(), $ = za(z.content);
2488
- if (z.role === "assistant" && !I) {
2489
- const T = to(b());
2490
- L(T), f = null, R = T;
2731
+ const Se = x(), q = tr(T.content);
2732
+ if (T.role === "assistant" && !Se) {
2733
+ const D = bo(v());
2734
+ k(D), H = null, $ = D;
2491
2735
  }
2492
- const A = Sa(z, $, g, D);
2493
- L(A), f = A, R = null;
2736
+ const R = Ga(T, q, m, A);
2737
+ k(R), H = R, $ = null;
2494
2738
  }
2495
- const G = ye(), $e = v[v.length - 1]?.id === "assistant-draft";
2496
- if (r.isThinking && !$e && !ue)
2497
- if (G) {
2498
- const x = at();
2499
- L(x), f = null, R = x;
2739
+ const de = x(), Ye = w[w.length - 1]?.id === "assistant-draft";
2740
+ if (r.isThinking && !Ye && !ze)
2741
+ if (de) {
2742
+ const C = ct();
2743
+ k(C), H = null, $ = C;
2500
2744
  } else {
2501
- const x = An(b());
2502
- L(x), f = null, R = x;
2745
+ const C = Gn(v());
2746
+ k(C), H = null, $ = C;
2503
2747
  }
2504
2748
  if (r.lastError) {
2505
- const x = document.createElement("div");
2506
- x.className = "pluno-pa-widget__error", x.textContent = r.lastError, L(x), f = x, R = null;
2749
+ const C = document.createElement("div");
2750
+ C.className = "pluno-pa-widget__error", C.textContent = r.lastError, k(C), H = C, $ = null;
2507
2751
  }
2508
- const Y = k && !r.isThinking ? To(y) : null;
2509
- if (k && Y && !k.dismissedCandidateIds.has(Y.id)) {
2510
- const x = Na(Y, {
2511
- isDrafting: k.draftingCandidateId === Y.id,
2512
- error: k.error,
2513
- characterIconOptions: k.characterIconOptions,
2514
- onDraft: k.onDraft,
2515
- onDismiss: k.onDismiss,
2516
- onDisable: k.onDisable
2752
+ const X = b && !r.isThinking ? Jo(g) : null;
2753
+ if (b && X && !b.dismissedCandidateIds.has(X.id)) {
2754
+ const C = Ya(X, {
2755
+ isDrafting: b.draftingCandidateId === X.id,
2756
+ error: b.error,
2757
+ characterIconOptions: b.characterIconOptions,
2758
+ onDraft: b.onDraft,
2759
+ onDismiss: b.onDismiss,
2760
+ onDisable: b.onDisable
2517
2761
  });
2518
- L(x), k.onSeen(Y), f = null, R = x;
2762
+ k(C), b.onSeen(X), H = null, $ = C;
2519
2763
  }
2520
- f?.classList.add("pluno-pa-widget__message--bottom-reserve"), R?.classList.add("pluno-pa-widget__bottom-reserve-compact"), L(t), ka(g, D), kn(e, N), d ? We(e, u) : e.scrollTop = h;
2764
+ H?.classList.add("pluno-pa-widget__message--bottom-reserve"), $?.classList.add("pluno-pa-widget__bottom-reserve-compact"), k(t), qa(m, A), Fn(e, P), d ? Ve(e, c) : e.scrollTop = h;
2521
2765
  }
2522
- function Sa(e, t, o, n) {
2523
- const i = Ea(e, t), r = i ? o.get(i) : void 0;
2766
+ function Ga(e, t, n, o) {
2767
+ const i = $a(e, t), r = i ? n.get(i) : void 0;
2524
2768
  if (i && r)
2525
- return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), n.add(i), r;
2769
+ return r.classList.remove("pluno-pa-widget__message--bottom-reserve"), o.add(i), r;
2526
2770
  const l = document.createElement("div");
2527
- l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Ba(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Ia(e.attachments));
2771
+ l.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? ir(l, t) : l.textContent = t, e.role === "user" && e.attachments?.length && l.appendChild(Va(e.attachments));
2528
2772
  const p = document.createElement("div");
2529
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Aa(t)), l.appendChild(p), i && (o.set(i, l), n.add(i)), l;
2773
+ return p.className = "pluno-pa-widget__message-actions", p.appendChild(Ka(t)), l.appendChild(p), i && (n.set(i, l), o.add(i)), l;
2530
2774
  }
2531
- function Ea(e, t) {
2775
+ function $a(e, t) {
2532
2776
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
2533
2777
  id: e.id,
2534
2778
  content: t,
2535
- attachments: e.attachments.map((o) => {
2536
- const { previewUrl: n } = o;
2779
+ attachments: e.attachments.map((n) => {
2780
+ const { previewUrl: o } = n;
2537
2781
  return {
2538
- id: o.id ?? null,
2539
- name: o.name,
2540
- mimeType: o.mimeType,
2541
- sizeBytes: o.sizeBytes,
2542
- previewUrl: n ?? null,
2543
- fileUrl: o.fileUrl ?? null,
2544
- gcsPath: o.gcsPath ?? null
2782
+ id: n.id ?? null,
2783
+ name: n.name,
2784
+ mimeType: n.mimeType,
2785
+ sizeBytes: n.sizeBytes,
2786
+ previewUrl: o ?? null,
2787
+ fileUrl: n.fileUrl ?? null,
2788
+ gcsPath: n.gcsPath ?? null
2545
2789
  };
2546
2790
  })
2547
2791
  });
2548
2792
  }
2549
- function ka(e, t) {
2550
- for (const o of e.keys())
2551
- t.has(o) || e.delete(o);
2793
+ function qa(e, t) {
2794
+ for (const n of e.keys())
2795
+ t.has(n) || e.delete(n);
2552
2796
  }
2553
- function kn(e, t) {
2554
- let o = e.firstChild;
2555
- for (const n of t) {
2556
- if (n === o) {
2557
- o = o.nextSibling;
2797
+ function Fn(e, t) {
2798
+ let n = e.firstChild;
2799
+ for (const o of t) {
2800
+ if (o === n) {
2801
+ n = n.nextSibling;
2558
2802
  continue;
2559
2803
  }
2560
- e.insertBefore(n, o);
2804
+ e.insertBefore(o, n);
2561
2805
  }
2562
- for (; o; ) {
2563
- const n = o;
2564
- o = o.nextSibling, e.removeChild(n);
2806
+ for (; n; ) {
2807
+ const o = n;
2808
+ n = n.nextSibling, e.removeChild(o);
2565
2809
  }
2566
2810
  }
2567
- function La(e) {
2811
+ function ja(e) {
2568
2812
  if (!e.assistantDraft)
2569
2813
  return [...e.messages];
2570
2814
  const t = {
@@ -2578,22 +2822,22 @@ function La(e) {
2578
2822
  };
2579
2823
  if (!t.respondsToUserMessageId)
2580
2824
  return [...e.messages, t];
2581
- const o = e.messages.findIndex(
2825
+ const n = e.messages.findIndex(
2582
2826
  (r) => r.role === "user" && r.id === t.respondsToUserMessageId
2583
2827
  );
2584
- if (o === -1)
2828
+ if (n === -1)
2585
2829
  return [...e.messages, t];
2586
- const n = e.messages.findIndex(
2587
- (r, l) => l > o && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Ln(r, t) && zt(r)
2830
+ const o = e.messages.findIndex(
2831
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Hn(r, t) && Xt(r)
2588
2832
  );
2589
- if (n !== -1)
2833
+ if (o !== -1)
2590
2834
  return [
2591
- ...e.messages.slice(0, n),
2835
+ ...e.messages.slice(0, o),
2592
2836
  t,
2593
- ...e.messages.slice(n + 1)
2837
+ ...e.messages.slice(o + 1)
2594
2838
  ];
2595
- let i = o + 1;
2596
- for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Ln(e.messages[i], t); )
2839
+ let i = n + 1;
2840
+ for (; i < e.messages.length && e.messages[i].role !== "user" && e.messages[i].respondsToUserMessageId === t.respondsToUserMessageId && Hn(e.messages[i], t); )
2597
2841
  i += 1;
2598
2842
  return [
2599
2843
  ...e.messages.slice(0, i),
@@ -2601,50 +2845,50 @@ function La(e) {
2601
2845
  ...e.messages.slice(i)
2602
2846
  ];
2603
2847
  }
2604
- function zt(e) {
2848
+ function Xt(e) {
2605
2849
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
2606
2850
  }
2607
- function Ln(e, t) {
2851
+ function Hn(e, t) {
2608
2852
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2609
2853
  }
2610
- function In(e, t, o, n, i, r, l, p) {
2611
- e.replaceChildren(), no(t, !1), t.disabled = !0, o(!1);
2854
+ function Wn(e, t, n, o, i, r, l, p) {
2855
+ e.replaceChildren(), _o(t, !1), t.disabled = !0, n(!1);
2612
2856
  const d = document.createElement("div");
2613
2857
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
2614
- const u = de(
2858
+ const c = me(
2615
2859
  "pluno-pa-widget__character--empty",
2616
- n()
2860
+ o()
2617
2861
  );
2618
- d.appendChild(u);
2619
- const c = document.createElement("div");
2620
- if (c.className = "pluno-pa-widget__empty", c.textContent = i, d.appendChild(c), l) {
2621
- const g = document.createElement("a");
2622
- g.className = "pluno-pa-widget__login", g.href = l, g.target = "_blank", g.rel = "noopener noreferrer", g.textContent = r, d.appendChild(g);
2862
+ d.appendChild(c);
2863
+ const u = document.createElement("div");
2864
+ if (u.className = "pluno-pa-widget__empty", u.textContent = i, d.appendChild(u), l) {
2865
+ const m = document.createElement("a");
2866
+ m.className = "pluno-pa-widget__login", m.href = l, m.target = "_blank", m.rel = "noopener noreferrer", m.textContent = r, d.appendChild(m);
2623
2867
  } else {
2624
- const g = document.createElement("button");
2625
- g.type = "button", g.className = "pluno-pa-widget__login", g.textContent = r, g.addEventListener("click", () => p?.()), d.appendChild(g);
2868
+ const m = document.createElement("button");
2869
+ m.type = "button", m.className = "pluno-pa-widget__login", m.textContent = r, m.addEventListener("click", () => p?.()), d.appendChild(m);
2626
2870
  }
2627
2871
  e.appendChild(d);
2628
2872
  }
2629
- function Ia(e) {
2873
+ function Va(e) {
2630
2874
  const t = document.createElement("div");
2631
2875
  t.className = "pluno-pa-widget__message-attachments";
2632
- for (const o of e)
2633
- t.appendChild(ma(o));
2876
+ for (const n of e)
2877
+ t.appendChild(Ra(n));
2634
2878
  return t;
2635
2879
  }
2636
- function Aa(e) {
2880
+ function Ka(e) {
2637
2881
  const t = document.createElement("button");
2638
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(ua()), t.addEventListener("click", (o) => {
2639
- o.preventDefault(), o.stopPropagation(), navigator.clipboard.writeText(e);
2882
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Na()), t.addEventListener("click", (n) => {
2883
+ n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
2640
2884
  }), t;
2641
2885
  }
2642
- function Na(e, t) {
2643
- const o = document.createElement("article");
2644
- o.className = "pluno-pa-widget__share-prompt";
2645
- const n = document.createElement("div");
2646
- n.className = "pluno-pa-widget__share-prompt-body", n.appendChild(
2647
- de(
2886
+ function Ya(e, t) {
2887
+ const n = document.createElement("article");
2888
+ n.className = "pluno-pa-widget__share-prompt";
2889
+ const o = document.createElement("div");
2890
+ o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
2891
+ me(
2648
2892
  "pluno-pa-widget__share-prompt-icon",
2649
2893
  t.characterIconOptions
2650
2894
  )
@@ -2655,97 +2899,97 @@ function Na(e, t) {
2655
2899
  r.textContent = "Share this win?", i.appendChild(r);
2656
2900
  const l = document.createElement("span");
2657
2901
  if (l.textContent = t.isDrafting ? "Drafting social post..." : "Create a screenshot and generate a draft for a social post.", i.appendChild(l), t.error) {
2658
- const c = document.createElement("span");
2659
- c.className = "pluno-pa-widget__share-prompt-error", c.textContent = t.error, i.appendChild(c);
2902
+ const u = document.createElement("span");
2903
+ u.className = "pluno-pa-widget__share-prompt-error", u.textContent = t.error, i.appendChild(u);
2660
2904
  }
2661
- n.appendChild(i);
2905
+ o.appendChild(i);
2662
2906
  const p = document.createElement("div");
2663
2907
  p.className = "pluno-pa-widget__share-prompt-actions";
2664
2908
  const d = document.createElement("div");
2665
2909
  d.className = "pluno-pa-widget__share-prompt-primary-actions";
2666
- const u = document.createElement("button");
2667
- if (u.type = "button", u.disabled = t.isDrafting, u.addEventListener("click", () => {
2910
+ const c = document.createElement("button");
2911
+ if (c.type = "button", c.disabled = t.isDrafting, c.addEventListener("click", () => {
2668
2912
  t.onDraft(e);
2669
- }), t.isDrafting ? (u.appendChild(Ot()), u.appendChild(document.createTextNode("Drafting..."))) : u.textContent = "Draft a social post", d.appendChild(u), t.isDrafting)
2913
+ }), t.isDrafting ? (c.appendChild(Zt()), c.appendChild(document.createTextNode("Drafting..."))) : c.textContent = "Draft a social post", d.appendChild(c), t.isDrafting)
2670
2914
  p.appendChild(d);
2671
2915
  else {
2672
- const c = document.createElement("button");
2673
- 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", () => {
2916
+ const u = document.createElement("button");
2917
+ u.type = "button", u.className = "pluno-pa-widget__share-prompt-dismiss", u.setAttribute("aria-label", "Dismiss share prompt"), u.title = "Dismiss", u.textContent = "Dismiss", u.addEventListener("click", () => {
2674
2918
  t.onDismiss(e);
2675
- }), d.appendChild(c), p.appendChild(d);
2676
- const g = document.createElement("button");
2677
- g.type = "button", g.className = "pluno-pa-widget__share-prompt-disable", g.textContent = "Don't ask again", g.addEventListener("click", () => {
2919
+ }), d.appendChild(u), p.appendChild(d);
2920
+ const m = document.createElement("button");
2921
+ m.type = "button", m.className = "pluno-pa-widget__share-prompt-disable", m.textContent = "Don't ask again", m.addEventListener("click", () => {
2678
2922
  t.onDisable(e);
2679
- }), p.appendChild(g);
2923
+ }), p.appendChild(m);
2680
2924
  }
2681
- return n.appendChild(p), o.appendChild(n), o;
2925
+ return o.appendChild(p), n.appendChild(o), n;
2682
2926
  }
2683
- function Ta(e, t) {
2684
- const o = document.createElement("div");
2685
- o.className = "pluno-pa-widget__share-dialog-backdrop", o.addEventListener("click", (y) => {
2686
- y.target === o && t.onClose();
2927
+ function Xa(e, t) {
2928
+ const n = document.createElement("div");
2929
+ n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (g) => {
2930
+ g.target === n && t.onClose();
2687
2931
  });
2688
- const n = document.createElement("section");
2689
- n.className = "pluno-pa-widget__share-dialog", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "Draft a social post");
2932
+ const o = document.createElement("section");
2933
+ o.className = "pluno-pa-widget__share-dialog", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "Draft a social post");
2690
2934
  const i = document.createElement("header"), r = document.createElement("strong");
2691
2935
  r.textContent = "Share this win", i.appendChild(r);
2692
2936
  const l = document.createElement("button");
2693
- l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), n.appendChild(i);
2937
+ l.type = "button", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), i.appendChild(l), o.appendChild(i);
2694
2938
  const p = document.createElement("p");
2695
2939
  p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
2696
2940
  const d = document.createElement("div");
2697
2941
  d.className = "pluno-pa-widget__share-dialog-step";
2698
- const u = document.createElement("div");
2699
- u.className = "pluno-pa-widget__share-dialog-step-header";
2700
- const c = document.createElement("strong");
2701
- c.textContent = "1) Copy Screenshot", u.appendChild(c);
2702
- const g = Pa(
2942
+ const c = document.createElement("div");
2943
+ c.className = "pluno-pa-widget__share-dialog-step-header";
2944
+ const u = document.createElement("strong");
2945
+ u.textContent = "1) Copy Screenshot", c.appendChild(u);
2946
+ const m = Za(
2703
2947
  "Copy Screenshot",
2704
2948
  async () => {
2705
2949
  try {
2706
- return await Po(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2950
+ return await Qo(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
2707
2951
  } catch {
2708
2952
  return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
2709
2953
  }
2710
2954
  }
2711
2955
  );
2712
- if (u.appendChild(g), d.appendChild(u), e.screenshotDataUrl) {
2713
- const y = document.createElement("div");
2714
- y.className = "pluno-pa-widget__share-dialog-screenshot";
2715
- const v = document.createElement("img");
2716
- v.src = e.screenshotDataUrl, v.alt = "Product page with Pluno open", y.appendChild(v), d.appendChild(y);
2956
+ if (c.appendChild(m), d.appendChild(c), e.screenshotDataUrl) {
2957
+ const g = document.createElement("div");
2958
+ g.className = "pluno-pa-widget__share-dialog-screenshot";
2959
+ const w = document.createElement("img");
2960
+ w.src = e.screenshotDataUrl, w.alt = "Product page with Pluno open", g.appendChild(w), d.appendChild(g);
2717
2961
  }
2718
- n.appendChild(d), n.appendChild(p);
2719
- const S = document.createElement("div");
2720
- S.className = "pluno-pa-widget__share-dialog-step";
2721
- const b = document.createElement("strong");
2722
- b.className = "pluno-pa-widget__share-dialog-step-title", b.textContent = "2) Share on", S.appendChild(b);
2723
- const H = document.createElement("p");
2724
- H.className = "pluno-pa-widget__share-dialog-hint", H.textContent = "Post draft opens prefilled on supported platforms.", S.appendChild(H);
2725
- const k = document.createElement("footer");
2726
- k.className = "pluno-pa-widget__share-dialog-platforms";
2727
- for (const y of Da(e)) {
2728
- const v = document.createElement("a");
2729
- v.href = y.href, v.target = "_blank", v.rel = "noopener noreferrer", v.title = y.label, v.setAttribute("aria-label", `Open ${y.label}`), v.appendChild(Ra(y.id)), k.appendChild(v);
2962
+ o.appendChild(d), o.appendChild(p);
2963
+ const E = document.createElement("div");
2964
+ E.className = "pluno-pa-widget__share-dialog-step";
2965
+ const v = document.createElement("strong");
2966
+ v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "2) Share on", E.appendChild(v);
2967
+ const z = document.createElement("p");
2968
+ z.className = "pluno-pa-widget__share-dialog-hint", z.textContent = "Post draft opens prefilled on supported platforms.", E.appendChild(z);
2969
+ const b = document.createElement("footer");
2970
+ b.className = "pluno-pa-widget__share-dialog-platforms";
2971
+ for (const g of Ja(e)) {
2972
+ const w = document.createElement("a");
2973
+ w.href = g.href, w.target = "_blank", w.rel = "noopener noreferrer", w.title = g.label, w.setAttribute("aria-label", `Open ${g.label}`), w.appendChild(Qa(g.id)), b.appendChild(w);
2730
2974
  }
2731
- if (S.appendChild(k), n.appendChild(S), t.socialPostRewardsUrl) {
2732
- const y = document.createElement("div");
2733
- y.className = "pluno-pa-widget__share-dialog-step";
2734
- const v = document.createElement("strong");
2735
- v.className = "pluno-pa-widget__share-dialog-step-title", v.textContent = "3) Submit post to get 2000 free credits!", y.appendChild(v);
2975
+ if (E.appendChild(b), o.appendChild(E), t.socialPostRewardsUrl) {
2976
+ const g = document.createElement("div");
2977
+ g.className = "pluno-pa-widget__share-dialog-step";
2978
+ const w = document.createElement("strong");
2979
+ w.className = "pluno-pa-widget__share-dialog-step-title", w.textContent = "3) Submit post to get 2000 free credits!", g.appendChild(w);
2736
2980
  const h = document.createElement("a");
2737
- h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(Ma()), y.appendChild(h), n.appendChild(y);
2981
+ h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(er()), g.appendChild(h), o.appendChild(g);
2738
2982
  }
2739
- return o.appendChild(n), o;
2983
+ return n.appendChild(o), n;
2740
2984
  }
2741
- function Pa(e, t) {
2742
- const o = document.createElement("button");
2743
- return o.type = "button", o.className = "pluno-pa-widget__share-dialog-copy", o.textContent = e, o.addEventListener("click", async (n) => {
2744
- n.preventDefault(), n.stopPropagation(), await t() && (o.textContent = "Copied ✓");
2745
- }), o;
2985
+ function Za(e, t) {
2986
+ const n = document.createElement("button");
2987
+ return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
2988
+ o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
2989
+ }), n;
2746
2990
  }
2747
- function Da(e) {
2748
- const t = e.linkedinPost.trim(), o = e.xPost.trim();
2991
+ function Ja(e) {
2992
+ const t = e.linkedinPost.trim(), n = e.xPost.trim();
2749
2993
  return [
2750
2994
  {
2751
2995
  id: "linkedin",
@@ -2755,7 +2999,7 @@ function Da(e) {
2755
2999
  {
2756
3000
  id: "x",
2757
3001
  label: "X",
2758
- href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(o)}`
3002
+ href: `https://twitter.com/intent/tweet?text=${encodeURIComponent(n)}`
2759
3003
  },
2760
3004
  {
2761
3005
  id: "instagram",
@@ -2764,7 +3008,7 @@ function Da(e) {
2764
3008
  }
2765
3009
  ];
2766
3010
  }
2767
- function Ra(e) {
3011
+ function Qa(e) {
2768
3012
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2769
3013
  return t.setAttribute("class", "pluno-pa-widget__share-dialog-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true"), e === "linkedin" ? (U(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), U(
2770
3014
  t,
@@ -2787,145 +3031,145 @@ function Ra(e) {
2787
3031
  "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"
2788
3032
  ), t);
2789
3033
  }
2790
- function U(e, t, o) {
2791
- const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
2792
- n.setAttribute("d", t), o && n.setAttribute("opacity", o), e.appendChild(n);
3034
+ function U(e, t, n) {
3035
+ const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
3036
+ o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
2793
3037
  }
2794
- function Ma() {
3038
+ function er() {
2795
3039
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2796
3040
  return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), U(e, "M14 5h5v5"), U(e, "M19 5l-8 8"), U(
2797
3041
  e,
2798
3042
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
2799
3043
  ), e;
2800
3044
  }
2801
- function eo(e) {
2802
- return e.role === "tool" && e.toolName === zn;
3045
+ function wo(e) {
3046
+ return e.role === "tool" && e.toolName === Xn;
2803
3047
  }
2804
- function za(e) {
3048
+ function tr(e) {
2805
3049
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
2806
3050
  }
2807
- function Oa(e, t, o, n) {
3051
+ function nr(e, t, n, o) {
2808
3052
  const i = document.createElement("article");
2809
3053
  i.className = "pluno-pa-widget__tool-group", i.title = new Date(
2810
3054
  e[e.length - 1].createdAt
2811
3055
  ).toLocaleString(), i.appendChild(
2812
- de(
3056
+ me(
2813
3057
  "pluno-pa-widget__character--tool-group",
2814
- n
3058
+ o
2815
3059
  )
2816
3060
  );
2817
- const r = document.createElement("details"), l = Ua(e);
3061
+ const r = document.createElement("details"), l = or(e);
2818
3062
  r.open = t.has(l), i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
2819
- i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), o();
3063
+ i.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
2820
3064
  });
2821
3065
  const p = document.createElement("summary");
2822
- p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(Ot());
2823
- const u = document.createElement("span");
2824
- if (u.className = "pluno-pa-widget__tool-summary-title", u.textContent = e[e.length - 1].content || "Run tool", p.appendChild(u), r.appendChild(p), e.length > 0) {
2825
- const c = document.createElement("div");
2826
- c.className = "pluno-pa-widget__tool-lines";
2827
- for (const g of e) {
2828
- const S = document.createElement("div");
2829
- S.className = "pluno-pa-widget__tool-line", g.loading && S.appendChild(Ot());
2830
- const b = document.createElement("span");
2831
- b.textContent = g.content || "Run tool", S.appendChild(b), c.appendChild(S);
2832
- }
2833
- r.appendChild(c);
3066
+ p.className = "pluno-pa-widget__tool-summary", e.some((u) => u.loading) && p.appendChild(Zt());
3067
+ const c = document.createElement("span");
3068
+ if (c.className = "pluno-pa-widget__tool-summary-title", c.textContent = e[e.length - 1].content || "Run tool", p.appendChild(c), r.appendChild(p), e.length > 0) {
3069
+ const u = document.createElement("div");
3070
+ u.className = "pluno-pa-widget__tool-lines";
3071
+ for (const m of e) {
3072
+ const E = document.createElement("div");
3073
+ E.className = "pluno-pa-widget__tool-line", m.loading && E.appendChild(Zt());
3074
+ const v = document.createElement("span");
3075
+ v.textContent = m.content || "Run tool", E.appendChild(v), u.appendChild(E);
3076
+ }
3077
+ r.appendChild(u);
2834
3078
  }
2835
3079
  return i.appendChild(r), i;
2836
3080
  }
2837
- function to(e) {
3081
+ function bo(e) {
2838
3082
  const t = document.createElement("article");
2839
3083
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
2840
- de(
3084
+ me(
2841
3085
  "pluno-pa-widget__character--tool-group",
2842
3086
  e
2843
3087
  )
2844
3088
  ), t;
2845
3089
  }
2846
- function An(e) {
2847
- const t = to(e);
2848
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(at()), t;
3090
+ function Gn(e) {
3091
+ const t = bo(e);
3092
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ct()), t;
2849
3093
  }
2850
- function at(e = "Thinking...") {
3094
+ function ct(e = "Thinking...") {
2851
3095
  const t = document.createElement("div");
2852
3096
  t.className = "pluno-pa-widget__status";
2853
- const o = document.createElement("span");
2854
- o.className = "pluno-pa-widget__thinking-dot", o.setAttribute("aria-hidden", "true"), t.appendChild(o);
2855
3097
  const n = document.createElement("span");
2856
- return n.textContent = e, t.appendChild(n), t;
3098
+ n.className = "pluno-pa-widget__thinking-dot", n.setAttribute("aria-hidden", "true"), t.appendChild(n);
3099
+ const o = document.createElement("span");
3100
+ return o.textContent = e, t.appendChild(o), t;
2857
3101
  }
2858
- function Ua(e) {
3102
+ function or(e) {
2859
3103
  return `tools:${e[0]?.id ?? ""}`;
2860
3104
  }
2861
- function Ot() {
3105
+ function Zt() {
2862
3106
  const e = document.createElement("span");
2863
3107
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
2864
3108
  }
2865
- function no(e, t) {
2866
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? da() : Xn());
3109
+ function _o(e, t) {
3110
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ia() : go());
2867
3111
  }
2868
- function Ba(e, t) {
2869
- const o = t.replace(/\r\n/g, `
3112
+ function ir(e, t) {
3113
+ const n = t.replace(/\r\n/g, `
2870
3114
  `).split(`
2871
3115
  `);
2872
- let n = 0;
2873
- for (; n < o.length; ) {
2874
- const i = o[n];
3116
+ let o = 0;
3117
+ for (; o < n.length; ) {
3118
+ const i = n[o];
2875
3119
  if (!i.trim()) {
2876
- n += 1;
3120
+ o += 1;
2877
3121
  continue;
2878
3122
  }
2879
3123
  if (i.match(/^```(\w+)?\s*$/)) {
2880
- const u = [];
2881
- for (n += 1; n < o.length && !/^```\s*$/.test(o[n]); )
2882
- u.push(o[n]), n += 1;
2883
- n += n < o.length ? 1 : 0;
2884
- const c = document.createElement("pre"), g = document.createElement("code");
2885
- g.textContent = u.join(`
2886
- `), c.appendChild(g), e.appendChild(c);
3124
+ const c = [];
3125
+ for (o += 1; o < n.length && !/^```\s*$/.test(n[o]); )
3126
+ c.push(n[o]), o += 1;
3127
+ o += o < n.length ? 1 : 0;
3128
+ const u = document.createElement("pre"), m = document.createElement("code");
3129
+ m.textContent = c.join(`
3130
+ `), u.appendChild(m), e.appendChild(u);
2887
3131
  continue;
2888
3132
  }
2889
3133
  const l = i.match(/^(#{1,3})\s+(.+)$/);
2890
3134
  if (l) {
2891
- const u = document.createElement(`h${l[1].length + 2}`);
2892
- et(u, l[2]), e.appendChild(u), n += 1;
3135
+ const c = document.createElement(`h${l[1].length + 2}`);
3136
+ at(c, l[2]), e.appendChild(c), o += 1;
2893
3137
  continue;
2894
3138
  }
2895
3139
  if (/^\s*[-*+]\s+/.test(i)) {
2896
- const u = document.createElement("ul");
2897
- for (; n < o.length && /^\s*[-*+]\s+/.test(o[n]); ) {
2898
- const c = document.createElement("li");
2899
- et(c, o[n].replace(/^\s*[-*+]\s+/, "")), u.appendChild(c), n += 1;
3140
+ const c = document.createElement("ul");
3141
+ for (; o < n.length && /^\s*[-*+]\s+/.test(n[o]); ) {
3142
+ const u = document.createElement("li");
3143
+ at(u, n[o].replace(/^\s*[-*+]\s+/, "")), c.appendChild(u), o += 1;
2900
3144
  }
2901
- e.appendChild(u);
3145
+ e.appendChild(c);
2902
3146
  continue;
2903
3147
  }
2904
3148
  if (/^\s*\d+\.\s+/.test(i)) {
2905
- const u = document.createElement("ol");
2906
- for (; n < o.length && /^\s*\d+\.\s+/.test(o[n]); ) {
2907
- const c = document.createElement("li");
2908
- et(c, o[n].replace(/^\s*\d+\.\s+/, "")), u.appendChild(c), n += 1;
3149
+ const c = document.createElement("ol");
3150
+ for (; o < n.length && /^\s*\d+\.\s+/.test(n[o]); ) {
3151
+ const u = document.createElement("li");
3152
+ at(u, n[o].replace(/^\s*\d+\.\s+/, "")), c.appendChild(u), o += 1;
2909
3153
  }
2910
- e.appendChild(u);
3154
+ e.appendChild(c);
2911
3155
  continue;
2912
3156
  }
2913
3157
  const p = [i];
2914
- for (n += 1; n < o.length && o[n].trim() && !/^```/.test(o[n]) && !/^(#{1,3})\s+/.test(o[n]) && !/^\s*[-*+]\s+/.test(o[n]) && !/^\s*\d+\.\s+/.test(o[n]); )
2915
- p.push(o[n]), n += 1;
3158
+ 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]); )
3159
+ p.push(n[o]), o += 1;
2916
3160
  const d = document.createElement("p");
2917
- p.forEach((u, c) => {
2918
- c > 0 && d.appendChild(document.createElement("br")), et(d, u);
3161
+ p.forEach((c, u) => {
3162
+ u > 0 && d.appendChild(document.createElement("br")), at(d, c);
2919
3163
  }), e.appendChild(d);
2920
3164
  }
2921
3165
  }
2922
- function et(e, t) {
2923
- const o = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
2924
- let n = 0;
2925
- for (const i of t.matchAll(o)) {
3166
+ function at(e, t) {
3167
+ const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3168
+ let o = 0;
3169
+ for (const i of t.matchAll(n)) {
2926
3170
  const r = i.index ?? 0;
2927
- r > n && e.appendChild(
2928
- document.createTextNode(t.slice(n, r))
3171
+ r > o && e.appendChild(
3172
+ document.createTextNode(t.slice(o, r))
2929
3173
  );
2930
3174
  const l = i[0];
2931
3175
  if (l.startsWith("`")) {
@@ -2939,17 +3183,17 @@ function et(e, t) {
2939
3183
  p.textContent = l.slice(1, -1), e.appendChild(p);
2940
3184
  } else {
2941
3185
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
2942
- if (p && Fa(p[2])) {
3186
+ if (p && ar(p[2])) {
2943
3187
  const d = document.createElement("a");
2944
3188
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
2945
3189
  } else
2946
3190
  e.appendChild(document.createTextNode(l));
2947
3191
  }
2948
- n = r + l.length;
3192
+ o = r + l.length;
2949
3193
  }
2950
- n < t.length && e.appendChild(document.createTextNode(t.slice(n)));
3194
+ o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
2951
3195
  }
2952
- function Fa(e) {
3196
+ function ar(e) {
2953
3197
  if (e.startsWith("/") || e.startsWith("#"))
2954
3198
  return !0;
2955
3199
  try {
@@ -2959,10 +3203,10 @@ function Fa(e) {
2959
3203
  return !1;
2960
3204
  }
2961
3205
  }
2962
- function Nn(e, t) {
2963
- if (Ha(e))
3206
+ function $n(e, t) {
3207
+ if (rr(e))
2964
3208
  return;
2965
- const o = `
3209
+ const n = `
2966
3210
  :host {
2967
3211
  all: initial;
2968
3212
  color-scheme: light;
@@ -3013,7 +3257,7 @@ function Nn(e, t) {
3013
3257
  --pluno-pa-accent-contrast: #fafafa;
3014
3258
  position: fixed;
3015
3259
  z-index: 2147483645;
3016
- font-family: ${Q.fontFamily};
3260
+ font-family: ${oe.fontFamily};
3017
3261
  font-size: 14px;
3018
3262
  color: var(--pluno-pa-text);
3019
3263
  width: var(--pluno-pa-launcher-width);
@@ -3307,6 +3551,82 @@ function Nn(e, t) {
3307
3551
  opacity: 1;
3308
3552
  transform: translateY(0) scale(1);
3309
3553
  }
3554
+ .pluno-pa-widget__resize-handle {
3555
+ position: absolute;
3556
+ z-index: 3;
3557
+ border: 0;
3558
+ background: transparent;
3559
+ padding: 0;
3560
+ opacity: 0;
3561
+ touch-action: none;
3562
+ }
3563
+ .pluno-pa-widget__resize-handle:focus-visible {
3564
+ opacity: 1;
3565
+ outline: 2px solid var(--pluno-pa-accent);
3566
+ outline-offset: 2px;
3567
+ }
3568
+ .pluno-pa-widget__resize-handle--left,
3569
+ .pluno-pa-widget__resize-handle--right {
3570
+ top: 14px;
3571
+ bottom: 14px;
3572
+ width: 12px;
3573
+ cursor: ew-resize;
3574
+ }
3575
+ .pluno-pa-widget__resize-handle--left {
3576
+ left: -6px;
3577
+ }
3578
+ .pluno-pa-widget__resize-handle--right {
3579
+ right: -6px;
3580
+ }
3581
+ .pluno-pa-widget__resize-handle--top,
3582
+ .pluno-pa-widget__resize-handle--bottom {
3583
+ left: 14px;
3584
+ right: 14px;
3585
+ height: 12px;
3586
+ cursor: ns-resize;
3587
+ }
3588
+ .pluno-pa-widget__resize-handle--top {
3589
+ top: -6px;
3590
+ }
3591
+ .pluno-pa-widget__resize-handle--bottom {
3592
+ bottom: -6px;
3593
+ }
3594
+ .pluno-pa-widget__resize-handle--top-left,
3595
+ .pluno-pa-widget__resize-handle--top-right,
3596
+ .pluno-pa-widget__resize-handle--bottom-left,
3597
+ .pluno-pa-widget__resize-handle--bottom-right {
3598
+ width: 18px;
3599
+ height: 18px;
3600
+ }
3601
+ .pluno-pa-widget__resize-handle--top-left {
3602
+ top: -7px;
3603
+ left: -7px;
3604
+ cursor: nwse-resize;
3605
+ }
3606
+ .pluno-pa-widget__resize-handle--top-right {
3607
+ top: -7px;
3608
+ right: -7px;
3609
+ cursor: nesw-resize;
3610
+ }
3611
+ .pluno-pa-widget__resize-handle--bottom-left {
3612
+ bottom: -7px;
3613
+ left: -7px;
3614
+ cursor: nesw-resize;
3615
+ }
3616
+ .pluno-pa-widget__resize-handle--bottom-right {
3617
+ bottom: -7px;
3618
+ right: -7px;
3619
+ cursor: nwse-resize;
3620
+ }
3621
+ .pluno-pa-widget--resizing,
3622
+ .pluno-pa-widget--resizing .pluno-pa-widget__panel,
3623
+ .pluno-pa-widget--resizing .pluno-pa-widget__timeline,
3624
+ .pluno-pa-widget--resizing .pluno-pa-widget__input {
3625
+ user-select: none;
3626
+ }
3627
+ .pluno-pa-widget--resizing .pluno-pa-widget__panel {
3628
+ transition: none;
3629
+ }
3310
3630
  .pluno-pa-widget__close {
3311
3631
  position: absolute;
3312
3632
  left: calc(var(--pluno-pa-panel-offset-x) + var(--pluno-pa-panel-width) - 32px);
@@ -4016,7 +4336,7 @@ function Nn(e, t) {
4016
4336
  place-items: center;
4017
4337
  padding: 18px;
4018
4338
  background: rgba(24, 24, 27, 0.28);
4019
- font-family: var(--pluno-pa-font, ${Q.fontFamily});
4339
+ font-family: var(--pluno-pa-font, ${oe.fontFamily});
4020
4340
  color: var(--pluno-pa-text);
4021
4341
  }
4022
4342
  .pluno-pa-widget__share-dialog {
@@ -4710,6 +5030,9 @@ function Nn(e, t) {
4710
5030
  padding: 2px 0;
4711
5031
  text-align: left;
4712
5032
  }
5033
+ .pluno-pa-widget__thinking-marker .pluno-pa-widget__status {
5034
+ align-self: center;
5035
+ }
4713
5036
  .pluno-pa-widget__thinking-dot {
4714
5037
  flex: 0 0 auto;
4715
5038
  width: 6px;
@@ -4801,8 +5124,8 @@ function Nn(e, t) {
4801
5124
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
4802
5125
  position: absolute;
4803
5126
  top: -16px;
4804
- left: 16px;
4805
- width: min(416px, calc(100% - 30px));
5127
+ left: ${qt}px;
5128
+ width: calc(100% - ${qt * 2}px);
4806
5129
  height: 36px;
4807
5130
  z-index: 3;
4808
5131
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5150,28 +5473,28 @@ function Nn(e, t) {
5150
5473
  filter: url(#pluno-pa-scribble-wobble-2);
5151
5474
  }
5152
5475
  `;
5153
- if (Wa(e, o))
5476
+ if (lr(e, n))
5154
5477
  return;
5155
- const n = e.ownerDocument.createElement("style");
5156
- n.id = Wn, n.textContent = o, e.appendChild(n), oo(e);
5478
+ const o = e.ownerDocument.createElement("style");
5479
+ o.id = io, o.textContent = n, e.appendChild(o), xo(e);
5157
5480
  }
5158
- function Ha(e) {
5159
- return e.getElementById(Wn) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Gn) === "true";
5481
+ function rr(e) {
5482
+ return e.getElementById(io) !== null || e.host instanceof HTMLElement && e.host.getAttribute(ao) === "true";
5160
5483
  }
5161
- function oo(e) {
5162
- e.host instanceof HTMLElement && e.host.setAttribute(Gn, "true");
5484
+ function xo(e) {
5485
+ e.host instanceof HTMLElement && e.host.setAttribute(ao, "true");
5163
5486
  }
5164
- function Wa(e, t) {
5487
+ function lr(e, t) {
5165
5488
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5166
5489
  return !1;
5167
5490
  try {
5168
- const o = new CSSStyleSheet();
5169
- return o.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, o], oo(e), !0;
5491
+ const n = new CSSStyleSheet();
5492
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], xo(e), !0;
5170
5493
  } catch {
5171
5494
  return !1;
5172
5495
  }
5173
5496
  }
5174
- async function Ga() {
5497
+ async function pr() {
5175
5498
  return document.body ? document.body : await new Promise((e) => {
5176
5499
  const t = new MutationObserver(() => {
5177
5500
  document.body && (t.disconnect(), e(document.body));
@@ -5179,41 +5502,42 @@ async function Ga() {
5179
5502
  t.observe(document.documentElement, { childList: !0 });
5180
5503
  });
5181
5504
  }
5182
- function io(e) {
5505
+ function yo(e) {
5183
5506
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5184
5507
  }
5185
- function $a(e) {
5508
+ function sr(e) {
5186
5509
  try {
5187
- const t = window.localStorage.getItem(io(e));
5510
+ const t = window.localStorage.getItem(yo(e));
5188
5511
  if (!t)
5189
- return Tn();
5190
- const o = JSON.parse(t);
5512
+ return qn();
5513
+ const n = JSON.parse(t);
5191
5514
  return {
5192
- isOpen: o.isOpen === !0,
5193
- composerValue: typeof o.composerValue == "string" ? o.composerValue : "",
5194
- focusedInput: o.focusedInput === "composer" || o.focusedInput === "launcher" ? o.focusedInput : null,
5195
- focusedInputAt: typeof o.focusedInputAt == "number" ? o.focusedInputAt : null,
5196
- openToolGroupKeys: Array.isArray(o.openToolGroupKeys) ? o.openToolGroupKeys.filter(
5197
- (n) => typeof n == "string"
5515
+ isOpen: n.isOpen === !0,
5516
+ composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
5517
+ focusedInput: n.focusedInput === "composer" || n.focusedInput === "launcher" ? n.focusedInput : null,
5518
+ focusedInputAt: typeof n.focusedInputAt == "number" ? n.focusedInputAt : null,
5519
+ openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5520
+ (o) => typeof o == "string"
5198
5521
  ) : [],
5199
- launcherPosition: Ka(o.launcherPosition) ? o.launcherPosition : null,
5200
- seenShareCandidateIds: Array.isArray(o.seenShareCandidateIds) ? o.seenShareCandidateIds.filter((n) => typeof n == "string").slice(-On) : [],
5201
- sharePromptsDisabled: o.sharePromptsDisabled === !0
5522
+ launcherPosition: gr(n.launcherPosition) ? n.launcherPosition : null,
5523
+ panelSize: hr(n.panelSize) ? ut(n.panelSize) : null,
5524
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Zn) : [],
5525
+ sharePromptsDisabled: n.sharePromptsDisabled === !0
5202
5526
  };
5203
5527
  } catch {
5204
- return Tn();
5528
+ return qn();
5205
5529
  }
5206
5530
  }
5207
- async function qa(e) {
5531
+ async function dr(e) {
5208
5532
  if (e.loadSharePromptsDisabled)
5209
5533
  return e.loadSharePromptsDisabled();
5210
5534
  try {
5211
- return window.localStorage.getItem(Un) === "true";
5535
+ return window.localStorage.getItem(Jn) === "true";
5212
5536
  } catch {
5213
5537
  return !1;
5214
5538
  }
5215
5539
  }
5216
- function ja(e, t) {
5540
+ function cr(e, t) {
5217
5541
  if (e.persistSharePromptsDisabled) {
5218
5542
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5219
5543
  () => {
@@ -5222,12 +5546,12 @@ function ja(e, t) {
5222
5546
  return;
5223
5547
  }
5224
5548
  try {
5225
- t && window.localStorage.setItem(Un, "true");
5549
+ t && window.localStorage.setItem(Jn, "true");
5226
5550
  } catch {
5227
5551
  return;
5228
5552
  }
5229
5553
  }
5230
- function Tn() {
5554
+ function qn() {
5231
5555
  return {
5232
5556
  isOpen: !1,
5233
5557
  composerValue: "",
@@ -5235,52 +5559,59 @@ function Tn() {
5235
5559
  focusedInputAt: null,
5236
5560
  openToolGroupKeys: [],
5237
5561
  launcherPosition: null,
5562
+ panelSize: null,
5238
5563
  seenShareCandidateIds: [],
5239
5564
  sharePromptsDisabled: !1
5240
5565
  };
5241
5566
  }
5242
- function Va(e, t) {
5567
+ function ur(e, t) {
5243
5568
  try {
5244
5569
  window.localStorage.setItem(
5245
- io(e),
5570
+ yo(e),
5246
5571
  JSON.stringify(t)
5247
5572
  );
5248
5573
  } catch {
5249
5574
  return;
5250
5575
  }
5251
5576
  }
5252
- function Ka(e) {
5577
+ function gr(e) {
5253
5578
  if (!e || typeof e != "object")
5254
5579
  return !1;
5255
5580
  const t = e;
5256
5581
  return Number.isFinite(t.x) && Number.isFinite(t.y) && (t.anchor === "top-left" || t.anchor === "top-right" || t.anchor === "bottom-left" || t.anchor === "bottom-right");
5257
5582
  }
5258
- const Pn = /* @__PURE__ */ new WeakSet();
5259
- function Ya(e) {
5583
+ function hr(e) {
5584
+ if (!e || typeof e != "object")
5585
+ return !1;
5586
+ const t = e;
5587
+ return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5588
+ }
5589
+ const jn = /* @__PURE__ */ new WeakSet();
5590
+ function mr(e) {
5260
5591
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
5261
5592
  }
5262
- function Dn(e) {
5593
+ function Vn(e) {
5263
5594
  const t = e.pathname.split("/");
5264
5595
  return t[t.length - 1] ?? "";
5265
5596
  }
5266
- function Xa(e, t) {
5267
- const o = new URL(e.src, document.baseURI);
5268
- return o.href === t.href || o.pathname === t.pathname ? !0 : Dn(o) === Dn(t);
5269
- }
5270
- class re extends EventTarget {
5271
- constructor(t, o) {
5272
- super(), this.channelId = o, this.url = t, this.addPreviewListener(Zo, () => {
5273
- this.readyState = re.OPEN, this.dispatchEvent(new Event("open"));
5274
- }), this.addPreviewListener(Jo, (n) => {
5275
- const i = n;
5597
+ function fr(e, t) {
5598
+ const n = new URL(e.src, document.baseURI);
5599
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Vn(n) === Vn(t);
5600
+ }
5601
+ class se extends EventTarget {
5602
+ constructor(t, n) {
5603
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(bi, () => {
5604
+ this.readyState = se.OPEN, this.dispatchEvent(new Event("open"));
5605
+ }), this.addPreviewListener(_i, (o) => {
5606
+ const i = o;
5276
5607
  this.dispatchEvent(
5277
5608
  new MessageEvent("message", { data: i.detail?.data ?? "" })
5278
5609
  );
5279
- }), this.addPreviewListener(Qo, () => {
5280
- this.readyState = re.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5281
- }), this.addPreviewListener(ei, (n) => {
5282
- const i = n;
5283
- this.readyState = re.CLOSED, this.dispatchEvent(
5610
+ }), this.addPreviewListener(xi, () => {
5611
+ this.readyState = se.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
5612
+ }), this.addPreviewListener(yi, (o) => {
5613
+ const i = o;
5614
+ this.readyState = se.CLOSED, this.dispatchEvent(
5284
5615
  new CloseEvent("close", {
5285
5616
  code: i.detail?.code ?? 1e3,
5286
5617
  reason: i.detail?.reason ?? "",
@@ -5289,8 +5620,8 @@ class re extends EventTarget {
5289
5620
  ), this.cleanup();
5290
5621
  }), window.dispatchEvent(
5291
5622
  new CustomEvent(
5292
- tt(
5293
- Ko,
5623
+ rt(
5624
+ mi,
5294
5625
  this.channelId
5295
5626
  ),
5296
5627
  {
@@ -5309,18 +5640,18 @@ class re extends EventTarget {
5309
5640
  extensions = "";
5310
5641
  binaryType = "blob";
5311
5642
  bufferedAmount = 0;
5312
- readyState = re.CONNECTING;
5313
- socketId = Za();
5643
+ readyState = se.CONNECTING;
5644
+ socketId = wr();
5314
5645
  listeners = /* @__PURE__ */ new Map();
5315
5646
  send(t) {
5316
- if (this.readyState !== re.OPEN)
5647
+ if (this.readyState !== se.OPEN)
5317
5648
  throw new DOMException(
5318
5649
  "Pluno preview websocket is not open",
5319
5650
  "InvalidStateError"
5320
5651
  );
5321
5652
  window.dispatchEvent(
5322
5653
  new CustomEvent(
5323
- tt(Yo, this.channelId),
5654
+ rt(fi, this.channelId),
5324
5655
  {
5325
5656
  detail: {
5326
5657
  socketId: this.socketId,
@@ -5330,78 +5661,78 @@ class re extends EventTarget {
5330
5661
  )
5331
5662
  );
5332
5663
  }
5333
- close(t, o) {
5334
- this.readyState !== re.CLOSED && (this.readyState = re.CLOSING, window.dispatchEvent(
5664
+ close(t, n) {
5665
+ this.readyState !== se.CLOSED && (this.readyState = se.CLOSING, window.dispatchEvent(
5335
5666
  new CustomEvent(
5336
- tt(Xo, this.channelId),
5667
+ rt(wi, this.channelId),
5337
5668
  {
5338
- detail: { socketId: this.socketId, code: t, reason: o }
5669
+ detail: { socketId: this.socketId, code: t, reason: n }
5339
5670
  }
5340
5671
  )
5341
5672
  ), this.cleanup());
5342
5673
  }
5343
- addPreviewListener(t, o) {
5344
- const n = tt(
5674
+ addPreviewListener(t, n) {
5675
+ const o = rt(
5345
5676
  t,
5346
5677
  this.channelId
5347
5678
  ), i = (r) => {
5348
- r.detail?.socketId === this.socketId && o(r);
5679
+ r.detail?.socketId === this.socketId && n(r);
5349
5680
  };
5350
- this.listeners.set(n, i), window.addEventListener(n, i);
5681
+ this.listeners.set(o, i), window.addEventListener(o, i);
5351
5682
  }
5352
5683
  cleanup() {
5353
- for (const [t, o] of this.listeners.entries())
5354
- window.removeEventListener(t, o);
5684
+ for (const [t, n] of this.listeners.entries())
5685
+ window.removeEventListener(t, n);
5355
5686
  this.listeners.clear();
5356
5687
  }
5357
5688
  }
5358
- function Za() {
5689
+ function wr() {
5359
5690
  const e = window.sessionStorage.getItem(
5360
- rn
5691
+ yn
5361
5692
  );
5362
5693
  if (e)
5363
5694
  return e;
5364
5695
  const t = crypto.randomUUID();
5365
- return window.sessionStorage.setItem(rn, t), t;
5696
+ return window.sessionStorage.setItem(yn, t), t;
5366
5697
  }
5367
- function tt(e, t) {
5698
+ function rt(e, t) {
5368
5699
  return `${e}:${t}`;
5369
5700
  }
5370
- function Ja(e) {
5701
+ function br(e) {
5371
5702
  const t = document.currentScript;
5372
5703
  if (t instanceof HTMLScriptElement)
5373
5704
  return [t];
5374
- const o = new URL(e, document.baseURI).href, n = new URL(o);
5705
+ const n = new URL(e, document.baseURI).href, o = new URL(n);
5375
5706
  return Array.from(
5376
5707
  document.querySelectorAll("script[type='module'][src]")
5377
5708
  ).filter(
5378
- (i) => i instanceof HTMLScriptElement && Ya(i) && Xa(i, n)
5709
+ (i) => i instanceof HTMLScriptElement && mr(i) && fr(i, o)
5379
5710
  );
5380
5711
  }
5381
- function Qa(e) {
5382
- for (const t of Ja(e)) {
5383
- if (Pn.has(t) || t.dataset.plunoAutoMount === "false")
5712
+ function _r(e) {
5713
+ for (const t of br(e)) {
5714
+ if (jn.has(t) || t.dataset.plunoAutoMount === "false")
5384
5715
  continue;
5385
- Pn.add(t);
5386
- const o = t.dataset.plunoPreviewChannel;
5387
- ki({
5716
+ jn.add(t);
5717
+ const n = t.dataset.plunoPreviewChannel;
5718
+ $i({
5388
5719
  token: t.dataset.plunoToken,
5389
5720
  tokenEndpoint: t.dataset.plunoTokenEndpoint,
5390
5721
  backendUrl: t.dataset.plunoBackendUrl,
5391
- webSocketFactory: o ? Ei(o) : void 0,
5722
+ webSocketFactory: n ? Gi(n) : void 0,
5392
5723
  launcherLabel: t.dataset.plunoLauncherLabel,
5393
5724
  accentColor: t.dataset.plunoAccentColor,
5394
5725
  colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
5395
5726
  fontFamily: t.dataset.plunoFontFamily,
5396
5727
  scribbleStyle: t.dataset.plunoScribbleStyle === "true",
5397
5728
  position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
5398
- }).catch((n) => {
5399
- console.error("Failed to mount Pluno widget", n);
5729
+ }).catch((o) => {
5730
+ console.error("Failed to mount Pluno widget", o);
5400
5731
  });
5401
5732
  }
5402
5733
  }
5403
- Qa(import.meta.url);
5734
+ _r(import.meta.url);
5404
5735
  export {
5405
- Ei as createProductAgentPreviewBridgeWebSocketFactory,
5406
- ki as mountPlunoProductAgentWidget
5736
+ Gi as createProductAgentPreviewBridgeWebSocketFactory,
5737
+ $i as mountPlunoProductAgentWidget
5407
5738
  };