@pluno/product-agent-web 0.1.103 → 0.1.105

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,26 +1,26 @@
1
- import { PlunoProductAgent as wi, getProductAgentOriginAccessErrorMessage as bi } from "./product-agent-sdk.js";
2
- const _i = "#7c3aed", vt = "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", Un = [253, 250, 241], Bn = 3.5;
3
- function vo(e) {
4
- const t = So(e);
5
- if (Fn(lt(t), Un) >= Bn)
1
+ import { PlunoProductAgent as yi, getProductAgentOriginAccessErrorMessage as vi } from "./product-agent-sdk.js";
2
+ const Si = "#7c3aed", Et = "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", kt = "#2c2a1e", Hn = [253, 250, 241], Gn = 3.5;
3
+ function ko(e) {
4
+ const t = Lo(e);
5
+ if ($n(dt(t), Hn) >= Gn)
6
6
  return t;
7
- let i = lt(t);
8
- const o = lt(St);
7
+ let i = dt(t);
8
+ const o = dt(kt);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (i = vi(i, o, 0.22), Fn(i, Un) >= Bn)
11
- return rn(i);
12
- return rn(i);
10
+ if (i = ki(i, o, 0.22), $n(i, Hn) >= Gn)
11
+ return pn(i);
12
+ return pn(i);
13
13
  }
14
- function xi() {
14
+ function Ci() {
15
15
  let n = "M 280 120", i = !1, o = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
- const l = (o % 3 - 1) * 18, s = i ? 280 - l : 1020 + l;
18
- n += ` L ${s} ${r}`, i = !i, o += 1;
17
+ const l = (o % 3 - 1) * 18, p = i ? 280 - l : 1020 + l;
18
+ n += ` L ${p} ${r}`, i = !i, o += 1;
19
19
  }
20
20
  return n;
21
21
  }
22
- function yi(e) {
23
- const t = So(e), n = ln(lt(t));
22
+ function Ei(e) {
23
+ const t = Lo(e), n = dn(dt(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,34 +56,34 @@ function yi(e) {
56
56
  shadow: pe(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function So(e) {
59
+ function Lo(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((n) => n + n).join("").toLowerCase()}` : _i;
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()}` : Si;
62
62
  }
63
- function lt(e) {
63
+ function dt(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 rn([e, t, n]) {
70
+ function pn([e, t, n]) {
71
71
  const i = (o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0");
72
72
  return `#${i(e)}${i(t)}${i(n)}`;
73
73
  }
74
- function ln([e, t, n]) {
74
+ function dn([e, t, n]) {
75
75
  const i = (o) => {
76
76
  const r = o / 255;
77
77
  return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
78
78
  };
79
79
  return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
80
80
  }
81
- function Fn(e, t) {
82
- const n = ln(e), i = ln(t), [o, r] = n > i ? [n, i] : [i, n];
81
+ function $n(e, t) {
82
+ const n = dn(e), i = dn(t), [o, r] = n > i ? [n, i] : [i, n];
83
83
  return (o + 0.05) / (r + 0.05);
84
84
  }
85
- function vi(e, t, n) {
86
- const i = sn(n);
85
+ function ki(e, t, n) {
86
+ const i = cn(n);
87
87
  return [
88
88
  e[0] + (t[0] - e[0]) * i,
89
89
  e[1] + (t[1] - e[1]) * i,
@@ -91,43 +91,43 @@ function vi(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function pe(e, t, n) {
94
- const [i, o, r] = Si(lt(e));
95
- return rn(Ci(i, sn(o + n), sn(r + t)));
94
+ const [i, o, r] = Li(dt(e));
95
+ return pn(Pi(i, cn(o + n), cn(r + t)));
96
96
  }
97
- function Si([e, t, n]) {
98
- const i = e / 255, o = t / 255, r = n / 255, l = Math.max(i, o, r), s = Math.min(i, o, r), p = (l + s) / 2;
99
- if (l === s)
100
- return [0, 0, p];
101
- const g = l - s, c = p > 0.5 ? g / (2 - l - s) : g / (l + s);
102
- return [(l === i ? (o - r) / g + (o < r ? 6 : 0) : l === o ? (r - i) / g + 2 : (i - o) / g + 4) / 6, c, p];
97
+ function Li([e, t, n]) {
98
+ const i = e / 255, o = t / 255, r = n / 255, l = Math.max(i, o, r), p = Math.min(i, o, r), s = (l + p) / 2;
99
+ if (l === p)
100
+ return [0, 0, s];
101
+ const g = l - p, c = s > 0.5 ? g / (2 - l - p) : g / (l + p);
102
+ return [(l === i ? (o - r) / g + (o < r ? 6 : 0) : l === o ? (r - i) / g + 2 : (i - o) / g + 4) / 6, c, s];
103
103
  }
104
- function Ci(e, t, n) {
104
+ function Pi(e, t, n) {
105
105
  if (t === 0)
106
106
  return [n * 255, n * 255, n * 255];
107
107
  const i = n < 0.5 ? n * (1 + t) : n + t - n * t, o = 2 * n - i;
108
108
  return [
109
- Kt(o, i, e + 1 / 3) * 255,
110
- Kt(o, i, e) * 255,
111
- Kt(o, i, e - 1 / 3) * 255
109
+ Zt(o, i, e + 1 / 3) * 255,
110
+ Zt(o, i, e) * 255,
111
+ Zt(o, i, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function Kt(e, t, n) {
114
+ function Zt(e, t, n) {
115
115
  let i = n;
116
116
  return i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6 ? e + (t - e) * 6 * i : i < 1 / 2 ? t : i < 2 / 3 ? e + (t - e) * (2 / 3 - i) * 6 : e;
117
117
  }
118
- function sn(e) {
118
+ function cn(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const Co = "suggest_share_on_socials";
122
- function Ei(e) {
121
+ const Po = "suggest_share_on_socials";
122
+ function Ai(e) {
123
123
  for (let t = e.length - 1; t >= 0; t -= 1) {
124
124
  const n = e[t];
125
- if (n.role !== "tool" || n.toolName !== Co)
125
+ if (n.role !== "tool" || n.toolName !== Po)
126
126
  continue;
127
- const i = Wn(e, t, "assistant");
127
+ const i = qn(e, t, "assistant");
128
128
  if (!i)
129
129
  return null;
130
- const o = Wn(e, i.index, "user");
130
+ const o = qn(e, i.index, "user");
131
131
  return o ? {
132
132
  id: `share:${n.callId ?? n.id}`,
133
133
  userPrompt: o.content,
@@ -136,13 +136,13 @@ function Ei(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- async function ki(e) {
140
- const t = await Li(e);
139
+ async function Ti(e) {
140
+ const t = await Ni(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 Wn(e, t, n) {
145
+ function qn(e, t, n) {
146
146
  for (let i = t - 1; i >= 0; i -= 1) {
147
147
  const o = e[i];
148
148
  if (o.role === n && o.content.trim())
@@ -150,73 +150,73 @@ function Wn(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- async function Li(e) {
153
+ async function Ni(e) {
154
154
  return await (await fetch(e)).blob();
155
155
  }
156
- const Pi = "https://app.pluno.ai", Ti = "/api/product-agent/embed/active-users", Ni = 1800, Ai = 15e3, Ii = 250, Ri = 1e3, Di = 3e4;
157
- function zi(e, t = {}) {
156
+ const Ii = "https://app.pluno.ai", Ri = "/api/product-agent/embed/active-users", Di = 1800, zi = 15e3, Mi = 250, Oi = 1e3, Ui = 3e4;
157
+ function Bi(e, t = {}) {
158
158
  let n = !1, i = null, o = null, r = null;
159
159
  const l = () => {
160
160
  r !== null && (window.clearInterval(r), r = null);
161
- }, s = (c) => {
161
+ }, p = (c) => {
162
162
  n || (o !== null && window.clearTimeout(o), o = window.setTimeout(() => {
163
163
  g();
164
- }, Ui(c)));
165
- }, p = (c) => {
164
+ }, Hi(c)));
165
+ }, s = (c) => {
166
166
  if (l(), i === null) {
167
167
  i = c, e(c);
168
168
  return;
169
169
  }
170
- const h = i, E = performance.now();
170
+ const h = i, C = performance.now();
171
171
  r = window.setInterval(() => {
172
172
  if (n) {
173
173
  l();
174
174
  return;
175
175
  }
176
- const P = Math.min(1, (performance.now() - E) / Ni);
177
- i = Math.round(h + (c - h) * Bi(P)), e(i), P >= 1 && (i = c, e(c), l());
178
- }, Ii);
176
+ const A = Math.min(1, (performance.now() - C) / Di);
177
+ i = Math.round(h + (c - h) * Gi(A)), e(i), A >= 1 && (i = c, e(c), l());
178
+ }, Mi);
179
179
  }, g = async () => {
180
180
  try {
181
- const c = await Mi(t);
181
+ const c = await Fi(t);
182
182
  if (n)
183
183
  return;
184
- p(c.count), s(c.refreshAfterMs);
184
+ s(c.count), p(c.refreshAfterMs);
185
185
  } catch {
186
- s(Ai);
186
+ p(zi);
187
187
  }
188
188
  };
189
189
  return g(), () => {
190
190
  n = !0, o !== null && window.clearTimeout(o), l();
191
191
  };
192
192
  }
193
- async function Mi(e) {
193
+ async function Fi(e) {
194
194
  if (e.loader)
195
195
  return e.loader();
196
- const n = await (e.fetcher ?? fetch)(new URL(Ti, Oi(e.backendUrl ?? Pi)).toString(), {
196
+ const n = await (e.fetcher ?? fetch)(new URL(Ri, Wi(e.backendUrl ?? Ii)).toString(), {
197
197
  cache: "no-store",
198
198
  credentials: "omit"
199
199
  });
200
200
  if (!n.ok)
201
201
  throw new Error("Failed to load active users");
202
- const i = await n.json(), o = Hn(i.count), r = Hn(i.refreshAfterMs ?? i.refresh_after_ms);
202
+ const i = await n.json(), o = jn(i.count), r = jn(i.refreshAfterMs ?? i.refresh_after_ms);
203
203
  if (o === null || r === null)
204
204
  throw new Error("Invalid active users response");
205
205
  return { count: o, refreshAfterMs: r };
206
206
  }
207
- function Hn(e) {
207
+ function jn(e) {
208
208
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
209
209
  }
210
- function Oi(e) {
210
+ function Wi(e) {
211
211
  return e.endsWith("/") ? e : `${e}/`;
212
212
  }
213
- function Ui(e) {
214
- return Math.min(Di, Math.max(Ri, e));
213
+ function Hi(e) {
214
+ return Math.min(Ui, Math.max(Oi, e));
215
215
  }
216
- function Bi(e) {
216
+ function Gi(e) {
217
217
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
218
218
  }
219
- const Fi = [
219
+ const $i = [
220
220
  "a[href]",
221
221
  "button",
222
222
  "input",
@@ -234,29 +234,33 @@ const Fi = [
234
234
  "[role='dialog']",
235
235
  "[aria-modal='true']",
236
236
  "[tabindex]:not([tabindex='-1'])",
237
- "[draggable='true']"
237
+ "[draggable='true']",
238
+ // Browsers may not expose an in-shadow-root selection by the time the click bubbles.
239
+ // Message content is selectable, so it must never become passive composer-focus space.
240
+ ".pluno-pa-widget__message",
241
+ ".timeline-item"
238
242
  ].join(",");
239
- function Wi(e, t, n) {
240
- return e instanceof Element ? Hi(
243
+ function qi(e, t, n) {
244
+ return e instanceof Element ? ji(
241
245
  t,
242
246
  n,
243
- e.closest(Fi) !== null
247
+ e.closest($i) !== null
244
248
  ) : !1;
245
249
  }
246
- function Hi(e, t, n) {
250
+ function ji(e, t, n) {
247
251
  return e === 1 && !t && !n;
248
252
  }
249
- function Gi(e, t, n) {
253
+ function Vi(e, t, n) {
250
254
  return e instanceof Node && t !== null && !t.contains(e) && !n?.contains(e);
251
255
  }
252
- function $i(e, t = !0) {
256
+ function Ki(e, t = !0) {
253
257
  if (!e || !t || !e.isConnected || e.disabled || e.readOnly)
254
258
  return !1;
255
259
  const n = e.getRootNode();
256
260
  return (n instanceof ShadowRoot ? n.activeElement : e.ownerDocument.activeElement) === e ? !1 : (e.focus({ preventScroll: !0 }), !0);
257
261
  }
258
- const qi = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
259
- function ji(e) {
262
+ const Yi = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
263
+ function Xi(e) {
260
264
  let t = "", n = "", i = null;
261
265
  for (const o of e.split(new RegExp("(?<=\\n)"))) {
262
266
  if (i) {
@@ -267,7 +271,7 @@ function ji(e) {
267
271
  }
268
272
  const r = o.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
269
273
  if (r) {
270
- t += Gn(n) + o, n = "", i = {
274
+ t += Vn(n) + o, n = "", i = {
271
275
  marker: r[1][0],
272
276
  length: r[1].length
273
277
  };
@@ -275,31 +279,31 @@ function ji(e) {
275
279
  }
276
280
  n += o;
277
281
  }
278
- return t + Gn(n);
282
+ return t + Vn(n);
279
283
  }
280
- function Gn(e) {
284
+ function Vn(e) {
281
285
  let t = "", n = 0;
282
- for (const i of e.matchAll(qi)) {
286
+ for (const i of e.matchAll(Yi)) {
283
287
  const o = i.index ?? 0;
284
- t += $n(
288
+ t += Kn(
285
289
  e.slice(n, o)
286
290
  ), t += i[0], n = o + i[0].length;
287
291
  }
288
- return t + $n(e.slice(n));
292
+ return t + Kn(e.slice(n));
289
293
  }
290
- function $n(e) {
294
+ function Kn(e) {
291
295
  return e.replace(
292
296
  /\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
293
- (t, n, i, o, r) => r[o - 1] === "!" || Vi(r, o) || Ki(r, o, n) ? t : `[${n}](${i})`
297
+ (t, n, i, o, r) => r[o - 1] === "!" || Zi(r, o) || Ji(r, o, n) ? t : `[${n}](${i})`
294
298
  );
295
299
  }
296
- function Vi(e, t) {
300
+ function Zi(e, t) {
297
301
  let n = 0;
298
302
  for (let i = t - 1; e[i] === "\\"; i -= 1)
299
303
  n += 1;
300
304
  return n % 2 === 1;
301
305
  }
302
- function Ki(e, t, n) {
306
+ function Ji(e, t, n) {
303
307
  if (n !== "x" && n !== "X")
304
308
  return !1;
305
309
  const i = e.lastIndexOf(`
@@ -308,7 +312,7 @@ function Ki(e, t, n) {
308
312
  e.slice(i, t)
309
313
  );
310
314
  }
311
- const Eo = 100, Yi = 1e4, Xi = 5e3, Zi = "product-agent:sdk-preview-socket-connect", Ji = "product-agent:sdk-preview-socket-send", Qi = "product-agent:sdk-preview-socket-close", ea = "product-agent:sdk-preview-socket-open", ta = "product-agent:sdk-preview-socket-message", na = "product-agent:sdk-preview-socket-error", oa = "product-agent:sdk-preview-socket-closed", qn = "product-agent:sdk-preview-socket-id", ia = "data-pluno-sdk-preview-channel", ko = "data-pluno-auto-mounted", be = "__plunoProductAgentAutoMountOwner", aa = 1e4, ra = "Failed to load Pluno widget token", jn = "Timed out loading Pluno widget token", la = "pluno.productAgent.widgetClientId.", Yt = /* @__PURE__ */ new Set(), sa = "product-agent:preview-diagnostic", Lo = "pluno.productAgent.sharePromptsDisabled", pa = 3, Vn = 'dialog[open], [aria-modal="true"], [role="dialog"]', da = 400, ca = 5e3, ua = 500, Kn = "Close the page's popup to chat", ga = "No recent chats for this page yet.", de = {
315
+ const Ao = 100, Qi = 1e4, ea = 5e3, ta = "product-agent:sdk-preview-socket-connect", na = "product-agent:sdk-preview-socket-send", oa = "product-agent:sdk-preview-socket-close", ia = "product-agent:sdk-preview-socket-open", aa = "product-agent:sdk-preview-socket-message", ra = "product-agent:sdk-preview-socket-error", la = "product-agent:sdk-preview-socket-closed", Yn = "product-agent:sdk-preview-socket-id", sa = "data-pluno-sdk-preview-channel", To = "data-pluno-auto-mounted", _e = "__plunoProductAgentAutoMountOwner", pa = 1e4, da = "Failed to load Pluno widget token", Xn = "Timed out loading Pluno widget token", ca = "pluno.productAgent.widgetClientId.", Jt = /* @__PURE__ */ new Set(), ua = "product-agent:preview-diagnostic", No = "pluno.productAgent.sharePromptsDisabled", ga = 3, Zn = 'dialog[open], [aria-modal="true"], [role="dialog"]', ha = 400, ma = 5e3, fa = 500, Jn = "Close the page's popup to chat", wa = "No recent chats for this page yet.", de = {
312
316
  launcherLabel: "Ask for anything...",
313
317
  accentColor: "#7c3aed",
314
318
  colorScheme: "light",
@@ -316,7 +320,7 @@ const Eo = 100, Yi = 1e4, Xi = 5e3, Zi = "product-agent:sdk-preview-socket-conne
316
320
  scribbleStyle: !0,
317
321
  position: "bottom-right",
318
322
  movableLauncher: !0
319
- }, ha = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Yn = "pluno-pa-scribble-font", Po = 190, To = 41, Xn = 22, ma = 1, fa = 48, bn = 420, wa = 520, ba = 0.24, _n = 680, _a = 800, xa = 0.76, A = 8, Re = 50, No = "http://www.w3.org/2000/svg", pn = 26, dn = 8, ya = 36, cn = 16, va = 4, Zn = [
323
+ }, ba = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', Qn = "pluno-pa-scribble-font", Io = 190, Ro = 41, eo = 22, _a = 1, xa = 48, yn = 420, ya = 520, va = 0.24, vn = 680, Sa = 800, Ca = 0.76, N = 8, Me = 50, Do = "http://www.w3.org/2000/svg", un = 26, gn = 8, Ea = 36, hn = 16, ka = 4, to = [
320
324
  {
321
325
  ellipseCx: "17.5",
322
326
  ellipseCy: "24.5",
@@ -353,12 +357,12 @@ const Eo = 100, Yi = 1e4, Xi = 5e3, Zi = "product-agent:sdk-preview-socket-conne
353
357
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
354
358
  pathStrokeWidth: "2.45"
355
359
  }
356
- ], Sa = 11, Ca = 13, un = 4, Ao = 10, Io = 40, Ea = "movable-launcher-position-v2", Ro = "pluno-pa-widget-styles", Do = "data-pluno-pa-widget-styles";
357
- let Jn = 0;
358
- function ka(e) {
359
- return (t) => new _e(t, e);
360
+ ], La = 11, Pa = 13, mn = 4, zo = 10, Mo = 40, Aa = "movable-launcher-position-v2", Oo = "pluno-pa-widget-styles", Uo = "data-pluno-pa-widget-styles";
361
+ let no = 0;
362
+ function Ta(e) {
363
+ return (t) => new xe(t, e);
360
364
  }
361
- async function La(e = {}) {
365
+ async function Na(e = {}) {
362
366
  const t = {
363
367
  layout: e.layout ?? "floating",
364
368
  mountTarget: e.mountTarget,
@@ -409,9 +413,11 @@ async function La(e = {}) {
409
413
  onMorningReportSnooze: e.onMorningReportSnooze,
410
414
  onMorningReportTaskStart: e.onMorningReportTaskStart,
411
415
  taskNotifications: e.taskNotifications,
412
- tabGroups: e.tabGroups
416
+ tabGroups: e.tabGroups,
417
+ integrationAuthStatusLoader: e.integrationAuthStatusLoader,
418
+ integrationAuthHandler: e.integrationAuthHandler
413
419
  };
414
- Z(
420
+ X(
415
421
  "web-sdk.widget",
416
422
  "Mounting widget with merged options",
417
423
  {
@@ -428,39 +434,39 @@ async function La(e = {}) {
428
434
  );
429
435
  const n = document.createElement("div");
430
436
  n.className = "pluno-pa-widget-host", n.setAttribute("data-pluno-product-agent-ui", "widget"), n.setAttribute("data-pluno-product-agent-layout", t.layout), t.sdkPreviewChannelId && n.setAttribute(
431
- ia,
437
+ sa,
432
438
  t.sdkPreviewChannelId
433
439
  );
434
440
  const i = n.attachShadow({ mode: "open" }), o = document.createElement("div");
435
441
  o.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, o.classList.add(`pluno-pa-widget--layout-${t.layout}`), o.setAttribute("data-pluno-product-agent-ui-root", "widget");
436
- let r = Qn(
442
+ let r = oo(
437
443
  t.accentColor,
438
444
  t.scribbleStyle
439
445
  );
440
- Xa(
446
+ er(
441
447
  o,
442
448
  t.launcherLabel,
443
449
  r,
444
450
  t.movableLauncher,
445
451
  t.showLauncherMinimizeButton
446
452
  ), i.appendChild(o);
447
- const l = Kr(t), s = t.layout === "floating" ? t.initialDisplayState ?? jr(t) : "shown";
448
- bo(t, s);
449
- let p = t.movableLauncher ? l.launcherPosition : null, g = p !== null, c = l.panelSize, h = null;
450
- o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), s === "minimized" && (o.classList.add("pluno-pa-widget--minimized"), Ie(
453
+ const l = Qr(t), p = t.layout === "floating" ? t.initialDisplayState ?? Zr(t) : "shown";
454
+ vo(t, p);
455
+ let s = t.movableLauncher ? l.launcherPosition : null, g = s !== null, c = l.panelSize, h = null;
456
+ o.classList.add(`pluno-pa-widget--${t.colorScheme}`), t.scribbleStyle && o.classList.add("pluno-pa-widget--scribble"), p === "minimized" && (o.classList.add("pluno-pa-widget--minimized"), ze(
451
457
  o,
452
- Zt(
458
+ en(
453
459
  o,
454
- p,
460
+ s,
455
461
  t.position
456
462
  )
457
- )), wo(i, t.accentColor), eo(o, r, {
463
+ )), yo(i, t.accentColor), io(o, r, {
458
464
  accentColor: t.accentColor,
459
465
  colorScheme: t.colorScheme,
460
466
  fontFamily: t.fontFamily,
461
467
  scribbleStyle: t.scribbleStyle
462
468
  });
463
- const E = t.mountTarget ?? await qr(), P = E.ownerDocument, T = o.querySelector(
469
+ const C = t.mountTarget ?? await Xr(), A = C.ownerDocument, T = o.querySelector(
464
470
  ".pluno-pa-widget__launcher"
465
471
  ), O = o.querySelector(
466
472
  ".pluno-pa-widget__launcher-drag-handle"
@@ -470,96 +476,96 @@ async function La(e = {}) {
470
476
  ".pluno-pa-widget__launcher-minimize"
471
477
  ), m = o.querySelector(".pluno-pa-widget__panel"), I = o.querySelector(
472
478
  ".pluno-pa-widget__scribble-spirals--panel"
473
- ), L = Array.from(
479
+ ), z = Array.from(
474
480
  o.querySelectorAll(".pluno-pa-widget__resize-handle")
475
- ), R = o.querySelector(
481
+ ), k = o.querySelector(
476
482
  ".pluno-pa-widget__close"
477
- ), B = o.querySelector(
483
+ ), ee = o.querySelector(
478
484
  ".pluno-pa-widget__composer"
479
- ), ge = o.querySelector(
485
+ ), W = o.querySelector(
480
486
  ".pluno-pa-widget__attachment-error"
481
- ), Ee = o.querySelector(
487
+ ), Ze = o.querySelector(
482
488
  ".pluno-pa-widget__billing-status"
483
- ), Ve = o.querySelector(
489
+ ), Oe = o.querySelector(
484
490
  ".pluno-pa-widget__attachments"
485
- ), D = o.querySelector(
491
+ ), ge = o.querySelector(
486
492
  ".pluno-pa-widget__attachment-input"
487
- ), De = o.querySelector(
493
+ ), U = o.querySelector(
488
494
  ".pluno-pa-widget__attach"
489
- ), f = o.querySelector(
495
+ ), x = o.querySelector(
490
496
  ".pluno-pa-widget__input"
491
- ), U = o.querySelector(
497
+ ), B = o.querySelector(
492
498
  ".pluno-pa-widget__send"
493
- ), ke = o.querySelector(
499
+ ), G = o.querySelector(
494
500
  ".pluno-pa-widget__top-actions"
495
- ), le = o.querySelector(
501
+ ), te = o.querySelector(
496
502
  ".pluno-pa-widget__history"
497
- ), Ke = o.querySelector(
503
+ ), Ae = o.querySelector(
498
504
  ".pluno-pa-widget__history-panel"
499
- ), G = o.querySelector(
505
+ ), Y = o.querySelector(
500
506
  ".pluno-pa-widget__history-list"
501
- ), st = o.querySelector(
507
+ ), ye = o.querySelector(
502
508
  ".pluno-pa-widget__history-close"
503
- ), ze = o.querySelector(
509
+ ), Ue = o.querySelector(
504
510
  ".pluno-pa-widget__history-status"
505
- ), se = o.querySelector(
511
+ ), Be = o.querySelector(
506
512
  ".pluno-pa-widget__timeline-jump"
507
- ), _ = o.querySelector(
513
+ ), se = o.querySelector(
508
514
  ".pluno-pa-widget__active-users-counter"
509
- ), x = o.querySelector(
515
+ ), f = o.querySelector(
510
516
  ".pluno-pa-widget__timeline"
511
- ), z = o.querySelector(
517
+ ), P = o.querySelector(
512
518
  ".pluno-pa-widget__timeline-bottom-sentinel"
513
- ), Y = o.querySelector(
519
+ ), R = o.querySelector(
514
520
  ".pluno-pa-widget__notify-suggestion"
515
- ), te = o.querySelector(
521
+ ), ve = o.querySelector(
516
522
  ".pluno-pa-widget__notify-suggestion-enable"
517
- ), v = o.querySelector(
523
+ ), ne = o.querySelector(
518
524
  ".pluno-pa-widget__notify-suggestion-later"
519
- ), N = o.querySelector(
525
+ ), y = o.querySelector(
520
526
  ".pluno-pa-widget__notify-suggestion-never"
521
- ), V = o.querySelector(
527
+ ), L = o.querySelector(
522
528
  ".pluno-pa-widget__tab-groups-suggestion"
523
- ), Jo = o.querySelector(
529
+ ), Se = o.querySelector(
524
530
  ".pluno-pa-widget__tab-groups-suggestion-enable"
525
- ), Qo = o.querySelector(
531
+ ), ni = o.querySelector(
526
532
  ".pluno-pa-widget__tab-groups-suggestion-dismiss"
527
533
  );
528
- if (!T || !u || !m || !R || !B || !ge || !Ee || !Ve || !D || !De || !f || !U || !ke || !le || !Ke || !G || !st || !ze || !se || !_ || !x || !z)
534
+ if (!T || !u || !m || !k || !ee || !W || !Ze || !Oe || !ge || !U || !x || !B || !G || !te || !Ae || !Y || !ye || !Ue || !Be || !se || !f || !P)
529
535
  throw new Error("Failed to mount Pluno widget");
530
536
  if (t.movableLauncher && !O)
531
537
  throw new Error("Failed to mount Pluno widget drag handle");
532
- De.hidden = !t.attachmentsEnabled, D.disabled = !t.attachmentsEnabled, lo(u), lo(f);
538
+ U.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled, uo(u), uo(x);
533
539
  let $ = [], he = null;
534
- const xe = () => $i(
535
- f,
536
- o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !re(t.billingStatus)
537
- ), Me = () => {
538
- fr(
539
- Ve,
540
+ const Ce = () => Ki(
541
+ x,
542
+ o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !le(t.billingStatus)
543
+ ), Fe = () => {
544
+ xr(
545
+ Oe,
540
546
  $,
541
547
  (a) => {
542
548
  $ = $.filter(
543
- (d, y) => y !== a
544
- ), Me(), H(b.getState()), q(), xe();
549
+ (d, w) => w !== a
550
+ ), Fe(), M(b.getState()), q(), Ce();
545
551
  }
546
552
  );
547
- }, Sn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => Xo(t.tokenEndpoint) : void 0);
548
- if (!t.loginRequired && !t.signupRequired && !t.token && !Sn && !t.webSocketFactory)
553
+ }, kn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => ei(t.tokenEndpoint) : void 0);
554
+ if (!t.loginRequired && !t.signupRequired && !t.token && !kn && !t.webSocketFactory)
549
555
  throw new Error("Pluno widget requires token or tokenEndpoint");
550
- const ei = window.fetch.bind(window), Pt = Vr(t.clientId);
556
+ const oi = window.fetch.bind(window), Nt = Jr(t.clientId);
551
557
  let b;
552
558
  try {
553
559
  const a = {
554
560
  token: t.token,
555
- tokenProvider: Sn,
561
+ tokenProvider: kn,
556
562
  backendUrl: t.backendUrl,
557
563
  metadata: () => ({
558
564
  ...t.metadata ?? {},
559
565
  ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
560
566
  }),
561
567
  initialStarterPrompts: t.initialStarterPrompts,
562
- clientId: Pt.clientId,
568
+ clientId: Nt.clientId,
563
569
  restorePersistedState: t.restorePersistedState,
564
570
  expectedPersistedSessionId: t.expectedPersistedSessionId,
565
571
  keepRunsActiveOnSessionNavigation: t.keepRunsActiveOnSessionNavigation,
@@ -570,11 +576,11 @@ async function La(e = {}) {
570
576
  autoConnect: !1,
571
577
  disableNetworkCapture: !!t.sdkPreviewChannelId
572
578
  };
573
- b = await wi.init(a);
579
+ b = await yi.init(a);
574
580
  } catch (a) {
575
- throw Pt.release(), n.remove(), a;
581
+ throw Nt.release(), n.remove(), a;
576
582
  }
577
- E.appendChild(n), Z(
583
+ C.appendChild(n), X(
578
584
  "web-sdk.widget",
579
585
  "Applied initial widget appearance",
580
586
  {
@@ -584,120 +590,120 @@ async function La(e = {}) {
584
590
  cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
585
591
  }
586
592
  );
587
- const Tt = new Set(l.openToolGroupKeys), Oe = new Set(
593
+ const It = new Set(l.openToolGroupKeys), We = new Set(
588
594
  l.seenShareCandidateIds
589
- ), pt = new Set(Oe);
590
- let Nt = l.sharePromptsDisabled || await Yr(t), ne = null, X = !1, dt = !(t.loginRequired || t.signupRequired), ye = !1, Le = {
595
+ ), ct = new Set(We);
596
+ let Rt = l.sharePromptsDisabled || await el(t), oe = null, V = !1, ut = !(t.loginRequired || t.signupRequired), Ee = !1, Te = {
591
597
  enabled: !0
592
- }, Pe = 0, Cn = "", K = !1, me = !1, ve = [], At = null, Ye = null;
593
- const oe = (a, d) => {
594
- Le = { enabled: a, reason: d };
595
- }, ie = () => {
596
- se.hidden = !0;
597
- }, ti = () => {
598
- se.hidden = !1;
599
- }, ni = (a = "jump") => {
600
- oe(!0, a), ie(), rt(x, () => Le.enabled), Pe = x.scrollTop;
598
+ }, Ne = 0, Ln = "", K = !1, me = !1, ke = [], Dt = null, Je = null;
599
+ const ie = (a, d) => {
600
+ Te = { enabled: a, reason: d };
601
+ }, ae = () => {
602
+ Be.hidden = !0;
603
+ }, ii = () => {
604
+ Be.hidden = !1;
605
+ }, ai = (a = "jump") => {
606
+ ie(!0, a), ae(), pt(f, () => Te.enabled), Ne = f.scrollTop;
601
607
  }, fe = () => {
602
- if (le.hidden = t.layout === "page" || t.loginRequired, Ke.hidden = !K, le.setAttribute("aria-expanded", String(K)), G.classList.toggle(
608
+ if (te.hidden = t.layout === "page" || t.loginRequired, Ae.hidden = !K, te.setAttribute("aria-expanded", String(K)), Y.classList.toggle(
603
609
  "pluno-pa-widget__history-list--center",
604
- me && ve.length === 0
605
- ), G.replaceChildren(), me && ve.length === 0) {
610
+ me && ke.length === 0
611
+ ), Y.replaceChildren(), me && ke.length === 0) {
606
612
  const a = document.createElement("p");
607
- a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", G.appendChild(a);
613
+ a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", Y.appendChild(a);
608
614
  }
609
- for (const a of ve) {
615
+ for (const a of ke) {
610
616
  const d = document.createElement("button");
611
617
  d.type = "button", d.className = "pluno-pa-widget__history-item", d.disabled = me;
612
- const y = document.createElement("span");
613
- y.className = "pluno-pa-widget__history-item-title", y.textContent = Va(a);
614
- const C = document.createElement("time");
615
- C.className = "pluno-pa-widget__history-time", C.dateTime = a.lastActiveAt, C.textContent = Ya(
618
+ const w = document.createElement("span");
619
+ w.className = "pluno-pa-widget__history-item-title", w.textContent = Za(a);
620
+ const v = document.createElement("time");
621
+ v.className = "pluno-pa-widget__history-time", v.dateTime = a.lastActiveAt, v.textContent = Qa(
616
622
  a.lastActiveAt,
617
623
  Date.now()
618
624
  );
619
- const M = document.createElement("small");
620
- M.className = "pluno-pa-widget__history-path", M.textContent = Ka(a), d.append(y, C, M), d.addEventListener("click", () => {
621
- K = !1, Ye = null, fe(), oe(!0, "newSession"), ie(), b.loadSession(a.id), H(b.getState()), xe();
622
- }), G.appendChild(d);
625
+ const D = document.createElement("small");
626
+ D.className = "pluno-pa-widget__history-path", D.textContent = Ja(a), d.append(w, v, D), d.addEventListener("click", () => {
627
+ K = !1, Je = null, fe(), ie(!0, "newSession"), ae(), b.loadSession(a.id), M(b.getState()), Ce();
628
+ }), Y.appendChild(d);
623
629
  }
624
- if (me && ve.length > 0) {
630
+ if (me && ke.length > 0) {
625
631
  const a = document.createElement("p");
626
- a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", G.appendChild(a);
632
+ a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", Y.appendChild(a);
627
633
  }
628
- ze.textContent = Ye ?? (!me && ve.length === 0 ? "No recent chats for this page yet." : ""), ze.hidden = ze.textContent.length === 0;
629
- }, En = async (a) => {
634
+ Ue.textContent = Je ?? (!me && ke.length === 0 ? "No recent chats for this page yet." : ""), Ue.hidden = Ue.textContent.length === 0;
635
+ }, Pn = async (a) => {
630
636
  if (!me) {
631
- me = !0, Ye = null, fe();
637
+ me = !0, Je = null, fe();
632
638
  try {
633
639
  const d = await b.listSessions({ cursor: a, limit: 20 });
634
- ve = a ? [...ve, ...d.sessions] : d.sessions, At = d.nextCursor;
640
+ ke = a ? [...ke, ...d.sessions] : d.sessions, Dt = d.nextCursor;
635
641
  } catch (d) {
636
- Z(
642
+ X(
637
643
  "web-sdk.widget",
638
644
  "Failed to load session history",
639
645
  {
640
646
  message: d instanceof Error ? d.message : String(d)
641
647
  }
642
- ), Ye = ga;
648
+ ), Je = wa;
643
649
  } finally {
644
650
  me = !1, fe();
645
651
  }
646
652
  }
647
- }, oi = () => {
648
- !At || me || G.scrollHeight - G.scrollTop - G.clientHeight <= 24 && En(At);
649
- }, kn = () => {
650
- X || typeof document > "u" || (wo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || P.body?.appendChild(n)));
651
- }, Ln = new MutationObserver(kn);
652
- Ln.observe(P.documentElement, {
653
+ }, ri = () => {
654
+ !Dt || me || Y.scrollHeight - Y.scrollTop - Y.clientHeight <= 24 && Pn(Dt);
655
+ }, An = () => {
656
+ V || typeof document > "u" || (yo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || A.body?.appendChild(n)));
657
+ }, Tn = new MutationObserver(An);
658
+ Tn.observe(A.documentElement, {
653
659
  childList: !0,
654
660
  subtree: !0
655
- }), kn();
656
- const Xe = (a = !0) => {
657
- const d = Ct(o, a);
658
- return gn(
661
+ }), An();
662
+ const Qe = (a = !0) => {
663
+ const d = Lt(o, a);
664
+ return fn(
659
665
  o,
660
- p ? zo(p, d) : za(
666
+ s ? Bo(s, d) : Ba(
661
667
  o,
662
668
  t.position,
663
669
  d
664
670
  ),
665
671
  d
666
672
  );
667
- }, W = () => {
668
- const a = Ha(i, u, f);
669
- Zr(t, {
673
+ }, H = () => {
674
+ const a = ja(i, u, x);
675
+ nl(t, {
670
676
  isOpen: o.classList.contains("pluno-pa-widget--open"),
671
- composerValue: f.value,
677
+ composerValue: x.value,
672
678
  focusedInput: a,
673
679
  focusedInputAt: a ? Date.now() : null,
674
- openToolGroupKeys: [...Tt],
675
- launcherPosition: g ? p : null,
680
+ openToolGroupKeys: [...It],
681
+ launcherPosition: g ? s : null,
676
682
  panelSize: c,
677
- seenShareCandidateIds: [...Oe].slice(
678
- -Eo
683
+ seenShareCandidateIds: [...We].slice(
684
+ -Ao
679
685
  ),
680
- sharePromptsDisabled: Nt
686
+ sharePromptsDisabled: Rt
681
687
  });
682
- }, ct = (a) => {
688
+ }, gt = (a) => {
683
689
  t.onDisplayStateChange?.(a);
684
- }, Ze = (a, d = !0) => {
685
- if (bo(t, a), a === "shown") {
686
- o.classList.remove("pluno-pa-widget--minimized"), T.removeAttribute("tabindex"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && Je(!1), d && ct("shown");
690
+ }, et = (a, d = !0) => {
691
+ if (vo(t, a), a === "shown") {
692
+ o.classList.remove("pluno-pa-widget--minimized"), T.removeAttribute("tabindex"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && tt(!1), d && gt("shown");
687
693
  return;
688
694
  }
689
- ne !== null && (window.clearTimeout(ne), ne = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), T.hidden = !1, m.hidden = !0, R.hidden = !0, T.tabIndex = 0, f.value = "", Ie(
695
+ oe !== null && (window.clearTimeout(oe), oe = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), T.hidden = !1, m.hidden = !0, k.hidden = !0, T.tabIndex = 0, x.value = "", ze(
690
696
  o,
691
- Zt(
697
+ en(
692
698
  o,
693
- p,
699
+ s,
694
700
  t.position
695
701
  )
696
- ), io(o), W(), d && ct("minimized");
697
- }, Te = (a, d = {}) => {
698
- Wa(a, {
699
- debugVersion: Ea,
700
- launcherPosition: p,
702
+ ), so(o), H(), d && gt("minimized");
703
+ }, Ie = (a, d = {}) => {
704
+ qa(a, {
705
+ debugVersion: Aa,
706
+ launcherPosition: s,
701
707
  rootClasses: o.className,
702
708
  rootStyle: {
703
709
  left: o.style.left,
@@ -705,55 +711,55 @@ async function La(e = {}) {
705
711
  right: o.style.right,
706
712
  bottom: o.style.bottom
707
713
  },
708
- rootRect: Qt(o),
709
- launcherRect: Qt(T),
710
- panelRect: Qt(m),
711
- viewport: ee(),
714
+ rootRect: nn(o),
715
+ launcherRect: nn(T),
716
+ panelRect: nn(m),
717
+ viewport: Q(),
712
718
  panelHidden: m.hidden,
713
- closeHidden: R.hidden,
719
+ closeHidden: k.hidden,
714
720
  ...d
715
721
  });
716
- }, Je = (a = !0) => {
717
- if (!p)
718
- return Ie(o, null), Xe(a);
719
- const d = Xe(a);
720
- return Ie(o, d), Te("Applied stored closed launcher position", {
722
+ }, tt = (a = !0) => {
723
+ if (!s)
724
+ return ze(o, null), Qe(a);
725
+ const d = Qe(a);
726
+ return ze(o, d), Ie("Applied stored closed launcher position", {
721
727
  visibleLauncherPosition: d
722
728
  }), d;
723
- }, It = (a, d) => {
729
+ }, zt = (a, d) => {
724
730
  if (!a || !d) {
725
- io(o);
731
+ so(o);
726
732
  return;
727
733
  }
728
- Fa(o, {
734
+ $a(o, {
729
735
  x: a.x - d.x,
730
736
  y: a.y - d.y
731
737
  });
732
- }, Rt = () => {
733
- const a = at(c).width;
738
+ }, Mt = () => {
739
+ const a = st(c).width;
734
740
  return t.layout === "page" && m.getBoundingClientRect().width || a;
735
- }, Pn = () => {
741
+ }, Nn = () => {
736
742
  if (o.classList.contains("pluno-pa-widget--minimized")) {
737
- Ie(
743
+ ze(
738
744
  o,
739
- Zt(
745
+ en(
740
746
  o,
741
- p,
747
+ s,
742
748
  t.position
743
749
  )
744
750
  );
745
751
  return;
746
752
  }
747
- const a = Je();
753
+ const a = tt();
748
754
  if (o.classList.contains("pluno-pa-widget--open") || o.classList.contains("pluno-pa-widget--closing")) {
749
- Xt(o, c);
750
- const d = at(c);
751
- tn(
755
+ Qt(o, c);
756
+ const d = st(c);
757
+ an(
752
758
  I,
753
- Rt()
759
+ Mt()
754
760
  );
755
- const y = yt(
756
- h ?? Jt(
761
+ const w = Ct(
762
+ h ?? tn(
757
763
  o,
758
764
  a,
759
765
  t.position,
@@ -761,44 +767,44 @@ async function La(e = {}) {
761
767
  ),
762
768
  d
763
769
  );
764
- h && (h = y), It(y, a), Te(
770
+ h && (h = w), zt(w, a), Ie(
765
771
  "Applied open panel position after viewport resize",
766
- { openPanelPosition: y }
772
+ { openPanelPosition: w }
767
773
  );
768
- } else p && Te(
774
+ } else s && Ie(
769
775
  "Applied visible launcher position after viewport resize",
770
776
  { visibleLauncherPosition: a }
771
777
  );
772
778
  };
773
- let Tn = () => {
779
+ let In = () => {
774
780
  };
775
- window.addEventListener("resize", Pn), t.movableLauncher && O ? (Je(), Tn = Ia({
781
+ window.addEventListener("resize", Nn), t.movableLauncher && O ? (tt(), In = Ma({
776
782
  root: o,
777
783
  launcher: T,
778
784
  launcherDragHandle: O,
779
- getPosition: () => Xe(),
785
+ getPosition: () => Qe(),
780
786
  setPosition: (a) => {
781
- const d = a, y = Ct(o), C = gn(
787
+ const d = a, w = Lt(o), v = fn(
782
788
  o,
783
789
  a,
784
- y
790
+ w
785
791
  );
786
- p = Oa(
787
- C,
788
- y
789
- ), Ie(o, C), Te("Dragging closed launcher", {
792
+ s = Wa(
793
+ v,
794
+ w
795
+ ), ze(o, v), Ie("Dragging closed launcher", {
790
796
  requestedPosition: d
791
797
  });
792
798
  },
793
799
  persist: () => {
794
- g = !0, W(), Te("Persisted closed launcher drag position");
800
+ g = !0, H(), Ie("Persisted closed launcher drag position");
795
801
  }
796
- })) : Ie(o, null), Xt(o, c);
797
- const ii = () => {
798
- const a = at(c), d = Xe();
802
+ })) : ze(o, null), Qt(o, c);
803
+ const li = () => {
804
+ const a = st(c), d = Qe();
799
805
  return {
800
- position: yt(
801
- h ?? Jt(
806
+ position: Ct(
807
+ h ?? tn(
802
808
  o,
803
809
  d,
804
810
  t.position,
@@ -808,77 +814,77 @@ async function La(e = {}) {
808
814
  ),
809
815
  size: a
810
816
  };
811
- }, ai = (a) => {
812
- c = kt(a.size), Xt(o, c), tn(
817
+ }, si = (a) => {
818
+ c = At(a.size), Qt(o, c), an(
813
819
  I,
814
- Rt()
815
- ), h = yt(
820
+ Mt()
821
+ ), h = Ct(
816
822
  a.position,
817
- at(c)
823
+ st(c)
818
824
  );
819
- const d = Xe();
820
- It(h, d);
821
- }, ri = L.length > 0 ? Ra({
825
+ const d = Qe();
826
+ zt(h, d);
827
+ }, pi = z.length > 0 ? Oa({
822
828
  root: o,
823
- handles: L,
824
- getBounds: ii,
825
- setBounds: ai,
826
- persist: W
829
+ handles: z,
830
+ getBounds: li,
831
+ setBounds: si,
832
+ persist: H
827
833
  }) : () => {
828
834
  };
829
- let Dt = !1;
830
- const Nn = async () => {
831
- if (!(!t.billingStatusLoader || Dt)) {
832
- Dt = !0;
835
+ let Ot = !1;
836
+ const Rn = async () => {
837
+ if (!(!t.billingStatusLoader || Ot)) {
838
+ Ot = !0;
833
839
  try {
834
840
  const a = await t.billingStatusLoader();
835
- if (X)
841
+ if (V)
836
842
  return;
837
- po(
843
+ ho(
838
844
  t.billingStatus,
839
845
  a,
840
846
  b.getState().lastErrorCode
841
- ) && (t.billingStatus = a, on(
842
- Ee,
847
+ ) && (t.billingStatus = a, ln(
848
+ Ze,
843
849
  t.billingStatus,
844
850
  b.getState().lastErrorCode
845
851
  ), q());
846
852
  } catch (a) {
847
- Z(
853
+ X(
848
854
  "web-sdk.widget",
849
855
  "Failed to refresh billing status",
850
856
  { message: a instanceof Error ? a.message : String(a) }
851
857
  );
852
858
  } finally {
853
- Dt = !1;
859
+ Ot = !1;
854
860
  }
855
861
  }
856
862
  }, we = (a = "", d = !0) => {
857
- Nn(), et && (et = !1, Ot()), o.classList.contains("pluno-pa-widget--open") || (h = null), ne !== null && (window.clearTimeout(ne), ne = null), Ze("shown", !1), m.hidden = !1, R.hidden = !1, tn(
863
+ Rn(), ot && (ot = !1, Ft()), o.classList.contains("pluno-pa-widget--open") || (h = null), oe !== null && (window.clearTimeout(oe), oe = null), et("shown", !1), m.hidden = !1, k.hidden = !1, an(
858
864
  I,
859
- Rt()
865
+ Mt()
860
866
  ), o.classList.remove("pluno-pa-widget--closing");
861
- const y = Je(), C = Jt(
867
+ const w = tt(), v = tn(
862
868
  o,
863
- y,
869
+ w,
864
870
  t.position,
865
871
  c
866
872
  );
867
- if (It(C, y), Te("Opening launcher at clamped open panel position", {
868
- openPanelPosition: C,
869
- visibleLauncherPosition: y
870
- }), oe(!0, "open"), ie(), !d) {
871
- o.classList.add("pluno-pa-widget--open"), T.hidden = !0, a && (f.value = a, it(f)), rt(x, () => Le.enabled), Pe = x.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), W(), ct("shown"), t.onPanelOpenChange?.(!0);
873
+ if (zt(v, w), Ie("Opening launcher at clamped open panel position", {
874
+ openPanelPosition: v,
875
+ visibleLauncherPosition: w
876
+ }), ie(!0, "open"), ae(), !d) {
877
+ o.classList.add("pluno-pa-widget--open"), T.hidden = !0, a && (x.value = a, lt(x)), pt(f, () => Te.enabled), Ne = f.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), H(), gt("shown"), t.onPanelOpenChange?.(!0);
872
878
  return;
873
879
  }
874
880
  window.requestAnimationFrame(() => {
875
- o.classList.add("pluno-pa-widget--open"), a && (f.value = a, it(f)), rt(x, () => Le.enabled), Pe = x.scrollTop, f.focus(), f.setSelectionRange(f.value.length, f.value.length), W(), ct("shown"), t.onPanelOpenChange?.(!0), ne = window.setTimeout(() => {
876
- T.hidden = !0, rt(x, () => Le.enabled), Pe = x.scrollTop;
881
+ o.classList.add("pluno-pa-widget--open"), a && (x.value = a, lt(x)), pt(f, () => Te.enabled), Ne = f.scrollTop, x.focus(), x.setSelectionRange(x.value.length, x.value.length), H(), gt("shown"), t.onPanelOpenChange?.(!0), oe = window.setTimeout(() => {
882
+ T.hidden = !0, pt(f, () => Te.enabled), Ne = f.scrollTop;
877
883
  }, 220);
878
884
  });
879
- }, zt = () => {
880
- ne !== null && (window.clearTimeout(ne), ne = null), T.hidden = !1, p && (Je(!1), Te("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), W(), t.onPanelOpenChange?.(!1), ne = window.setTimeout(() => {
881
- m.hidden = !0, R.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
885
+ }, Ut = () => {
886
+ oe !== null && (window.clearTimeout(oe), oe = null), T.hidden = !1, s && (tt(!1), Ie("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), H(), t.onPanelOpenChange?.(!1), oe = window.setTimeout(() => {
887
+ m.hidden = !0, k.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
882
888
  }, 220);
883
889
  };
884
890
  T.addEventListener("submit", (a) => {
@@ -895,21 +901,21 @@ async function La(e = {}) {
895
901
  const a = u.value;
896
902
  we(a), u.value = "";
897
903
  });
898
- let Mt = null, ut = null, Ne = null;
899
- const An = (a) => a === u || a === f, li = (a) => {
904
+ let Bt = null, ht = null, Re = null;
905
+ const Dn = (a) => a === u || a === x, di = (a) => {
900
906
  if (!(a instanceof Element) || a.getRootNode() === o.getRootNode())
901
907
  return null;
902
908
  let d = a;
903
909
  for (; d; ) {
904
- const y = d.closest(Vn);
905
- if (y)
906
- return y;
907
- const C = d.getRootNode();
908
- d = C instanceof ShadowRoot ? C.host : null;
910
+ const w = d.closest(Zn);
911
+ if (w)
912
+ return w;
913
+ const v = d.getRootNode();
914
+ d = v instanceof ShadowRoot ? v.host : null;
909
915
  }
910
916
  return null;
911
- }, si = (a) => {
912
- if (!a.isConnected || !a.matches(Vn))
917
+ }, ci = (a) => {
918
+ if (!a.isConnected || !a.matches(Zn))
913
919
  return !1;
914
920
  if (!(a instanceof HTMLElement))
915
921
  return !0;
@@ -919,73 +925,73 @@ async function La(e = {}) {
919
925
  return a.checkVisibility();
920
926
  const d = window.getComputedStyle(a);
921
927
  return d.display !== "none" && d.visibility !== "hidden";
922
- }, In = (a) => {
923
- Ue !== a && (Ue = a, o.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), Ae(), a !== null ? Ne = window.setInterval(() => {
924
- const d = Ue;
925
- (!d || !si(d)) && In(null);
926
- }, ua) : Ne !== null && (window.clearInterval(Ne), Ne = null, ut = null));
927
- }, pi = () => {
928
- Ne !== null && (window.clearInterval(Ne), Ne = null);
928
+ }, zn = (a) => {
929
+ He !== a && (He = a, o.classList.toggle("pluno-pa-widget--host-modal-conflict", a !== null), De(), a !== null ? Re = window.setInterval(() => {
930
+ const d = He;
931
+ (!d || !ci(d)) && zn(null);
932
+ }, fa) : Re !== null && (window.clearInterval(Re), Re = null, ht = null));
933
+ }, ui = () => {
934
+ Re !== null && (window.clearInterval(Re), Re = null);
929
935
  };
930
936
  o.addEventListener("focusin", (a) => {
931
- An(a.target) && (Mt = Date.now(), W());
937
+ Dn(a.target) && (Bt = Date.now(), H());
932
938
  }), o.addEventListener("focusout", (a) => {
933
- if (!An(a.target) || Ue !== null)
939
+ if (!Dn(a.target) || He !== null)
934
940
  return;
935
- const d = Mt;
936
- if (Mt = null, d === null || Date.now() - d > da)
941
+ const d = Bt;
942
+ if (Bt = null, d === null || Date.now() - d > ha)
937
943
  return;
938
- const y = li(a.relatedTarget);
939
- if (!y)
944
+ const w = di(a.relatedTarget);
945
+ if (!w)
940
946
  return;
941
- const C = Date.now();
942
- if (ut !== null && C - ut <= ca) {
943
- In(y);
947
+ const v = Date.now();
948
+ if (ht !== null && v - ht <= ma) {
949
+ zn(w);
944
950
  return;
945
951
  }
946
- ut = C;
952
+ ht = v;
947
953
  }), T.addEventListener("keydown", (a) => {
948
954
  !o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), we());
949
955
  }), S?.addEventListener("pointerdown", (a) => {
950
956
  a.stopPropagation();
951
957
  }), S?.addEventListener("click", (a) => {
952
- a.preventDefault(), a.stopPropagation(), Ze("minimized");
953
- }), R.addEventListener("click", zt), x.addEventListener("scroll", () => {
954
- x.scrollTop < Pe - 1 && oe(!1, "userScroll"), Pe = x.scrollTop;
955
- }), se.addEventListener("click", () => {
956
- ni();
958
+ a.preventDefault(), a.stopPropagation(), et("minimized");
959
+ }), k.addEventListener("click", Ut), f.addEventListener("scroll", () => {
960
+ f.scrollTop < Ne - 1 && ie(!1, "userScroll"), Ne = f.scrollTop;
961
+ }), Be.addEventListener("click", () => {
962
+ ai();
957
963
  });
958
- const Rn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
964
+ const Mn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
959
965
  ([a]) => {
960
- a?.isIntersecting && (oe(!0, "bottom"), ie());
966
+ a?.isIntersecting && (ie(!0, "bottom"), ae());
961
967
  },
962
- { root: x, threshold: 0 }
968
+ { root: f, threshold: 0 }
963
969
  );
964
- Rn?.observe(z);
965
- const Qe = () => t.loginRequired || t.signupRequired;
966
- let Ue = null, et = !1;
967
- const ae = () => dt || b.getState().status !== "connected", Ae = () => {
968
- const a = Qe(), d = Ue !== null;
969
- u.readOnly = !1, f.readOnly = !1, u.placeholder = d ? Kn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : et ? "New update" : t.launcherLabel, f.placeholder = d ? Kn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : de.launcherLabel, B.hidden = a;
970
+ Mn?.observe(P);
971
+ const nt = () => t.loginRequired || t.signupRequired;
972
+ let He = null, ot = !1;
973
+ const re = () => ut || b.getState().status !== "connected", De = () => {
974
+ const a = nt(), d = He !== null;
975
+ u.readOnly = !1, x.readOnly = !1, u.placeholder = d ? Jn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : ot ? "New update" : t.launcherLabel, x.placeholder = d ? Jn : a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : de.launcherLabel, ee.hidden = a;
970
976
  }, q = () => {
971
- U.disabled = ae() || re(t.billingStatus) || !b.getState().isThinking && f.value.trim().length === 0 && $.length === 0, De.disabled = Qe() || ae() || re(t.billingStatus);
977
+ B.disabled = re() || le(t.billingStatus) || !b.getState().isThinking && x.value.trim().length === 0 && $.length === 0, U.disabled = nt() || re() || le(t.billingStatus);
972
978
  };
973
- Ae();
974
- const Ot = () => {
979
+ De();
980
+ const Ft = () => {
975
981
  const a = b.getState().isThinking;
976
982
  o.classList.toggle("pluno-pa-widget--thinking", a), o.classList.toggle(
977
983
  "pluno-pa-widget--unread",
978
- !a && et
979
- ), Ae();
984
+ !a && ot
985
+ ), De();
980
986
  };
981
- Ot();
982
- const Ut = () => {
983
- Qe() || X || (dt = !0, Ae(), q(), b.connect().then(
987
+ Ft();
988
+ const Wt = () => {
989
+ nt() || V || (ut = !0, De(), q(), b.connect().then(
984
990
  () => {
985
- X || (dt = !1, Ae(), q());
991
+ V || (ut = !1, De(), q());
986
992
  },
987
993
  (a) => {
988
- X || (dt = !1, Ae(), q(), Z(
994
+ V || (ut = !1, De(), q(), X(
989
995
  "web-sdk.widget",
990
996
  "Failed to connect Product Agent widget",
991
997
  {
@@ -995,7 +1001,7 @@ async function La(e = {}) {
995
1001
  }
996
1002
  ));
997
1003
  };
998
- B.addEventListener("submit", (a) => {
1004
+ ee.addEventListener("submit", (a) => {
999
1005
  if (a.preventDefault(), t.loginRequired) {
1000
1006
  t.onLoginClick?.();
1001
1007
  return;
@@ -1004,72 +1010,72 @@ async function La(e = {}) {
1004
1010
  t.onSignupClick?.();
1005
1011
  return;
1006
1012
  }
1007
- ae() || re(t.billingStatus) || (ye = !0, oe(!0, "send"), ie(), $ = en(
1013
+ re() || le(t.billingStatus) || (Ee = !0, ie(!0, "send"), ae(), $ = on(
1008
1014
  b,
1009
- f,
1015
+ x,
1010
1016
  $,
1011
- bt
1012
- ), Me(), q());
1017
+ yt
1018
+ ), Fe(), q());
1013
1019
  });
1014
- let tt = 0;
1015
- const di = () => {
1016
- tt = 0, o.classList.remove("pluno-pa-widget--drag-over");
1017
- }, Bt = (a) => {
1018
- he !== null && window.clearTimeout(he), ge.textContent = a, ge.hidden = !1, he = window.setTimeout(() => {
1019
- ge.textContent = "", ge.hidden = !0, he = null;
1020
+ let it = 0;
1021
+ const gi = () => {
1022
+ it = 0, o.classList.remove("pluno-pa-widget--drag-over");
1023
+ }, Ht = (a) => {
1024
+ he !== null && window.clearTimeout(he), W.textContent = a, W.hidden = !1, he = window.setTimeout(() => {
1025
+ W.textContent = "", W.hidden = !0, he = null;
1020
1026
  }, 3e3);
1021
- }, ci = () => {
1022
- he !== null && (window.clearTimeout(he), he = null), ge.textContent = "", ge.hidden = !0;
1023
- }, Ft = async (a) => {
1027
+ }, hi = () => {
1028
+ he !== null && (window.clearTimeout(he), he = null), W.textContent = "", W.hidden = !0;
1029
+ }, Gt = async (a) => {
1024
1030
  if (!t.attachmentsEnabled || a.length === 0)
1025
1031
  return;
1026
- const d = _r(b, a);
1027
- if ($ = [...$, ...d], Me(), ci(), q(), H(b.getState()), !o.classList.contains("pluno-pa-widget--open")) {
1032
+ const d = Sr(b, a);
1033
+ if ($ = [...$, ...d], Fe(), hi(), q(), M(b.getState()), !o.classList.contains("pluno-pa-widget--open")) {
1028
1034
  we();
1029
1035
  return;
1030
1036
  }
1031
- xe();
1032
- }, ui = async (a) => {
1033
- await Ft(a), !(a.length === 0 || Ue !== null) && f.focus();
1037
+ Ce();
1038
+ }, mi = async (a) => {
1039
+ await Gt(a), !(a.length === 0 || He !== null) && x.focus();
1034
1040
  };
1035
- De.addEventListener("click", () => {
1036
- t.loginRequired || ae() || re(t.billingStatus) || D.click();
1037
- }), D.addEventListener("change", () => {
1038
- const a = Array.from(D.files ?? []);
1039
- D.value = "", ui(a).catch((d) => {
1040
- Bt(
1041
+ U.addEventListener("click", () => {
1042
+ t.loginRequired || re() || le(t.billingStatus) || ge.click();
1043
+ }), ge.addEventListener("change", () => {
1044
+ const a = Array.from(ge.files ?? []);
1045
+ ge.value = "", mi(a).catch((d) => {
1046
+ Ht(
1041
1047
  d instanceof Error ? d.message : "Failed to attach file"
1042
- ), Z("web-sdk.widget", "Attachment failed", {
1048
+ ), X("web-sdk.widget", "Attachment failed", {
1043
1049
  message: d instanceof Error ? d.message : String(d)
1044
1050
  });
1045
1051
  });
1046
1052
  }), o.addEventListener("dragenter", (a) => {
1047
- !t.attachmentsEnabled || !_t(a.dataTransfer) || t.loginRequired || ae() || (a.preventDefault(), a.stopPropagation(), tt += 1, o.classList.add("pluno-pa-widget--drag-over"));
1053
+ !t.attachmentsEnabled || !vt(a.dataTransfer) || t.loginRequired || re() || (a.preventDefault(), a.stopPropagation(), it += 1, o.classList.add("pluno-pa-widget--drag-over"));
1048
1054
  }), o.addEventListener("dragover", (a) => {
1049
1055
  const d = a.dataTransfer;
1050
- !t.attachmentsEnabled || !_t(d) || t.loginRequired || ae() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
1056
+ !t.attachmentsEnabled || !vt(d) || t.loginRequired || re() || (a.preventDefault(), a.stopPropagation(), d.dropEffect = "copy");
1051
1057
  }), o.addEventListener("dragleave", (a) => {
1052
- _t(a.dataTransfer) && (a.stopPropagation(), tt = Math.max(0, tt - 1), tt === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
1058
+ vt(a.dataTransfer) && (a.stopPropagation(), it = Math.max(0, it - 1), it === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
1053
1059
  }), o.addEventListener("drop", (a) => {
1054
1060
  const d = a.dataTransfer;
1055
- !t.attachmentsEnabled || !_t(d) || t.loginRequired || ae() || (a.preventDefault(), a.stopPropagation(), di(), Ft(d.files).catch((y) => {
1056
- Bt(
1057
- y instanceof Error ? y.message : "Failed to attach file"
1058
- ), Z("web-sdk.widget", "Attachment failed", {
1059
- message: y instanceof Error ? y.message : String(y)
1061
+ !t.attachmentsEnabled || !vt(d) || t.loginRequired || re() || (a.preventDefault(), a.stopPropagation(), gi(), Gt(d.files).catch((w) => {
1062
+ Ht(
1063
+ w instanceof Error ? w.message : "Failed to attach file"
1064
+ ), X("web-sdk.widget", "Attachment failed", {
1065
+ message: w instanceof Error ? w.message : String(w)
1060
1066
  });
1061
1067
  }));
1062
1068
  }), o.addEventListener("paste", (a) => {
1063
1069
  a.stopPropagation();
1064
- const d = a.clipboardData, y = Array.from(d?.files ?? []);
1065
- !t.attachmentsEnabled || y.length === 0 || t.loginRequired || ae() || (a.preventDefault(), Ft(y).catch((C) => {
1066
- Bt(
1067
- C instanceof Error ? C.message : "Failed to attach file"
1068
- ), Z("web-sdk.widget", "Attachment failed", {
1069
- message: C instanceof Error ? C.message : String(C)
1070
+ const d = a.clipboardData, w = Array.from(d?.files ?? []);
1071
+ !t.attachmentsEnabled || w.length === 0 || t.loginRequired || re() || (a.preventDefault(), Gt(w).catch((v) => {
1072
+ Ht(
1073
+ v instanceof Error ? v.message : "Failed to attach file"
1074
+ ), X("web-sdk.widget", "Attachment failed", {
1075
+ message: v instanceof Error ? v.message : String(v)
1070
1076
  });
1071
1077
  }));
1072
- }), U.addEventListener("click", () => {
1078
+ }), B.addEventListener("click", () => {
1073
1079
  if (t.loginRequired) {
1074
1080
  t.onLoginClick?.();
1075
1081
  return;
@@ -1078,43 +1084,43 @@ async function La(e = {}) {
1078
1084
  b.stop();
1079
1085
  return;
1080
1086
  }
1081
- if (ae())
1087
+ if (re())
1082
1088
  return;
1083
- const a = f.value.trim().length > 0 || $.length > 0;
1084
- ye = !0, oe(!0, "send"), ie(), $ = en(
1089
+ const a = x.value.trim().length > 0 || $.length > 0;
1090
+ Ee = !0, ie(!0, "send"), ae(), $ = on(
1085
1091
  b,
1086
- f,
1092
+ x,
1087
1093
  $,
1088
- bt
1089
- ), Me(), q(), H(b.getState()), a && xe();
1090
- }), le.addEventListener("click", () => {
1091
- K = !K, Ye = null, fe(), K && ve.length === 0 && En(null), K || xe();
1092
- }), st.addEventListener("click", () => {
1093
- K = !1, fe(), xe();
1094
- }), G.addEventListener("scroll", oi), f.addEventListener("input", () => {
1095
- it(f), W(), q(), mi();
1096
- }), f.addEventListener("keydown", (a) => {
1094
+ yt
1095
+ ), Fe(), q(), M(b.getState()), a && Ce();
1096
+ }), te.addEventListener("click", () => {
1097
+ K = !K, Je = null, fe(), K && ke.length === 0 && Pn(null), K || Ce();
1098
+ }), ye.addEventListener("click", () => {
1099
+ K = !1, fe(), Ce();
1100
+ }), Y.addEventListener("scroll", ri), x.addEventListener("input", () => {
1101
+ lt(x), H(), q(), bi();
1102
+ }), x.addEventListener("keydown", (a) => {
1097
1103
  if (!(a.key !== "Enter" || a.shiftKey)) {
1098
1104
  if (a.preventDefault(), t.loginRequired) {
1099
1105
  t.onLoginClick?.();
1100
1106
  return;
1101
1107
  }
1102
- ae() || (ye = !0, oe(!0, "send"), ie(), $ = en(
1108
+ re() || (Ee = !0, ie(!0, "send"), ae(), $ = on(
1103
1109
  b,
1104
- f,
1110
+ x,
1105
1111
  $,
1106
- bt
1107
- ), Me(), q(), H(b.getState()));
1112
+ yt
1113
+ ), Fe(), q(), M(b.getState()));
1108
1114
  }
1109
1115
  }), o.addEventListener("click", (a) => {
1110
1116
  const d = a.target instanceof Element ? a.target : null;
1111
- d?.closest("a[href]") && W(), K && Gi(d, Ke, le) && (K = !1, fe());
1112
- const C = window.getSelection(), M = !!(C && !C.isCollapsed && C.anchorNode && o.contains(C.anchorNode));
1113
- Wi(
1117
+ d?.closest("a[href]") && H(), K && Vi(d, Ae, te) && (K = !1, fe());
1118
+ const v = window.getSelection(), D = !!(v && !v.isCollapsed && v.anchorNode && o.contains(v.anchorNode));
1119
+ qi(
1114
1120
  a.target,
1115
1121
  a.detail,
1116
- M
1117
- ) && xe();
1122
+ D
1123
+ ) && Ce();
1118
1124
  }), o.addEventListener("copy", (a) => {
1119
1125
  a.clipboardData && window.getSelection() && !window.getSelection()?.isCollapsed && window.getSelection()?.anchorNode && window.getSelection()?.focusNode && o.contains(window.getSelection()?.anchorNode ?? null) && o.contains(window.getSelection()?.focusNode ?? null) && window.getSelection()?.toString() && (a.clipboardData.clearData(), a.clipboardData.setData(
1120
1126
  "text/plain",
@@ -1132,88 +1138,101 @@ async function La(e = {}) {
1132
1138
  ), a.stopPropagation();
1133
1139
  return;
1134
1140
  }
1135
- a.key !== "Escape" || !K || (K = !1, fe(), xe());
1136
- }), l.composerValue && (f.value = l.composerValue, it(f)), t.layout === "page" ? we(f.value, !1) : s === "minimized" ? Ze("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && we(f.value, !1), Ga(l, o, u, f);
1137
- const gt = () => r;
1138
- let Wt = b.getState().appearance !== null, ht = null, nt = null, Be = null, Dn = b.getState().isThinking, Fe = null;
1139
- const ot = t.taskNotifications;
1140
- let We = null, He = !1;
1141
- const zn = () => {
1142
- We !== null && (window.clearTimeout(We), We = null);
1143
- }, mt = () => {
1144
- Y && (Y.hidden = !0);
1145
- }, Mn = () => b.getState().assistantDraft.trim().length > 0, gi = async () => {
1146
- if (!ot || !Y || He || X || !b.getState().isThinking || Mn())
1141
+ a.key !== "Escape" || !K || (K = !1, fe(), Ce());
1142
+ }), l.composerValue && (x.value = l.composerValue, lt(x)), t.layout === "page" ? we(x.value, !1) : p === "minimized" ? et("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && we(x.value, !1), Va(l, o, u, x);
1143
+ const mt = () => r;
1144
+ let $t = b.getState().appearance !== null, ft = null, at = null, Ge = null, On = b.getState().isThinking, $e = null;
1145
+ const rt = t.taskNotifications;
1146
+ let qe = null, je = !1;
1147
+ const Un = () => {
1148
+ qe !== null && (window.clearTimeout(qe), qe = null);
1149
+ }, wt = () => {
1150
+ R && (R.hidden = !0);
1151
+ }, Bn = () => b.getState().assistantDraft.trim().length > 0, fi = async () => {
1152
+ if (!rt || !R || je || V || !b.getState().isThinking || Bn())
1147
1153
  return;
1148
1154
  let a;
1149
1155
  try {
1150
- a = await ot.getState();
1156
+ a = await rt.getState();
1151
1157
  } catch {
1152
1158
  return;
1153
1159
  }
1154
- a.enabled || a.neverSuggest || !b.getState().isThinking || Mn() || He || X || (Y.hidden = !1);
1160
+ a.enabled || a.neverSuggest || !b.getState().isThinking || Bn() || je || V || (R.hidden = !1);
1155
1161
  };
1156
- te?.addEventListener("click", () => {
1157
- He = !0, mt(), ot?.enable().catch(() => {
1162
+ ve?.addEventListener("click", () => {
1163
+ je = !0, wt(), rt?.enable().catch(() => {
1158
1164
  });
1159
- }), v?.addEventListener("click", () => {
1160
- He = !0, mt();
1161
- }), N?.addEventListener("click", () => {
1162
- He = !0, mt(), ot?.dismissForever().catch(() => {
1165
+ }), ne?.addEventListener("click", () => {
1166
+ je = !0, wt();
1167
+ }), y?.addEventListener("click", () => {
1168
+ je = !0, wt(), rt?.dismissForever().catch(() => {
1163
1169
  });
1164
1170
  });
1165
- const ft = t.tabGroups;
1166
- let Ge = !1;
1167
- const wt = async () => {
1168
- if (!ft || !V || Ge || X)
1171
+ const bt = t.tabGroups;
1172
+ let Ve = !1;
1173
+ const _t = async () => {
1174
+ if (!bt || !L || Ve || V)
1169
1175
  return;
1170
- const a = await ft.getState().catch(() => null);
1171
- !a || Ge || X || (V.hidden = !a.permissionNeeded);
1176
+ const a = await bt.getState().catch(() => null);
1177
+ !a || Ve || V || (L.hidden = !a.permissionNeeded);
1172
1178
  };
1173
- Jo?.addEventListener("click", () => {
1174
- Ge = !0, V && (V.hidden = !0), ft?.enable().catch(() => {
1179
+ Se?.addEventListener("click", () => {
1180
+ Ve = !0, L && (L.hidden = !0), bt?.enable().catch(() => {
1175
1181
  }).finally(() => {
1176
- Ge = !1, wt();
1182
+ Ve = !1, _t();
1177
1183
  });
1178
- }), Qo?.addEventListener("click", () => {
1179
- Ge = !0, V && (V.hidden = !0), ft?.dismiss().catch(() => {
1184
+ }), ni?.addEventListener("click", () => {
1185
+ Ve = !0, L && (L.hidden = !0), bt?.dismiss().catch(() => {
1180
1186
  }).finally(() => {
1181
- Ge = !1, wt();
1187
+ Ve = !1, _t();
1182
1188
  });
1183
- }), wt();
1184
- let $e = null, On = () => {
1189
+ }), _t();
1190
+ let Ke = null, Fn = () => {
1185
1191
  };
1186
- const hi = !!t.socialPostDraftHandler, Ht = /* @__PURE__ */ new Map(), Gt = () => f.value.trim().length > 0 || $.length > 0, mi = () => {
1187
- const a = $e !== null && an(b.getState(), Gt());
1188
- _.hidden = !a, a && $e !== null && Oo(_, $e);
1192
+ const wi = !!t.socialPostDraftHandler, qt = /* @__PURE__ */ new Map(), jt = () => x.value.trim().length > 0 || $.length > 0, bi = () => {
1193
+ const a = Ke !== null && sn(b.getState(), jt());
1194
+ se.hidden = !a, a && Ke !== null && Wo(se, Ke);
1189
1195
  };
1190
- let qe = null;
1191
- const $t = (a = {}) => {
1192
- ye = !0, oe(!0, "newSession"), ie(), K = !1, fe(), b.startNewSession(a), Tt.clear(), f.value = "", $ = [], Me(), it(f), W(), q(), f.focus(), H(b.getState());
1193
- }, bt = () => {
1194
- t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), $t());
1195
- }, qt = (a) => {
1196
+ let Ye = null;
1197
+ const be = /* @__PURE__ */ new Map(), xt = /* @__PURE__ */ new Set(), _i = async (a) => {
1198
+ if (t.integrationAuthHandler) {
1199
+ be.set(a.authRequestId, { status: "connecting" }), M(b.getState());
1200
+ try {
1201
+ await t.integrationAuthHandler(a), be.set(a.authRequestId, { status: "completed" });
1202
+ } catch (d) {
1203
+ be.set(a.authRequestId, {
1204
+ status: "error",
1205
+ error: d instanceof Error ? d.message : `Could not connect ${a.appName}.`
1206
+ });
1207
+ }
1208
+ M(b.getState());
1209
+ }
1210
+ }, Vt = (a = {}) => {
1211
+ Ee = !0, ie(!0, "newSession"), ae(), K = !1, fe(), b.startNewSession(a), It.clear(), be.clear(), xt.clear(), x.value = "", $ = [], Fe(), lt(x), H(), q(), x.focus(), M(b.getState());
1212
+ }, yt = () => {
1213
+ t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), Vt());
1214
+ }, Kt = (a) => {
1196
1215
  if (!a || t.layout === "page") {
1197
- qe?.remove(), qe = null;
1216
+ Ye?.remove(), Ye = null;
1198
1217
  return;
1199
1218
  }
1200
- qe || (qe = Lt(
1219
+ Ye || (Ye = Tt(
1201
1220
  "pluno-pa-widget__new-chat",
1202
1221
  "New chat",
1203
- sr(),
1222
+ ur(),
1204
1223
  !1
1205
- ), qe.addEventListener("click", () => $t()), ke.insertBefore(qe, le));
1206
- }, H = (a) => {
1207
- if (fe(), yn(a.lastErrorCode) ? Fe = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !re(t.billingStatus) && (Fe = null), on(
1208
- Ee,
1224
+ ), Ye.addEventListener("click", () => Vt()), G.insertBefore(Ye, te));
1225
+ }, M = (a) => {
1226
+ if (fe(), Cn(a.lastErrorCode) ? $e = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !le(t.billingStatus) && ($e = null), ln(
1227
+ Ze,
1209
1228
  t.billingStatus,
1210
- Fe
1229
+ $e
1211
1230
  ), t.loginRequired) {
1212
- Ht.clear(), ho(
1213
- x,
1214
- U,
1215
- qt,
1216
- gt,
1231
+ qt.clear(), bo(
1232
+ f,
1233
+ B,
1234
+ Kt,
1235
+ mt,
1217
1236
  "Log in to use Pluno on this page.",
1218
1237
  t.loginButtonLabel,
1219
1238
  t.loginUrl,
@@ -1222,11 +1241,11 @@ async function La(e = {}) {
1222
1241
  return;
1223
1242
  }
1224
1243
  if (t.signupRequired) {
1225
- Ht.clear(), ho(
1226
- x,
1227
- U,
1228
- qt,
1229
- gt,
1244
+ qt.clear(), bo(
1245
+ f,
1246
+ B,
1247
+ Kt,
1248
+ mt,
1230
1249
  "Complete signup to unlock your free trial credits.",
1231
1250
  t.signupButtonLabel,
1232
1251
  t.signupUrl,
@@ -1234,77 +1253,107 @@ async function La(e = {}) {
1234
1253
  );
1235
1254
  return;
1236
1255
  }
1237
- const d = qa(a), y = d !== Cn;
1238
- Cn = d;
1239
- const C = ye || Le.enabled;
1240
- ye = !1, kr(
1241
- x,
1242
- z,
1243
- U,
1244
- qt,
1245
- _,
1256
+ const d = Ya(a), w = d !== Ln;
1257
+ Ln = d;
1258
+ const v = Ee || Te.enabled;
1259
+ Ee = !1, Tr(
1260
+ f,
1261
+ P,
1262
+ B,
1263
+ Kt,
1264
+ se,
1246
1265
  a,
1247
- $e,
1248
- $e !== null && an(a, Gt()),
1249
- C,
1250
- () => Le.enabled,
1251
- Tt,
1252
- Ht,
1253
- W,
1254
- gt,
1255
- (M) => {
1256
- ae() || (bt(), ye = !0, oe(!0, "send"), ie(), b.sendMessage(M));
1266
+ Ke,
1267
+ Ke !== null && sn(a, jt()),
1268
+ v,
1269
+ () => Te.enabled,
1270
+ It,
1271
+ qt,
1272
+ H,
1273
+ mt,
1274
+ (D) => {
1275
+ re() || (yt(), Ee = !0, ie(!0, "send"), ae(), b.sendMessage(D));
1257
1276
  },
1258
1277
  () => {
1259
- ye = !0, oe(!0, "send"), ie(), b.retryLastMessage();
1278
+ Ee = !0, ie(!0, "send"), ae(), b.retryLastMessage();
1260
1279
  },
1261
1280
  t.morningReport,
1262
1281
  () => {
1263
- t.morningReport = null, t.onMorningReportSnooze?.(), zt(), H(b.getState());
1282
+ t.morningReport = null, t.onMorningReportSnooze?.(), Ut(), M(b.getState());
1264
1283
  },
1265
- Ut,
1284
+ Wt,
1266
1285
  t.attachmentPreviewUrlResolver,
1267
- hi && !Nt ? {
1268
- dismissedCandidateIds: pt,
1269
- draftingCandidate: ht,
1270
- error: nt,
1271
- characterIconOptions: gt(),
1272
- onSeen: (M) => {
1273
- Oe.add(M.id), W();
1286
+ t.integrationAuthHandler ? {
1287
+ states: be,
1288
+ initialStatus: t.integrationAuthStatusLoader ? "checking" : "pending",
1289
+ onConnect: (D) => {
1290
+ _i(D);
1291
+ }
1292
+ } : void 0,
1293
+ wi && !Rt ? {
1294
+ dismissedCandidateIds: ct,
1295
+ draftingCandidate: ft,
1296
+ error: at,
1297
+ characterIconOptions: mt(),
1298
+ onSeen: (D) => {
1299
+ We.add(D.id), H();
1274
1300
  },
1275
- onDraft: (M) => {
1276
- fi(M);
1301
+ onDraft: (D) => {
1302
+ xi(D);
1277
1303
  },
1278
- onDismiss: (M) => {
1279
- Oe.add(M.id), pt.add(M.id), W(), nt = null, H(b.getState());
1304
+ onDismiss: (D) => {
1305
+ We.add(D.id), ct.add(D.id), H(), at = null, M(b.getState());
1280
1306
  },
1281
- onDisable: (M) => {
1282
- Nt = !0, Oe.add(M.id), pt.add(M.id), W(), Xr(t, !0), nt = null, H(b.getState());
1307
+ onDisable: (D) => {
1308
+ Rt = !0, We.add(D.id), ct.add(D.id), H(), tl(t, !0), at = null, M(b.getState());
1283
1309
  }
1284
1310
  } : void 0
1285
- ), C ? (Pe = x.scrollTop, ie()) : y && ja(a) && ti();
1311
+ ), v ? (Ne = f.scrollTop, ae()) : w && Xa(a) && ii();
1312
+ }, Wn = async (a) => {
1313
+ if (!t.integrationAuthStatusLoader)
1314
+ return;
1315
+ const d = a.messages.map((w) => w.integrationAuthRequest).filter((w) => !!w);
1316
+ await Promise.all(
1317
+ d.map(async (w) => {
1318
+ if (!(be.has(w.authRequestId) || xt.has(w.authRequestId))) {
1319
+ xt.add(w.authRequestId), be.set(w.authRequestId, { status: "checking" }), M(b.getState());
1320
+ try {
1321
+ const v = await t.integrationAuthStatusLoader(w);
1322
+ be.set(w.authRequestId, { status: v });
1323
+ } catch (v) {
1324
+ be.set(w.authRequestId, {
1325
+ status: "error",
1326
+ error: v instanceof Error ? v.message : `Could not load ${w.appName} connection status.`
1327
+ });
1328
+ } finally {
1329
+ xt.delete(w.authRequestId);
1330
+ }
1331
+ V || M(b.getState());
1332
+ }
1333
+ })
1334
+ );
1286
1335
  };
1287
- return On = zi(
1336
+ return Fn = Bi(
1288
1337
  (a) => {
1289
- $e = a, !X && an(b.getState(), Gt()) && H(b.getState());
1338
+ Ke = a, !V && sn(b.getState(), jt()) && M(b.getState());
1290
1339
  },
1291
1340
  {
1292
1341
  backendUrl: t.backendUrl,
1293
- fetcher: ei,
1342
+ fetcher: oi,
1294
1343
  loader: t.activeUsersLoader
1295
1344
  }
1296
1345
  ), b.on("state", (a) => {
1297
- wt();
1298
- const d = Dn && !a.isThinking;
1299
- Dn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && ot && !He && We === null && Y?.hidden !== !1 && (We = window.setTimeout(() => {
1300
- We = null, gi();
1301
- }, Yi)), (!a.isThinking || a.assistantDraft.trim()) && (zn(), mt()), d && !o.classList.contains("pluno-pa-widget--open") && (et = !0), Ot(), a.appearance ? (Wt = !0, Z(
1346
+ _t();
1347
+ const d = On && !a.isThinking;
1348
+ On = a.isThinking, a.isThinking && !a.assistantDraft.trim() && rt && !je && qe === null && R?.hidden !== !1 && (qe = window.setTimeout(() => {
1349
+ qe = null, fi();
1350
+ }, Qi)), (!a.isThinking || a.assistantDraft.trim()) && (Un(), wt()), d && !o.classList.contains("pluno-pa-widget--open") && (ot = !0), Ft(), a.appearance ? ($t = !0, X(
1302
1351
  "web-sdk.widget",
1303
1352
  "Agent state supplied appearance",
1304
1353
  {
1305
1354
  appearance: a.appearance
1306
1355
  }
1307
- ), jt(a.appearance, "agent.state.appearance")) : Wt && (Wt = !1, Z(
1356
+ ), Yt(a.appearance, "agent.state.appearance")) : $t && ($t = !1, X(
1308
1357
  "web-sdk.widget",
1309
1358
  "Agent state cleared appearance; reverting to configured widget options",
1310
1359
  {
@@ -1312,99 +1361,99 @@ async function La(e = {}) {
1312
1361
  fallbackColorScheme: t.colorScheme,
1313
1362
  fallbackFontFamily: t.fontFamily
1314
1363
  }
1315
- ), jt({}, "agent.state.appearance-cleared")), H(a), q(), d && Nn();
1316
- }), H(b.getState()), q(), Ut(), {
1364
+ ), Yt({}, "agent.state.appearance-cleared")), M(a), Wn(a), q(), d && Rn();
1365
+ }), M(b.getState()), Wn(b.getState()), q(), Wt(), {
1317
1366
  agent: b,
1318
- startNewChat: $t,
1367
+ startNewChat: Vt,
1319
1368
  host: n,
1320
1369
  updateAppearance: (a) => {
1321
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), jt(a, "widgetHandle.updateAppearance");
1370
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), Yt(a, "widgetHandle.updateAppearance");
1322
1371
  },
1323
1372
  updateBillingStatus: (a) => {
1324
1373
  const d = a ?? null;
1325
- po(
1374
+ ho(
1326
1375
  t.billingStatus,
1327
1376
  d,
1328
- Fe
1329
- ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !re(t.billingStatus) && (Fe = null), on(
1377
+ $e
1378
+ ) && (t.billingStatus = d, t.billingStatus?.creditsUsed !== null && !le(t.billingStatus) && ($e = null), ln(
1330
1379
  o.querySelector(".pluno-pa-widget__billing-status"),
1331
1380
  t.billingStatus,
1332
- Fe
1381
+ $e
1333
1382
  ), q());
1334
1383
  },
1335
1384
  updateAuthGate: (a) => {
1336
- const d = Qe();
1337
- 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), Ae(), H(b.getState()), q(), d && !Qe() && Ut();
1385
+ const d = nt();
1386
+ 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), De(), M(b.getState()), q(), d && !nt() && Wt();
1338
1387
  },
1339
1388
  openPanel: () => {
1340
- we(f.value, !1);
1389
+ we(x.value, !1);
1341
1390
  },
1342
- closePanel: zt,
1391
+ closePanel: Ut,
1343
1392
  updateDisplayState: (a) => {
1344
1393
  if (a === "shown") {
1345
- Ze("shown", !1);
1394
+ et("shown", !1);
1346
1395
  return;
1347
1396
  }
1348
- Ze("minimized", !1);
1397
+ et("minimized", !1);
1349
1398
  },
1350
1399
  updateMorningReport: (a) => {
1351
- t.morningReport = a ?? null, H(b.getState());
1400
+ t.morningReport = a ?? null, M(b.getState());
1352
1401
  },
1353
1402
  destroy: () => {
1354
- X || (W(), X = !0, Ln.disconnect(), Rn?.disconnect(), pi(), window.removeEventListener("resize", Pn), Tn(), ri(), he !== null && window.clearTimeout(he), zn(), On(), Be?.remove(), b.destroy(), Pt.release(), n.remove());
1403
+ V || (H(), V = !0, Tn.disconnect(), Mn?.disconnect(), ui(), window.removeEventListener("resize", Nn), In(), pi(), he !== null && window.clearTimeout(he), Un(), Fn(), Ge?.remove(), b.destroy(), Nt.release(), n.remove());
1355
1404
  }
1356
1405
  };
1357
- async function fi(a) {
1358
- if (!ht) {
1359
- ht = a, nt = null, H(b.getState());
1406
+ async function xi(a) {
1407
+ if (!ft) {
1408
+ ft = a, at = null, M(b.getState());
1360
1409
  try {
1361
1410
  if (!t.socialPostDraftHandler)
1362
1411
  throw new Error("Social post drafting is not available here.");
1363
1412
  const d = await t.socialPostDraftHandler(a);
1364
1413
  if (!d.linkedinPost || !d.xPost)
1365
1414
  throw new Error("Pluno did not return a complete social post draft.");
1366
- Oe.add(a.id), pt.add(a.id), W(), Be?.remove(), Be = Dr(d, {
1415
+ We.add(a.id), ct.add(a.id), H(), Ge?.remove(), Ge = Br(d, {
1367
1416
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1368
1417
  onClose: () => {
1369
- Be?.remove(), Be = null;
1418
+ Ge?.remove(), Ge = null;
1370
1419
  }
1371
- }), o.appendChild(Be);
1420
+ }), o.appendChild(Ge);
1372
1421
  } catch (d) {
1373
- nt = d instanceof Error ? d.message : "Could not draft social post.";
1422
+ at = d instanceof Error ? d.message : "Could not draft social post.";
1374
1423
  } finally {
1375
- ht = null, H(b.getState());
1424
+ ft = null, M(b.getState());
1376
1425
  }
1377
1426
  }
1378
1427
  }
1379
- function jt(a, d) {
1380
- const y = a.accentColor ?? t.accentColor, C = a.colorScheme ?? t.colorScheme, M = a.fontFamily ?? t.fontFamily, Vt = a.scribbleStyle ?? t.scribbleStyle;
1381
- r = Qn(
1382
- y,
1383
- Vt
1384
- ), eo(o, r, {
1385
- accentColor: y,
1386
- colorScheme: C,
1387
- fontFamily: M,
1388
- scribbleStyle: Vt
1389
- }), Z("web-sdk.widget", "Updated widget appearance", {
1428
+ function Yt(a, d) {
1429
+ const w = a.accentColor ?? t.accentColor, v = a.colorScheme ?? t.colorScheme, D = a.fontFamily ?? t.fontFamily, Xt = a.scribbleStyle ?? t.scribbleStyle;
1430
+ r = oo(
1431
+ w,
1432
+ Xt
1433
+ ), io(o, r, {
1434
+ accentColor: w,
1435
+ colorScheme: v,
1436
+ fontFamily: D,
1437
+ scribbleStyle: Xt
1438
+ }), X("web-sdk.widget", "Updated widget appearance", {
1390
1439
  source: d,
1391
1440
  inputAppearance: a,
1392
- appliedAccentColor: y,
1393
- appliedColorScheme: C,
1394
- appliedFontFamily: M,
1395
- appliedScribbleStyle: Vt,
1441
+ appliedAccentColor: w,
1442
+ appliedColorScheme: v,
1443
+ appliedFontFamily: D,
1444
+ appliedScribbleStyle: Xt,
1396
1445
  cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
1397
1446
  });
1398
1447
  }
1399
1448
  }
1400
- function Qn(e, t) {
1449
+ function oo(e, t) {
1401
1450
  return { accentColor: e, scribbleStyle: t };
1402
1451
  }
1403
- function Pa(e) {
1404
- const t = Ta(e);
1405
- return t === null ? "#fafafa" : Na(t) > 0.5 ? "#18181b" : "#fafaf9";
1452
+ function Ia(e) {
1453
+ const t = Ra(e);
1454
+ return t === null ? "#fafafa" : Da(t) > 0.5 ? "#18181b" : "#fafaf9";
1406
1455
  }
1407
- function Ta(e) {
1456
+ function Ra(e) {
1408
1457
  const t = e.trim();
1409
1458
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1410
1459
  Number.parseInt(t.slice(1, 3), 16),
@@ -1416,14 +1465,14 @@ function Ta(e) {
1416
1465
  Number.parseInt(t[3] + t[3], 16)
1417
1466
  ] : null;
1418
1467
  }
1419
- function Na([e, t, n]) {
1468
+ function Da([e, t, n]) {
1420
1469
  const i = (o) => {
1421
1470
  const r = o / 255;
1422
1471
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1423
1472
  };
1424
1473
  return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
1425
1474
  }
1426
- function eo(e, t, n) {
1475
+ function io(e, t, n) {
1427
1476
  e.classList.toggle(
1428
1477
  "pluno-pa-widget--dark",
1429
1478
  n.colorScheme === "dark"
@@ -1431,27 +1480,27 @@ function eo(e, t, n) {
1431
1480
  "pluno-pa-widget--light",
1432
1481
  n.colorScheme !== "dark"
1433
1482
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1434
- const i = n.scribbleStyle ? vo(n.accentColor) : n.accentColor;
1483
+ const i = n.scribbleStyle ? ko(n.accentColor) : n.accentColor;
1435
1484
  e.style.setProperty("--pluno-pa-accent", i), n.scribbleStyle ? e.style.setProperty(
1436
1485
  "--pluno-pa-accent-contrast",
1437
- Pa(i)
1438
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ha : n.fontFamily, n.scribbleStyle && Aa(e.ownerDocument);
1486
+ Ia(i)
1487
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? ba : n.fontFamily, n.scribbleStyle && za(e.ownerDocument);
1439
1488
  const o = Array.from(
1440
1489
  e.querySelectorAll(".pluno-pa-widget__character")
1441
1490
  );
1442
1491
  for (const r of o)
1443
1492
  r.replaceWith(
1444
- Ce(
1493
+ Pe(
1445
1494
  Array.from(r.classList).join(" "),
1446
1495
  t
1447
1496
  )
1448
1497
  );
1449
1498
  }
1450
- function Aa(e) {
1451
- if (e.getElementById(Yn))
1499
+ function za(e) {
1500
+ if (e.getElementById(Qn))
1452
1501
  return;
1453
1502
  const t = e.createElement("style");
1454
- t.id = Yn, t.textContent = `@font-face {
1503
+ t.id = Qn, t.textContent = `@font-face {
1455
1504
  font-family: "Architects Daughter";
1456
1505
  font-style: normal;
1457
1506
  font-weight: 400;
@@ -1459,7 +1508,7 @@ function Aa(e) {
1459
1508
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1460
1509
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1461
1510
  }
1462
- function Ia({
1511
+ function Ma({
1463
1512
  root: e,
1464
1513
  launcher: t,
1465
1514
  launcherDragHandle: n,
@@ -1467,17 +1516,17 @@ function Ia({
1467
1516
  setPosition: o,
1468
1517
  persist: r
1469
1518
  }) {
1470
- let l = null, s = null, p = null, g = !1, c = null;
1519
+ let l = null, p = null, s = null, g = !1, c = null;
1471
1520
  const h = () => {
1472
- l = null, s = null, p = null, g = !1, e.classList.remove("pluno-pa-widget--dragging");
1473
- }, E = (m) => {
1474
- e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), l = m.pointerId, s = { x: m.clientX, y: m.clientY }, p = i(), g = !1, t.setPointerCapture?.(m.pointerId));
1475
- }, P = (m) => {
1476
- if (l !== m.pointerId || !s || !p)
1521
+ l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--dragging");
1522
+ }, C = (m) => {
1523
+ e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (m.preventDefault(), m.stopPropagation(), l = m.pointerId, p = { x: m.clientX, y: m.clientY }, s = i(), g = !1, t.setPointerCapture?.(m.pointerId));
1524
+ }, A = (m) => {
1525
+ if (l !== m.pointerId || !p || !s)
1477
1526
  return;
1478
1527
  m.preventDefault();
1479
- const I = m.clientX - s.x, L = m.clientY - s.y;
1480
- !g && Math.hypot(I, L) < un || (g = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: p.x + I, y: p.y + L }));
1528
+ const I = m.clientX - p.x, z = m.clientY - p.y;
1529
+ !g && Math.hypot(I, z) < mn || (g = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: s.x + I, y: s.y + z }));
1481
1530
  }, T = (m) => {
1482
1531
  l === m.pointerId && (m.preventDefault(), m.stopPropagation(), g && (c = { x: m.clientX, y: m.clientY }, r()), h());
1483
1532
  }, O = (m) => {
@@ -1488,83 +1537,83 @@ function Ia({
1488
1537
  const I = Math.hypot(
1489
1538
  m.clientX - c.x,
1490
1539
  m.clientY - c.y
1491
- ) <= un;
1540
+ ) <= mn;
1492
1541
  c = null, I && (m.preventDefault(), m.stopPropagation());
1493
1542
  }, S = (m) => {
1494
1543
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1495
1544
  return;
1496
- const I = m.shiftKey ? Io : Ao, L = i();
1497
- let R = null;
1498
- m.key === "ArrowUp" ? R = { x: L.x, y: L.y - I } : m.key === "ArrowDown" ? R = { x: L.x, y: L.y + I } : m.key === "ArrowLeft" ? R = { x: L.x - I, y: L.y } : m.key === "ArrowRight" && (R = { x: L.x + I, y: L.y }), R && (m.preventDefault(), m.stopPropagation(), o(R), r());
1545
+ const I = m.shiftKey ? Mo : zo, z = i();
1546
+ let k = null;
1547
+ m.key === "ArrowUp" ? k = { x: z.x, y: z.y - I } : m.key === "ArrowDown" ? k = { x: z.x, y: z.y + I } : m.key === "ArrowLeft" ? k = { x: z.x - I, y: z.y } : m.key === "ArrowRight" && (k = { x: z.x + I, y: z.y }), k && (m.preventDefault(), m.stopPropagation(), o(k), r());
1499
1548
  };
1500
- return t.addEventListener("pointerdown", E), t.addEventListener("pointermove", P), t.addEventListener("pointerup", T), t.addEventListener("pointercancel", O), t.addEventListener("click", u, !0), n.addEventListener("keydown", S), () => {
1501
- t.removeEventListener("pointerdown", E), t.removeEventListener("pointermove", P), t.removeEventListener("pointerup", T), t.removeEventListener("pointercancel", O), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", S);
1549
+ return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", A), t.addEventListener("pointerup", T), t.addEventListener("pointercancel", O), t.addEventListener("click", u, !0), n.addEventListener("keydown", S), () => {
1550
+ t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", A), t.removeEventListener("pointerup", T), t.removeEventListener("pointercancel", O), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", S);
1502
1551
  };
1503
1552
  }
1504
- function Ra({
1553
+ function Oa({
1505
1554
  root: e,
1506
1555
  handles: t,
1507
1556
  getBounds: n,
1508
1557
  setBounds: i,
1509
1558
  persist: o
1510
1559
  }) {
1511
- let r = null, l = null, s = null, p = null, g = !1;
1560
+ let r = null, l = null, p = null, s = null, g = !1;
1512
1561
  const c = () => {
1513
- r = null, l = null, s = null, p = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
1562
+ r = null, l = null, p = null, s = null, g = !1, e.classList.remove("pluno-pa-widget--resizing");
1514
1563
  }, h = (u) => {
1515
1564
  const S = u.currentTarget, m = S.dataset.resizeDirection;
1516
- !e.classList.contains("pluno-pa-widget--open") || !to(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, s = { x: u.clientX, y: u.clientY }, p = n(), g = !1, S.setPointerCapture?.(u.pointerId));
1517
- }, E = (u) => {
1518
- if (r !== u.pointerId || !l || !s || !p)
1565
+ !e.classList.contains("pluno-pa-widget--open") || !ao(m) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = m, p = { x: u.clientX, y: u.clientY }, s = n(), g = !1, S.setPointerCapture?.(u.pointerId));
1566
+ }, C = (u) => {
1567
+ if (r !== u.pointerId || !l || !p || !s)
1519
1568
  return;
1520
1569
  u.preventDefault(), u.stopPropagation();
1521
- const S = u.clientX - s.x, m = u.clientY - s.y;
1522
- !g && Math.hypot(S, m) < un || (g = !0, e.classList.add("pluno-pa-widget--resizing"), i(
1523
- no(p, l, S, m)
1570
+ const S = u.clientX - p.x, m = u.clientY - p.y;
1571
+ !g && Math.hypot(S, m) < mn || (g = !0, e.classList.add("pluno-pa-widget--resizing"), i(
1572
+ ro(s, l, S, m)
1524
1573
  ));
1525
- }, P = (u) => {
1574
+ }, A = (u) => {
1526
1575
  r === u.pointerId && (u.preventDefault(), u.stopPropagation(), g && o(), c());
1527
1576
  }, T = (u) => {
1528
1577
  r === u.pointerId && (u.preventDefault(), c());
1529
1578
  }, O = (u) => {
1530
- const m = u.currentTarget.dataset.resizeDirection, I = u.shiftKey ? Io : Ao, L = n();
1531
- let R = 0, B = 0;
1532
- to(m) && (u.key === "ArrowLeft" ? R = -I : u.key === "ArrowRight" ? R = I : u.key === "ArrowUp" ? B = -I : u.key === "ArrowDown" && (B = I), !(R === 0 && B === 0) && (u.preventDefault(), u.stopPropagation(), i(no(L, m, R, B)), o()));
1579
+ const m = u.currentTarget.dataset.resizeDirection, I = u.shiftKey ? Mo : zo, z = n();
1580
+ let k = 0, ee = 0;
1581
+ ao(m) && (u.key === "ArrowLeft" ? k = -I : u.key === "ArrowRight" ? k = I : u.key === "ArrowUp" ? ee = -I : u.key === "ArrowDown" && (ee = I), !(k === 0 && ee === 0) && (u.preventDefault(), u.stopPropagation(), i(ro(z, m, k, ee)), o()));
1533
1582
  };
1534
1583
  for (const u of t)
1535
- u.addEventListener("pointerdown", h), u.addEventListener("pointermove", E), u.addEventListener("pointerup", P), u.addEventListener("pointercancel", T), u.addEventListener("keydown", O);
1584
+ u.addEventListener("pointerdown", h), u.addEventListener("pointermove", C), u.addEventListener("pointerup", A), u.addEventListener("pointercancel", T), u.addEventListener("keydown", O);
1536
1585
  return () => {
1537
1586
  for (const u of t)
1538
- u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", E), u.removeEventListener("pointerup", P), u.removeEventListener("pointercancel", T), u.removeEventListener("keydown", O);
1587
+ u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", C), u.removeEventListener("pointerup", A), u.removeEventListener("pointercancel", T), u.removeEventListener("keydown", O);
1539
1588
  };
1540
1589
  }
1541
- function to(e) {
1590
+ function ao(e) {
1542
1591
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1543
1592
  }
1544
- function no(e, t, n, i) {
1545
- const o = ee(), r = oo({
1593
+ function ro(e, t, n, i) {
1594
+ const o = Q(), r = lo({
1546
1595
  leading: e.position.x,
1547
1596
  length: e.size.width,
1548
1597
  delta: n,
1549
1598
  resizeLeading: t.endsWith("left") || t === "left",
1550
1599
  resizeTrailing: t.endsWith("right") || t === "right",
1551
- minLeading: A,
1552
- maxTrailing: o.width - A,
1600
+ minLeading: N,
1601
+ maxTrailing: o.width - N,
1553
1602
  minLength: Math.min(
1554
- bn,
1555
- o.width - A * 2
1603
+ yn,
1604
+ o.width - N * 2
1556
1605
  )
1557
- }), l = oo({
1606
+ }), l = lo({
1558
1607
  leading: e.position.y,
1559
1608
  length: e.size.height,
1560
1609
  delta: i,
1561
1610
  resizeLeading: t.startsWith("top") || t === "top",
1562
1611
  resizeTrailing: t.startsWith("bottom") || t === "bottom",
1563
- minLeading: Re,
1564
- maxTrailing: o.height - A,
1612
+ minLeading: Me,
1613
+ maxTrailing: o.height - N,
1565
1614
  minLength: Math.min(
1566
- _n,
1567
- o.height - Re - A
1615
+ vn,
1616
+ o.height - Me - N
1568
1617
  )
1569
1618
  });
1570
1619
  return {
@@ -1572,7 +1621,7 @@ function no(e, t, n, i) {
1572
1621
  size: { width: r.length, height: l.length }
1573
1622
  };
1574
1623
  }
1575
- function oo({
1624
+ function lo({
1576
1625
  leading: e,
1577
1626
  length: t,
1578
1627
  delta: n,
@@ -1580,33 +1629,33 @@ function oo({
1580
1629
  resizeTrailing: o,
1581
1630
  minLeading: r,
1582
1631
  maxTrailing: l,
1583
- minLength: s
1632
+ minLength: p
1584
1633
  }) {
1585
- const p = e + t;
1634
+ const s = e + t;
1586
1635
  if (i) {
1587
1636
  const g = e + n;
1588
1637
  if (g >= r) {
1589
- const h = Q(g, r, p - s);
1590
- return { leading: h, length: p - h };
1638
+ const h = J(g, r, s - p);
1639
+ return { leading: h, length: s - h };
1591
1640
  }
1592
- const c = Q(
1593
- p + r - g,
1594
- p,
1641
+ const c = J(
1642
+ s + r - g,
1643
+ s,
1595
1644
  l
1596
1645
  );
1597
1646
  return { leading: r, length: c - r };
1598
1647
  }
1599
1648
  if (o) {
1600
- const g = p + n;
1649
+ const g = s + n;
1601
1650
  if (g <= l) {
1602
- const h = Q(
1651
+ const h = J(
1603
1652
  g,
1604
- e + s,
1653
+ e + p,
1605
1654
  l
1606
1655
  );
1607
1656
  return { leading: e, length: h - e };
1608
1657
  }
1609
- const c = Q(
1658
+ const c = J(
1610
1659
  e - (g - l),
1611
1660
  r,
1612
1661
  e
@@ -1615,194 +1664,194 @@ function oo({
1615
1664
  }
1616
1665
  return { leading: e, length: t };
1617
1666
  }
1618
- function Ct(e, t = !0) {
1619
- const n = ee();
1667
+ function Lt(e, t = !0) {
1668
+ const n = Q();
1620
1669
  if (e.classList.contains("pluno-pa-widget--minimized"))
1621
- return { width: Xn, height: Xn };
1670
+ return { width: eo, height: eo };
1622
1671
  const i = e.getBoundingClientRect(), o = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1623
1672
  return {
1624
- width: t && o && i.width > 0 ? i.width : Math.min(Po, n.width - 36),
1625
- height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? fa : To
1673
+ width: t && o && i.width > 0 ? i.width : Math.min(Io, n.width - 36),
1674
+ height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? xa : Ro
1626
1675
  };
1627
1676
  }
1628
- function Da() {
1629
- const e = ee();
1677
+ function Ua() {
1678
+ const e = Q();
1630
1679
  return {
1631
1680
  width: Math.min(
1632
- Q(
1633
- e.width * ba,
1634
- bn,
1635
- wa
1681
+ J(
1682
+ e.width * va,
1683
+ yn,
1684
+ ya
1636
1685
  ),
1637
- e.width - A * 2
1686
+ e.width - N * 2
1638
1687
  ),
1639
1688
  height: Math.min(
1640
- Q(
1641
- e.height * xa,
1642
- _n,
1643
- _a
1689
+ J(
1690
+ e.height * Ca,
1691
+ vn,
1692
+ Sa
1644
1693
  ),
1645
- e.height - Re - A
1694
+ e.height - Me - N
1646
1695
  )
1647
1696
  };
1648
1697
  }
1649
- function at(e = null) {
1650
- return e ? kt(e) : Da();
1698
+ function st(e = null) {
1699
+ return e ? At(e) : Ua();
1651
1700
  }
1652
- function kt(e) {
1653
- const t = ee();
1701
+ function At(e) {
1702
+ const t = Q();
1654
1703
  return {
1655
- width: Q(
1704
+ width: J(
1656
1705
  e.width,
1657
1706
  Math.min(
1658
- bn,
1659
- t.width - A * 2
1707
+ yn,
1708
+ t.width - N * 2
1660
1709
  ),
1661
1710
  Math.max(
1662
- A,
1663
- t.width - A * 2
1711
+ N,
1712
+ t.width - N * 2
1664
1713
  )
1665
1714
  ),
1666
- height: Q(
1715
+ height: J(
1667
1716
  e.height,
1668
1717
  Math.min(
1669
- _n,
1670
- t.height - Re - A
1718
+ vn,
1719
+ t.height - Me - N
1671
1720
  ),
1672
1721
  Math.max(
1673
- A,
1674
- t.height - Re - A
1722
+ N,
1723
+ t.height - Me - N
1675
1724
  )
1676
1725
  )
1677
1726
  };
1678
1727
  }
1679
- function Xt(e, t) {
1728
+ function Qt(e, t) {
1680
1729
  if (!t) {
1681
1730
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1682
1731
  return;
1683
1732
  }
1684
- const n = kt(t);
1733
+ const n = At(t);
1685
1734
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1686
1735
  }
1687
- function za(e, t, n) {
1736
+ function Ba(e, t, n) {
1688
1737
  const i = Number.parseFloat(e.style.left), o = Number.parseFloat(e.style.top);
1689
1738
  if (Number.isFinite(i) && Number.isFinite(o))
1690
1739
  return { x: i, y: o };
1691
1740
  const r = e.getBoundingClientRect();
1692
1741
  if (r.width > 0 || r.height > 0)
1693
1742
  return { x: r.left, y: r.top };
1694
- const l = ee();
1743
+ const l = Q();
1695
1744
  return {
1696
1745
  x: t === "bottom-left" ? 26 : l.width - 26 - n.width,
1697
1746
  y: l.height - 24 - n.height
1698
1747
  };
1699
1748
  }
1700
- function Zt(e, t, n) {
1701
- const i = Ct(e, !1);
1702
- return t ? gn(
1749
+ function en(e, t, n) {
1750
+ const i = Lt(e, !1);
1751
+ return t ? fn(
1703
1752
  e,
1704
- zo(t, i),
1753
+ Bo(t, i),
1705
1754
  i
1706
- ) : Ma(n === "bottom-left" ? "bottom-left" : "bottom-right", i, ma);
1755
+ ) : Fa(n === "bottom-left" ? "bottom-left" : "bottom-right", i, _a);
1707
1756
  }
1708
- function Ma(e, t, n) {
1709
- const i = ee();
1757
+ function Fa(e, t, n) {
1758
+ const i = Q();
1710
1759
  return {
1711
1760
  x: e.endsWith("right") ? Math.max(0, i.width - t.width - n) : n,
1712
1761
  y: e.startsWith("bottom") ? Math.max(0, i.height - t.height - n) : n
1713
1762
  };
1714
1763
  }
1715
- function gn(e, t, n) {
1716
- const i = ee(), o = A + Ba(e);
1764
+ function fn(e, t, n) {
1765
+ const i = Q(), o = N + Ga(e);
1717
1766
  return {
1718
- x: Q(
1767
+ x: J(
1719
1768
  t.x,
1720
- A,
1769
+ N,
1721
1770
  Math.max(
1722
- A,
1723
- i.width - n.width - A
1771
+ N,
1772
+ i.width - n.width - N
1724
1773
  )
1725
1774
  ),
1726
- y: Q(
1775
+ y: J(
1727
1776
  t.y,
1728
1777
  o,
1729
1778
  Math.max(
1730
1779
  o,
1731
- i.height - n.height - A
1780
+ i.height - n.height - N
1732
1781
  )
1733
1782
  )
1734
1783
  };
1735
1784
  }
1736
- function zo(e, t) {
1737
- const n = ee();
1785
+ function Bo(e, t) {
1786
+ const n = Q();
1738
1787
  return {
1739
1788
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1740
1789
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1741
1790
  };
1742
1791
  }
1743
- function Oa(e, t) {
1744
- const n = Ua(e, t), i = ee();
1792
+ function Wa(e, t) {
1793
+ const n = Ha(e, t), i = Q();
1745
1794
  return {
1746
1795
  anchor: n,
1747
1796
  x: n.endsWith("right") ? i.width - e.x - t.width : e.x,
1748
1797
  y: n.startsWith("bottom") ? i.height - e.y - t.height : e.y
1749
1798
  };
1750
1799
  }
1751
- function Ua(e, t) {
1752
- const n = ee(), i = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = i <= n.width / 2 ? "left" : "right";
1800
+ function Ha(e, t) {
1801
+ const n = Q(), i = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = i <= n.width / 2 ? "left" : "right";
1753
1802
  return `${r}-${l}`;
1754
1803
  }
1755
- function Ba(e) {
1756
- return e.classList.contains("pluno-pa-widget--scribble") ? Ca : Sa;
1804
+ function Ga(e) {
1805
+ return e.classList.contains("pluno-pa-widget--scribble") ? Pa : La;
1757
1806
  }
1758
- function Jt(e, t, n, i = null) {
1759
- const o = Ct(e), r = at(i), l = {
1807
+ function tn(e, t, n, i = null) {
1808
+ const o = Lt(e), r = st(i), l = {
1760
1809
  x: n === "bottom-left" ? t.x : t.x + o.width - r.width,
1761
1810
  y: t.y + o.height - r.height
1762
1811
  };
1763
- return yt(l, r);
1812
+ return Ct(l, r);
1764
1813
  }
1765
- function yt(e, t) {
1766
- const n = ee();
1814
+ function Ct(e, t) {
1815
+ const n = Q();
1767
1816
  return {
1768
- x: Q(
1817
+ x: J(
1769
1818
  e.x,
1770
- A,
1819
+ N,
1771
1820
  Math.max(
1772
- A,
1773
- n.width - t.width - A
1821
+ N,
1822
+ n.width - t.width - N
1774
1823
  )
1775
1824
  ),
1776
- y: Q(
1825
+ y: J(
1777
1826
  e.y,
1778
- Re,
1827
+ Me,
1779
1828
  Math.max(
1780
- Re,
1781
- n.height - t.height - A
1829
+ Me,
1830
+ n.height - t.height - N
1782
1831
  )
1783
1832
  )
1784
1833
  };
1785
1834
  }
1786
- function Ie(e, t) {
1835
+ function ze(e, t) {
1787
1836
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1788
1837
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1789
1838
  return;
1790
1839
  }
1791
1840
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1792
1841
  }
1793
- function Fa(e, t) {
1842
+ function $a(e, t) {
1794
1843
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1795
1844
  }
1796
- function io(e) {
1845
+ function so(e) {
1797
1846
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1798
1847
  }
1799
- function ee() {
1848
+ function Q() {
1800
1849
  return {
1801
- width: window.innerWidth || document.documentElement.clientWidth || Po + A * 2,
1802
- height: window.innerHeight || document.documentElement.clientHeight || To + A * 2
1850
+ width: window.innerWidth || document.documentElement.clientWidth || Io + N * 2,
1851
+ height: window.innerHeight || document.documentElement.clientHeight || Ro + N * 2
1803
1852
  };
1804
1853
  }
1805
- function Qt(e) {
1854
+ function nn(e) {
1806
1855
  const t = e.getBoundingClientRect();
1807
1856
  return {
1808
1857
  x: Math.round(t.x),
@@ -1811,10 +1860,10 @@ function Qt(e) {
1811
1860
  height: Math.round(t.height)
1812
1861
  };
1813
1862
  }
1814
- function Q(e, t, n) {
1863
+ function J(e, t, n) {
1815
1864
  return Math.min(Math.max(e, t), n);
1816
1865
  }
1817
- function Z(e, t, n) {
1866
+ function X(e, t, n) {
1818
1867
  if (typeof window > "u")
1819
1868
  return;
1820
1869
  const i = window, o = {
@@ -1824,44 +1873,44 @@ function Z(e, t, n) {
1824
1873
  details: n
1825
1874
  }, r = i.__plunoProductAgentDiagnostics__ ?? [];
1826
1875
  r.push(o), r.length > 120 && r.splice(0, r.length - 120), i.__plunoProductAgentDiagnostics__ = r, i.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1827
- new CustomEvent(sa, { detail: o })
1876
+ new CustomEvent(ua, { detail: o })
1828
1877
  );
1829
1878
  }
1830
- function Wa(e, t) {
1831
- Z("web-sdk.widget.position", e, t);
1879
+ function qa(e, t) {
1880
+ X("web-sdk.widget.position", e, t);
1832
1881
  }
1833
- function en(e, t, n, i) {
1882
+ function on(e, t, n, i) {
1834
1883
  const o = t.value.trim();
1835
1884
  return !o && n.length === 0 ? n : (i(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
1836
- attachments: n.length > 0 ? n.map($a) : void 0
1885
+ attachments: n.length > 0 ? n.map(Ka) : void 0
1837
1886
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
1838
1887
  }
1839
- function Ha(e, t, n) {
1888
+ function ja(e, t, n) {
1840
1889
  const i = e.activeElement;
1841
1890
  return i === n ? "composer" : i === t ? "launcher" : null;
1842
1891
  }
1843
- function Ga(e, t, n, i) {
1844
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > Xi)
1892
+ function Va(e, t, n, i) {
1893
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > ea)
1845
1894
  return;
1846
1895
  const o = e.focusedInput === "composer" ? i : n;
1847
1896
  o === i && !t.classList.contains("pluno-pa-widget--open") || o === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
1848
1897
  !o.isConnected || o.readOnly || (o.focus(), o.setSelectionRange(o.value.length, o.value.length));
1849
1898
  });
1850
1899
  }
1851
- function $a(e) {
1900
+ function Ka(e) {
1852
1901
  return e;
1853
1902
  }
1854
- function it(e) {
1903
+ function lt(e) {
1855
1904
  e.style.height = "0px";
1856
1905
  const t = Math.max(22, Math.min(e.scrollHeight, 140));
1857
1906
  e.style.height = `${t}px`, e.style.overflowY = e.scrollHeight > 140 ? "auto" : "hidden";
1858
1907
  }
1859
- function rt(e, t = () => !0) {
1908
+ function pt(e, t = () => !0) {
1860
1909
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
1861
1910
  t() && (e.scrollTop = e.scrollHeight);
1862
1911
  });
1863
1912
  }
1864
- function qa(e) {
1913
+ function Ya(e) {
1865
1914
  const t = e.messages[e.messages.length - 1];
1866
1915
  return [
1867
1916
  e.messages.length,
@@ -1872,13 +1921,13 @@ function qa(e) {
1872
1921
  e.lastError ?? ""
1873
1922
  ].join(":");
1874
1923
  }
1875
- function ja(e) {
1924
+ function Xa(e) {
1876
1925
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
1877
1926
  }
1878
- function Va(e) {
1927
+ function Za(e) {
1879
1928
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
1880
1929
  }
1881
- function Ka(e) {
1930
+ function Ja(e) {
1882
1931
  const t = e.currentPage;
1883
1932
  if (typeof t?.url == "string" && t.url.trim())
1884
1933
  try {
@@ -1889,7 +1938,7 @@ function Ka(e) {
1889
1938
  }
1890
1939
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
1891
1940
  }
1892
- function Ya(e, t) {
1941
+ function Qa(e, t) {
1893
1942
  const n = new Date(e).getTime();
1894
1943
  if (!Number.isFinite(n))
1895
1944
  return "now";
@@ -1900,41 +1949,41 @@ function Ya(e, t) {
1900
1949
  ];
1901
1950
  for (const [r, l] of o)
1902
1951
  if (i >= l) {
1903
- const s = Math.max(1, Math.floor(i / l));
1904
- return r === "min" ? `${s} min` : `${s} ${r}${s === 1 ? "" : "s"}`;
1952
+ const p = Math.max(1, Math.floor(i / l));
1953
+ return r === "min" ? `${p} min` : `${p} ${r}${p === 1 ? "" : "s"}`;
1905
1954
  }
1906
1955
  return "now";
1907
1956
  }
1908
- function Xa(e, t, n, i, o) {
1909
- e.appendChild(rr()), e.appendChild(
1910
- Za(
1957
+ function er(e, t, n, i, o) {
1958
+ e.appendChild(dr()), e.appendChild(
1959
+ tr(
1911
1960
  t,
1912
1961
  n,
1913
1962
  i,
1914
1963
  o
1915
1964
  )
1916
1965
  ), e.appendChild(
1917
- Lt(
1966
+ Tt(
1918
1967
  "pluno-pa-widget__close",
1919
1968
  "Close",
1920
- lr(16),
1969
+ cr(16),
1921
1970
  !0
1922
1971
  )
1923
- ), e.appendChild(Ja(n));
1972
+ ), e.appendChild(nr(n));
1924
1973
  }
1925
- function Za(e, t, n, i) {
1974
+ function tr(e, t, n, i) {
1926
1975
  const o = document.createElement("form");
1927
1976
  if (o.className = "pluno-pa-widget__launcher", i && o.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
1928
- const p = document.createElement("button");
1929
- p.type = "button", p.className = "pluno-pa-widget__launcher-drag-handle", p.setAttribute("aria-label", "Move Pluno launcher"), p.title = "Move Pluno launcher", o.appendChild(p);
1977
+ const s = document.createElement("button");
1978
+ s.type = "button", s.className = "pluno-pa-widget__launcher-drag-handle", s.setAttribute("aria-label", "Move Pluno launcher"), s.title = "Move Pluno launcher", o.appendChild(s);
1930
1979
  }
1931
1980
  o.appendChild(
1932
- Bo(
1981
+ Go(
1933
1982
  "pluno-pa-widget__scribble-spirals--launcher",
1934
1983
  10
1935
1984
  )
1936
1985
  ), o.appendChild(
1937
- Ce(
1986
+ Pe(
1938
1987
  "pluno-pa-widget__character--launcher",
1939
1988
  t
1940
1989
  )
@@ -1943,58 +1992,58 @@ function Za(e, t, n, i) {
1943
1992
  r.className = "pluno-pa-widget__launcher-run-indicator", o.appendChild(r);
1944
1993
  const l = document.createElement("input");
1945
1994
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), o.appendChild(l);
1946
- const s = Et("Working...");
1947
- if (s.classList.add("pluno-pa-widget__status--launcher"), o.appendChild(s), i) {
1948
- const p = document.createElement("button");
1949
- p.type = "button", p.className = "pluno-pa-widget__launcher-minimize", p.textContent = "-", p.setAttribute("aria-label", "Minimize Pluno on this site"), p.title = "Minimize Pluno on this site", o.appendChild(p);
1995
+ const p = Pt("Working...");
1996
+ if (p.classList.add("pluno-pa-widget__status--launcher"), o.appendChild(p), i) {
1997
+ const s = document.createElement("button");
1998
+ s.type = "button", s.className = "pluno-pa-widget__launcher-minimize", s.textContent = "-", s.setAttribute("aria-label", "Minimize Pluno on this site"), s.title = "Minimize Pluno on this site", o.appendChild(s);
1950
1999
  }
1951
2000
  return o;
1952
2001
  }
1953
- function Ja(e) {
2002
+ function nr(e) {
1954
2003
  const t = document.createElement("section");
1955
2004
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
1956
- Bo("pluno-pa-widget__scribble-spirals--panel", 16)
2005
+ Go("pluno-pa-widget__scribble-spirals--panel", 16)
1957
2006
  );
1958
2007
  const n = document.createElement("div");
1959
2008
  n.className = "pluno-pa-widget__timeline-wrap";
1960
2009
  const i = document.createElement("main");
1961
- i.className = "pluno-pa-widget__timeline", i.appendChild(or(e));
2010
+ i.className = "pluno-pa-widget__timeline", i.appendChild(lr(e));
1962
2011
  const o = document.createElement("div");
1963
2012
  o.className = "pluno-pa-widget__timeline-bottom-sentinel", o.setAttribute("aria-hidden", "true"), i.appendChild(o), n.appendChild(i);
1964
2013
  const r = document.createElement("div");
1965
2014
  r.className = "pluno-pa-widget__active-users-counter", r.hidden = !0, n.appendChild(r);
1966
2015
  const l = document.createElement("button");
1967
2016
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
1968
- const s = document.createElement("div");
1969
- return s.className = "pluno-pa-widget__top-actions", s.appendChild(
1970
- Lt(
2017
+ const p = document.createElement("div");
2018
+ return p.className = "pluno-pa-widget__top-actions", p.appendChild(
2019
+ Tt(
1971
2020
  "pluno-pa-widget__history",
1972
- hn(),
1973
- pr(),
2021
+ wn(),
2022
+ gr(),
1974
2023
  !0
1975
2024
  )
1976
- ), n.appendChild(s), n.appendChild(nr()), t.appendChild(n), t.appendChild(Qa()), t.appendChild(er()), t.appendChild(tr()), t.appendChild(Se("left", "Resize Pluno from left")), t.appendChild(
1977
- Se("right", "Resize Pluno from right")
1978
- ), t.appendChild(Se("top", "Resize Pluno from top")), t.appendChild(
1979
- Se("bottom", "Resize Pluno from bottom")
2025
+ ), n.appendChild(p), n.appendChild(rr()), t.appendChild(n), t.appendChild(or()), t.appendChild(ir()), t.appendChild(ar()), t.appendChild(Le("left", "Resize Pluno from left")), t.appendChild(
2026
+ Le("right", "Resize Pluno from right")
2027
+ ), t.appendChild(Le("top", "Resize Pluno from top")), t.appendChild(
2028
+ Le("bottom", "Resize Pluno from bottom")
1980
2029
  ), t.appendChild(
1981
- Se("top-left", "Resize Pluno from top left")
2030
+ Le("top-left", "Resize Pluno from top left")
1982
2031
  ), t.appendChild(
1983
- Se("top-right", "Resize Pluno from top right")
2032
+ Le("top-right", "Resize Pluno from top right")
1984
2033
  ), t.appendChild(
1985
- Se("bottom-left", "Resize Pluno from bottom left")
2034
+ Le("bottom-left", "Resize Pluno from bottom left")
1986
2035
  ), t.appendChild(
1987
- Se("bottom-right", "Resize Pluno from bottom right")
2036
+ Le("bottom-right", "Resize Pluno from bottom right")
1988
2037
  ), t;
1989
2038
  }
1990
- function Se(e, t) {
2039
+ function Le(e, t) {
1991
2040
  const n = document.createElement("button");
1992
2041
  return n.type = "button", n.className = [
1993
2042
  "pluno-pa-widget__resize-handle",
1994
2043
  `pluno-pa-widget__resize-handle--${e}`
1995
2044
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
1996
2045
  }
1997
- function Qa() {
2046
+ function or() {
1998
2047
  const e = document.createElement("div");
1999
2048
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
2000
2049
  const t = document.createElement("span");
@@ -2008,7 +2057,7 @@ function Qa() {
2008
2057
  const r = document.createElement("button");
2009
2058
  return r.type = "button", r.className = "pluno-pa-widget__notify-suggestion-never", r.textContent = "Never", n.append(i, o, r), e.append(t, n), e;
2010
2059
  }
2011
- function er() {
2060
+ function ir() {
2012
2061
  const e = document.createElement("div");
2013
2062
  e.className = "pluno-pa-widget__notify-suggestion pluno-pa-widget__tab-groups-suggestion", e.hidden = !0;
2014
2063
  const t = document.createElement("span");
@@ -2020,7 +2069,7 @@ function er() {
2020
2069
  const o = document.createElement("button");
2021
2070
  return o.type = "button", o.className = "pluno-pa-widget__notify-suggestion-later pluno-pa-widget__tab-groups-suggestion-dismiss", o.textContent = "Not now", n.append(i, o), e.append(t, n), e;
2022
2071
  }
2023
- function tr() {
2072
+ function ar() {
2024
2073
  const e = document.createElement("form");
2025
2074
  e.className = "pluno-pa-widget__composer";
2026
2075
  const t = document.createElement("div");
@@ -2034,11 +2083,11 @@ function tr() {
2034
2083
  const r = document.createElement("input");
2035
2084
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), o.appendChild(r);
2036
2085
  const l = document.createElement("button");
2037
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(cr()), l.appendChild(ur()), o.appendChild(l);
2038
- const s = document.createElement("textarea");
2039
- s.className = "pluno-pa-widget__input", s.rows = 1, s.placeholder = "Ask for anything...", o.appendChild(s);
2040
- const p = document.createElement("button");
2041
- p.type = "button", p.className = "pluno-pa-widget__send", p.setAttribute("aria-label", "Send"), p.appendChild(Wo()), o.appendChild(p), e.appendChild(o);
2086
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(mr()), l.appendChild(fr()), o.appendChild(l);
2087
+ const p = document.createElement("textarea");
2088
+ p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", o.appendChild(p);
2089
+ const s = document.createElement("button");
2090
+ s.type = "button", s.className = "pluno-pa-widget__send", s.setAttribute("aria-label", "Send"), s.appendChild(qo()), o.appendChild(s), e.appendChild(o);
2042
2091
  const g = document.createElement("div");
2043
2092
  g.className = "pluno-pa-widget__composer-meta";
2044
2093
  const c = document.createElement("a");
@@ -2046,20 +2095,20 @@ function tr() {
2046
2095
  const h = document.createElement("span");
2047
2096
  return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", g.appendChild(h), e.appendChild(g), e;
2048
2097
  }
2049
- function hn() {
2098
+ function wn() {
2050
2099
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
2051
2100
  }
2052
- function nr() {
2101
+ function rr() {
2053
2102
  const e = document.createElement("section");
2054
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", hn());
2103
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", wn());
2055
2104
  const t = document.createElement("div");
2056
2105
  t.className = "pluno-pa-widget__history-header";
2057
2106
  const n = document.createElement("strong");
2058
- n.textContent = hn();
2059
- const i = Lt(
2107
+ n.textContent = wn();
2108
+ const i = Tt(
2060
2109
  "pluno-pa-widget__history-close",
2061
2110
  "Close recent chats",
2062
- dr(),
2111
+ hr(),
2063
2112
  !1
2064
2113
  );
2065
2114
  t.append(n, i);
@@ -2068,20 +2117,20 @@ function nr() {
2068
2117
  const r = document.createElement("p");
2069
2118
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, o, r), e;
2070
2119
  }
2071
- function or(e) {
2120
+ function lr(e) {
2072
2121
  const t = document.createElement("div");
2073
2122
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
2074
- Ce(
2123
+ Pe(
2075
2124
  "pluno-pa-widget__character--empty",
2076
2125
  e
2077
2126
  )
2078
- ), t.appendChild(Mo()), t;
2127
+ ), t.appendChild(Fo()), t;
2079
2128
  }
2080
- function Mo() {
2129
+ function Fo() {
2081
2130
  const e = document.createElement("div");
2082
2131
  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;
2083
2132
  }
2084
- function Oo(e, t) {
2133
+ function Wo(e, t) {
2085
2134
  e.replaceChildren(), e.setAttribute(
2086
2135
  "aria-label",
2087
2136
  `${t.toLocaleString("en-US")} users currently active`
@@ -2093,17 +2142,17 @@ function Oo(e, t) {
2093
2142
  )
2094
2143
  );
2095
2144
  }
2096
- function Ce(e, t) {
2097
- const n = `pluno-pa-character-${Jn}`;
2098
- Jn += 1;
2099
- const i = t.scribbleStyle ? ar(t.accentColor, n) : ir(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
2145
+ function Pe(e, t) {
2146
+ const n = `pluno-pa-character-${no}`;
2147
+ no += 1;
2148
+ const i = t.scribbleStyle ? pr(t.accentColor, n) : sr(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
2100
2149
  return i.setAttribute(
2101
2150
  "class",
2102
2151
  o.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
2103
2152
  ), i.setAttribute("aria-hidden", "true"), i.setAttribute("focusable", "false"), i.removeAttribute("role"), i.removeAttribute("aria-label"), i;
2104
2153
  }
2105
- function ir(e, t) {
2106
- const n = yi(e), i = {
2154
+ function sr(e, t) {
2155
+ const n = Ei(e), i = {
2107
2156
  boltFill: `${t}-boltFill`,
2108
2157
  boltEdge: `${t}-boltEdge`,
2109
2158
  boltGlow: `${t}-boltGlow`,
@@ -2114,7 +2163,7 @@ function ir(e, t) {
2114
2163
  eyeShadow: `${t}-eyeShadow`,
2115
2164
  pupilGloss: `${t}-pupilGloss`,
2116
2165
  boltClip: `${t}-boltClip`
2117
- }, o = Uo(), r = w(o, "defs"), l = w(r, "linearGradient", {
2166
+ }, o = Ho(), r = _(o, "defs"), l = _(r, "linearGradient", {
2118
2167
  id: i.boltFill,
2119
2168
  x1: "420",
2120
2169
  y1: "180",
@@ -2123,7 +2172,7 @@ function ir(e, t) {
2123
2172
  gradientUnits: "userSpaceOnUse"
2124
2173
  });
2125
2174
  F(l, "0", n.top), F(l, "0.36", n.middle), F(l, "0.72", n.bottom), F(l, "1", n.bottom);
2126
- const s = w(r, "linearGradient", {
2175
+ const p = _(r, "linearGradient", {
2127
2176
  id: i.boltEdge,
2128
2177
  x1: "470",
2129
2178
  y1: "145",
@@ -2131,29 +2180,29 @@ function ir(e, t) {
2131
2180
  y2: "980",
2132
2181
  gradientUnits: "userSpaceOnUse"
2133
2182
  });
2134
- F(s, "0", n.edgeStart), F(s, "0.32", n.edgeMiddle), F(s, "0.78", n.edgeEnd), F(s, "1", n.edgeEnd);
2135
- const p = w(r, "radialGradient", {
2183
+ F(p, "0", n.edgeStart), F(p, "0.32", n.edgeMiddle), F(p, "0.78", n.edgeEnd), F(p, "1", n.edgeEnd);
2184
+ const s = _(r, "radialGradient", {
2136
2185
  id: i.boltGlow,
2137
2186
  cx: "50%",
2138
2187
  cy: "22%",
2139
2188
  r: "82%"
2140
2189
  });
2141
- F(p, "0", n.glow, "0.72"), F(p, "0.5", n.middle, "0.44"), F(p, "1", n.bottom, "0");
2142
- const g = w(r, "radialGradient", {
2190
+ F(s, "0", n.glow, "0.72"), F(s, "0.5", n.middle, "0.44"), F(s, "1", n.bottom, "0");
2191
+ const g = _(r, "radialGradient", {
2143
2192
  id: i.eyeWhite,
2144
2193
  cx: "35%",
2145
2194
  cy: "25%",
2146
2195
  r: "70%"
2147
2196
  });
2148
2197
  F(g, "0", "#ffffff"), F(g, "0.72", "#ffffff"), F(g, "1", "#e5e5e5");
2149
- const c = w(r, "radialGradient", {
2198
+ const c = _(r, "radialGradient", {
2150
2199
  id: i.pupil,
2151
2200
  cx: "42%",
2152
2201
  cy: "38%",
2153
2202
  r: "65%"
2154
2203
  });
2155
2204
  F(c, "0", "#2a1f10"), F(c, "0.52", "#080604"), F(c, "1", "#000000");
2156
- const h = w(r, "filter", {
2205
+ const h = _(r, "filter", {
2157
2206
  id: i.softDropShadow,
2158
2207
  x: "-18%",
2159
2208
  y: "-12%",
@@ -2161,14 +2210,14 @@ function ir(e, t) {
2161
2210
  height: "136%",
2162
2211
  "color-interpolation-filters": "sRGB"
2163
2212
  });
2164
- w(h, "feDropShadow", {
2213
+ _(h, "feDropShadow", {
2165
2214
  dx: "0",
2166
2215
  dy: "12",
2167
2216
  stdDeviation: "18",
2168
2217
  "flood-color": n.shadow,
2169
2218
  "flood-opacity": "0.24"
2170
2219
  });
2171
- const E = w(r, "filter", {
2220
+ const C = _(r, "filter", {
2172
2221
  id: i.innerDepth,
2173
2222
  x: "-8%",
2174
2223
  y: "-8%",
@@ -2176,32 +2225,32 @@ function ir(e, t) {
2176
2225
  height: "116%",
2177
2226
  "color-interpolation-filters": "sRGB"
2178
2227
  });
2179
- w(E, "feGaussianBlur", {
2228
+ _(C, "feGaussianBlur", {
2180
2229
  in: "SourceAlpha",
2181
2230
  stdDeviation: "8",
2182
2231
  result: "blur"
2183
- }), w(E, "feOffset", {
2232
+ }), _(C, "feOffset", {
2184
2233
  dx: "-7",
2185
2234
  dy: "-9",
2186
2235
  result: "topLeft"
2187
- }), w(E, "feComposite", {
2236
+ }), _(C, "feComposite", {
2188
2237
  in: "topLeft",
2189
2238
  in2: "SourceAlpha",
2190
2239
  operator: "arithmetic",
2191
2240
  k2: "-1",
2192
2241
  k3: "1",
2193
2242
  result: "innerShadow"
2194
- }), w(E, "feColorMatrix", {
2243
+ }), _(C, "feColorMatrix", {
2195
2244
  in: "innerShadow",
2196
2245
  type: "matrix",
2197
2246
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
2198
2247
  result: "innerLight"
2199
- }), w(E, "feBlend", {
2248
+ }), _(C, "feBlend", {
2200
2249
  in: "SourceGraphic",
2201
2250
  in2: "innerLight",
2202
2251
  mode: "screen"
2203
2252
  });
2204
- const P = w(r, "filter", {
2253
+ const A = _(r, "filter", {
2205
2254
  id: i.eyeShadow,
2206
2255
  x: "-24%",
2207
2256
  y: "-20%",
@@ -2209,14 +2258,14 @@ function ir(e, t) {
2209
2258
  height: "148%",
2210
2259
  "color-interpolation-filters": "sRGB"
2211
2260
  });
2212
- w(P, "feDropShadow", {
2261
+ _(A, "feDropShadow", {
2213
2262
  dx: "0",
2214
2263
  dy: "8",
2215
2264
  stdDeviation: "5",
2216
2265
  "flood-color": n.shadow,
2217
2266
  "flood-opacity": "0.3"
2218
2267
  });
2219
- const T = w(r, "filter", {
2268
+ const T = _(r, "filter", {
2220
2269
  id: i.pupilGloss,
2221
2270
  x: "-15%",
2222
2271
  y: "-15%",
@@ -2224,51 +2273,51 @@ function ir(e, t) {
2224
2273
  height: "130%",
2225
2274
  "color-interpolation-filters": "sRGB"
2226
2275
  });
2227
- w(T, "feDropShadow", {
2276
+ _(T, "feDropShadow", {
2228
2277
  dx: "0",
2229
2278
  dy: "3",
2230
2279
  stdDeviation: "3",
2231
2280
  "flood-color": "#000000",
2232
2281
  "flood-opacity": "0.22"
2233
2282
  });
2234
- const O = w(r, "clipPath", { id: i.boltClip });
2235
- w(O, "path", { d: vt });
2236
- const u = w(o, "g", {
2237
- filter: J(i.softDropShadow)
2283
+ const O = _(r, "clipPath", { id: i.boltClip });
2284
+ _(O, "path", { d: Et });
2285
+ const u = _(o, "g", {
2286
+ filter: Z(i.softDropShadow)
2238
2287
  });
2239
- w(u, "path", {
2240
- d: vt,
2241
- fill: J(i.boltEdge)
2288
+ _(u, "path", {
2289
+ d: Et,
2290
+ fill: Z(i.boltEdge)
2242
2291
  });
2243
2292
  const S = "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";
2244
- w(u, "path", {
2293
+ _(u, "path", {
2245
2294
  d: S,
2246
- fill: J(i.boltFill),
2247
- filter: J(i.innerDepth)
2248
- }), w(u, "path", {
2295
+ fill: Z(i.boltFill),
2296
+ filter: Z(i.innerDepth)
2297
+ }), _(u, "path", {
2249
2298
  d: S,
2250
- fill: J(i.boltGlow),
2299
+ fill: Z(i.boltGlow),
2251
2300
  opacity: "0.74"
2252
2301
  });
2253
- const m = w(u, "g", {
2254
- "clip-path": J(i.boltClip),
2302
+ const m = _(u, "g", {
2303
+ "clip-path": Z(i.boltClip),
2255
2304
  opacity: "0.42"
2256
2305
  });
2257
- w(m, "path", {
2306
+ _(m, "path", {
2258
2307
  d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
2259
2308
  fill: "none",
2260
2309
  stroke: n.highlight,
2261
2310
  "stroke-width": "22",
2262
2311
  "stroke-linecap": "round",
2263
2312
  opacity: "0.65"
2264
- }), w(m, "path", {
2313
+ }), _(m, "path", {
2265
2314
  d: "M556 685 L501 994",
2266
2315
  fill: "none",
2267
2316
  stroke: n.highlight,
2268
2317
  "stroke-width": "20",
2269
2318
  "stroke-linecap": "round",
2270
2319
  opacity: "0.55"
2271
- }), w(m, "path", {
2320
+ }), _(m, "path", {
2272
2321
  d: "M858 160 C882 166 893 181 883 204",
2273
2322
  fill: "none",
2274
2323
  stroke: n.inner,
@@ -2276,8 +2325,8 @@ function ir(e, t) {
2276
2325
  "stroke-linecap": "round",
2277
2326
  opacity: "0.48"
2278
2327
  });
2279
- const I = w(o, "g", { filter: J(i.eyeShadow) });
2280
- return ao(
2328
+ const I = _(o, "g", { filter: Z(i.eyeShadow) });
2329
+ return po(
2281
2330
  I,
2282
2331
  "rotate(-2 528 463)",
2283
2332
  "528",
@@ -2287,7 +2336,7 @@ function ir(e, t) {
2287
2336
  "557",
2288
2337
  "447",
2289
2338
  i
2290
- ), ao(
2339
+ ), po(
2291
2340
  I,
2292
2341
  "rotate(2 717 462)",
2293
2342
  "717",
@@ -2299,13 +2348,13 @@ function ir(e, t) {
2299
2348
  i
2300
2349
  ), o;
2301
2350
  }
2302
- function ar(e, t) {
2303
- const n = vo(e), i = {
2351
+ function pr(e, t) {
2352
+ const n = ko(e), i = {
2304
2353
  clip: `${t}-scribbleBoltClip`,
2305
2354
  wobble: `${t}-scribbleBoltWobble`
2306
- }, o = Uo(), r = w(o, "defs"), l = w(r, "clipPath", { id: i.clip });
2307
- w(l, "path", { d: vt });
2308
- const s = w(r, "filter", {
2355
+ }, o = Ho(), r = _(o, "defs"), l = _(r, "clipPath", { id: i.clip });
2356
+ _(l, "path", { d: Et });
2357
+ const p = _(r, "filter", {
2309
2358
  id: i.wobble,
2310
2359
  x: "-10%",
2311
2360
  y: "-10%",
@@ -2313,24 +2362,24 @@ function ar(e, t) {
2313
2362
  height: "120%",
2314
2363
  "color-interpolation-filters": "sRGB"
2315
2364
  });
2316
- w(s, "feTurbulence", {
2365
+ _(p, "feTurbulence", {
2317
2366
  type: "fractalNoise",
2318
2367
  baseFrequency: "0.011",
2319
2368
  numOctaves: "3",
2320
2369
  seed: "7",
2321
2370
  result: "noise"
2322
- }), w(s, "feDisplacementMap", {
2371
+ }), _(p, "feDisplacementMap", {
2323
2372
  in: "SourceGraphic",
2324
2373
  in2: "noise",
2325
2374
  scale: "16",
2326
2375
  xChannelSelector: "R",
2327
2376
  yChannelSelector: "G"
2328
2377
  });
2329
- const p = w(o, "g", { filter: J(i.wobble) }), g = w(p, "g", {
2330
- "clip-path": J(i.clip)
2378
+ const s = _(o, "g", { filter: Z(i.wobble) }), g = _(s, "g", {
2379
+ "clip-path": Z(i.clip)
2331
2380
  });
2332
- return w(g, "path", {
2333
- d: xi(),
2381
+ return _(g, "path", {
2382
+ d: Ci(),
2334
2383
  fill: "none",
2335
2384
  stroke: n,
2336
2385
  "stroke-width": "56",
@@ -2338,14 +2387,14 @@ function ar(e, t) {
2338
2387
  "stroke-linejoin": "round",
2339
2388
  opacity: "0.9",
2340
2389
  transform: "rotate(-14 627 600)"
2341
- }), w(p, "path", {
2342
- d: vt,
2390
+ }), _(s, "path", {
2391
+ d: Et,
2343
2392
  fill: "none",
2344
- stroke: St,
2393
+ stroke: kt,
2345
2394
  "stroke-width": "18",
2346
2395
  "stroke-linejoin": "round"
2347
- }), ro(
2348
- p,
2396
+ }), co(
2397
+ s,
2349
2398
  "rotate(-2 528 463)",
2350
2399
  "528",
2351
2400
  "463",
@@ -2353,8 +2402,8 @@ function ar(e, t) {
2353
2402
  "473",
2354
2403
  "557",
2355
2404
  "447"
2356
- ), ro(
2357
- p,
2405
+ ), co(
2406
+ s,
2358
2407
  "rotate(2 717 462)",
2359
2408
  "717",
2360
2409
  "462",
@@ -2364,123 +2413,123 @@ function ar(e, t) {
2364
2413
  "447"
2365
2414
  ), o;
2366
2415
  }
2367
- function Uo() {
2368
- return k("svg", {
2369
- xmlns: No,
2416
+ function Ho() {
2417
+ return E("svg", {
2418
+ xmlns: Do,
2370
2419
  viewBox: "0 0 1254 1254"
2371
2420
  });
2372
2421
  }
2373
- function ao(e, t, n, i, o, r, l, s, p) {
2374
- const g = w(e, "g", { transform: t });
2375
- w(g, "ellipse", {
2422
+ function po(e, t, n, i, o, r, l, p, s) {
2423
+ const g = _(e, "g", { transform: t });
2424
+ _(g, "ellipse", {
2376
2425
  cx: n,
2377
2426
  cy: i,
2378
2427
  rx: "73",
2379
2428
  ry: "80",
2380
- fill: J(p.eyeWhite)
2381
- }), w(g, "ellipse", {
2429
+ fill: Z(s.eyeWhite)
2430
+ }), _(g, "ellipse", {
2382
2431
  cx: o,
2383
2432
  cy: r,
2384
2433
  rx: "49",
2385
2434
  ry: "57",
2386
- fill: J(p.pupil),
2387
- filter: J(p.pupilGloss)
2388
- }), w(g, "circle", {
2435
+ fill: Z(s.pupil),
2436
+ filter: Z(s.pupilGloss)
2437
+ }), _(g, "circle", {
2389
2438
  cx: l,
2390
- cy: s,
2439
+ cy: p,
2391
2440
  r: "18",
2392
2441
  fill: "#ffffff"
2393
2442
  });
2394
2443
  }
2395
- function ro(e, t, n, i, o, r, l, s) {
2396
- const p = w(e, "g", { transform: t });
2397
- w(p, "ellipse", {
2444
+ function co(e, t, n, i, o, r, l, p) {
2445
+ const s = _(e, "g", { transform: t });
2446
+ _(s, "ellipse", {
2398
2447
  cx: n,
2399
2448
  cy: i,
2400
2449
  rx: "73",
2401
2450
  ry: "80",
2402
2451
  fill: "#ffffff",
2403
- stroke: St,
2452
+ stroke: kt,
2404
2453
  "stroke-width": "13"
2405
- }), w(p, "ellipse", {
2454
+ }), _(s, "ellipse", {
2406
2455
  cx: o,
2407
2456
  cy: r,
2408
2457
  rx: "45",
2409
2458
  ry: "53",
2410
- fill: St
2411
- }), w(p, "circle", {
2459
+ fill: kt
2460
+ }), _(s, "circle", {
2412
2461
  cx: l,
2413
- cy: s,
2462
+ cy: p,
2414
2463
  r: "16",
2415
2464
  fill: "#ffffff"
2416
2465
  });
2417
2466
  }
2418
- function w(e, t, n = {}) {
2419
- const i = k(t, n);
2467
+ function _(e, t, n = {}) {
2468
+ const i = E(t, n);
2420
2469
  return e.appendChild(i), i;
2421
2470
  }
2422
2471
  function F(e, t, n, i) {
2423
2472
  const o = { offset: t, "stop-color": n };
2424
- i !== void 0 && (o["stop-opacity"] = i), w(e, "stop", o);
2473
+ i !== void 0 && (o["stop-opacity"] = i), _(e, "stop", o);
2425
2474
  }
2426
- function J(e) {
2475
+ function Z(e) {
2427
2476
  return `url(#${e})`;
2428
2477
  }
2429
- function Lt(e, t, n, i) {
2478
+ function Tt(e, t, n, i) {
2430
2479
  const o = document.createElement("button");
2431
2480
  return o.type = "button", o.className = e, o.setAttribute("aria-label", t), o.title = t, o.hidden = i, o.appendChild(n), o;
2432
2481
  }
2433
- function rr() {
2434
- const e = k("svg", {
2482
+ function dr() {
2483
+ const e = E("svg", {
2435
2484
  class: "pluno-pa-widget__scribble-defs",
2436
2485
  "aria-hidden": "true",
2437
2486
  focusable: "false",
2438
2487
  width: "0",
2439
2488
  height: "0"
2440
- }), t = k("defs");
2441
- return t.appendChild(nn("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2442
- nn("pluno-pa-scribble-wobble-2", "5", "15")
2489
+ }), t = E("defs");
2490
+ return t.appendChild(rn("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2491
+ rn("pluno-pa-scribble-wobble-2", "5", "15")
2443
2492
  ), t.appendChild(
2444
- nn("pluno-pa-scribble-wobble-3", "9", "19")
2493
+ rn("pluno-pa-scribble-wobble-3", "9", "19")
2445
2494
  ), e.appendChild(t), e;
2446
2495
  }
2447
- function Bo(e, t) {
2448
- const n = k("svg", {
2496
+ function Go(e, t) {
2497
+ const n = E("svg", {
2449
2498
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2450
2499
  preserveAspectRatio: "xMidYMid meet",
2451
2500
  "aria-hidden": "true",
2452
2501
  focusable: "false"
2453
2502
  });
2454
- return Fo(n, t), n;
2503
+ return $o(n, t), n;
2455
2504
  }
2456
- function tn(e, t) {
2505
+ function an(e, t) {
2457
2506
  if (!e)
2458
2507
  return;
2459
2508
  const n = Math.max(
2460
2509
  0,
2461
- t - cn * 2
2510
+ t - hn * 2
2462
2511
  ), i = Math.max(
2463
- va,
2512
+ ka,
2464
2513
  Math.floor(
2465
- (n - dn * 2) / pn
2514
+ (n - gn * 2) / un
2466
2515
  )
2467
2516
  );
2468
- Fo(e, i);
2517
+ $o(e, i);
2469
2518
  }
2470
- function Fo(e, t) {
2519
+ function $o(e, t) {
2471
2520
  if (e.dataset.spiralCount === `${t}`)
2472
2521
  return;
2473
- const n = t * pn + dn * 2;
2522
+ const n = t * un + gn * 2;
2474
2523
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2475
2524
  "viewBox",
2476
- `0 0 ${n} ${ya}`
2525
+ `0 0 ${n} ${Ea}`
2477
2526
  ), e.replaceChildren();
2478
2527
  for (let i = 0; i < t; i += 1) {
2479
- const o = Zn[i % Zn.length], r = k("g", {
2480
- transform: `translate(${dn + i * pn} 0)`
2528
+ const o = to[i % to.length], r = E("g", {
2529
+ transform: `translate(${gn + i * un} 0)`
2481
2530
  });
2482
2531
  r.appendChild(
2483
- k("ellipse", {
2532
+ E("ellipse", {
2484
2533
  cx: o.ellipseCx,
2485
2534
  cy: o.ellipseCy,
2486
2535
  rx: o.ellipseRx,
@@ -2491,7 +2540,7 @@ function Fo(e, t) {
2491
2540
  opacity: "0.8"
2492
2541
  })
2493
2542
  ), r.appendChild(
2494
- k("path", {
2543
+ E("path", {
2495
2544
  d: o.path,
2496
2545
  fill: "none",
2497
2546
  stroke: "#2c2a1e",
@@ -2501,8 +2550,8 @@ function Fo(e, t) {
2501
2550
  ), e.appendChild(r);
2502
2551
  }
2503
2552
  }
2504
- function nn(e, t, n) {
2505
- const i = k("filter", {
2553
+ function rn(e, t, n) {
2554
+ const i = E("filter", {
2506
2555
  id: e,
2507
2556
  x: "-8%",
2508
2557
  y: "-8%",
@@ -2510,7 +2559,7 @@ function nn(e, t, n) {
2510
2559
  height: "116%"
2511
2560
  });
2512
2561
  return i.appendChild(
2513
- k("feTurbulence", {
2562
+ E("feTurbulence", {
2514
2563
  type: "fractalNoise",
2515
2564
  baseFrequency: "0.012 0.028",
2516
2565
  numOctaves: "3",
@@ -2518,7 +2567,7 @@ function nn(e, t, n) {
2518
2567
  result: "stroke-noise"
2519
2568
  })
2520
2569
  ), i.appendChild(
2521
- k("feDisplacementMap", {
2570
+ E("feDisplacementMap", {
2522
2571
  in: "SourceGraphic",
2523
2572
  in2: "stroke-noise",
2524
2573
  scale: "3.5",
@@ -2527,7 +2576,7 @@ function nn(e, t, n) {
2527
2576
  result: "warped"
2528
2577
  })
2529
2578
  ), i.appendChild(
2530
- k("feTurbulence", {
2579
+ E("feTurbulence", {
2531
2580
  type: "fractalNoise",
2532
2581
  baseFrequency: "0.7",
2533
2582
  numOctaves: "1",
@@ -2535,7 +2584,7 @@ function nn(e, t, n) {
2535
2584
  result: "ink-noise"
2536
2585
  })
2537
2586
  ), i.appendChild(
2538
- k("feDisplacementMap", {
2587
+ E("feDisplacementMap", {
2539
2588
  in: "warped",
2540
2589
  in2: "ink-noise",
2541
2590
  scale: "0.9",
@@ -2544,7 +2593,7 @@ function nn(e, t, n) {
2544
2593
  })
2545
2594
  ), i;
2546
2595
  }
2547
- function lr(e) {
2596
+ function cr(e) {
2548
2597
  const t = ue(
2549
2598
  "0 0 24 24",
2550
2599
  e,
@@ -2553,9 +2602,9 @@ function lr(e) {
2553
2602
  "currentColor",
2554
2603
  "2.25"
2555
2604
  );
2556
- return t.appendChild(k("path", { d: "m6 9 6 6 6-6" })), t;
2605
+ return t.appendChild(E("path", { d: "m6 9 6 6 6-6" })), t;
2557
2606
  }
2558
- function sr() {
2607
+ function ur() {
2559
2608
  const e = ue(
2560
2609
  "0 0 24 24",
2561
2610
  17,
@@ -2565,16 +2614,16 @@ function sr() {
2565
2614
  "2.25"
2566
2615
  );
2567
2616
  return e.appendChild(
2568
- k("path", {
2617
+ E("path", {
2569
2618
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
2570
2619
  })
2571
2620
  ), e.appendChild(
2572
- k("path", {
2621
+ E("path", {
2573
2622
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
2574
2623
  })
2575
2624
  ), e;
2576
2625
  }
2577
- function pr() {
2626
+ function gr() {
2578
2627
  const e = ue(
2579
2628
  "0 0 24 24",
2580
2629
  17,
@@ -2583,9 +2632,9 @@ function pr() {
2583
2632
  "currentColor",
2584
2633
  "2.25"
2585
2634
  );
2586
- return e.appendChild(k("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(k("path", { d: "M3 4v5h5" })), e.appendChild(k("path", { d: "M12 7v5l3 2" })), e;
2635
+ return e.appendChild(E("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(E("path", { d: "M3 4v5h5" })), e.appendChild(E("path", { d: "M12 7v5l3 2" })), e;
2587
2636
  }
2588
- function dr() {
2637
+ function hr() {
2589
2638
  const e = ue(
2590
2639
  "0 0 24 24",
2591
2640
  15,
@@ -2594,9 +2643,9 @@ function dr() {
2594
2643
  "currentColor",
2595
2644
  "2.4"
2596
2645
  );
2597
- return e.appendChild(k("path", { d: "M18 6 6 18" })), e.appendChild(k("path", { d: "m6 6 12 12" })), e;
2646
+ return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2598
2647
  }
2599
- function Wo() {
2648
+ function qo() {
2600
2649
  const e = ue(
2601
2650
  "0 0 24 24",
2602
2651
  14,
@@ -2606,10 +2655,10 @@ function Wo() {
2606
2655
  "2.75"
2607
2656
  );
2608
2657
  return e.appendChild(
2609
- k("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2610
- ), e.appendChild(k("polyline", { points: "5 12 12 5 19 12" })), e;
2658
+ E("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2659
+ ), e.appendChild(E("polyline", { points: "5 12 12 5 19 12" })), e;
2611
2660
  }
2612
- function cr() {
2661
+ function mr() {
2613
2662
  const e = ue(
2614
2663
  "0 0 24 24",
2615
2664
  16,
@@ -2622,18 +2671,18 @@ function cr() {
2622
2671
  "class",
2623
2672
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
2624
2673
  ), e.appendChild(
2625
- k("path", {
2674
+ E("path", {
2626
2675
  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"
2627
2676
  })
2628
2677
  ), e;
2629
2678
  }
2630
- function ur() {
2679
+ function fr() {
2631
2680
  const e = ue("0 0 24 24", 19, 19, "none", "currentColor");
2632
2681
  return e.setAttribute(
2633
2682
  "class",
2634
2683
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
2635
2684
  ), e.appendChild(
2636
- k("path", {
2685
+ E("path", {
2637
2686
  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",
2638
2687
  stroke: "currentColor",
2639
2688
  "stroke-width": "2",
@@ -2642,10 +2691,10 @@ function ur() {
2642
2691
  })
2643
2692
  ), e;
2644
2693
  }
2645
- function gr() {
2694
+ function wr() {
2646
2695
  const e = ue("0 0 24 24", 18, 18, "currentColor");
2647
2696
  return e.appendChild(
2648
- k("rect", {
2697
+ E("rect", {
2649
2698
  x: "6",
2650
2699
  y: "6",
2651
2700
  width: "12",
@@ -2654,7 +2703,7 @@ function gr() {
2654
2703
  })
2655
2704
  ), e;
2656
2705
  }
2657
- function hr() {
2706
+ function br() {
2658
2707
  const e = ue(
2659
2708
  "0 0 24 24",
2660
2709
  12,
@@ -2663,9 +2712,9 @@ function hr() {
2663
2712
  "currentColor",
2664
2713
  "2.4"
2665
2714
  );
2666
- return e.appendChild(k("path", { d: "M18 6 6 18" })), e.appendChild(k("path", { d: "m6 6 12 12" })), e;
2715
+ return e.appendChild(E("path", { d: "M18 6 6 18" })), e.appendChild(E("path", { d: "m6 6 12 12" })), e;
2667
2716
  }
2668
- function mr() {
2717
+ function _r() {
2669
2718
  const e = ue(
2670
2719
  "0 0 24 24",
2671
2720
  13,
@@ -2675,7 +2724,7 @@ function mr() {
2675
2724
  "2.25"
2676
2725
  );
2677
2726
  return e.appendChild(
2678
- k("rect", {
2727
+ E("rect", {
2679
2728
  width: "14",
2680
2729
  height: "14",
2681
2730
  x: "8",
@@ -2684,7 +2733,7 @@ function mr() {
2684
2733
  ry: "2"
2685
2734
  })
2686
2735
  ), e.appendChild(
2687
- k("path", {
2736
+ E("path", {
2688
2737
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2689
2738
  })
2690
2739
  ), e;
@@ -2697,33 +2746,33 @@ function ue(e, t, n, i, o, r) {
2697
2746
  fill: i,
2698
2747
  "aria-hidden": "true"
2699
2748
  };
2700
- return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), k("svg", l);
2749
+ return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), E("svg", l);
2701
2750
  }
2702
- function k(e, t = {}) {
2703
- const n = document.createElementNS(No, e);
2751
+ function E(e, t = {}) {
2752
+ const n = document.createElementNS(Do, e);
2704
2753
  for (const [i, o] of Object.entries(t))
2705
2754
  n.setAttribute(i, o);
2706
2755
  return n;
2707
2756
  }
2708
- function lo(e) {
2757
+ function uo(e) {
2709
2758
  for (const t of ["keydown", "keypress", "keyup"])
2710
2759
  e.addEventListener(t, (n) => {
2711
2760
  n.stopPropagation();
2712
2761
  });
2713
2762
  }
2714
- function fr(e, t, n) {
2763
+ function xr(e, t, n) {
2715
2764
  e.replaceChildren(), e.hidden = t.length === 0;
2716
2765
  for (const [i, o] of t.entries()) {
2717
2766
  const r = document.createElement("div");
2718
- r.className = "pluno-pa-widget__attachment", r.appendChild(wr(o));
2767
+ r.className = "pluno-pa-widget__attachment", r.appendChild(yr(o));
2719
2768
  const l = document.createElement("span");
2720
2769
  l.textContent = o.name, r.appendChild(l);
2721
- const s = document.createElement("button");
2722
- s.type = "button", s.setAttribute("aria-label", `Remove ${o.name}`), s.appendChild(hr()), s.addEventListener("click", () => n(i)), r.appendChild(s), e.appendChild(r);
2770
+ const p = document.createElement("button");
2771
+ p.type = "button", p.setAttribute("aria-label", `Remove ${o.name}`), p.appendChild(br()), p.addEventListener("click", () => n(i)), r.appendChild(p), e.appendChild(r);
2723
2772
  }
2724
2773
  }
2725
- function wr(e) {
2726
- const t = xn(e), n = Ho(e);
2774
+ function yr(e) {
2775
+ const t = Sn(e), n = jo(e);
2727
2776
  if (t === "image" && n) {
2728
2777
  const i = document.createElement("img");
2729
2778
  return i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), i.addEventListener("error", () => i.replaceWith(ce(e))), i;
@@ -2734,8 +2783,8 @@ function wr(e) {
2734
2783
  }
2735
2784
  return ce(e);
2736
2785
  }
2737
- function br(e, t) {
2738
- const n = xn(e), i = Ho(e);
2786
+ function vr(e, t) {
2787
+ const n = Sn(e), i = jo(e);
2739
2788
  if (n === "image" && i) {
2740
2789
  const o = document.createElement("img");
2741
2790
  o.className = "pluno-pa-widget__message-attachment-preview", o.alt = e.name;
@@ -2766,109 +2815,109 @@ function br(e, t) {
2766
2815
  function ce(e, t = "composer") {
2767
2816
  if (t === "composer") {
2768
2817
  const r = document.createElement("span");
2769
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = so(e), r;
2818
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = go(e), r;
2770
2819
  }
2771
2820
  const n = document.createElement("div");
2772
2821
  n.className = "pluno-pa-widget__message-attachment-file";
2773
2822
  const i = document.createElement("span");
2774
- i.textContent = so(e);
2823
+ i.textContent = go(e);
2775
2824
  const o = document.createElement("strong");
2776
2825
  return o.textContent = e.name, n.append(i, o), n;
2777
2826
  }
2778
- function xn(e) {
2827
+ function Sn(e) {
2779
2828
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2780
2829
  }
2781
- function Ho(e) {
2830
+ function jo(e) {
2782
2831
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2783
2832
  }
2784
- function so(e) {
2785
- const t = xn(e);
2833
+ function go(e) {
2834
+ const t = Sn(e);
2786
2835
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2787
2836
  }
2788
- function _r(e, t) {
2837
+ function Sr(e, t) {
2789
2838
  return t ? Array.from(t).map((i) => ({
2790
2839
  ...e.createLocalAttachment(i),
2791
- previewUrl: xr(i)
2840
+ previewUrl: Cr(i)
2792
2841
  })) : [];
2793
2842
  }
2794
- function xr(e) {
2843
+ function Cr(e) {
2795
2844
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2796
2845
  }
2797
- function _t(e) {
2846
+ function vt(e) {
2798
2847
  return !!(e && Array.from(e.types).includes("Files"));
2799
2848
  }
2800
- function on(e, t, n = null) {
2801
- if (!e || !mn(t, n)) {
2849
+ function ln(e, t, n = null) {
2850
+ if (!e || !bn(t, n)) {
2802
2851
  e && (e.hidden = !0, e.replaceChildren());
2803
2852
  return;
2804
2853
  }
2805
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", re(t) || yn(n) ? e.appendChild(
2806
- yr(t, n)
2807
- ) : Go(t) && e.appendChild(vr(t));
2854
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", le(t) || Cn(n) ? e.appendChild(
2855
+ Er(t, n)
2856
+ ) : Vo(t) && e.appendChild(kr(t));
2808
2857
  }
2809
- function yr(e, t) {
2858
+ function Er(e, t) {
2810
2859
  const n = document.createElement("div");
2811
2860
  n.className = "pluno-pa-widget__billing-action-card";
2812
2861
  const i = e.limitExceeded || t === "limit_exceeded", o = document.createElement("strong");
2813
2862
  o.textContent = i ? "Credits used up" : "Billing needs attention", n.appendChild(o);
2814
2863
  const r = document.createElement("span");
2815
2864
  return r.textContent = i ? "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(
2816
- $o(
2865
+ Ko(
2817
2866
  e,
2818
2867
  "Upgrade plan",
2819
2868
  "pluno-pa-widget__billing-action-card-actions"
2820
2869
  )
2821
2870
  ), n;
2822
2871
  }
2823
- function vr(e) {
2872
+ function kr(e) {
2824
2873
  const t = document.createElement("div");
2825
2874
  t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
2826
2875
  const n = document.createElement("strong");
2827
2876
  n.textContent = "Credits running low", t.appendChild(n);
2828
2877
  const i = document.createElement("span");
2829
- return i.textContent = Cr(e) ?? "Credits are running low for this period.", t.appendChild(i), t.appendChild(
2830
- $o(
2878
+ return i.textContent = Pr(e) ?? "Credits are running low for this period.", t.appendChild(i), t.appendChild(
2879
+ Ko(
2831
2880
  e,
2832
2881
  "Upgrade",
2833
2882
  "pluno-pa-widget__billing-action-card-actions"
2834
2883
  )
2835
2884
  ), t;
2836
2885
  }
2837
- function mn(e, t) {
2838
- return e !== null && (re(e) || Go(e) || yn(t));
2886
+ function bn(e, t) {
2887
+ return e !== null && (le(e) || Vo(e) || Cn(t));
2839
2888
  }
2840
- function po(e, t, n) {
2841
- return mn(t, n) || Sr(t) ? !0 : !mn(e, n);
2889
+ function ho(e, t, n) {
2890
+ return bn(t, n) || Lr(t) ? !0 : !bn(e, n);
2842
2891
  }
2843
- function Sr(e) {
2844
- return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || re(e));
2892
+ function Lr(e) {
2893
+ return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || le(e));
2845
2894
  }
2846
- function re(e) {
2895
+ function le(e) {
2847
2896
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
2848
2897
  }
2849
- function yn(e) {
2898
+ function Cn(e) {
2850
2899
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
2851
2900
  }
2852
- function Go(e) {
2853
- return !re(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2901
+ function Vo(e) {
2902
+ return !le(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
2854
2903
  }
2855
- function Cr(e) {
2856
- return e.creditsRemaining === null ? null : `${Er(e.creditsRemaining)} credits left`;
2904
+ function Pr(e) {
2905
+ return e.creditsRemaining === null ? null : `${Ar(e.creditsRemaining)} credits left`;
2857
2906
  }
2858
- function Er(e) {
2907
+ function Ar(e) {
2859
2908
  return new Intl.NumberFormat("en-US", {
2860
2909
  maximumFractionDigits: 0
2861
2910
  }).format(Math.ceil(e));
2862
2911
  }
2863
- function $o(e, t, n) {
2912
+ function Ko(e, t, n) {
2864
2913
  const i = document.createElement("div");
2865
2914
  return i.className = n, i.appendChild(
2866
- co(t, e.pricingUrl)
2915
+ mo(t, e.pricingUrl)
2867
2916
  ), i.appendChild(
2868
- co("Earn credits", e.earnCreditsUrl)
2917
+ mo("Earn credits", e.earnCreditsUrl)
2869
2918
  ), i;
2870
2919
  }
2871
- function co(e, t) {
2920
+ function mo(e, t) {
2872
2921
  const n = document.createElement("button");
2873
2922
  if (n.type = "button", e === "Earn credits") {
2874
2923
  const i = document.createElement("span");
@@ -2879,167 +2928,197 @@ function co(e, t) {
2879
2928
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
2880
2929
  }), n;
2881
2930
  }
2882
- function an(e, t) {
2931
+ function sn(e, t) {
2883
2932
  return e.messages.filter(
2884
- (i) => !qo(i)
2933
+ (i) => !Yo(i)
2885
2934
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
2886
2935
  }
2887
- function kr(e, t, n, i, o, r, l, s, p, g, c, h, E, P, T, O, u, S, m, I, L) {
2888
- const R = Nr(r), B = R.filter(
2889
- (_) => !qo(_)
2890
- ), ge = e.scrollTop, Ee = [], Ve = /* @__PURE__ */ new Set(), D = (_) => {
2891
- Ee.push(_);
2936
+ function Tr(e, t, n, i, o, r, l, p, s, g, c, h, C, A, T, O, u, S, m, I, z, k) {
2937
+ const ee = zr(r), W = ee.filter(
2938
+ (f) => !Yo(f)
2939
+ ), Ze = e.scrollTop, Oe = [], ge = /* @__PURE__ */ new Set(), U = (f) => {
2940
+ Oe.push(f);
2892
2941
  };
2893
- Vo(n, r.isThinking), o.hidden = !s, s && l !== null && Oo(o, l);
2894
- const De = B.length > 0 || !!r.assistantDraft || r.isThinking;
2895
- if (i(De), u || B.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2896
- const _ = document.createElement("div");
2897
- _.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
2898
- const x = document.createElement("div");
2899
- x.className = "pluno-pa-widget__empty-hero";
2900
- const z = Ce(
2942
+ Zo(n, r.isThinking), o.hidden = !p, p && l !== null && Wo(o, l);
2943
+ const x = W.length > 0 || !!r.assistantDraft || r.isThinking;
2944
+ if (i(x), u || W.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
2945
+ const f = document.createElement("div");
2946
+ f.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
2947
+ const P = document.createElement("div");
2948
+ P.className = "pluno-pa-widget__empty-hero";
2949
+ const R = Pe(
2901
2950
  "pluno-pa-widget__character--empty",
2902
- P()
2951
+ A()
2903
2952
  );
2904
- if (x.appendChild(z), _.appendChild(x), u) {
2905
- const v = document.createElement("h2");
2906
- v.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", v.textContent = u.opening, _.appendChild(v);
2953
+ if (P.appendChild(R), f.appendChild(P), u) {
2954
+ const y = document.createElement("h2");
2955
+ y.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", y.textContent = u.opening, f.appendChild(y);
2907
2956
  } else
2908
- _.appendChild(Mo());
2909
- const Y = u?.prompts ?? r.starterPrompts, te = document.createElement("div");
2910
- if (te.className = Y.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", Y.length === 0 && !r.starterPromptsLoading && te.setAttribute("aria-hidden", "true"), Y.length > 0)
2911
- for (const v of Y) {
2912
- const N = document.createElement("button");
2913
- N.type = "button", N.className = "pluno-pa-widget__starter-prompt", N.textContent = `"${v}"`, N.addEventListener("click", () => {
2914
- T(v);
2915
- }), te.appendChild(N);
2957
+ f.appendChild(Fo());
2958
+ const ve = u?.prompts ?? r.starterPrompts, ne = document.createElement("div");
2959
+ if (ne.className = ve.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", ve.length === 0 && !r.starterPromptsLoading && ne.setAttribute("aria-hidden", "true"), ve.length > 0)
2960
+ for (const y of ve) {
2961
+ const L = document.createElement("button");
2962
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt", L.textContent = `"${y}"`, L.addEventListener("click", () => {
2963
+ T(y);
2964
+ }), ne.appendChild(L);
2916
2965
  }
2917
2966
  else if (r.starterPromptsLoading) {
2918
- const v = document.createElement("button");
2919
- v.type = "button", v.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", v.disabled = !0, v.tabIndex = -1, v.textContent = "Generating example tasks...", te.appendChild(v);
2967
+ const y = document.createElement("button");
2968
+ y.type = "button", y.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", y.disabled = !0, y.tabIndex = -1, y.textContent = "Generating example tasks...", ne.appendChild(y);
2920
2969
  } else
2921
- for (let v = 0; v < pa; v += 1) {
2922
- const N = document.createElement("button");
2923
- N.type = "button", N.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", N.disabled = !0, N.tabIndex = -1, N.textContent = "", te.appendChild(N);
2970
+ for (let y = 0; y < ga; y += 1) {
2971
+ const L = document.createElement("button");
2972
+ L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", L.disabled = !0, L.tabIndex = -1, L.textContent = "", ne.appendChild(L);
2924
2973
  }
2925
- if (_.appendChild(te), u) {
2926
- const v = document.createElement("button");
2927
- v.type = "button", v.className = "pluno-pa-widget__morning-report-snooze", v.textContent = "Snooze morning report", v.addEventListener("click", S), _.appendChild(v);
2974
+ if (f.appendChild(ne), u) {
2975
+ const y = document.createElement("button");
2976
+ y.type = "button", y.className = "pluno-pa-widget__morning-report-snooze", y.textContent = "Snooze morning report", y.addEventListener("click", S), f.appendChild(y);
2928
2977
  }
2929
- h.clear(), D(_), D(t), uo(e, Ee);
2978
+ h.clear(), U(f), U(t), fo(e, Oe);
2930
2979
  return;
2931
2980
  }
2932
- let f = null, U = null, ke = [];
2933
- const le = B.length - 1, Ke = le >= 0 && fn(B[le]), G = () => {
2934
- if (ke.length === 0)
2981
+ let B = null, G = null, te = [];
2982
+ const Ae = W.length - 1, Y = Ae >= 0 && _n(W[Ae]), ye = () => {
2983
+ if (te.length === 0)
2935
2984
  return !1;
2936
- const _ = Br(
2937
- ke,
2985
+ const f = $r(
2986
+ te,
2938
2987
  c,
2939
- E,
2940
- P()
2988
+ C,
2989
+ A()
2941
2990
  );
2942
- return D(_), f = null, U = _, ke = [], !0;
2991
+ return U(f), B = null, G = f, te = [], !0;
2943
2992
  };
2944
- for (let _ = 0; _ < B.length; _ += 1) {
2945
- const x = B[_];
2946
- if (x.role === "tool") {
2947
- ke.push(x);
2993
+ for (let f = 0; f < W.length; f += 1) {
2994
+ const P = W[f];
2995
+ if (P.role === "tool" && P.integrationAuthRequest && z) {
2996
+ ye();
2997
+ const y = Nr(
2998
+ P.integrationAuthRequest,
2999
+ z.states.get(P.integrationAuthRequest.authRequestId) ?? {
3000
+ status: z.initialStatus
3001
+ },
3002
+ z.onConnect
3003
+ );
3004
+ U(y), B = null, G = y;
3005
+ continue;
3006
+ }
3007
+ if (P.role === "tool") {
3008
+ te.push(P);
2948
3009
  continue;
2949
3010
  }
2950
- if (fn(x)) {
2951
- if (_ !== le)
3011
+ if (_n(P)) {
3012
+ if (f !== Ae)
2952
3013
  continue;
2953
- if (G()) {
2954
- const N = Et();
2955
- D(N), f = null, U = N;
3014
+ if (ye()) {
3015
+ const L = Pt();
3016
+ U(L), B = null, G = L;
2956
3017
  } else {
2957
- const N = fo(P());
2958
- D(N), f = null, U = N;
3018
+ const L = xo(A());
3019
+ U(L), B = null, G = L;
2959
3020
  }
2960
3021
  continue;
2961
3022
  }
2962
- if (x.role === "system") {
2963
- if (x.dataType === "run_error" || x.dataType === "run_status") {
2964
- G();
2965
- const v = document.createElement("div"), N = x.dataType === "run_error";
2966
- if (v.className = N ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", v.textContent = mo(x.content), N && x.securitySettingsUrl) {
2967
- const V = document.createElement("a");
2968
- V.className = "pluno-pa-widget__error-retry", V.href = x.securitySettingsUrl, V.target = "_blank", V.rel = "noreferrer", V.textContent = "Security settings", v.appendChild(V);
3023
+ if (P.role === "system") {
3024
+ if (P.dataType === "run_error" || P.dataType === "run_status") {
3025
+ ye();
3026
+ const y = document.createElement("div"), L = P.dataType === "run_error";
3027
+ if (y.className = L ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", y.textContent = _o(P.content), L && P.securitySettingsUrl) {
3028
+ const Se = document.createElement("a");
3029
+ Se.className = "pluno-pa-widget__error-retry", Se.href = P.securitySettingsUrl, Se.target = "_blank", Se.rel = "noreferrer", Se.textContent = "Security settings", y.appendChild(Se);
2969
3030
  }
2970
- D(v), f = N ? v : null, U = N ? null : v;
3031
+ U(y), B = L ? y : null, G = L ? null : y;
2971
3032
  }
2972
3033
  continue;
2973
3034
  }
2974
- const z = G(), Y = mo(x.content);
2975
- if (x.role === "assistant" && !z) {
2976
- const v = jo(P());
2977
- D(v), f = null, U = v;
3035
+ const R = ye(), ve = _o(P.content);
3036
+ if (P.role === "assistant" && !R) {
3037
+ const y = Xo(A());
3038
+ U(y), B = null, G = y;
2978
3039
  }
2979
- const te = Lr(
2980
- x,
2981
- Y,
3040
+ const ne = Ir(
3041
+ P,
3042
+ ve,
2982
3043
  h,
2983
- Ve,
3044
+ ge,
2984
3045
  I
2985
3046
  );
2986
- D(te), f = te, U = null;
3047
+ U(ne), B = ne, G = null;
2987
3048
  }
2988
- const st = G(), ze = B[B.length - 1]?.id === "assistant-draft";
2989
- if (r.isThinking && !ze && !Ke)
2990
- if (st) {
2991
- const _ = Et();
2992
- D(_), f = null, U = _;
3049
+ const Ue = ye(), Be = W[W.length - 1]?.id === "assistant-draft";
3050
+ if (r.isThinking && !Be && !Y)
3051
+ if (Ue) {
3052
+ const f = Pt();
3053
+ U(f), B = null, G = f;
2993
3054
  } else {
2994
- const _ = fo(P());
2995
- D(_), f = null, U = _;
3055
+ const f = xo(A());
3056
+ U(f), B = null, G = f;
2996
3057
  }
2997
3058
  if (r.lastError) {
2998
- const _ = document.createElement("div");
2999
- _.className = "pluno-pa-widget__error";
3000
- const x = document.createElement("span");
3001
- if (x.textContent = r.lastError, _.appendChild(x), r.lastErrorSecuritySettingsUrl) {
3002
- const z = document.createElement("a");
3003
- z.className = "pluno-pa-widget__error-retry", z.href = r.lastErrorSecuritySettingsUrl, z.target = "_blank", z.rel = "noreferrer", z.textContent = "Security settings", _.appendChild(z);
3059
+ const f = document.createElement("div");
3060
+ f.className = "pluno-pa-widget__error";
3061
+ const P = document.createElement("span");
3062
+ if (P.textContent = r.lastError, f.appendChild(P), r.lastErrorSecuritySettingsUrl) {
3063
+ const R = document.createElement("a");
3064
+ R.className = "pluno-pa-widget__error-retry", R.href = r.lastErrorSecuritySettingsUrl, R.target = "_blank", R.rel = "noreferrer", R.textContent = "Security settings", f.appendChild(R);
3004
3065
  }
3005
3066
  if (r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
3006
- const z = document.createElement("button");
3007
- z.type = "button", z.className = "pluno-pa-widget__error-retry", z.textContent = "Try again", z.addEventListener(
3067
+ const R = document.createElement("button");
3068
+ R.type = "button", R.className = "pluno-pa-widget__error-retry", R.textContent = "Try again", R.addEventListener(
3008
3069
  "click",
3009
3070
  r.lastErrorCode === "connection_failed" ? m : O
3010
- ), _.appendChild(z);
3071
+ ), f.appendChild(R);
3011
3072
  }
3012
- D(_), f = _, U = null;
3073
+ U(f), B = f, G = null;
3013
3074
  }
3014
- const se = L ? L.draftingCandidate ?? (r.isThinking ? null : Ei(R)) : null;
3015
- if (L && se && !L.dismissedCandidateIds.has(se.id)) {
3016
- const _ = Rr(se, {
3017
- isDrafting: L.draftingCandidate?.id === se.id,
3018
- error: L.error,
3019
- characterIconOptions: L.characterIconOptions,
3020
- onDraft: L.onDraft,
3021
- onDismiss: L.onDismiss,
3022
- onDisable: L.onDisable
3075
+ const se = k ? k.draftingCandidate ?? (r.isThinking ? null : Ai(ee)) : null;
3076
+ if (k && se && !k.dismissedCandidateIds.has(se.id)) {
3077
+ const f = Ur(se, {
3078
+ isDrafting: k.draftingCandidate?.id === se.id,
3079
+ error: k.error,
3080
+ characterIconOptions: k.characterIconOptions,
3081
+ onDraft: k.onDraft,
3082
+ onDismiss: k.onDismiss,
3083
+ onDisable: k.onDisable
3023
3084
  });
3024
- D(_), L.onSeen(se), f = null, U = _;
3085
+ U(f), k.onSeen(se), B = null, G = f;
3025
3086
  }
3026
- f?.classList.add("pluno-pa-widget__message--bottom-reserve"), U?.classList.add("pluno-pa-widget__bottom-reserve-compact"), D(t), Tr(h, Ve), uo(e, Ee), p ? rt(e, g) : e.scrollTop = ge;
3087
+ B?.classList.add("pluno-pa-widget__message--bottom-reserve"), G?.classList.add("pluno-pa-widget__bottom-reserve-compact"), U(t), Dr(h, ge), fo(e, Oe), s ? pt(e, g) : e.scrollTop = Ze;
3027
3088
  }
3028
- function Lr(e, t, n, i, o) {
3029
- const r = Pr(e, t), l = r ? n.get(r) : void 0;
3089
+ function Nr(e, t, n) {
3090
+ const i = document.createElement("section");
3091
+ i.className = "pluno-pa-widget__integration-auth-card", i.setAttribute("aria-label", `Connect ${e.appName}`);
3092
+ const o = document.createElement("div");
3093
+ if (o.className = "pluno-pa-widget__integration-auth-header", e.appLogo) {
3094
+ const g = document.createElement("img");
3095
+ g.className = "pluno-pa-widget__integration-auth-logo", g.src = e.appLogo, g.alt = "", o.appendChild(g);
3096
+ }
3097
+ const r = document.createElement("div"), l = document.createElement("strong");
3098
+ l.textContent = `Connect ${e.appName}`;
3099
+ const p = document.createElement("span");
3100
+ if (p.textContent = "Authenticate in this browser so Pluno can continue your task.", r.append(l, p), o.appendChild(r), i.appendChild(o), t.error) {
3101
+ const g = document.createElement("div");
3102
+ g.className = "pluno-pa-widget__integration-auth-error", g.textContent = t.error, i.appendChild(g);
3103
+ }
3104
+ const s = document.createElement("button");
3105
+ return s.type = "button", s.className = "pluno-pa-widget__integration-auth-button", s.disabled = t.status === "checking" || t.status === "connecting" || t.status === "completed", t.status === "checking" ? s.textContent = "Checking connection..." : t.status === "connecting" ? s.textContent = "Connecting..." : t.status === "completed" ? s.textContent = "Connected" : t.status === "expired" || t.status === "cancelled" ? s.textContent = `Reconnect ${e.appName}` : t.status === "error" ? s.textContent = "Try again" : s.textContent = `Connect ${e.appName}`, s.addEventListener("click", () => n(e)), i.appendChild(s), i;
3106
+ }
3107
+ function Ir(e, t, n, i, o) {
3108
+ const r = Rr(e, t), l = r ? n.get(r) : void 0;
3030
3109
  if (r && l)
3031
3110
  return l.classList.remove("pluno-pa-widget__message--bottom-reserve"), i.add(r), l;
3032
- const s = document.createElement("div");
3033
- s.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? Wr(s, t) : s.textContent = t, e.role === "user" && e.attachments?.length && s.appendChild(
3034
- Ar(
3111
+ const p = document.createElement("div");
3112
+ p.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? jr(p, t) : p.textContent = t, e.role === "user" && e.attachments?.length && p.appendChild(
3113
+ Mr(
3035
3114
  e.attachments,
3036
3115
  o
3037
3116
  )
3038
3117
  );
3039
- const p = document.createElement("div");
3040
- return p.className = "pluno-pa-widget__message-actions", p.appendChild(Ir(t)), s.appendChild(p), r && (n.set(r, s), i.add(r)), s;
3118
+ const s = document.createElement("div");
3119
+ return s.className = "pluno-pa-widget__message-actions", s.appendChild(Or(t)), p.appendChild(s), r && (n.set(r, p), i.add(r)), p;
3041
3120
  }
3042
- function Pr(e, t) {
3121
+ function Rr(e, t) {
3043
3122
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
3044
3123
  id: e.id,
3045
3124
  content: t,
@@ -3057,11 +3136,11 @@ function Pr(e, t) {
3057
3136
  })
3058
3137
  });
3059
3138
  }
3060
- function Tr(e, t) {
3139
+ function Dr(e, t) {
3061
3140
  for (const n of e.keys())
3062
3141
  t.has(n) || e.delete(n);
3063
3142
  }
3064
- function uo(e, t) {
3143
+ function fo(e, t) {
3065
3144
  let n = e.firstChild;
3066
3145
  for (const i of t) {
3067
3146
  if (i === n) {
@@ -3075,7 +3154,7 @@ function uo(e, t) {
3075
3154
  n = n.nextSibling, e.removeChild(i);
3076
3155
  }
3077
3156
  }
3078
- function Nr(e) {
3157
+ function zr(e) {
3079
3158
  if (!e.assistantDraft)
3080
3159
  return [...e.messages];
3081
3160
  const t = {
@@ -3095,7 +3174,7 @@ function Nr(e) {
3095
3174
  if (n === -1)
3096
3175
  return [...e.messages, t];
3097
3176
  const i = e.messages.findIndex(
3098
- (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && go(r, t) && fn(r)
3177
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && wo(r, t) && _n(r)
3099
3178
  );
3100
3179
  if (i !== -1)
3101
3180
  return [
@@ -3104,7 +3183,7 @@ function Nr(e) {
3104
3183
  ...e.messages.slice(i + 1)
3105
3184
  ];
3106
3185
  let o = n + 1;
3107
- for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && go(e.messages[o], t); )
3186
+ for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && wo(e.messages[o], t); )
3108
3187
  o += 1;
3109
3188
  return [
3110
3189
  ...e.messages.slice(0, o),
@@ -3112,55 +3191,55 @@ function Nr(e) {
3112
3191
  ...e.messages.slice(o)
3113
3192
  ];
3114
3193
  }
3115
- function fn(e) {
3194
+ function _n(e) {
3116
3195
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
3117
3196
  }
3118
- function go(e, t) {
3197
+ function wo(e, t) {
3119
3198
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
3120
3199
  }
3121
- function ho(e, t, n, i, o, r, l, s) {
3122
- e.replaceChildren(), Vo(t, !1), t.disabled = !0, n(!1);
3123
- const p = document.createElement("div");
3124
- p.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
3125
- const g = Ce(
3200
+ function bo(e, t, n, i, o, r, l, p) {
3201
+ e.replaceChildren(), Zo(t, !1), t.disabled = !0, n(!1);
3202
+ const s = document.createElement("div");
3203
+ s.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
3204
+ const g = Pe(
3126
3205
  "pluno-pa-widget__character--empty",
3127
3206
  i()
3128
3207
  );
3129
- p.appendChild(g);
3208
+ s.appendChild(g);
3130
3209
  const c = document.createElement("div");
3131
- if (c.className = "pluno-pa-widget__empty", c.textContent = o, p.appendChild(c), l) {
3210
+ if (c.className = "pluno-pa-widget__empty", c.textContent = o, s.appendChild(c), l) {
3132
3211
  const h = document.createElement("a");
3133
- h.className = "pluno-pa-widget__login", h.href = l, h.target = "_blank", h.rel = "noopener noreferrer", h.textContent = r, p.appendChild(h);
3212
+ h.className = "pluno-pa-widget__login", h.href = l, h.target = "_blank", h.rel = "noopener noreferrer", h.textContent = r, s.appendChild(h);
3134
3213
  } else {
3135
3214
  const h = document.createElement("button");
3136
- h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = r, h.addEventListener("click", () => s?.()), p.appendChild(h);
3215
+ h.type = "button", h.className = "pluno-pa-widget__login", h.textContent = r, h.addEventListener("click", () => p?.()), s.appendChild(h);
3137
3216
  }
3138
- e.appendChild(p);
3217
+ e.appendChild(s);
3139
3218
  }
3140
- function Ar(e, t) {
3219
+ function Mr(e, t) {
3141
3220
  const n = document.createElement("div");
3142
3221
  n.className = "pluno-pa-widget__message-attachments";
3143
3222
  for (const i of e)
3144
3223
  n.appendChild(
3145
- br(
3224
+ vr(
3146
3225
  i,
3147
3226
  t
3148
3227
  )
3149
3228
  );
3150
3229
  return n;
3151
3230
  }
3152
- function Ir(e) {
3231
+ function Or(e) {
3153
3232
  const t = document.createElement("button");
3154
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(mr()), t.addEventListener("click", (n) => {
3233
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(_r()), t.addEventListener("click", (n) => {
3155
3234
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
3156
3235
  }), t;
3157
3236
  }
3158
- function Rr(e, t) {
3237
+ function Ur(e, t) {
3159
3238
  const n = document.createElement("article");
3160
3239
  n.className = "pluno-pa-widget__share-prompt";
3161
3240
  const i = document.createElement("div");
3162
3241
  i.className = "pluno-pa-widget__share-prompt-body", i.appendChild(
3163
- Ce(
3242
+ Pe(
3164
3243
  "pluno-pa-widget__share-prompt-icon",
3165
3244
  t.characterIconOptions
3166
3245
  )
@@ -3175,28 +3254,28 @@ function Rr(e, t) {
3175
3254
  c.className = "pluno-pa-widget__share-prompt-error", c.textContent = t.error, o.appendChild(c);
3176
3255
  }
3177
3256
  i.appendChild(o);
3178
- const s = document.createElement("div");
3179
- s.className = "pluno-pa-widget__share-prompt-actions";
3180
3257
  const p = document.createElement("div");
3181
- p.className = "pluno-pa-widget__share-prompt-primary-actions";
3258
+ p.className = "pluno-pa-widget__share-prompt-actions";
3259
+ const s = document.createElement("div");
3260
+ s.className = "pluno-pa-widget__share-prompt-primary-actions";
3182
3261
  const g = document.createElement("button");
3183
3262
  if (g.type = "button", g.className = "pluno-pa-widget__share-prompt-draft", g.disabled = t.isDrafting, g.addEventListener("click", () => {
3184
3263
  t.onDraft(e);
3185
- }), t.isDrafting ? (g.appendChild(wn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", p.appendChild(g), t.isDrafting)
3186
- s.appendChild(p);
3264
+ }), t.isDrafting ? (g.appendChild(xn()), g.appendChild(document.createTextNode("Drafting..."))) : g.textContent = "Draft a social post", s.appendChild(g), t.isDrafting)
3265
+ p.appendChild(s);
3187
3266
  else {
3188
3267
  const c = document.createElement("button");
3189
3268
  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", () => {
3190
3269
  t.onDismiss(e);
3191
- }), p.appendChild(c), s.appendChild(p);
3270
+ }), s.appendChild(c), p.appendChild(s);
3192
3271
  const h = document.createElement("button");
3193
3272
  h.type = "button", h.className = "pluno-pa-widget__share-prompt-disable", h.textContent = "Don't ask again", h.addEventListener("click", () => {
3194
3273
  t.onDisable(e);
3195
- }), s.appendChild(h);
3274
+ }), p.appendChild(h);
3196
3275
  }
3197
- return i.appendChild(s), n.appendChild(i), n;
3276
+ return i.appendChild(p), n.appendChild(i), n;
3198
3277
  }
3199
- function Dr(e, t) {
3278
+ function Br(e, t) {
3200
3279
  const n = document.createElement("div");
3201
3280
  n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (u) => {
3202
3281
  u.target === n && t.onClose();
@@ -3207,60 +3286,60 @@ function Dr(e, t) {
3207
3286
  r.textContent = "Share this win", o.appendChild(r);
3208
3287
  const l = document.createElement("button");
3209
3288
  l.type = "button", l.className = "pluno-pa-widget__share-dialog-close", l.setAttribute("aria-label", "Close"), l.textContent = "×", l.addEventListener("click", t.onClose), o.appendChild(l), i.appendChild(o);
3210
- const s = document.createElement("p");
3211
- s.className = "pluno-pa-widget__share-dialog-status", s.hidden = !0;
3212
- const p = document.createElement("div");
3213
- p.className = "pluno-pa-widget__share-dialog-step";
3289
+ const p = document.createElement("p");
3290
+ p.className = "pluno-pa-widget__share-dialog-status", p.hidden = !0;
3291
+ const s = document.createElement("div");
3292
+ s.className = "pluno-pa-widget__share-dialog-step";
3214
3293
  const g = document.createElement("div");
3215
3294
  g.className = "pluno-pa-widget__share-dialog-step-header";
3216
3295
  const c = document.createElement("strong");
3217
3296
  c.textContent = "1) Copy Screenshot", g.appendChild(c);
3218
- const h = zr(
3297
+ const h = Fr(
3219
3298
  "Copy Screenshot",
3220
3299
  async () => {
3221
3300
  try {
3222
- return await ki(e.screenshotDataUrl ?? ""), s.textContent = "", s.hidden = !0, !0;
3301
+ return await Ti(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
3223
3302
  } catch {
3224
- return s.textContent = "Could not copy screenshot.", s.hidden = !1, !1;
3303
+ return p.textContent = "Could not copy screenshot.", p.hidden = !1, !1;
3225
3304
  }
3226
3305
  }
3227
3306
  );
3228
- if (g.appendChild(h), p.appendChild(g), e.screenshotDataUrl) {
3307
+ if (g.appendChild(h), s.appendChild(g), e.screenshotDataUrl) {
3229
3308
  const u = document.createElement("div");
3230
3309
  u.className = "pluno-pa-widget__share-dialog-screenshot";
3231
3310
  const S = document.createElement("img");
3232
- S.src = e.screenshotDataUrl, S.alt = "Product page with Pluno open", u.appendChild(S), p.appendChild(u);
3311
+ S.src = e.screenshotDataUrl, S.alt = "Product page with Pluno open", u.appendChild(S), s.appendChild(u);
3233
3312
  }
3234
- i.appendChild(p), i.appendChild(s);
3235
- const E = document.createElement("div");
3236
- E.className = "pluno-pa-widget__share-dialog-step";
3237
- const P = document.createElement("strong");
3238
- P.className = "pluno-pa-widget__share-dialog-step-title", P.textContent = "2) Share on", E.appendChild(P);
3313
+ i.appendChild(s), i.appendChild(p);
3314
+ const C = document.createElement("div");
3315
+ C.className = "pluno-pa-widget__share-dialog-step";
3316
+ const A = document.createElement("strong");
3317
+ A.className = "pluno-pa-widget__share-dialog-step-title", A.textContent = "2) Share on", C.appendChild(A);
3239
3318
  const T = document.createElement("p");
3240
- T.className = "pluno-pa-widget__share-dialog-hint", T.textContent = "Post draft opens prefilled on supported platforms.", E.appendChild(T);
3319
+ T.className = "pluno-pa-widget__share-dialog-hint", T.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(T);
3241
3320
  const O = document.createElement("footer");
3242
3321
  O.className = "pluno-pa-widget__share-dialog-platforms";
3243
- for (const u of Mr(e)) {
3322
+ for (const u of Wr(e)) {
3244
3323
  const S = document.createElement("a");
3245
- S.href = u.href, S.target = "_blank", S.rel = "noopener noreferrer", S.title = u.label, S.setAttribute("aria-label", `Open ${u.label}`), S.appendChild(Or(u.id)), O.appendChild(S);
3324
+ S.href = u.href, S.target = "_blank", S.rel = "noopener noreferrer", S.title = u.label, S.setAttribute("aria-label", `Open ${u.label}`), S.appendChild(Hr(u.id)), O.appendChild(S);
3246
3325
  }
3247
- if (E.appendChild(O), i.appendChild(E), t.socialPostRewardsUrl) {
3326
+ if (C.appendChild(O), i.appendChild(C), t.socialPostRewardsUrl) {
3248
3327
  const u = document.createElement("div");
3249
3328
  u.className = "pluno-pa-widget__share-dialog-step";
3250
3329
  const S = document.createElement("strong");
3251
3330
  S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "3) Submit post to get 2000 free credits!", u.appendChild(S);
3252
3331
  const m = document.createElement("a");
3253
- m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Ur()), u.appendChild(m), i.appendChild(u);
3332
+ m.className = "pluno-pa-widget__share-dialog-reward-link", m.href = t.socialPostRewardsUrl, m.target = "_blank", m.rel = "noopener noreferrer", m.appendChild(document.createTextNode("Submit post URL")), m.appendChild(Gr()), u.appendChild(m), i.appendChild(u);
3254
3333
  }
3255
3334
  return n.appendChild(i), n;
3256
3335
  }
3257
- function zr(e, t) {
3336
+ function Fr(e, t) {
3258
3337
  const n = document.createElement("button");
3259
3338
  return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (i) => {
3260
3339
  i.preventDefault(), i.stopPropagation(), await t() && (n.textContent = "Copied ✓");
3261
3340
  }), n;
3262
3341
  }
3263
- function Mr(e) {
3342
+ function Wr(e) {
3264
3343
  const t = e.linkedinPost.trim(), n = e.xPost.trim();
3265
3344
  return [
3266
3345
  {
@@ -3280,7 +3359,7 @@ function Mr(e) {
3280
3359
  }
3281
3360
  ];
3282
3361
  }
3283
- function Or(e) {
3362
+ function Hr(e) {
3284
3363
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3285
3364
  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" ? (j(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), j(
3286
3365
  t,
@@ -3307,63 +3386,63 @@ function j(e, t, n) {
3307
3386
  const i = document.createElementNS("http://www.w3.org/2000/svg", "path");
3308
3387
  i.setAttribute("d", t), n && i.setAttribute("opacity", n), e.appendChild(i);
3309
3388
  }
3310
- function Ur() {
3389
+ function Gr() {
3311
3390
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3312
3391
  return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), j(e, "M14 5h5v5"), j(e, "M19 5l-8 8"), j(
3313
3392
  e,
3314
3393
  "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"
3315
3394
  ), e;
3316
3395
  }
3317
- function qo(e) {
3318
- return e.role === "tool" && e.toolName === Co;
3396
+ function Yo(e) {
3397
+ return e.role === "tool" && e.toolName === Po;
3319
3398
  }
3320
- function mo(e) {
3399
+ function _o(e) {
3321
3400
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3322
3401
  }
3323
- function Br(e, t, n, i) {
3402
+ function $r(e, t, n, i) {
3324
3403
  const o = document.createElement("article");
3325
3404
  o.className = "pluno-pa-widget__tool-group", o.title = new Date(
3326
3405
  e[e.length - 1].createdAt
3327
3406
  ).toLocaleString(), o.appendChild(
3328
- Ce(
3407
+ Pe(
3329
3408
  "pluno-pa-widget__character--tool-group",
3330
3409
  i
3331
3410
  )
3332
3411
  );
3333
- const r = document.createElement("details"), l = Fr(e);
3412
+ const r = document.createElement("details"), l = qr(e);
3334
3413
  r.open = t.has(l), o.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.addEventListener("toggle", () => {
3335
3414
  o.classList.toggle("pluno-pa-widget__tool-group--open", r.open), r.open ? t.add(l) : t.delete(l), n();
3336
3415
  });
3337
- const s = document.createElement("summary");
3338
- s.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && s.appendChild(wn());
3416
+ const p = document.createElement("summary");
3417
+ p.className = "pluno-pa-widget__tool-summary", e.some((c) => c.loading) && p.appendChild(xn());
3339
3418
  const g = document.createElement("span");
3340
- if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = e[e.length - 1].content || "Run tool", s.appendChild(g), r.appendChild(s), e.length > 0) {
3419
+ if (g.className = "pluno-pa-widget__tool-summary-title", g.textContent = e[e.length - 1].content || "Run tool", p.appendChild(g), r.appendChild(p), e.length > 0) {
3341
3420
  const c = document.createElement("div");
3342
3421
  c.className = "pluno-pa-widget__tool-lines";
3343
3422
  for (const h of e) {
3344
- const E = document.createElement("div");
3345
- E.className = "pluno-pa-widget__tool-line", h.loading && E.appendChild(wn());
3346
- const P = document.createElement("span");
3347
- P.textContent = h.content || "Run tool", E.appendChild(P), c.appendChild(E);
3423
+ const C = document.createElement("div");
3424
+ C.className = "pluno-pa-widget__tool-line", h.loading && C.appendChild(xn());
3425
+ const A = document.createElement("span");
3426
+ A.textContent = h.content || "Run tool", C.appendChild(A), c.appendChild(C);
3348
3427
  }
3349
3428
  r.appendChild(c);
3350
3429
  }
3351
3430
  return o.appendChild(r), o;
3352
3431
  }
3353
- function jo(e) {
3432
+ function Xo(e) {
3354
3433
  const t = document.createElement("article");
3355
3434
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3356
- Ce(
3435
+ Pe(
3357
3436
  "pluno-pa-widget__character--tool-group",
3358
3437
  e
3359
3438
  )
3360
3439
  ), t;
3361
3440
  }
3362
- function fo(e) {
3363
- const t = jo(e);
3364
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Et()), t;
3441
+ function xo(e) {
3442
+ const t = Xo(e);
3443
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Pt()), t;
3365
3444
  }
3366
- function Et(e = "Thinking...") {
3445
+ function Pt(e = "Thinking...") {
3367
3446
  const t = document.createElement("div");
3368
3447
  t.className = "pluno-pa-widget__status";
3369
3448
  const n = document.createElement("span");
@@ -3371,18 +3450,18 @@ function Et(e = "Thinking...") {
3371
3450
  const i = document.createElement("span");
3372
3451
  return i.textContent = e, t.appendChild(i), t;
3373
3452
  }
3374
- function Fr(e) {
3453
+ function qr(e) {
3375
3454
  return `tools:${e[0]?.id ?? ""}`;
3376
3455
  }
3377
- function wn() {
3456
+ function xn() {
3378
3457
  const e = document.createElement("span");
3379
3458
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3380
3459
  }
3381
- function Vo(e, t) {
3382
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? gr() : Wo());
3460
+ function Zo(e, t) {
3461
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? wr() : qo());
3383
3462
  }
3384
- function Wr(e, t) {
3385
- const n = ji(t).replace(/\r\n/g, `
3463
+ function jr(e, t) {
3464
+ const n = Xi(t).replace(/\r\n/g, `
3386
3465
  `).split(`
3387
3466
  `);
3388
3467
  let i = 0;
@@ -3397,46 +3476,46 @@ function Wr(e, t) {
3397
3476
  for (i += 1; i < n.length && !/^```\s*$/.test(n[i]); )
3398
3477
  c.push(n[i]), i += 1;
3399
3478
  i += i < n.length ? 1 : 0;
3400
- const h = document.createElement("pre"), E = document.createElement("code");
3401
- E.textContent = c.join(`
3402
- `), h.appendChild(E), e.appendChild(h);
3479
+ const h = document.createElement("pre"), C = document.createElement("code");
3480
+ C.textContent = c.join(`
3481
+ `), h.appendChild(C), e.appendChild(h);
3403
3482
  continue;
3404
3483
  }
3405
3484
  const l = o.match(/^(#{1,3})\s+(.+)$/);
3406
3485
  if (l) {
3407
3486
  const c = document.createElement(`h${l[1].length + 2}`);
3408
- je(c, l[2]), e.appendChild(c), i += 1;
3487
+ Xe(c, l[2]), e.appendChild(c), i += 1;
3409
3488
  continue;
3410
3489
  }
3411
3490
  if (/^\s*[-*+]\s+/.test(o)) {
3412
3491
  const c = document.createElement("ul");
3413
3492
  for (; i < n.length && /^\s*[-*+]\s+/.test(n[i]); ) {
3414
3493
  const h = document.createElement("li");
3415
- je(h, n[i].replace(/^\s*[-*+]\s+/, "")), c.appendChild(h), i += 1;
3494
+ Xe(h, n[i].replace(/^\s*[-*+]\s+/, "")), c.appendChild(h), i += 1;
3416
3495
  }
3417
3496
  e.appendChild(c);
3418
3497
  continue;
3419
3498
  }
3420
- const s = o.match(/^\s*(\d+)\.\s+/);
3421
- if (s) {
3499
+ const p = o.match(/^\s*(\d+)\.\s+/);
3500
+ if (p) {
3422
3501
  const c = document.createElement("ol");
3423
- for (c.start = Number(s[1]); i < n.length && /^\s*\d+\.\s+/.test(n[i]); ) {
3502
+ for (c.start = Number(p[1]); i < n.length && /^\s*\d+\.\s+/.test(n[i]); ) {
3424
3503
  const h = document.createElement("li");
3425
- je(h, n[i].replace(/^\s*\d+\.\s+/, "")), c.appendChild(h), i += 1;
3504
+ Xe(h, n[i].replace(/^\s*\d+\.\s+/, "")), c.appendChild(h), i += 1;
3426
3505
  }
3427
3506
  e.appendChild(c);
3428
3507
  continue;
3429
3508
  }
3430
- const p = [o];
3509
+ const s = [o];
3431
3510
  for (i += 1; i < n.length && n[i].trim() && !/^```/.test(n[i]) && !/^(#{1,3})\s+/.test(n[i]) && !/^\s*[-*+]\s+/.test(n[i]) && !/^\s*\d+\.\s+/.test(n[i]); )
3432
- p.push(n[i]), i += 1;
3511
+ s.push(n[i]), i += 1;
3433
3512
  const g = document.createElement("p");
3434
- p.forEach((c, h) => {
3435
- h > 0 && g.appendChild(document.createElement("br")), je(g, c);
3513
+ s.forEach((c, h) => {
3514
+ h > 0 && g.appendChild(document.createElement("br")), Xe(g, c);
3436
3515
  }), e.appendChild(g);
3437
3516
  }
3438
3517
  }
3439
- function je(e, t) {
3518
+ function Xe(e, t) {
3440
3519
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3441
3520
  let i = 0;
3442
3521
  for (const o of t.matchAll(n)) {
@@ -3446,19 +3525,19 @@ function je(e, t) {
3446
3525
  );
3447
3526
  const l = o[0];
3448
3527
  if (l.startsWith("`")) {
3449
- const s = document.createElement("code");
3450
- s.textContent = l.slice(1, -1), e.appendChild(s);
3528
+ const p = document.createElement("code");
3529
+ p.textContent = l.slice(1, -1), e.appendChild(p);
3451
3530
  } else if (l.startsWith("**")) {
3452
- const s = document.createElement("strong");
3453
- je(s, l.slice(2, -2)), e.appendChild(s);
3531
+ const p = document.createElement("strong");
3532
+ Xe(p, l.slice(2, -2)), e.appendChild(p);
3454
3533
  } else if (l.startsWith("*")) {
3455
- const s = document.createElement("em");
3456
- je(s, l.slice(1, -1)), e.appendChild(s);
3534
+ const p = document.createElement("em");
3535
+ Xe(p, l.slice(1, -1)), e.appendChild(p);
3457
3536
  } else {
3458
- const s = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3459
- if (s && Hr(s[2])) {
3460
- const p = document.createElement("a");
3461
- p.href = s[2], p.target = "_top", p.rel = "noreferrer", p.textContent = s[1], e.appendChild(p);
3537
+ const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3538
+ if (p && Vr(p[2])) {
3539
+ const s = document.createElement("a");
3540
+ s.href = p[2], s.target = "_top", s.rel = "noreferrer", s.textContent = p[1], e.appendChild(s);
3462
3541
  } else
3463
3542
  e.appendChild(document.createTextNode(l));
3464
3543
  }
@@ -3466,7 +3545,7 @@ function je(e, t) {
3466
3545
  }
3467
3546
  i < t.length && e.appendChild(document.createTextNode(t.slice(i)));
3468
3547
  }
3469
- function Hr(e) {
3548
+ function Vr(e) {
3470
3549
  if (e.startsWith("/") || e.startsWith("#"))
3471
3550
  return !0;
3472
3551
  try {
@@ -3476,8 +3555,8 @@ function Hr(e) {
3476
3555
  return !1;
3477
3556
  }
3478
3557
  }
3479
- function wo(e, t) {
3480
- if (Gr(e))
3558
+ function yo(e, t) {
3559
+ if (Kr(e))
3481
3560
  return;
3482
3561
  const n = `
3483
3562
  :host {
@@ -4238,6 +4317,69 @@ function wo(e, t) {
4238
4317
  overflow-wrap: anywhere;
4239
4318
  word-break: break-word;
4240
4319
  }
4320
+ .pluno-pa-widget__integration-auth-card {
4321
+ display: grid;
4322
+ gap: 12px;
4323
+ border: 1px solid var(--pluno-pa-divider);
4324
+ border-radius: 14px;
4325
+ background: var(--pluno-pa-surface);
4326
+ padding: 14px;
4327
+ color: var(--pluno-pa-text);
4328
+ }
4329
+ .pluno-pa-widget__integration-auth-header {
4330
+ display: flex;
4331
+ align-items: center;
4332
+ gap: 10px;
4333
+ min-width: 0;
4334
+ }
4335
+ .pluno-pa-widget__integration-auth-logo {
4336
+ width: 34px;
4337
+ height: 34px;
4338
+ flex: 0 0 auto;
4339
+ border-radius: 8px;
4340
+ object-fit: contain;
4341
+ background: #fff;
4342
+ }
4343
+ .pluno-pa-widget__integration-auth-header > div {
4344
+ display: grid;
4345
+ gap: 2px;
4346
+ min-width: 0;
4347
+ }
4348
+ .pluno-pa-widget__integration-auth-header strong {
4349
+ font-size: 14px;
4350
+ line-height: 1.3;
4351
+ }
4352
+ .pluno-pa-widget__integration-auth-header span {
4353
+ color: var(--pluno-pa-muted);
4354
+ font-size: 12px;
4355
+ line-height: 1.4;
4356
+ }
4357
+ .pluno-pa-widget__integration-auth-error {
4358
+ color: var(--pluno-pa-danger, #dc2626);
4359
+ font-size: 12px;
4360
+ line-height: 1.4;
4361
+ }
4362
+ .pluno-pa-widget__integration-auth-button {
4363
+ width: fit-content;
4364
+ min-height: 34px;
4365
+ border: 0;
4366
+ border-radius: 9px;
4367
+ background: var(--pluno-pa-accent);
4368
+ padding: 7px 12px;
4369
+ color: #fff;
4370
+ font: inherit;
4371
+ font-size: 13px;
4372
+ font-weight: 700;
4373
+ cursor: pointer;
4374
+ }
4375
+ .pluno-pa-widget__integration-auth-button:hover:not(:disabled),
4376
+ .pluno-pa-widget__integration-auth-button:focus-visible:not(:disabled) {
4377
+ filter: brightness(1.08);
4378
+ }
4379
+ .pluno-pa-widget__integration-auth-button:disabled {
4380
+ cursor: default;
4381
+ opacity: 0.65;
4382
+ }
4241
4383
  .pluno-pa-widget__message::after {
4242
4384
  content: "";
4243
4385
  position: absolute;
@@ -5459,8 +5601,8 @@ function wo(e, t) {
5459
5601
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5460
5602
  position: absolute;
5461
5603
  top: -16px;
5462
- left: ${cn}px;
5463
- width: calc(100% - ${cn * 2}px);
5604
+ left: ${hn}px;
5605
+ width: calc(100% - ${hn * 2}px);
5464
5606
  height: 36px;
5465
5607
  z-index: 3;
5466
5608
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -5552,6 +5694,23 @@ function wo(e, t) {
5552
5694
  position: relative;
5553
5695
  border-radius: var(--pluno-pa-scribble-wobble);
5554
5696
  }
5697
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-card {
5698
+ position: relative;
5699
+ border-radius: var(--pluno-pa-scribble-wobble-alt);
5700
+ transform: rotate(-0.25deg);
5701
+ }
5702
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-header strong {
5703
+ font-size: 17px;
5704
+ }
5705
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-header span,
5706
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-error {
5707
+ font-size: 15px;
5708
+ }
5709
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-button {
5710
+ position: relative;
5711
+ color: var(--pluno-pa-text);
5712
+ font-size: 16px;
5713
+ }
5555
5714
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button {
5556
5715
  position: relative;
5557
5716
  border-radius: var(--pluno-pa-scribble-wobble);
@@ -5597,6 +5756,8 @@ function wo(e, t) {
5597
5756
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
5598
5757
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card,
5599
5758
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button,
5759
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-card,
5760
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-button,
5600
5761
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body,
5601
5762
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable) {
5602
5763
  isolation: isolate;
@@ -5618,6 +5779,8 @@ function wo(e, t) {
5618
5779
  .pluno-pa-widget--scribble .pluno-pa-widget__close::before,
5619
5780
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card::before,
5620
5781
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::before,
5782
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-card::before,
5783
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-button::before,
5621
5784
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-body::before,
5622
5785
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::before {
5623
5786
  content: "";
@@ -5637,6 +5800,10 @@ function wo(e, t) {
5637
5800
  .pluno-pa-widget--scribble .pluno-pa-widget__send::before {
5638
5801
  background: var(--pluno-pa-accent);
5639
5802
  }
5803
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-button::before {
5804
+ border-color: var(--pluno-pa-text);
5805
+ background: var(--pluno-pa-surface);
5806
+ }
5640
5807
  .pluno-pa-widget--scribble .pluno-pa-widget__send:disabled {
5641
5808
  color: var(--pluno-pa-faint);
5642
5809
  }
@@ -5678,6 +5845,7 @@ function wo(e, t) {
5678
5845
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy,
5679
5846
  .pluno-pa-widget--scribble .pluno-pa-widget__close,
5680
5847
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button,
5848
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-button,
5681
5849
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable) {
5682
5850
  border-radius: 43% 57% 39% 61% / 59% 41% 58% 42%;
5683
5851
  }
@@ -5688,6 +5856,7 @@ function wo(e, t) {
5688
5856
  .pluno-pa-widget--scribble .pluno-pa-widget__message-copy::after,
5689
5857
  .pluno-pa-widget--scribble .pluno-pa-widget__close::after,
5690
5858
  .pluno-pa-widget--scribble .pluno-pa-widget__billing-action-card-actions button::after,
5859
+ .pluno-pa-widget--scribble .pluno-pa-widget__integration-auth-button::after,
5691
5860
  .pluno-pa-widget--scribble .pluno-pa-widget__share-prompt-actions button:not(.pluno-pa-widget__share-prompt-disable)::after {
5692
5861
  content: "";
5693
5862
  position: absolute;
@@ -5810,28 +5979,28 @@ function wo(e, t) {
5810
5979
  filter: url(#pluno-pa-scribble-wobble-2);
5811
5980
  }
5812
5981
  `;
5813
- if ($r(e, n))
5982
+ if (Yr(e, n))
5814
5983
  return;
5815
5984
  const i = e.ownerDocument.createElement("style");
5816
- i.id = Ro, i.textContent = n, e.appendChild(i), Ko(e);
5985
+ i.id = Oo, i.textContent = n, e.appendChild(i), Jo(e);
5817
5986
  }
5818
- function Gr(e) {
5819
- return e.getElementById(Ro) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Do) === "true";
5987
+ function Kr(e) {
5988
+ return e.getElementById(Oo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Uo) === "true";
5820
5989
  }
5821
- function Ko(e) {
5822
- e.host instanceof HTMLElement && e.host.setAttribute(Do, "true");
5990
+ function Jo(e) {
5991
+ e.host instanceof HTMLElement && e.host.setAttribute(Uo, "true");
5823
5992
  }
5824
- function $r(e, t) {
5993
+ function Yr(e, t) {
5825
5994
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
5826
5995
  return !1;
5827
5996
  try {
5828
5997
  const n = new CSSStyleSheet();
5829
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Ko(e), !0;
5998
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], Jo(e), !0;
5830
5999
  } catch {
5831
6000
  return !1;
5832
6001
  }
5833
6002
  }
5834
- async function qr() {
6003
+ async function Xr() {
5835
6004
  return document.body ? document.body : await new Promise((e) => {
5836
6005
  const t = new MutationObserver(() => {
5837
6006
  document.body && (t.disconnect(), e(document.body));
@@ -5839,25 +6008,25 @@ async function qr() {
5839
6008
  t.observe(document.documentElement, { childList: !0 });
5840
6009
  });
5841
6010
  }
5842
- function vn(e) {
6011
+ function En(e) {
5843
6012
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
5844
6013
  }
5845
- function Yo(e) {
5846
- return `${vn(e)}.displayState`;
6014
+ function Qo(e) {
6015
+ return `${En(e)}.displayState`;
5847
6016
  }
5848
- function jr(e) {
6017
+ function Zr(e) {
5849
6018
  try {
5850
6019
  return window.sessionStorage.getItem(
5851
- Yo(e)
6020
+ Qo(e)
5852
6021
  ) === "minimized" ? "minimized" : "shown";
5853
6022
  } catch {
5854
6023
  return "shown";
5855
6024
  }
5856
6025
  }
5857
- function bo(e, t) {
6026
+ function vo(e, t) {
5858
6027
  if (e.layout === "floating")
5859
6028
  try {
5860
- const n = Yo(e);
6029
+ const n = Qo(e);
5861
6030
  if (t === "minimized") {
5862
6031
  window.sessionStorage.setItem(n, t);
5863
6032
  return;
@@ -5867,15 +6036,15 @@ function bo(e, t) {
5867
6036
  return;
5868
6037
  }
5869
6038
  }
5870
- function Vr(e) {
6039
+ function Jr(e) {
5871
6040
  if (e)
5872
6041
  return { clientId: e, release: () => {
5873
6042
  } };
5874
6043
  let t = 0;
5875
- for (; Yt.has(t); )
6044
+ for (; Jt.has(t); )
5876
6045
  t += 1;
5877
- Yt.add(t);
5878
- const n = `${la}${t}`;
6046
+ Jt.add(t);
6047
+ const n = `${ca}${t}`;
5879
6048
  let i = crypto.randomUUID();
5880
6049
  try {
5881
6050
  i = window.sessionStorage.getItem(n) ?? i, window.sessionStorage.setItem(n, i);
@@ -5885,15 +6054,15 @@ function Vr(e) {
5885
6054
  return {
5886
6055
  clientId: i,
5887
6056
  release: () => {
5888
- o || (o = !0, Yt.delete(t));
6057
+ o || (o = !0, Jt.delete(t));
5889
6058
  }
5890
6059
  };
5891
6060
  }
5892
- function Kr(e) {
6061
+ function Qr(e) {
5893
6062
  try {
5894
- const t = window.localStorage.getItem(vn(e));
6063
+ const t = window.localStorage.getItem(En(e));
5895
6064
  if (!t)
5896
- return _o();
6065
+ return So();
5897
6066
  const n = JSON.parse(t);
5898
6067
  return {
5899
6068
  isOpen: n.isOpen === !0,
@@ -5903,25 +6072,25 @@ function Kr(e) {
5903
6072
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
5904
6073
  (i) => typeof i == "string"
5905
6074
  ) : [],
5906
- launcherPosition: Jr(n.launcherPosition) ? n.launcherPosition : null,
5907
- panelSize: Qr(n.panelSize) ? kt(n.panelSize) : null,
5908
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-Eo) : [],
6075
+ launcherPosition: ol(n.launcherPosition) ? n.launcherPosition : null,
6076
+ panelSize: il(n.panelSize) ? At(n.panelSize) : null,
6077
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-Ao) : [],
5909
6078
  sharePromptsDisabled: n.sharePromptsDisabled === !0
5910
6079
  };
5911
6080
  } catch {
5912
- return _o();
6081
+ return So();
5913
6082
  }
5914
6083
  }
5915
- async function Yr(e) {
6084
+ async function el(e) {
5916
6085
  if (e.loadSharePromptsDisabled)
5917
6086
  return e.loadSharePromptsDisabled();
5918
6087
  try {
5919
- return window.localStorage.getItem(Lo) === "true";
6088
+ return window.localStorage.getItem(No) === "true";
5920
6089
  } catch {
5921
6090
  return !1;
5922
6091
  }
5923
6092
  }
5924
- function Xr(e, t) {
6093
+ function tl(e, t) {
5925
6094
  if (e.persistSharePromptsDisabled) {
5926
6095
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
5927
6096
  () => {
@@ -5930,12 +6099,12 @@ function Xr(e, t) {
5930
6099
  return;
5931
6100
  }
5932
6101
  try {
5933
- t && window.localStorage.setItem(Lo, "true");
6102
+ t && window.localStorage.setItem(No, "true");
5934
6103
  } catch {
5935
6104
  return;
5936
6105
  }
5937
6106
  }
5938
- function _o() {
6107
+ function So() {
5939
6108
  return {
5940
6109
  isOpen: !1,
5941
6110
  composerValue: "",
@@ -5948,29 +6117,29 @@ function _o() {
5948
6117
  sharePromptsDisabled: !1
5949
6118
  };
5950
6119
  }
5951
- function Zr(e, t) {
6120
+ function nl(e, t) {
5952
6121
  try {
5953
6122
  window.localStorage.setItem(
5954
- vn(e),
6123
+ En(e),
5955
6124
  JSON.stringify(t)
5956
6125
  );
5957
6126
  } catch {
5958
6127
  return;
5959
6128
  }
5960
6129
  }
5961
- function Jr(e) {
6130
+ function ol(e) {
5962
6131
  if (!e || typeof e != "object")
5963
6132
  return !1;
5964
6133
  const t = e;
5965
6134
  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");
5966
6135
  }
5967
- function Qr(e) {
6136
+ function il(e) {
5968
6137
  if (!e || typeof e != "object")
5969
6138
  return !1;
5970
6139
  const t = e;
5971
6140
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
5972
6141
  }
5973
- async function Xo(e, t) {
6142
+ async function ei(e, t) {
5974
6143
  const n = await fetch(e, {
5975
6144
  method: "POST",
5976
6145
  credentials: "include",
@@ -5982,7 +6151,7 @@ async function Xo(e, t) {
5982
6151
  ...t ? { signal: t } : {}
5983
6152
  });
5984
6153
  if (!n.ok) {
5985
- const o = await n.text(), r = bi(o);
6154
+ const o = await n.text(), r = vi(o);
5986
6155
  throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
5987
6156
  }
5988
6157
  const i = await n.json();
@@ -5990,15 +6159,15 @@ async function Xo(e, t) {
5990
6159
  throw new Error("Pluno token endpoint did not return a token");
5991
6160
  return i.token;
5992
6161
  }
5993
- function el(e) {
6162
+ function al(e) {
5994
6163
  let t = !1, n = !1;
5995
6164
  const i = async () => {
5996
6165
  const o = new AbortController();
5997
6166
  let r = !1;
5998
- const l = new Promise((s, p) => {
6167
+ const l = new Promise((p, s) => {
5999
6168
  const g = window.setTimeout(() => {
6000
- r = !0, o.abort(), p(new Error(jn));
6001
- }, aa);
6169
+ r = !0, o.abort(), s(new Error(Xn));
6170
+ }, pa);
6002
6171
  o.signal.addEventListener(
6003
6172
  "abort",
6004
6173
  () => window.clearTimeout(g),
@@ -6006,13 +6175,13 @@ function el(e) {
6006
6175
  );
6007
6176
  });
6008
6177
  try {
6009
- const s = await Promise.race([
6010
- Xo(e, o.signal),
6178
+ const p = await Promise.race([
6179
+ ei(e, o.signal),
6011
6180
  l
6012
6181
  ]);
6013
- return o.abort(), s;
6014
- } catch (s) {
6015
- throw o.abort(), r ? new Error(jn) : s instanceof Error && s.message.startsWith("Pluno widget blocked on ") ? s : new Error(ra);
6182
+ return o.abort(), p;
6183
+ } catch (p) {
6184
+ throw o.abort(), r ? new Error(Xn) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(da);
6016
6185
  }
6017
6186
  };
6018
6187
  return {
@@ -6035,32 +6204,32 @@ function el(e) {
6035
6204
  }
6036
6205
  };
6037
6206
  }
6038
- const xo = /* @__PURE__ */ new WeakSet();
6039
- function tl(e) {
6207
+ const Co = /* @__PURE__ */ new WeakSet();
6208
+ function rl(e) {
6040
6209
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
6041
6210
  }
6042
- function yo(e) {
6211
+ function Eo(e) {
6043
6212
  const t = e.pathname.split("/");
6044
6213
  return t[t.length - 1] ?? "";
6045
6214
  }
6046
- function nl(e, t) {
6215
+ function ll(e, t) {
6047
6216
  const n = new URL(e.src, document.baseURI);
6048
- return n.href === t.href || n.pathname === t.pathname ? !0 : yo(n) === yo(t);
6217
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Eo(n) === Eo(t);
6049
6218
  }
6050
- class _e extends EventTarget {
6219
+ class xe extends EventTarget {
6051
6220
  constructor(t, n) {
6052
- super(), this.channelId = n, this.url = t, this.addPreviewListener(ea, () => {
6053
- this.readyState = _e.OPEN, this.dispatchEvent(new Event("open"));
6054
- }), this.addPreviewListener(ta, (i) => {
6221
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(ia, () => {
6222
+ this.readyState = xe.OPEN, this.dispatchEvent(new Event("open"));
6223
+ }), this.addPreviewListener(aa, (i) => {
6055
6224
  const o = i;
6056
6225
  this.dispatchEvent(
6057
6226
  new MessageEvent("message", { data: o.detail?.data ?? "" })
6058
6227
  );
6059
- }), this.addPreviewListener(na, () => {
6060
- this.readyState = _e.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
6061
- }), this.addPreviewListener(oa, (i) => {
6228
+ }), this.addPreviewListener(ra, () => {
6229
+ this.readyState = xe.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
6230
+ }), this.addPreviewListener(la, (i) => {
6062
6231
  const o = i;
6063
- this.readyState = _e.CLOSED, this.dispatchEvent(
6232
+ this.readyState = xe.CLOSED, this.dispatchEvent(
6064
6233
  new CloseEvent("close", {
6065
6234
  code: o.detail?.code ?? 1e3,
6066
6235
  reason: o.detail?.reason ?? "",
@@ -6069,8 +6238,8 @@ class _e extends EventTarget {
6069
6238
  ), this.cleanup();
6070
6239
  }), window.dispatchEvent(
6071
6240
  new CustomEvent(
6072
- xt(
6073
- Zi,
6241
+ St(
6242
+ ta,
6074
6243
  this.channelId
6075
6244
  ),
6076
6245
  {
@@ -6089,18 +6258,18 @@ class _e extends EventTarget {
6089
6258
  extensions = "";
6090
6259
  binaryType = "blob";
6091
6260
  bufferedAmount = 0;
6092
- readyState = _e.CONNECTING;
6093
- socketId = ol();
6261
+ readyState = xe.CONNECTING;
6262
+ socketId = sl();
6094
6263
  listeners = /* @__PURE__ */ new Map();
6095
6264
  send(t) {
6096
- if (this.readyState !== _e.OPEN)
6265
+ if (this.readyState !== xe.OPEN)
6097
6266
  throw new DOMException(
6098
6267
  "Pluno preview websocket is not open",
6099
6268
  "InvalidStateError"
6100
6269
  );
6101
6270
  window.dispatchEvent(
6102
6271
  new CustomEvent(
6103
- xt(Ji, this.channelId),
6272
+ St(na, this.channelId),
6104
6273
  {
6105
6274
  detail: {
6106
6275
  socketId: this.socketId,
@@ -6111,9 +6280,9 @@ class _e extends EventTarget {
6111
6280
  );
6112
6281
  }
6113
6282
  close(t, n) {
6114
- this.readyState !== _e.CLOSED && (this.readyState = _e.CLOSING, window.dispatchEvent(
6283
+ this.readyState !== xe.CLOSED && (this.readyState = xe.CLOSING, window.dispatchEvent(
6115
6284
  new CustomEvent(
6116
- xt(Qi, this.channelId),
6285
+ St(oa, this.channelId),
6117
6286
  {
6118
6287
  detail: { socketId: this.socketId, code: t, reason: n }
6119
6288
  }
@@ -6121,7 +6290,7 @@ class _e extends EventTarget {
6121
6290
  ), this.cleanup());
6122
6291
  }
6123
6292
  addPreviewListener(t, n) {
6124
- const i = xt(
6293
+ const i = St(
6125
6294
  t,
6126
6295
  this.channelId
6127
6296
  ), o = (r) => {
@@ -6135,19 +6304,19 @@ class _e extends EventTarget {
6135
6304
  this.listeners.clear();
6136
6305
  }
6137
6306
  }
6138
- function ol() {
6307
+ function sl() {
6139
6308
  const e = window.sessionStorage.getItem(
6140
- qn
6309
+ Yn
6141
6310
  );
6142
6311
  if (e)
6143
6312
  return e;
6144
6313
  const t = crypto.randomUUID();
6145
- return window.sessionStorage.setItem(qn, t), t;
6314
+ return window.sessionStorage.setItem(Yn, t), t;
6146
6315
  }
6147
- function xt(e, t) {
6316
+ function St(e, t) {
6148
6317
  return `${e}:${t}`;
6149
6318
  }
6150
- function il(e) {
6319
+ function pl(e) {
6151
6320
  const t = document.currentScript;
6152
6321
  if (t instanceof HTMLScriptElement)
6153
6322
  return [t];
@@ -6155,65 +6324,65 @@ function il(e) {
6155
6324
  return Array.from(
6156
6325
  document.querySelectorAll("script[type='module'][src]")
6157
6326
  ).filter(
6158
- (o) => o instanceof HTMLScriptElement && tl(o) && nl(o, i)
6327
+ (o) => o instanceof HTMLScriptElement && rl(o) && ll(o, i)
6159
6328
  );
6160
6329
  }
6161
- function al(e) {
6162
- for (const t of il(e))
6163
- xo.has(t) || t.dataset.plunoAutoMount === "false" || (xo.add(t), Zo(t).catch((n) => {
6330
+ function dl(e) {
6331
+ for (const t of pl(e))
6332
+ Co.has(t) || t.dataset.plunoAutoMount === "false" || (Co.add(t), ti(t).catch((n) => {
6164
6333
  console.error("Failed to mount Pluno widget", n);
6165
6334
  }));
6166
6335
  }
6167
- function Zo(e) {
6168
- const t = window, n = t[be];
6336
+ function ti(e) {
6337
+ const t = window, n = t[_e];
6169
6338
  if (n) {
6170
6339
  if (n.host === null)
6171
6340
  return n.mountPromise.catch(() => {
6172
- const p = t[be];
6173
- return p ? p.mountPromise : Zo(e);
6341
+ const s = t[_e];
6342
+ return s ? s.mountPromise : ti(e);
6174
6343
  });
6175
- if (rl(n.host))
6344
+ if (cl(n.host))
6176
6345
  return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
6177
- n.destroy?.(), delete t[be];
6346
+ n.destroy?.(), delete t[_e];
6178
6347
  }
6179
- const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? el(o) : null;
6348
+ const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? al(o) : null;
6180
6349
  let l;
6181
- const s = La({
6350
+ const p = Na({
6182
6351
  token: e.dataset.plunoToken,
6183
6352
  tokenProvider: r?.loadToken,
6184
6353
  tokenEndpoint: o,
6185
6354
  backendUrl: e.dataset.plunoBackendUrl,
6186
- webSocketFactory: i ? ka(i) : void 0,
6355
+ webSocketFactory: i ? Ta(i) : void 0,
6187
6356
  launcherLabel: e.dataset.plunoLauncherLabel,
6188
6357
  accentColor: e.dataset.plunoAccentColor,
6189
6358
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
6190
6359
  fontFamily: e.dataset.plunoFontFamily,
6191
6360
  scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
6192
6361
  position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
6193
- }).then((p) => {
6194
- if (t[be] !== l) {
6195
- p.destroy();
6362
+ }).then((s) => {
6363
+ if (t[_e] !== l) {
6364
+ s.destroy();
6196
6365
  return;
6197
6366
  }
6198
- const g = p.host;
6199
- g.setAttribute(ko, "true"), l.host = g, l.destroy = () => {
6200
- t[be] === l && delete t[be], l.host = null, l.destroy = null, p.destroy();
6367
+ const g = s.host;
6368
+ g.setAttribute(To, "true"), l.host = g, l.destroy = () => {
6369
+ t[_e] === l && delete t[_e], l.host = null, l.destroy = null, s.destroy();
6201
6370
  };
6202
- }).catch((p) => {
6203
- throw t[be] === l && delete t[be], p;
6371
+ }).catch((s) => {
6372
+ throw t[_e] === l && delete t[_e], s;
6204
6373
  });
6205
6374
  return l = {
6206
- mountPromise: s,
6375
+ mountPromise: p,
6207
6376
  host: null,
6208
6377
  destroy: null,
6209
6378
  retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
6210
- }, t[be] = l, s;
6379
+ }, t[_e] = l, p;
6211
6380
  }
6212
- function rl(e) {
6213
- return e.isConnected && e.getAttribute(ko) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6381
+ function cl(e) {
6382
+ return e.isConnected && e.getAttribute(To) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6214
6383
  }
6215
- al(import.meta.url);
6384
+ dl(import.meta.url);
6216
6385
  export {
6217
- ka as createProductAgentPreviewBridgeWebSocketFactory,
6218
- La as mountPlunoProductAgentWidget
6386
+ Ta as createProductAgentPreviewBridgeWebSocketFactory,
6387
+ Na as mountPlunoProductAgentWidget
6219
6388
  };