@pluno/product-agent-web 0.1.120 → 0.1.121

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,17 +1,17 @@
1
- import { PlunoProductAgent as zi, getProductAgentOriginAccessErrorMessage as Mi } from "./product-agent-sdk.js";
2
- const Di = "#7c3aed", zt = "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", Mt = "#2c2a1e", no = [253, 250, 241], oo = 3.5;
3
- function Uo(e) {
4
- const t = Bo(e);
5
- if (io(mt(t), no) >= oo)
1
+ import { PlunoProductAgent as Di, getProductAgentOriginAccessErrorMessage as Oi } from "./product-agent-sdk.js";
2
+ const Ui = "#7c3aed", Dt = "M547 151 C516 151 493 169 485 199 L382 606 C373 641 396 666 431 666 L523 666 C552 666 568 684 563 713 L491 1028 C486 1054 510 1067 527 1044 L894 487 C915 455 894 432 856 432 L815 432 C784 432 773 411 789 382 L904 205 C922 171 901 145 859 145 Z", Ot = "#2c2a1e", io = [253, 250, 241], ao = 3.5;
3
+ function Fo(e) {
4
+ const t = Wo(e);
5
+ if (ro(ft(t), io) >= ao)
6
6
  return t;
7
- let i = mt(t);
8
- const o = mt(Mt);
7
+ let i = ft(t);
8
+ const o = ft(Ot);
9
9
  for (let r = 0; r < 6; r += 1)
10
- if (i = Bi(i, o, 0.22), io(i, no) >= oo)
11
- return xn(i);
12
- return xn(i);
10
+ if (i = Wi(i, o, 0.22), ro(i, io) >= ao)
11
+ return vn(i);
12
+ return vn(i);
13
13
  }
14
- function Oi() {
14
+ function Bi() {
15
15
  let n = "M 280 120", i = !1, o = 0;
16
16
  for (let r = 150; r <= 1170; r += 62) {
17
17
  const l = (o % 3 - 1) * 18, p = i ? 280 - l : 1020 + l;
@@ -19,8 +19,8 @@ function Oi() {
19
19
  }
20
20
  return n;
21
21
  }
22
- function Ui(e) {
23
- const t = Bo(e), n = yn(mt(t));
22
+ function Fi(e) {
23
+ const t = Wo(e), n = Sn(ft(t));
24
24
  return n > 0.86 ? {
25
25
  top: "#ffffff",
26
26
  middle: "#f6f6f6",
@@ -56,34 +56,34 @@ function Ui(e) {
56
56
  shadow: de(t, -0.25, -0.08)
57
57
  };
58
58
  }
59
- function Bo(e) {
59
+ function Wo(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()}` : Di;
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()}` : Ui;
62
62
  }
63
- function mt(e) {
63
+ function ft(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 xn([e, t, n]) {
70
+ function vn([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 yn([e, t, n]) {
74
+ function Sn([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 io(e, t) {
82
- const n = yn(e), i = yn(t), [o, r] = n > i ? [n, i] : [i, n];
81
+ function ro(e, t) {
82
+ const n = Sn(e), i = Sn(t), [o, r] = n > i ? [n, i] : [i, n];
83
83
  return (o + 0.05) / (r + 0.05);
84
84
  }
85
- function Bi(e, t, n) {
86
- const i = vn(n);
85
+ function Wi(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 Bi(e, t, n) {
91
91
  ];
92
92
  }
93
93
  function de(e, t, n) {
94
- const [i, o, r] = Fi(mt(e));
95
- return xn(Wi(i, vn(o + n), vn(r + t)));
94
+ const [i, o, r] = Hi(ft(e));
95
+ return vn($i(i, Cn(o + n), Cn(r + t)));
96
96
  }
97
- function Fi([e, t, n]) {
97
+ function Hi([e, t, n]) {
98
98
  const i = e / 255, o = t / 255, r = n / 255, l = Math.max(i, o, r), p = Math.min(i, o, r), d = (l + p) / 2;
99
99
  if (l === p)
100
100
  return [0, 0, d];
101
101
  const c = l - p, g = d > 0.5 ? c / (2 - l - p) : c / (l + p);
102
102
  return [(l === i ? (o - r) / c + (o < r ? 6 : 0) : l === o ? (r - i) / c + 2 : (i - o) / c + 4) / 6, g, d];
103
103
  }
104
- function Wi(e, t, n) {
104
+ function $i(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
- pn(o, i, e + 1 / 3) * 255,
110
- pn(o, i, e) * 255,
111
- pn(o, i, e - 1 / 3) * 255
109
+ cn(o, i, e + 1 / 3) * 255,
110
+ cn(o, i, e) * 255,
111
+ cn(o, i, e - 1 / 3) * 255
112
112
  ];
113
113
  }
114
- function pn(e, t, n) {
114
+ function cn(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 vn(e) {
118
+ function Cn(e) {
119
119
  return Math.max(0, Math.min(1, e));
120
120
  }
121
- const Fo = "suggest_share_on_socials";
122
- function Hi(e) {
121
+ const Ho = "suggest_share_on_socials";
122
+ function Gi(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 !== Fo)
125
+ if (n.role !== "tool" || n.toolName !== Ho)
126
126
  continue;
127
- const i = ao(e, t, "assistant");
127
+ const i = lo(e, t, "assistant");
128
128
  if (!i)
129
129
  return null;
130
- const o = ao(e, i.index, "user");
130
+ const o = lo(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 Hi(e) {
136
136
  }
137
137
  return null;
138
138
  }
139
- function $i(e) {
139
+ function qi(e) {
140
140
  let t = 2166136261;
141
141
  for (const n of e)
142
142
  t ^= n.charCodeAt(0), t = Math.imul(t, 16777619);
143
143
  return (t >>> 0) % 2 === 0 ? "referral" : "social";
144
144
  }
145
- function ao(e, t, n) {
145
+ function lo(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,15 +150,15 @@ function ao(e, t, n) {
150
150
  }
151
151
  return null;
152
152
  }
153
- const Gi = "https://app.pluno.ai", qi = "/api/product-agent/embed/active-users", ji = 1800, Vi = 15e3, Ki = 250, Yi = 1e3, Xi = 3e4;
154
- function Zi(e, t = {}) {
153
+ const ji = "https://app.pluno.ai", Vi = "/api/product-agent/embed/active-users", Ki = 1800, Yi = 15e3, Xi = 250, Zi = 1e3, Ji = 3e4;
154
+ function Qi(e, t = {}) {
155
155
  let n = !1, i = null, o = null, r = null;
156
156
  const l = () => {
157
157
  r !== null && (window.clearInterval(r), r = null);
158
158
  }, p = (g) => {
159
159
  n || (o !== null && window.clearTimeout(o), o = window.setTimeout(() => {
160
160
  c();
161
- }, ea(g)));
161
+ }, na(g)));
162
162
  }, d = (g) => {
163
163
  if (l(), i === null) {
164
164
  i = g, e(g);
@@ -170,50 +170,50 @@ function Zi(e, t = {}) {
170
170
  l();
171
171
  return;
172
172
  }
173
- const y = Math.min(1, (performance.now() - f) / ji);
174
- i = Math.round(h + (g - h) * ta(y)), e(i), y >= 1 && (i = g, e(g), l());
175
- }, Ki);
173
+ const x = Math.min(1, (performance.now() - f) / Ki);
174
+ i = Math.round(h + (g - h) * oa(x)), e(i), x >= 1 && (i = g, e(g), l());
175
+ }, Xi);
176
176
  }, c = async () => {
177
177
  try {
178
- const g = await Ji(t);
178
+ const g = await ea(t);
179
179
  if (n)
180
180
  return;
181
181
  d(g.count), p(g.refreshAfterMs);
182
182
  } catch {
183
- p(Vi);
183
+ p(Yi);
184
184
  }
185
185
  };
186
186
  return c(), () => {
187
187
  n = !0, o !== null && window.clearTimeout(o), l();
188
188
  };
189
189
  }
190
- async function Ji(e) {
190
+ async function ea(e) {
191
191
  if (e.loader)
192
192
  return e.loader();
193
- const n = await (e.fetcher ?? fetch)(new URL(qi, Qi(e.backendUrl ?? Gi)).toString(), {
193
+ const n = await (e.fetcher ?? fetch)(new URL(Vi, ta(e.backendUrl ?? ji)).toString(), {
194
194
  cache: "no-store",
195
195
  credentials: "omit"
196
196
  });
197
197
  if (!n.ok)
198
198
  throw new Error("Failed to load active users");
199
- const i = await n.json(), o = ro(i.count), r = ro(i.refreshAfterMs ?? i.refresh_after_ms);
199
+ const i = await n.json(), o = po(i.count), r = po(i.refreshAfterMs ?? i.refresh_after_ms);
200
200
  if (o === null || r === null)
201
201
  throw new Error("Invalid active users response");
202
202
  return { count: o, refreshAfterMs: r };
203
203
  }
204
- function ro(e) {
204
+ function po(e) {
205
205
  return typeof e != "number" || !Number.isFinite(e) || e < 0 ? null : Math.round(e);
206
206
  }
207
- function Qi(e) {
207
+ function ta(e) {
208
208
  return e.endsWith("/") ? e : `${e}/`;
209
209
  }
210
- function ea(e) {
211
- return Math.min(Xi, Math.max(Yi, e));
210
+ function na(e) {
211
+ return Math.min(Ji, Math.max(Zi, e));
212
212
  }
213
- function ta(e) {
213
+ function oa(e) {
214
214
  return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
215
215
  }
216
- const na = [
216
+ const ia = [
217
217
  "a[href]",
218
218
  "button",
219
219
  "input",
@@ -237,27 +237,27 @@ const na = [
237
237
  ".pluno-pa-widget__message",
238
238
  ".timeline-item"
239
239
  ].join(",");
240
- function oa(e, t, n) {
241
- return e instanceof Element ? ia(
240
+ function aa(e, t, n) {
241
+ return e instanceof Element ? ra(
242
242
  t,
243
243
  n,
244
- e.closest(na) !== null
244
+ e.closest(ia) !== null
245
245
  ) : !1;
246
246
  }
247
- function ia(e, t, n) {
247
+ function ra(e, t, n) {
248
248
  return e === 1 && !t && !n;
249
249
  }
250
- function aa(e, t, n) {
250
+ function la(e, t, n) {
251
251
  return e instanceof Node && t !== null && !t.contains(e) && !n?.contains(e);
252
252
  }
253
- function ra(e, t = !0) {
253
+ function pa(e, t = !0) {
254
254
  if (!e || !t || !e.isConnected || e.disabled || e.readOnly)
255
255
  return !1;
256
256
  const n = e.getRootNode();
257
257
  return (n instanceof ShadowRoot ? n.activeElement : e.ownerDocument.activeElement) === e ? !1 : (e.focus({ preventScroll: !0 }), !0);
258
258
  }
259
- const la = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
260
- function pa(e) {
259
+ const sa = /(`+)(?!`)[\s\S]*?\1(?!`)/g;
260
+ function da(e) {
261
261
  let t = "", n = "", i = null;
262
262
  for (const o of e.split(new RegExp("(?<=\\n)"))) {
263
263
  if (i) {
@@ -268,7 +268,7 @@ function pa(e) {
268
268
  }
269
269
  const r = o.match(/^[ \t]{0,3}(`{3,}|~{3,})/);
270
270
  if (r) {
271
- t += lo(n) + o, n = "", i = {
271
+ t += so(n) + o, n = "", i = {
272
272
  marker: r[1][0],
273
273
  length: r[1].length
274
274
  };
@@ -276,31 +276,31 @@ function pa(e) {
276
276
  }
277
277
  n += o;
278
278
  }
279
- return t + lo(n);
279
+ return t + so(n);
280
280
  }
281
- function lo(e) {
281
+ function so(e) {
282
282
  let t = "", n = 0;
283
- for (const i of e.matchAll(la)) {
283
+ for (const i of e.matchAll(sa)) {
284
284
  const o = i.index ?? 0;
285
- t += po(
285
+ t += co(
286
286
  e.slice(n, o)
287
287
  ), t += i[0], n = o + i[0].length;
288
288
  }
289
- return t + po(e.slice(n));
289
+ return t + co(e.slice(n));
290
290
  }
291
- function po(e) {
291
+ function co(e) {
292
292
  return e.replace(
293
293
  /\[([^\]\n]*\S[^\]\n]*)\][ \t]+\(([^)\s]+)\)/g,
294
- (t, n, i, o, r) => r[o - 1] === "!" || sa(r, o) || da(r, o, n) ? t : `[${n}](${i})`
294
+ (t, n, i, o, r) => r[o - 1] === "!" || ca(r, o) || ua(r, o, n) ? t : `[${n}](${i})`
295
295
  );
296
296
  }
297
- function sa(e, t) {
297
+ function ca(e, t) {
298
298
  let n = 0;
299
299
  for (let i = t - 1; e[i] === "\\"; i -= 1)
300
300
  n += 1;
301
301
  return n % 2 === 1;
302
302
  }
303
- function da(e, t, n) {
303
+ function ua(e, t, n) {
304
304
  if (n !== "x" && n !== "X")
305
305
  return !1;
306
306
  const i = e.lastIndexOf(`
@@ -309,7 +309,7 @@ function da(e, t, n) {
309
309
  e.slice(i, t)
310
310
  );
311
311
  }
312
- const Wo = 100, ca = 1e4, ua = 5e3, ga = "product-agent:sdk-preview-socket-connect", ha = "product-agent:sdk-preview-socket-send", ma = "product-agent:sdk-preview-socket-close", fa = "product-agent:sdk-preview-socket-open", wa = "product-agent:sdk-preview-socket-message", ba = "product-agent:sdk-preview-socket-error", _a = "product-agent:sdk-preview-socket-closed", so = "product-agent:sdk-preview-socket-id", xa = "data-pluno-sdk-preview-channel", Ho = "data-pluno-auto-mounted", ye = "__plunoProductAgentAutoMountOwner", ya = 1e4, va = "Failed to load Pluno widget token", co = "Timed out loading Pluno widget token", Sa = "pluno.productAgent.widgetClientId.", sn = /* @__PURE__ */ new Set(), Ca = "product-agent:preview-diagnostic", $o = "pluno.productAgent.sharePromptsDisabled", Ea = 3, uo = 'dialog[open], [aria-modal="true"], [role="dialog"]', go = 1500, ka = 5e3, La = 500, Ta = "No recent chats for this page yet.", ve = {
312
+ const $o = 100, ga = 1e4, ha = 5e3, ma = "product-agent:sdk-preview-socket-connect", fa = "product-agent:sdk-preview-socket-send", wa = "product-agent:sdk-preview-socket-close", ba = "product-agent:sdk-preview-socket-open", _a = "product-agent:sdk-preview-socket-message", xa = "product-agent:sdk-preview-socket-error", ya = "product-agent:sdk-preview-socket-closed", uo = "product-agent:sdk-preview-socket-id", va = "data-pluno-sdk-preview-channel", Go = "data-pluno-auto-mounted", ve = "__plunoProductAgentAutoMountOwner", Sa = 1e4, Ca = "Failed to load Pluno widget token", go = "Timed out loading Pluno widget token", Ea = "pluno.productAgent.widgetClientId.", un = /* @__PURE__ */ new Set(), ka = "product-agent:preview-diagnostic", qo = "pluno.productAgent.sharePromptsDisabled", La = 3, ho = 'dialog[open], [aria-modal="true"], [role="dialog"]', mo = 1500, Ta = 5e3, Aa = 500, Pa = "No recent chats for this page yet.", Se = {
313
313
  launcherLabel: "Ask for anything...",
314
314
  accentColor: "#7c3aed",
315
315
  colorScheme: "light",
@@ -317,7 +317,7 @@ const Wo = 100, ca = 1e4, ua = 5e3, ga = "product-agent:sdk-preview-socket-conne
317
317
  scribbleStyle: !0,
318
318
  position: "bottom-right",
319
319
  movableLauncher: !0
320
- }, Aa = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', ho = "pluno-pa-scribble-font", Go = 190, qo = 41, Pa = 22, Ia = 32, Na = 1, Ra = 48, Rn = 420, za = 520, Ma = 0.24, zn = 680, Da = 800, Oa = 0.76, N = 8, He = 50, jo = "http://www.w3.org/2000/svg", Sn = 26, Cn = 8, Ua = 36, En = 16, Ba = 4, mo = [
320
+ }, Ia = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', fo = "pluno-pa-scribble-font", jo = 190, Vo = 41, Na = 22, Ra = 32, za = 1, Ma = 48, Mn = 420, Da = 520, Oa = 0.24, Dn = 680, Ua = 800, Ba = 0.76, N = 8, Ge = 50, Ko = "http://www.w3.org/2000/svg", En = 26, kn = 8, Fa = 36, Ln = 16, Wa = 4, wo = [
321
321
  {
322
322
  ellipseCx: "17.5",
323
323
  ellipseCy: "24.5",
@@ -354,22 +354,22 @@ const Wo = 100, ca = 1e4, ua = 5e3, ga = "product-agent:sdk-preview-socket-conne
354
354
  path: "M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1",
355
355
  pathStrokeWidth: "2.45"
356
356
  }
357
- ], Fa = 11, Wa = 13, kn = 4, Vo = 10, Ko = 40, Ha = "movable-launcher-position-v2", Yo = "pluno-pa-widget-styles", Xo = "data-pluno-pa-widget-styles";
358
- let fo = 0;
359
- function $a(e) {
360
- return (t) => new Se(t, e);
357
+ ], Ha = 11, $a = 13, Tn = 4, Yo = 10, Xo = 40, Ga = "movable-launcher-position-v2", Zo = "pluno-pa-widget-styles", Jo = "data-pluno-pa-widget-styles";
358
+ let bo = 0;
359
+ function qa(e) {
360
+ return (t) => new Ce(t, e);
361
361
  }
362
- async function Ga(e = {}) {
362
+ async function ja(e = {}) {
363
363
  const t = {
364
364
  layout: e.layout ?? "floating",
365
365
  mountTarget: e.mountTarget,
366
- launcherLabel: e.launcherLabel ?? ve.launcherLabel,
367
- accentColor: e.accentColor ?? ve.accentColor,
368
- colorScheme: e.colorScheme ?? ve.colorScheme,
369
- fontFamily: e.fontFamily ?? ve.fontFamily,
370
- scribbleStyle: e.scribbleStyle ?? ve.scribbleStyle,
371
- position: e.position ?? ve.position,
372
- movableLauncher: e.movableLauncher ?? ve.movableLauncher,
366
+ launcherLabel: e.launcherLabel ?? Se.launcherLabel,
367
+ accentColor: e.accentColor ?? Se.accentColor,
368
+ colorScheme: e.colorScheme ?? Se.colorScheme,
369
+ fontFamily: e.fontFamily ?? Se.fontFamily,
370
+ scribbleStyle: e.scribbleStyle ?? Se.scribbleStyle,
371
+ position: e.position ?? Se.position,
372
+ movableLauncher: e.movableLauncher ?? Se.movableLauncher,
373
373
  mobilePanelTopOffset: typeof e.mobilePanelTopOffset == "number" && Number.isFinite(e.mobilePanelTopOffset) ? Math.max(0, e.mobilePanelTopOffset) : 0,
374
374
  token: e.token,
375
375
  tokenProvider: e.tokenProvider,
@@ -432,82 +432,82 @@ async function Ga(e = {}) {
432
432
  );
433
433
  const n = document.createElement("div");
434
434
  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(
435
- xa,
435
+ va,
436
436
  t.sdkPreviewChannelId
437
437
  );
438
438
  const i = n.attachShadow({ mode: "open" }), o = document.createElement("div");
439
439
  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");
440
- let r = wo(
440
+ let r = _o(
441
441
  t.accentColor,
442
442
  t.scribbleStyle
443
443
  );
444
- ur(
444
+ hr(
445
445
  o,
446
446
  t.launcherLabel,
447
447
  r,
448
448
  t.movableLauncher,
449
449
  t.showLauncherMinimizeButton
450
450
  ), i.appendChild(o);
451
- const l = fl(t), p = t.layout === "floating" ? t.initialDisplayState ?? hl(t) : "shown";
452
- zo(t, p);
451
+ const l = bl(t), p = t.layout === "floating" ? t.initialDisplayState ?? fl(t) : "shown";
452
+ Do(t, p);
453
453
  let d = t.movableLauncher ? l.launcherPosition : null, c = d !== null, g = l.panelSize, h = null;
454
454
  o.style.setProperty(
455
455
  "--pluno-pa-mobile-panel-top-offset",
456
456
  `${t.mobilePanelTopOffset}px`
457
- ), 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"), We(
457
+ ), 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"), $e(
458
458
  o,
459
- cn(
459
+ hn(
460
460
  o,
461
461
  d,
462
462
  t.position
463
463
  )
464
- )), Ro(i, t.accentColor), bo(o, r, {
464
+ )), Mo(i, t.accentColor), xo(o, r, {
465
465
  accentColor: t.accentColor,
466
466
  colorScheme: t.colorScheme,
467
467
  fontFamily: t.fontFamily,
468
468
  scribbleStyle: t.scribbleStyle
469
469
  });
470
- const f = t.mountTarget ?? await gl(), y = f.ownerDocument, v = o.querySelector(
470
+ const f = t.mountTarget ?? await ml(), x = f.ownerDocument, y = o.querySelector(
471
471
  ".pluno-pa-widget__launcher"
472
- ), O = o.querySelector(
472
+ ), U = o.querySelector(
473
473
  ".pluno-pa-widget__launcher-drag-handle"
474
474
  ), u = o.querySelector(
475
475
  ".pluno-pa-widget__launcher-input"
476
- ), W = o.querySelector(
476
+ ), H = o.querySelector(
477
477
  ".pluno-pa-widget__launcher-minimize"
478
478
  ), w = o.querySelector(".pluno-pa-widget__panel"), R = o.querySelector(
479
479
  ".pluno-pa-widget__scribble-spirals--panel"
480
- ), M = Array.from(
480
+ ), D = Array.from(
481
481
  o.querySelectorAll(".pluno-pa-widget__resize-handle")
482
- ), T = o.querySelector(
482
+ ), L = o.querySelector(
483
483
  ".pluno-pa-widget__close"
484
484
  ), ne = o.querySelector(
485
485
  ".pluno-pa-widget__composer"
486
- ), H = o.querySelector(
486
+ ), $ = o.querySelector(
487
487
  ".pluno-pa-widget__attachment-error"
488
- ), Qe = o.querySelector(
488
+ ), bt = o.querySelector(
489
489
  ".pluno-pa-widget__billing-status"
490
- ), $e = o.querySelector(
490
+ ), qe = o.querySelector(
491
491
  ".pluno-pa-widget__attachments"
492
492
  ), ge = o.querySelector(
493
493
  ".pluno-pa-widget__attachment-input"
494
- ), U = o.querySelector(
494
+ ), B = o.querySelector(
495
495
  ".pluno-pa-widget__attach"
496
- ), S = o.querySelector(
496
+ ), v = o.querySelector(
497
497
  ".pluno-pa-widget__input"
498
- ), B = o.querySelector(
498
+ ), F = o.querySelector(
499
499
  ".pluno-pa-widget__send"
500
- ), q = o.querySelector(
500
+ ), j = o.querySelector(
501
501
  ".pluno-pa-widget__top-actions"
502
502
  ), Z = o.querySelector(
503
503
  ".pluno-pa-widget__history"
504
- ), Ne = o.querySelector(
504
+ ), ze = o.querySelector(
505
505
  ".pluno-pa-widget__history-panel"
506
506
  ), K = o.querySelector(
507
507
  ".pluno-pa-widget__history-list"
508
- ), wt = o.querySelector(
508
+ ), _t = o.querySelector(
509
509
  ".pluno-pa-widget__history-close"
510
- ), Re = o.querySelector(
510
+ ), Me = o.querySelector(
511
511
  ".pluno-pa-widget__history-status"
512
512
  ), he = o.querySelector(
513
513
  ".pluno-pa-widget__timeline-jump"
@@ -515,58 +515,70 @@ async function Ga(e = {}) {
515
515
  ".pluno-pa-widget__active-users-counter"
516
516
  ), z = o.querySelector(
517
517
  ".pluno-pa-widget__timeline"
518
- ), et = o.querySelector(
518
+ ), tt = o.querySelector(
519
519
  ".pluno-pa-widget__timeline-bottom-sentinel"
520
- ), ze = o.querySelector(
520
+ ), De = o.querySelector(
521
521
  ".pluno-pa-widget__notify-suggestion"
522
- ), Me = o.querySelector(
522
+ ), Oe = o.querySelector(
523
523
  ".pluno-pa-widget__notify-suggestion-enable"
524
- ), E = o.querySelector(
524
+ ), C = o.querySelector(
525
525
  ".pluno-pa-widget__notify-suggestion-later"
526
- ), A = o.querySelector(
526
+ ), T = o.querySelector(
527
527
  ".pluno-pa-widget__notify-suggestion-never"
528
528
  ), I = o.querySelector(
529
529
  ".pluno-pa-widget__tab-groups-suggestion"
530
- ), Ce = o.querySelector(
530
+ ), Ee = o.querySelector(
531
531
  ".pluno-pa-widget__tab-groups-suggestion-enable"
532
532
  ), oe = o.querySelector(
533
533
  ".pluno-pa-widget__tab-groups-suggestion-dismiss"
534
534
  );
535
- if (!v || !u || !w || !T || !ne || !H || !Qe || !$e || !ge || !U || !S || !B || !q || !Z || !Ne || !K || !wt || !Re || !he || !me || !z || !et)
535
+ if (!y || !u || !w || !L || !ne || !$ || !bt || !qe || !ge || !B || !v || !F || !j || !Z || !ze || !K || !_t || !Me || !he || !me || !z || !tt)
536
536
  throw new Error("Failed to mount Pluno widget");
537
- if (t.movableLauncher && !O)
537
+ if (t.movableLauncher && !U)
538
538
  throw new Error("Failed to mount Pluno widget drag handle");
539
- U.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled, ko(u), ko(S);
540
- let b = [], L = null;
541
- const j = () => ra(
542
- S,
539
+ let E = !1;
540
+ const P = (a) => {
541
+ Bt(t.billingStatus) || (E = !1), Ur(
542
+ bt,
543
+ t.billingStatus,
544
+ a,
545
+ E,
546
+ () => {
547
+ E = !0, P(a);
548
+ }
549
+ );
550
+ };
551
+ B.hidden = !t.attachmentsEnabled, ge.disabled = !t.attachmentsEnabled, To(u), To(v);
552
+ let M = [], fe = null;
553
+ const ke = () => pa(
554
+ v,
543
555
  o.classList.contains("pluno-pa-widget--open") && !t.loginRequired && !t.signupRequired && !pe(t.billingStatus)
544
- ), Ge = () => {
545
- Nr(
546
- $e,
547
- b,
556
+ ), je = () => {
557
+ Rr(
558
+ qe,
559
+ M,
548
560
  (a) => {
549
- b = b.filter(
561
+ M = M.filter(
550
562
  (s, m) => m !== a
551
- ), Ge(), D(_.getState()), V(), j();
563
+ ), je(), O(b.getState()), V(), ke();
552
564
  }
553
565
  );
554
- }, Un = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => gi(t.tokenEndpoint) : void 0);
555
- if (!t.loginRequired && !t.signupRequired && !t.token && !Un && !t.webSocketFactory)
566
+ }, Fn = t.loginRequired || t.signupRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (t.tokenEndpoint ? async () => mi(t.tokenEndpoint) : void 0);
567
+ if (!t.loginRequired && !t.signupRequired && !t.token && !Fn && !t.webSocketFactory)
556
568
  throw new Error("Pluno widget requires token or tokenEndpoint");
557
- const mi = window.fetch.bind(window), Bt = ml(t.clientId);
558
- let _;
569
+ const wi = window.fetch.bind(window), Ht = wl(t.clientId);
570
+ let b;
559
571
  try {
560
572
  const a = {
561
573
  token: t.token,
562
- tokenProvider: Un,
574
+ tokenProvider: Fn,
563
575
  backendUrl: t.backendUrl,
564
576
  metadata: () => ({
565
577
  ...t.metadata ?? {},
566
- ...!_.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
578
+ ...!b.getState().sessionId && t.scribbleStyle ? { scribbleStyleStarted: !0 } : {}
567
579
  }),
568
580
  initialStarterPrompts: t.initialStarterPrompts,
569
- clientId: Bt.clientId,
581
+ clientId: Ht.clientId,
570
582
  restorePersistedState: t.restorePersistedState,
571
583
  expectedPersistedSessionId: t.expectedPersistedSessionId,
572
584
  keepRunsActiveOnSessionNavigation: t.keepRunsActiveOnSessionNavigation,
@@ -577,9 +589,9 @@ async function Ga(e = {}) {
577
589
  autoConnect: !1,
578
590
  disableNetworkCapture: !!t.sdkPreviewChannelId
579
591
  };
580
- _ = await zi.init(a);
592
+ b = await Di.init(a);
581
593
  } catch (a) {
582
- throw Bt.release(), n.remove(), a;
594
+ throw Ht.release(), n.remove(), a;
583
595
  }
584
596
  f.appendChild(n), J(
585
597
  "web-sdk.widget",
@@ -591,54 +603,54 @@ async function Ga(e = {}) {
591
603
  cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
592
604
  }
593
605
  );
594
- const Ft = new Set(l.openToolGroupKeys), De = new Set(
606
+ const $t = new Set(l.openToolGroupKeys), Ue = new Set(
595
607
  l.seenShareCandidateIds
596
- ), tt = new Set(De);
597
- let Wt = l.sharePromptsDisabled || await wl(t), ie = null, Y = !1, bt = !(t.loginRequired || t.signupRequired), Ee = !1, Oe = {
608
+ ), nt = new Set(Ue);
609
+ let Gt = l.sharePromptsDisabled || await _l(t), ie = null, Y = !1, xt = !(t.loginRequired || t.signupRequired), Le = !1, Be = {
598
610
  enabled: !0
599
- }, Ue = 0, Bn = "", X = !1, fe = !1, ke = [], Ht = null, nt = null;
611
+ }, Fe = 0, Wn = "", X = !1, we = !1, Te = [], qt = null, ot = null;
600
612
  const ae = (a, s) => {
601
- Oe = { enabled: a, reason: s };
613
+ Be = { enabled: a, reason: s };
602
614
  }, re = () => {
603
615
  he.hidden = !0;
604
- }, fi = () => {
616
+ }, bi = () => {
605
617
  he.hidden = !1;
606
- }, wi = (a = "jump") => {
607
- ae(!0, a), re(), ht(z, () => Oe.enabled), Ue = z.scrollTop;
608
- }, we = () => {
609
- if (Z.hidden = t.layout === "page" || t.loginRequired, Ne.hidden = !X, Z.setAttribute("aria-expanded", String(X)), K.classList.toggle(
618
+ }, _i = (a = "jump") => {
619
+ ae(!0, a), re(), mt(z, () => Be.enabled), Fe = z.scrollTop;
620
+ }, be = () => {
621
+ if (Z.hidden = t.layout === "page" || t.loginRequired, ze.hidden = !X, Z.setAttribute("aria-expanded", String(X)), K.classList.toggle(
610
622
  "pluno-pa-widget__history-list--center",
611
- fe && ke.length === 0
612
- ), K.replaceChildren(), fe && ke.length === 0) {
623
+ we && Te.length === 0
624
+ ), K.replaceChildren(), we && Te.length === 0) {
613
625
  const a = document.createElement("p");
614
626
  a.className = "pluno-pa-widget__history-loading", a.textContent = "Loading...", K.appendChild(a);
615
627
  }
616
- for (const a of ke) {
628
+ for (const a of Te) {
617
629
  const s = document.createElement("button");
618
- s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = fe;
630
+ s.type = "button", s.className = "pluno-pa-widget__history-item", s.disabled = we;
619
631
  const m = document.createElement("span");
620
- m.className = "pluno-pa-widget__history-item-title", m.textContent = sr(a);
621
- const C = document.createElement("time");
622
- C.className = "pluno-pa-widget__history-time", C.dateTime = a.lastActiveAt, C.textContent = cr(
632
+ m.className = "pluno-pa-widget__history-item-title", m.textContent = cr(a);
633
+ const S = document.createElement("time");
634
+ S.className = "pluno-pa-widget__history-time", S.dateTime = a.lastActiveAt, S.textContent = gr(
623
635
  a.lastActiveAt,
624
636
  Date.now()
625
637
  );
626
638
  const k = document.createElement("small");
627
- k.className = "pluno-pa-widget__history-path", k.textContent = dr(a), s.append(m, C, k), s.addEventListener("click", () => {
628
- X = !1, nt = null, we(), ae(!0, "newSession"), re(), _.loadSession(a.id), D(_.getState()), j();
639
+ k.className = "pluno-pa-widget__history-path", k.textContent = ur(a), s.append(m, S, k), s.addEventListener("click", () => {
640
+ X = !1, ot = null, be(), ae(!0, "newSession"), re(), b.loadSession(a.id), O(b.getState()), ke();
629
641
  }), K.appendChild(s);
630
642
  }
631
- if (fe && ke.length > 0) {
643
+ if (we && Te.length > 0) {
632
644
  const a = document.createElement("p");
633
645
  a.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", a.textContent = "Loading...", K.appendChild(a);
634
646
  }
635
- Re.textContent = nt ?? (!fe && ke.length === 0 ? "No recent chats for this page yet." : ""), Re.hidden = Re.textContent.length === 0;
636
- }, Fn = async (a) => {
637
- if (!fe) {
638
- fe = !0, nt = null, we();
647
+ Me.textContent = ot ?? (!we && Te.length === 0 ? "No recent chats for this page yet." : ""), Me.hidden = Me.textContent.length === 0;
648
+ }, Hn = async (a) => {
649
+ if (!we) {
650
+ we = !0, ot = null, be();
639
651
  try {
640
- const s = await _.listSessions({ cursor: a, limit: 20 });
641
- ke = a ? [...ke, ...s.sessions] : s.sessions, Ht = s.nextCursor;
652
+ const s = await b.listSessions({ cursor: a, limit: 20 });
653
+ Te = a ? [...Te, ...s.sessions] : s.sessions, qt = s.nextCursor;
642
654
  } catch (s) {
643
655
  J(
644
656
  "web-sdk.widget",
@@ -646,68 +658,68 @@ async function Ga(e = {}) {
646
658
  {
647
659
  message: s instanceof Error ? s.message : String(s)
648
660
  }
649
- ), nt = Ta;
661
+ ), ot = Pa;
650
662
  } finally {
651
- fe = !1, we();
663
+ we = !1, be();
652
664
  }
653
665
  }
654
- }, bi = () => {
655
- !Ht || fe || K.scrollHeight - K.scrollTop - K.clientHeight <= 24 && Fn(Ht);
656
- }, Wn = () => {
657
- Y || typeof document > "u" || (Ro(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || y.body?.appendChild(n)));
658
- }, Hn = new MutationObserver(Wn);
659
- Hn.observe(y.documentElement, {
666
+ }, xi = () => {
667
+ !qt || we || K.scrollHeight - K.scrollTop - K.clientHeight <= 24 && Hn(qt);
668
+ }, $n = () => {
669
+ Y || typeof document > "u" || (Mo(i, t.accentColor), n.isConnected || (t.mountTarget?.isConnected ? t.mountTarget.appendChild(n) : t.mountTarget || x.body?.appendChild(n)));
670
+ }, Gn = new MutationObserver($n);
671
+ Gn.observe(x.documentElement, {
660
672
  childList: !0,
661
673
  subtree: !0
662
- }), Wn();
663
- const ot = (a = !0) => {
664
- const s = Dt(o, a);
665
- return Ln(
674
+ }), $n();
675
+ const it = (a = !0) => {
676
+ const s = Ut(o, a);
677
+ return An(
666
678
  o,
667
- d ? Nt(d, s) : Ja(
679
+ d ? zt(d, s) : er(
668
680
  o,
669
681
  t.position,
670
682
  s
671
683
  ),
672
684
  s
673
685
  );
674
- }, F = () => {
675
- const a = ir(
686
+ }, W = () => {
687
+ const a = rr(
676
688
  i,
677
689
  u,
678
- S
690
+ v
679
691
  );
680
- _l(t, {
692
+ yl(t, {
681
693
  isOpen: o.classList.contains("pluno-pa-widget--open"),
682
- composerValue: S.value,
694
+ composerValue: v.value,
683
695
  focusedInput: a,
684
696
  focusedInputAt: a ? Date.now() : null,
685
- openToolGroupKeys: [...Ft],
697
+ openToolGroupKeys: [...$t],
686
698
  launcherPosition: c ? d : null,
687
699
  panelSize: g,
688
- seenShareCandidateIds: [...De].slice(
689
- -Wo
700
+ seenShareCandidateIds: [...Ue].slice(
701
+ -$o
690
702
  ),
691
- sharePromptsDisabled: Wt
703
+ sharePromptsDisabled: Gt
692
704
  });
693
- }, _t = (a) => {
705
+ }, yt = (a) => {
694
706
  t.onDisplayStateChange?.(a);
695
- }, it = (a, s = !0) => {
696
- if (zo(t, a), a === "shown") {
697
- o.classList.remove("pluno-pa-widget--minimized"), v.removeAttribute("tabindex"), v.removeAttribute("role"), v.removeAttribute("aria-label"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && at(!1), s && _t("shown");
707
+ }, at = (a, s = !0) => {
708
+ if (Do(t, a), a === "shown") {
709
+ o.classList.remove("pluno-pa-widget--minimized"), y.removeAttribute("tabindex"), y.removeAttribute("role"), y.removeAttribute("aria-label"), !o.classList.contains("pluno-pa-widget--open") && !o.classList.contains("pluno-pa-widget--closing") && rt(!1), s && yt("shown");
698
710
  return;
699
711
  }
700
- ie !== null && (window.clearTimeout(ie), ie = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), v.hidden = !1, v.setAttribute("role", "button"), v.setAttribute("aria-label", "Open Pluno"), w.hidden = !0, T.hidden = !0, v.tabIndex = 0, S.value = "", We(
712
+ ie !== null && (window.clearTimeout(ie), ie = null), o.classList.remove("pluno-pa-widget--open"), o.classList.remove("pluno-pa-widget--closing"), o.classList.add("pluno-pa-widget--minimized"), y.hidden = !1, y.setAttribute("role", "button"), y.setAttribute("aria-label", "Open Pluno"), w.hidden = !0, L.hidden = !0, y.tabIndex = 0, v.value = "", $e(
701
713
  o,
702
- cn(
714
+ hn(
703
715
  o,
704
716
  d,
705
717
  t.position
706
718
  )
707
- ), So(o), F(), s && _t("minimized");
708
- }, Be = (a, s = {}) => {
709
- or(a, {
710
- debugVersion: Ha,
719
+ ), Eo(o), W(), s && yt("minimized");
720
+ }, We = (a, s = {}) => {
721
+ ar(a, {
722
+ debugVersion: Ga,
711
723
  launcherPosition: d,
712
724
  rootClasses: o.className,
713
725
  rootStyle: {
@@ -716,38 +728,38 @@ async function Ga(e = {}) {
716
728
  right: o.style.right,
717
729
  bottom: o.style.bottom
718
730
  },
719
- rootRect: gn(o),
720
- launcherRect: gn(v),
721
- panelRect: gn(w),
731
+ rootRect: fn(o),
732
+ launcherRect: fn(y),
733
+ panelRect: fn(w),
722
734
  viewport: te(),
723
735
  panelHidden: w.hidden,
724
- closeHidden: T.hidden,
736
+ closeHidden: L.hidden,
725
737
  ...s
726
738
  });
727
- }, at = (a = !0) => {
739
+ }, rt = (a = !0) => {
728
740
  if (!d)
729
- return We(o, null), ot(a);
730
- const s = ot(a);
731
- return We(o, s), Be("Applied stored closed launcher position", {
741
+ return $e(o, null), it(a);
742
+ const s = it(a);
743
+ return $e(o, s), We("Applied stored closed launcher position", {
732
744
  visibleLauncherPosition: s
733
745
  }), s;
734
- }, $t = (a, s) => {
746
+ }, jt = (a, s) => {
735
747
  if (!a || !s) {
736
- So(o);
748
+ Eo(o);
737
749
  return;
738
750
  }
739
- nr(o, {
751
+ ir(o, {
740
752
  x: a.x - s.x,
741
753
  y: a.y - s.y
742
754
  });
743
- }, Gt = () => {
744
- const a = Je(g).width;
755
+ }, Vt = () => {
756
+ const a = et(g).width;
745
757
  return t.layout === "page" && w.getBoundingClientRect().width || a;
746
- }, $n = () => {
758
+ }, qn = () => {
747
759
  if (o.classList.contains("pluno-pa-widget--minimized")) {
748
- We(
760
+ $e(
749
761
  o,
750
- cn(
762
+ hn(
751
763
  o,
752
764
  d,
753
765
  t.position
@@ -755,16 +767,16 @@ async function Ga(e = {}) {
755
767
  );
756
768
  return;
757
769
  }
758
- const a = at();
770
+ const a = rt();
759
771
  if (o.classList.contains("pluno-pa-widget--open") || o.classList.contains("pluno-pa-widget--closing")) {
760
- dn(o, g);
761
- const s = Je(g);
762
- mn(
772
+ gn(o, g);
773
+ const s = et(g);
774
+ bn(
763
775
  R,
764
- Gt()
776
+ Vt()
765
777
  );
766
- const m = Rt(
767
- h ? Nt(h, s) : un(
778
+ const m = Mt(
779
+ h ? zt(h, s) : mn(
768
780
  o,
769
781
  a,
770
782
  t.position,
@@ -772,44 +784,44 @@ async function Ga(e = {}) {
772
784
  ),
773
785
  s
774
786
  );
775
- $t(m, a), Be(
787
+ jt(m, a), We(
776
788
  "Applied open panel position after viewport resize",
777
789
  { openPanelPosition: m }
778
790
  );
779
- } else d && Be(
791
+ } else d && We(
780
792
  "Applied visible launcher position after viewport resize",
781
793
  { visibleLauncherPosition: a }
782
794
  );
783
795
  };
784
- let Gn = () => {
796
+ let jn = () => {
785
797
  };
786
- window.addEventListener("resize", $n), t.movableLauncher && O ? (at(), Gn = Ya({
798
+ window.addEventListener("resize", qn), t.movableLauncher && U ? (rt(), jn = Za({
787
799
  root: o,
788
- launcher: v,
789
- launcherDragHandle: O,
790
- getPosition: () => ot(),
800
+ launcher: y,
801
+ launcherDragHandle: U,
802
+ getPosition: () => it(),
791
803
  setPosition: (a) => {
792
- const s = a, m = Dt(o), C = Ln(
804
+ const s = a, m = Ut(o), S = An(
793
805
  o,
794
806
  a,
795
807
  m
796
808
  );
797
- d = vo(
798
- C,
809
+ d = Co(
810
+ S,
799
811
  m
800
- ), We(o, C), Be("Dragging closed launcher", {
812
+ ), $e(o, S), We("Dragging closed launcher", {
801
813
  requestedPosition: s
802
814
  });
803
815
  },
804
816
  persist: () => {
805
- c = !0, F(), Be("Persisted closed launcher drag position");
817
+ c = !0, W(), We("Persisted closed launcher drag position");
806
818
  }
807
- })) : We(o, null), dn(o, g);
808
- const _i = () => {
809
- const a = Je(g), s = ot();
819
+ })) : $e(o, null), gn(o, g);
820
+ const yi = () => {
821
+ const a = et(g), s = it();
810
822
  return {
811
- position: Rt(
812
- h ? Nt(h, a) : un(
823
+ position: Mt(
824
+ h ? zt(h, a) : mn(
813
825
  o,
814
826
  s,
815
827
  t.position,
@@ -819,46 +831,42 @@ async function Ga(e = {}) {
819
831
  ),
820
832
  size: a
821
833
  };
822
- }, xi = (a) => {
823
- g = Ot(a.size), dn(o, g), mn(
834
+ }, vi = (a) => {
835
+ g = Ft(a.size), gn(o, g), bn(
824
836
  R,
825
- Gt()
837
+ Vt()
826
838
  );
827
- const s = Rt(
839
+ const s = Mt(
828
840
  a.position,
829
- Je(g)
841
+ et(g)
830
842
  );
831
- h = vo(
843
+ h = Co(
832
844
  s,
833
- Je(g)
845
+ et(g)
834
846
  );
835
- const m = ot();
836
- $t(s, m);
837
- }, yi = M.length > 0 ? Xa({
847
+ const m = it();
848
+ jt(s, m);
849
+ }, Si = D.length > 0 ? Ja({
838
850
  root: o,
839
- handles: M,
840
- getBounds: _i,
841
- setBounds: xi,
842
- persist: F
851
+ handles: D,
852
+ getBounds: yi,
853
+ setBounds: vi,
854
+ persist: W
843
855
  }) : () => {
844
856
  };
845
- let qt = !1;
846
- const qn = async () => {
847
- if (!(!t.billingStatusLoader || qt)) {
848
- qt = !0;
857
+ let Kt = !1;
858
+ const Vn = async () => {
859
+ if (!(!t.billingStatusLoader || Kt)) {
860
+ Kt = !0;
849
861
  try {
850
862
  const a = await t.billingStatusLoader();
851
863
  if (Y)
852
864
  return;
853
- To(
865
+ Po(
854
866
  t.billingStatus,
855
867
  a,
856
- _.getState().lastErrorCode
857
- ) && (t.billingStatus = a, wn(
858
- Qe,
859
- t.billingStatus,
860
- _.getState().lastErrorCode
861
- ), V());
868
+ b.getState().lastErrorCode
869
+ ) && (t.billingStatus = a, P(b.getState().lastErrorCode), V());
862
870
  } catch (a) {
863
871
  J(
864
872
  "web-sdk.widget",
@@ -866,55 +874,55 @@ async function Ga(e = {}) {
866
874
  { message: a instanceof Error ? a.message : String(a) }
867
875
  );
868
876
  } finally {
869
- qt = !1;
877
+ Kt = !1;
870
878
  }
871
879
  }
872
- }, be = (a = "", s = !0, m = !0) => {
873
- qn(), st && (st = !1, Xt()), o.classList.contains("pluno-pa-widget--open") || (h = null), ie !== null && (window.clearTimeout(ie), ie = null), it("shown", !1), w.hidden = !1, T.hidden = !1, mn(
880
+ }, _e = (a = "", s = !0, m = !0) => {
881
+ Vn(), dt && (dt = !1, Qt()), o.classList.contains("pluno-pa-widget--open") || (h = null), ie !== null && (window.clearTimeout(ie), ie = null), at("shown", !1), w.hidden = !1, L.hidden = !1, bn(
874
882
  R,
875
- Gt()
883
+ Vt()
876
884
  ), o.classList.remove("pluno-pa-widget--closing");
877
- const C = at(), k = un(
885
+ const S = rt(), k = mn(
878
886
  o,
879
- C,
887
+ S,
880
888
  t.position,
881
889
  g
882
890
  );
883
- if ($t(k, C), Be("Opening launcher at clamped open panel position", {
891
+ if (jt(k, S), We("Opening launcher at clamped open panel position", {
884
892
  openPanelPosition: k,
885
- visibleLauncherPosition: C
893
+ visibleLauncherPosition: S
886
894
  }), ae(!0, "open"), re(), !s) {
887
- o.classList.add("pluno-pa-widget--open"), v.hidden = !0, a && (S.value = a, gt(S)), ht(z, () => Oe.enabled), Ue = z.scrollTop, m && (S.focus(), S.setSelectionRange(S.value.length, S.value.length)), F(), _t("shown"), t.onPanelOpenChange?.(!0);
895
+ o.classList.add("pluno-pa-widget--open"), y.hidden = !0, a && (v.value = a, ht(v)), mt(z, () => Be.enabled), Fe = z.scrollTop, m && (v.focus(), v.setSelectionRange(v.value.length, v.value.length)), W(), yt("shown"), t.onPanelOpenChange?.(!0);
888
896
  return;
889
897
  }
890
898
  window.requestAnimationFrame(() => {
891
- o.classList.add("pluno-pa-widget--open"), a && (S.value = a, gt(S)), ht(z, () => Oe.enabled), Ue = z.scrollTop, m && (S.focus(), S.setSelectionRange(S.value.length, S.value.length)), F(), _t("shown"), t.onPanelOpenChange?.(!0), ie = window.setTimeout(() => {
892
- v.hidden = !0, ht(z, () => Oe.enabled), Ue = z.scrollTop;
899
+ o.classList.add("pluno-pa-widget--open"), a && (v.value = a, ht(v)), mt(z, () => Be.enabled), Fe = z.scrollTop, m && (v.focus(), v.setSelectionRange(v.value.length, v.value.length)), W(), yt("shown"), t.onPanelOpenChange?.(!0), ie = window.setTimeout(() => {
900
+ y.hidden = !0, mt(z, () => Be.enabled), Fe = z.scrollTop;
893
901
  }, 220);
894
902
  });
895
- }, jt = () => {
896
- ie !== null && (window.clearTimeout(ie), ie = null), v.hidden = !1, d && (at(!1), Be("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), F(), t.onPanelOpenChange?.(!1), ie = window.setTimeout(() => {
897
- w.hidden = !0, T.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
903
+ }, Yt = () => {
904
+ ie !== null && (window.clearTimeout(ie), ie = null), y.hidden = !1, d && (rt(!1), We("Closing launcher at stored position")), o.classList.remove("pluno-pa-widget--open"), o.classList.add("pluno-pa-widget--closing"), W(), t.onPanelOpenChange?.(!1), ie = window.setTimeout(() => {
905
+ w.hidden = !0, L.hidden = !0, h = null, o.classList.remove("pluno-pa-widget--closing");
898
906
  }, 220);
899
907
  };
900
- v.addEventListener("submit", (a) => {
901
- a.preventDefault(), be(u.value), u.value = "";
902
- }), O?.addEventListener("click", (a) => {
908
+ y.addEventListener("submit", (a) => {
909
+ a.preventDefault(), _e(u.value), u.value = "";
910
+ }), U?.addEventListener("click", (a) => {
903
911
  a.preventDefault(), a.stopPropagation();
904
- }), v.addEventListener("click", (a) => {
905
- a.target === u && !O || (be(u.value), u.value = "");
912
+ }), y.addEventListener("click", (a) => {
913
+ a.target === u && !U || (_e(u.value), u.value = "");
906
914
  });
907
- const jn = () => {
908
- be(u.value), u.value = "";
915
+ const Kn = () => {
916
+ _e(u.value), u.value = "";
909
917
  };
910
- u.addEventListener("focus", jn), u.addEventListener("input", () => {
918
+ u.addEventListener("focus", Kn), u.addEventListener("input", () => {
911
919
  if (!u.value)
912
920
  return;
913
921
  const a = u.value;
914
- be(a), u.value = "";
922
+ _e(a), u.value = "";
915
923
  });
916
- let rt = null, Le = null, xt = null, Fe = null, se = null, G = null;
917
- const yt = (a) => a === u || a === S, Vn = (a) => a.composedPath().find(yt) ?? null, vi = (a) => {
924
+ let lt = null, Ae = null, vt = null, He = null, se = null, q = null;
925
+ const St = (a) => a === u || a === v, Yn = (a) => a.composedPath().find(St) ?? null, Ci = (a) => {
918
926
  let s = a;
919
927
  for (; s; ) {
920
928
  if (s.assignedSlot)
@@ -922,30 +930,30 @@ async function Ga(e = {}) {
922
930
  s = s.parentElement;
923
931
  }
924
932
  return null;
925
- }, Vt = (a) => {
933
+ }, Xt = (a) => {
926
934
  if (!(a instanceof Element) || a.getRootNode() === o.getRootNode())
927
935
  return null;
928
936
  let s = a;
929
937
  for (; s; ) {
930
- const m = s.closest(uo);
938
+ const m = s.closest(ho);
931
939
  if (m)
932
940
  return m;
933
- const C = vi(s);
934
- if (C) {
935
- s = C;
941
+ const S = Ci(s);
942
+ if (S) {
943
+ s = S;
936
944
  continue;
937
945
  }
938
946
  const k = s.getRootNode();
939
947
  s = k instanceof ShadowRoot ? k.host : null;
940
948
  }
941
949
  return null;
942
- }, Kt = () => {
943
- let a = y.activeElement;
950
+ }, Zt = () => {
951
+ let a = x.activeElement;
944
952
  for (; a?.shadowRoot?.activeElement; )
945
953
  a = a.shadowRoot.activeElement;
946
954
  return a;
947
- }, Si = (a) => {
948
- if (!a.isConnected || !a.matches(uo))
955
+ }, Ei = (a) => {
956
+ if (!a.isConnected || !a.matches(ho))
949
957
  return !1;
950
958
  if (!(a instanceof HTMLElement))
951
959
  return !0;
@@ -955,125 +963,125 @@ async function Ga(e = {}) {
955
963
  return a.checkVisibility();
956
964
  const s = window.getComputedStyle(a);
957
965
  return s.display !== "none" && s.visibility !== "hidden";
958
- }, Yt = (a, s) => {
966
+ }, Jt = (a, s) => {
959
967
  s && (se !== null && window.clearTimeout(se), se = window.setTimeout(() => {
960
- se = null, _e === a && s.isConnected && s.focus({ preventScroll: !0 });
968
+ se = null, xe === a && s.isConnected && s.focus({ preventScroll: !0 });
961
969
  }, 0));
962
- }, lt = (a, s = null) => {
963
- if (_e === a) {
964
- a && Yt(a, s);
970
+ }, pt = (a, s = null) => {
971
+ if (xe === a) {
972
+ a && Jt(a, s);
965
973
  return;
966
974
  }
967
- _e = a, a !== null ? (Yt(a, s), Fe = window.setInterval(() => {
968
- const m = _e;
969
- if (!m || !Si(m)) {
970
- lt(null);
975
+ xe = a, a !== null ? (Jt(a, s), He = window.setInterval(() => {
976
+ const m = xe;
977
+ if (!m || !Ei(m)) {
978
+ pt(null);
971
979
  return;
972
980
  }
973
- Yt(m, null);
974
- }, La)) : (Fe !== null && (window.clearInterval(Fe), Fe = null), se !== null && (window.clearTimeout(se), se = null), xt = null);
975
- }, Ci = () => {
976
- Fe !== null && (window.clearInterval(Fe), Fe = null), se !== null && (window.clearTimeout(se), se = null), G !== null && (window.clearTimeout(G), G = null);
977
- }, Kn = (a) => {
978
- const s = Vn(a);
981
+ Jt(m, null);
982
+ }, Aa)) : (He !== null && (window.clearInterval(He), He = null), se !== null && (window.clearTimeout(se), se = null), vt = null);
983
+ }, ki = () => {
984
+ He !== null && (window.clearInterval(He), He = null), se !== null && (window.clearTimeout(se), se = null), q !== null && (window.clearTimeout(q), q = null);
985
+ }, Xn = (a) => {
986
+ const s = Yn(a);
979
987
  if (!s)
980
988
  return;
981
989
  const m = Date.now();
982
- Le = m, rt = m, G !== null && window.clearTimeout(G);
983
- const C = _e ?? Vt(Kt());
984
- C && (lt(C, s), a.stopImmediatePropagation()), G = window.setTimeout(() => {
985
- if (G = null, Le !== m)
990
+ Ae = m, lt = m, q !== null && window.clearTimeout(q);
991
+ const S = xe ?? Xt(Zt());
992
+ S && (pt(S, s), a.stopImmediatePropagation()), q = window.setTimeout(() => {
993
+ if (q = null, Ae !== m)
986
994
  return;
987
- const k = Kt();
995
+ const k = Zt();
988
996
  if (k === s) {
989
- Le = null;
997
+ Ae = null;
990
998
  return;
991
999
  }
992
- const Te = Vt(k);
993
- Te && lt(Te, s);
1000
+ const Pe = Xt(k);
1001
+ Pe && pt(Pe, s);
994
1002
  }, 0);
995
- }, vt = (a) => {
996
- const s = Vn(a);
997
- s && (rt = Date.now(), _e !== null && (a.stopImmediatePropagation(), Le = null, G !== null && (window.clearTimeout(G), G = null), F(), a.type === "focus" && s === u && jn()));
1003
+ }, Ct = (a) => {
1004
+ const s = Yn(a);
1005
+ s && (lt = Date.now(), xe !== null && (a.stopImmediatePropagation(), Ae = null, q !== null && (window.clearTimeout(q), q = null), W(), a.type === "focus" && s === u && Kn()));
998
1006
  };
999
- y.defaultView?.addEventListener(
1007
+ x.defaultView?.addEventListener(
1000
1008
  "pointerdown",
1001
- Kn,
1009
+ Xn,
1002
1010
  !0
1003
- ), y.defaultView?.addEventListener(
1011
+ ), x.defaultView?.addEventListener(
1004
1012
  "focus",
1005
- vt,
1013
+ Ct,
1006
1014
  !0
1007
- ), y.defaultView?.addEventListener(
1015
+ ), x.defaultView?.addEventListener(
1008
1016
  "focusin",
1009
- vt,
1017
+ Ct,
1010
1018
  !0
1011
1019
  ), o.addEventListener("pointerdown", (a) => {
1012
- yt(a.target) && a.stopPropagation();
1020
+ St(a.target) && a.stopPropagation();
1013
1021
  }), o.addEventListener("focusin", (a) => {
1014
- yt(a.target) && (a.stopPropagation(), rt = Date.now(), Le = null, G !== null && (window.clearTimeout(G), G = null), F());
1022
+ St(a.target) && (a.stopPropagation(), lt = Date.now(), Ae = null, q !== null && (window.clearTimeout(q), q = null), W());
1015
1023
  }), o.addEventListener("focusout", (a) => {
1016
- if (!yt(a.target) || _e !== null)
1024
+ if (!St(a.target) || xe !== null)
1017
1025
  return;
1018
- const s = rt;
1019
- if (rt = null, s === null || Date.now() - s > go)
1026
+ const s = lt;
1027
+ if (lt = null, s === null || Date.now() - s > mo)
1020
1028
  return;
1021
- const m = a.target, C = Le !== null && Date.now() - Le <= go;
1022
- Le = null, G !== null && (window.clearTimeout(G), G = null);
1023
- const k = (Te) => {
1024
- const ln = Vt(Te);
1025
- if (!ln)
1029
+ const m = a.target, S = Ae !== null && Date.now() - Ae <= mo;
1030
+ Ae = null, q !== null && (window.clearTimeout(q), q = null);
1031
+ const k = (Pe) => {
1032
+ const dn = Xt(Pe);
1033
+ if (!dn)
1026
1034
  return !1;
1027
- if (C)
1028
- return lt(ln, m), !0;
1029
- const to = Date.now();
1030
- return xt !== null && to - xt <= ka ? (lt(ln, m), !0) : (xt = to, !0);
1035
+ if (S)
1036
+ return pt(dn, m), !0;
1037
+ const oo = Date.now();
1038
+ return vt !== null && oo - vt <= Ta ? (pt(dn, m), !0) : (vt = oo, !0);
1031
1039
  };
1032
1040
  k(a.relatedTarget) || window.setTimeout(() => {
1033
- _e === null && m.isConnected && k(Kt());
1041
+ xe === null && m.isConnected && k(Zt());
1034
1042
  }, 0);
1035
- }), v.addEventListener("keydown", (a) => {
1036
- !o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), be());
1037
- }), W?.addEventListener("pointerdown", (a) => {
1043
+ }), y.addEventListener("keydown", (a) => {
1044
+ !o.classList.contains("pluno-pa-widget--minimized") || a.key !== "Enter" && a.key !== " " || (a.preventDefault(), _e());
1045
+ }), H?.addEventListener("pointerdown", (a) => {
1038
1046
  a.stopPropagation();
1039
- }), W?.addEventListener("click", (a) => {
1040
- a.preventDefault(), a.stopPropagation(), it("minimized");
1041
- }), T.addEventListener("click", jt), z.addEventListener("scroll", () => {
1042
- z.scrollTop < Ue - 1 && ae(!1, "userScroll"), Ue = z.scrollTop;
1047
+ }), H?.addEventListener("click", (a) => {
1048
+ a.preventDefault(), a.stopPropagation(), at("minimized");
1049
+ }), L.addEventListener("click", Yt), z.addEventListener("scroll", () => {
1050
+ z.scrollTop < Fe - 1 && ae(!1, "userScroll"), Fe = z.scrollTop;
1043
1051
  }), he.addEventListener("click", () => {
1044
- wi();
1052
+ _i();
1045
1053
  });
1046
- const Yn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
1054
+ const Zn = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
1047
1055
  ([a]) => {
1048
1056
  a?.isIntersecting && (ae(!0, "bottom"), re());
1049
1057
  },
1050
1058
  { root: z, threshold: 0 }
1051
1059
  );
1052
- Yn?.observe(et);
1053
- const pt = () => t.loginRequired || t.signupRequired;
1054
- let _e = null, st = !1;
1055
- const le = () => bt || _.getState().status !== "connected", qe = () => {
1056
- const a = pt();
1057
- u.readOnly = !1, S.readOnly = !1, u.placeholder = a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : st ? "New update" : t.launcherLabel, S.placeholder = a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : ve.launcherLabel, ne.hidden = a;
1060
+ Zn?.observe(tt);
1061
+ const st = () => t.loginRequired || t.signupRequired;
1062
+ let xe = null, dt = !1;
1063
+ const le = () => xt || b.getState().status !== "connected", Ve = () => {
1064
+ const a = st();
1065
+ u.readOnly = !1, v.readOnly = !1, u.placeholder = a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : dt ? "New update" : t.launcherLabel, v.placeholder = a ? t.signupRequired ? t.signupButtonLabel : t.loginButtonLabel : Se.launcherLabel, ne.hidden = a;
1058
1066
  }, V = () => {
1059
- B.disabled = le() || pe(t.billingStatus) || !_.getState().isThinking && S.value.trim().length === 0 && b.length === 0, U.disabled = pt() || le() || pe(t.billingStatus);
1067
+ F.disabled = le() || pe(t.billingStatus) || !b.getState().isThinking && v.value.trim().length === 0 && M.length === 0, B.disabled = st() || le() || pe(t.billingStatus);
1060
1068
  };
1061
- qe();
1062
- const Xt = () => {
1063
- const a = _.getState().isThinking;
1069
+ Ve();
1070
+ const Qt = () => {
1071
+ const a = b.getState().isThinking;
1064
1072
  o.classList.toggle("pluno-pa-widget--thinking", a), o.classList.toggle(
1065
1073
  "pluno-pa-widget--unread",
1066
- !a && st
1067
- ), qe();
1074
+ !a && dt
1075
+ ), Ve();
1068
1076
  };
1069
- Xt();
1070
- const Zt = () => {
1071
- pt() || Y || (bt = !0, qe(), V(), _.connect().then(
1077
+ Qt();
1078
+ const en = () => {
1079
+ st() || Y || (xt = !0, Ve(), V(), b.connect().then(
1072
1080
  () => {
1073
- Y || (bt = !1, qe(), V());
1081
+ Y || (xt = !1, Ve(), V());
1074
1082
  },
1075
1083
  (a) => {
1076
- Y || (bt = !1, qe(), V(), J(
1084
+ Y || (xt = !1, Ve(), V(), J(
1077
1085
  "web-sdk.widget",
1078
1086
  "Failed to connect Product Agent widget",
1079
1087
  {
@@ -1092,56 +1100,56 @@ async function Ga(e = {}) {
1092
1100
  t.onSignupClick?.();
1093
1101
  return;
1094
1102
  }
1095
- le() || pe(t.billingStatus) || (Ee = !0, ae(!0, "send"), re(), b = hn(
1096
- _,
1097
- S,
1103
+ le() || pe(t.billingStatus) || (Le = !0, ae(!0, "send"), re(), M = wn(
1098
1104
  b,
1099
- At
1100
- ), Ge(), V());
1105
+ v,
1106
+ M,
1107
+ It
1108
+ ), je(), V());
1101
1109
  });
1102
- let dt = 0;
1103
- const Ei = () => {
1104
- dt = 0, o.classList.remove("pluno-pa-widget--drag-over");
1105
- }, Jt = (a) => {
1106
- L !== null && window.clearTimeout(L), H.textContent = a, H.hidden = !1, L = window.setTimeout(() => {
1107
- H.textContent = "", H.hidden = !0, L = null;
1110
+ let ct = 0;
1111
+ const Li = () => {
1112
+ ct = 0, o.classList.remove("pluno-pa-widget--drag-over");
1113
+ }, tn = (a) => {
1114
+ fe !== null && window.clearTimeout(fe), $.textContent = a, $.hidden = !1, fe = window.setTimeout(() => {
1115
+ $.textContent = "", $.hidden = !0, fe = null;
1108
1116
  }, 3e3);
1109
- }, ki = () => {
1110
- L !== null && (window.clearTimeout(L), L = null), H.textContent = "", H.hidden = !0;
1111
- }, Qt = async (a) => {
1117
+ }, Ti = () => {
1118
+ fe !== null && (window.clearTimeout(fe), fe = null), $.textContent = "", $.hidden = !0;
1119
+ }, nn = async (a) => {
1112
1120
  if (!t.attachmentsEnabled || a.length === 0)
1113
1121
  return;
1114
- const s = Mr(_, a);
1115
- if (b = [...b, ...s], Ge(), ki(), V(), D(_.getState()), !o.classList.contains("pluno-pa-widget--open")) {
1116
- be();
1122
+ const s = Dr(b, a);
1123
+ if (M = [...M, ...s], je(), Ti(), V(), O(b.getState()), !o.classList.contains("pluno-pa-widget--open")) {
1124
+ _e();
1117
1125
  return;
1118
1126
  }
1119
- j();
1120
- }, Li = async (a) => {
1121
- await Qt(a), !(a.length === 0 || _e !== null) && S.focus();
1127
+ ke();
1128
+ }, Ai = async (a) => {
1129
+ await nn(a), !(a.length === 0 || xe !== null) && v.focus();
1122
1130
  };
1123
- U.addEventListener("click", () => {
1131
+ B.addEventListener("click", () => {
1124
1132
  t.loginRequired || le() || pe(t.billingStatus) || ge.click();
1125
1133
  }), ge.addEventListener("change", () => {
1126
1134
  const a = Array.from(ge.files ?? []);
1127
- ge.value = "", Li(a).catch((s) => {
1128
- Jt(
1135
+ ge.value = "", Ai(a).catch((s) => {
1136
+ tn(
1129
1137
  s instanceof Error ? s.message : "Failed to attach file"
1130
1138
  ), J("web-sdk.widget", "Attachment failed", {
1131
1139
  message: s instanceof Error ? s.message : String(s)
1132
1140
  });
1133
1141
  });
1134
1142
  }), o.addEventListener("dragenter", (a) => {
1135
- !t.attachmentsEnabled || !Pt(a.dataTransfer) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), dt += 1, o.classList.add("pluno-pa-widget--drag-over"));
1143
+ !t.attachmentsEnabled || !Nt(a.dataTransfer) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), ct += 1, o.classList.add("pluno-pa-widget--drag-over"));
1136
1144
  }), o.addEventListener("dragover", (a) => {
1137
1145
  const s = a.dataTransfer;
1138
- !t.attachmentsEnabled || !Pt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
1146
+ !t.attachmentsEnabled || !Nt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), s.dropEffect = "copy");
1139
1147
  }), o.addEventListener("dragleave", (a) => {
1140
- Pt(a.dataTransfer) && (a.stopPropagation(), dt = Math.max(0, dt - 1), dt === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
1148
+ Nt(a.dataTransfer) && (a.stopPropagation(), ct = Math.max(0, ct - 1), ct === 0 && o.classList.remove("pluno-pa-widget--drag-over"));
1141
1149
  }), o.addEventListener("drop", (a) => {
1142
1150
  const s = a.dataTransfer;
1143
- !t.attachmentsEnabled || !Pt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), Ei(), Qt(s.files).catch((m) => {
1144
- Jt(
1151
+ !t.attachmentsEnabled || !Nt(s) || t.loginRequired || le() || (a.preventDefault(), a.stopPropagation(), Li(), nn(s.files).catch((m) => {
1152
+ tn(
1145
1153
  m instanceof Error ? m.message : "Failed to attach file"
1146
1154
  ), J("web-sdk.widget", "Attachment failed", {
1147
1155
  message: m instanceof Error ? m.message : String(m)
@@ -1150,55 +1158,55 @@ async function Ga(e = {}) {
1150
1158
  }), o.addEventListener("paste", (a) => {
1151
1159
  a.stopPropagation();
1152
1160
  const s = a.clipboardData, m = Array.from(s?.files ?? []);
1153
- !t.attachmentsEnabled || m.length === 0 || t.loginRequired || le() || (a.preventDefault(), Qt(m).catch((C) => {
1154
- Jt(
1155
- C instanceof Error ? C.message : "Failed to attach file"
1161
+ !t.attachmentsEnabled || m.length === 0 || t.loginRequired || le() || (a.preventDefault(), nn(m).catch((S) => {
1162
+ tn(
1163
+ S instanceof Error ? S.message : "Failed to attach file"
1156
1164
  ), J("web-sdk.widget", "Attachment failed", {
1157
- message: C instanceof Error ? C.message : String(C)
1165
+ message: S instanceof Error ? S.message : String(S)
1158
1166
  });
1159
1167
  }));
1160
- }), B.addEventListener("click", () => {
1168
+ }), F.addEventListener("click", () => {
1161
1169
  if (t.loginRequired) {
1162
1170
  t.onLoginClick?.();
1163
1171
  return;
1164
1172
  }
1165
- if (_.getState().isThinking) {
1166
- _.stop();
1173
+ if (b.getState().isThinking) {
1174
+ b.stop();
1167
1175
  return;
1168
1176
  }
1169
1177
  if (le())
1170
1178
  return;
1171
- const a = S.value.trim().length > 0 || b.length > 0;
1172
- Ee = !0, ae(!0, "send"), re(), b = hn(
1173
- _,
1174
- S,
1179
+ const a = v.value.trim().length > 0 || M.length > 0;
1180
+ Le = !0, ae(!0, "send"), re(), M = wn(
1175
1181
  b,
1176
- At
1177
- ), Ge(), V(), D(_.getState()), a && j();
1182
+ v,
1183
+ M,
1184
+ It
1185
+ ), je(), V(), O(b.getState()), a && ke();
1178
1186
  }), Z.addEventListener("click", () => {
1179
- X = !X, nt = null, we(), X && ke.length === 0 && Fn(null), X || j();
1180
- }), wt.addEventListener("click", () => {
1181
- X = !1, we(), j();
1182
- }), K.addEventListener("scroll", bi), S.addEventListener("input", () => {
1183
- gt(S), F(), V(), Pi();
1184
- }), S.addEventListener("keydown", (a) => {
1187
+ X = !X, ot = null, be(), X && Te.length === 0 && Hn(null), X || ke();
1188
+ }), _t.addEventListener("click", () => {
1189
+ X = !1, be(), ke();
1190
+ }), K.addEventListener("scroll", xi), v.addEventListener("input", () => {
1191
+ ht(v), W(), V(), Ni();
1192
+ }), v.addEventListener("keydown", (a) => {
1185
1193
  if (!(a.key !== "Enter" || a.shiftKey)) {
1186
1194
  if (a.preventDefault(), t.loginRequired) {
1187
1195
  t.onLoginClick?.();
1188
1196
  return;
1189
1197
  }
1190
- le() || (Ee = !0, ae(!0, "send"), re(), b = hn(
1191
- _,
1192
- S,
1198
+ le() || (Le = !0, ae(!0, "send"), re(), M = wn(
1193
1199
  b,
1194
- At
1195
- ), Ge(), V(), D(_.getState()));
1200
+ v,
1201
+ M,
1202
+ It
1203
+ ), je(), V(), O(b.getState()));
1196
1204
  }
1197
1205
  }), o.addEventListener("click", (a) => {
1198
1206
  const s = a.target instanceof Element ? a.target : null;
1199
- s?.closest("a[href]") && F(), X && aa(s, Ne, Z) && (X = !1, we());
1200
- const C = window.getSelection(), k = !!(C && !C.isCollapsed && C.anchorNode && o.contains(C.anchorNode));
1201
- oa(a.target, a.detail, k) && j();
1207
+ s?.closest("a[href]") && W(), X && la(s, ze, Z) && (X = !1, be());
1208
+ const S = window.getSelection(), k = !!(S && !S.isCollapsed && S.anchorNode && o.contains(S.anchorNode));
1209
+ aa(a.target, a.detail, k) && ke();
1202
1210
  }), o.addEventListener("copy", (a) => {
1203
1211
  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(
1204
1212
  "text/plain",
@@ -1216,101 +1224,97 @@ async function Ga(e = {}) {
1216
1224
  ), a.stopPropagation();
1217
1225
  return;
1218
1226
  }
1219
- a.key !== "Escape" || !X || (X = !1, we(), j());
1220
- }), l.composerValue && (S.value = l.composerValue, gt(S)), t.layout === "page" ? be(S.value, !1) : p === "minimized" ? it("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && be(S.value, !1, !1), ar(l, o, u, S);
1221
- const St = () => r;
1222
- let en = _.getState().appearance !== null, Ct = null, ct = null, Xn = _.getState().isThinking, je = null;
1223
- const ut = t.taskNotifications;
1224
- let Ve = null, Ke = !1;
1225
- const Zn = () => {
1226
- Ve !== null && (window.clearTimeout(Ve), Ve = null);
1227
- }, Et = () => {
1228
- ze && (ze.hidden = !0);
1229
- }, Jn = () => _.getState().assistantDraft.trim().length > 0, Ti = async () => {
1230
- if (!ut || !ze || Ke || Y || !_.getState().isThinking || Jn())
1227
+ a.key !== "Escape" || !X || (X = !1, be(), ke());
1228
+ }), l.composerValue && (v.value = l.composerValue, ht(v)), t.layout === "page" ? _e(v.value, !1) : p === "minimized" ? at("minimized", !1) : t.initialDisplayState === void 0 && l.isOpen && _e(v.value, !1, !1), lr(l, o, u, v);
1229
+ const Et = () => r;
1230
+ let on = b.getState().appearance !== null, kt = null, ut = null, Jn = b.getState().isThinking, Ke = null;
1231
+ const gt = t.taskNotifications;
1232
+ let Ye = null, Xe = !1;
1233
+ const Qn = () => {
1234
+ Ye !== null && (window.clearTimeout(Ye), Ye = null);
1235
+ }, Lt = () => {
1236
+ De && (De.hidden = !0);
1237
+ }, eo = () => b.getState().assistantDraft.trim().length > 0, Pi = async () => {
1238
+ if (!gt || !De || Xe || Y || !b.getState().isThinking || eo())
1231
1239
  return;
1232
1240
  let a;
1233
1241
  try {
1234
- a = await ut.getState();
1242
+ a = await gt.getState();
1235
1243
  } catch {
1236
1244
  return;
1237
1245
  }
1238
- a.enabled || a.neverSuggest || !_.getState().isThinking || Jn() || Ke || Y || (ze.hidden = !1);
1246
+ a.enabled || a.neverSuggest || !b.getState().isThinking || eo() || Xe || Y || (De.hidden = !1);
1239
1247
  };
1240
- Me?.addEventListener("click", () => {
1241
- Ke = !0, Et(), ut?.enable().catch(() => {
1248
+ Oe?.addEventListener("click", () => {
1249
+ Xe = !0, Lt(), gt?.enable().catch(() => {
1242
1250
  });
1243
- }), E?.addEventListener("click", () => {
1244
- Ke = !0, Et();
1245
- }), A?.addEventListener("click", () => {
1246
- Ke = !0, Et(), ut?.dismissForever().catch(() => {
1251
+ }), C?.addEventListener("click", () => {
1252
+ Xe = !0, Lt();
1253
+ }), T?.addEventListener("click", () => {
1254
+ Xe = !0, Lt(), gt?.dismissForever().catch(() => {
1247
1255
  });
1248
1256
  });
1249
- const kt = t.tabGroups;
1250
- let Ye = !1;
1251
- const Lt = async () => {
1252
- if (!kt || !I || Ye || Y)
1257
+ const Tt = t.tabGroups;
1258
+ let Ze = !1;
1259
+ const At = async () => {
1260
+ if (!Tt || !I || Ze || Y)
1253
1261
  return;
1254
- const a = await kt.getState().catch(() => null);
1255
- !a || Ye || Y || (I.hidden = !a.permissionNeeded);
1262
+ const a = await Tt.getState().catch(() => null);
1263
+ !a || Ze || Y || (I.hidden = !a.permissionNeeded);
1256
1264
  };
1257
- Ce?.addEventListener("click", () => {
1258
- Ye = !0, I && (I.hidden = !0), kt?.enable().catch(() => {
1265
+ Ee?.addEventListener("click", () => {
1266
+ Ze = !0, I && (I.hidden = !0), Tt?.enable().catch(() => {
1259
1267
  }).finally(() => {
1260
- Ye = !1, Lt();
1268
+ Ze = !1, At();
1261
1269
  });
1262
1270
  }), oe?.addEventListener("click", () => {
1263
- Ye = !0, I && (I.hidden = !0), kt?.dismiss().catch(() => {
1271
+ Ze = !0, I && (I.hidden = !0), Tt?.dismiss().catch(() => {
1264
1272
  }).finally(() => {
1265
- Ye = !1, Lt();
1273
+ Ze = !1, At();
1266
1274
  });
1267
- }), Lt();
1268
- let Xe = null, Qn = () => {
1275
+ }), At();
1276
+ let Je = null, to = () => {
1269
1277
  };
1270
- const Ai = !!(t.sdkPreviewChannelId && t.referralLinkLoader), tn = /* @__PURE__ */ new Map(), nn = () => S.value.trim().length > 0 || b.length > 0, Pi = () => {
1271
- const a = Xe !== null && bn(_.getState(), nn());
1272
- me.hidden = !a, a && Xe !== null && Jo(me, Xe);
1278
+ const Ii = !!(t.sdkPreviewChannelId && t.referralLinkLoader), an = /* @__PURE__ */ new Map(), rn = () => v.value.trim().length > 0 || M.length > 0, Ni = () => {
1279
+ const a = Je !== null && xn(b.getState(), rn());
1280
+ me.hidden = !a, a && Je !== null && ei(me, Je);
1273
1281
  };
1274
- let Ze = null;
1275
- const xe = /* @__PURE__ */ new Map(), Tt = /* @__PURE__ */ new Set(), Ii = async (a) => {
1282
+ let Qe = null;
1283
+ const ye = /* @__PURE__ */ new Map(), Pt = /* @__PURE__ */ new Set(), Ri = async (a) => {
1276
1284
  if (t.integrationAuthHandler) {
1277
- xe.set(a.authRequestId, { status: "connecting" }), D(_.getState());
1285
+ ye.set(a.authRequestId, { status: "connecting" }), O(b.getState());
1278
1286
  try {
1279
- await t.integrationAuthHandler(a), xe.set(a.authRequestId, { status: "completed" });
1287
+ await t.integrationAuthHandler(a), ye.set(a.authRequestId, { status: "completed" });
1280
1288
  } catch (s) {
1281
- xe.set(a.authRequestId, {
1289
+ ye.set(a.authRequestId, {
1282
1290
  status: "error",
1283
1291
  error: s instanceof Error ? s.message : `Could not connect ${a.appName}.`
1284
1292
  });
1285
1293
  }
1286
- D(_.getState());
1294
+ O(b.getState());
1287
1295
  }
1288
- }, on = (a = {}) => {
1289
- Ee = !0, ae(!0, "newSession"), re(), X = !1, we(), _.startNewSession(a), Ft.clear(), xe.clear(), Tt.clear(), S.value = "", b = [], Ge(), gt(S), F(), V(), S.focus(), D(_.getState());
1290
- }, At = () => {
1291
- t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), on());
1292
- }, an = (a) => {
1296
+ }, ln = (a = {}) => {
1297
+ Le = !0, ae(!0, "newSession"), re(), X = !1, be(), b.startNewSession(a), $t.clear(), ye.clear(), Pt.clear(), v.value = "", M = [], je(), ht(v), W(), V(), v.focus(), O(b.getState());
1298
+ }, It = () => {
1299
+ t.morningReport !== null && (t.morningReport = null, t.onMorningReportTaskStart?.(), ln());
1300
+ }, pn = (a) => {
1293
1301
  if (!a || t.layout === "page") {
1294
- Ze?.remove(), Ze = null;
1302
+ Qe?.remove(), Qe = null;
1295
1303
  return;
1296
1304
  }
1297
- Ze || (Ze = Ut(
1305
+ Qe || (Qe = Wt(
1298
1306
  "pluno-pa-widget__new-chat",
1299
1307
  "New chat",
1300
- Cr(),
1308
+ kr(),
1301
1309
  !1
1302
- ), Ze.addEventListener("click", () => on()), q.insertBefore(Ze, Z));
1303
- }, D = (a) => {
1304
- if (we(), Dn(a.lastErrorCode) ? je = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !pe(t.billingStatus) && (je = null), wn(
1305
- Qe,
1306
- t.billingStatus,
1307
- je
1308
- ), t.loginRequired) {
1309
- tn.clear(), Io(
1310
+ ), Qe.addEventListener("click", () => ln()), j.insertBefore(Qe, Z));
1311
+ }, O = (a) => {
1312
+ if (be(), Un(a.lastErrorCode) ? Ke = a.lastErrorCode : t.billingStatus?.creditsUsed !== null && !pe(t.billingStatus) && (Ke = null), P(Ke), t.loginRequired) {
1313
+ an.clear(), Ro(
1310
1314
  z,
1311
- B,
1312
- an,
1313
- St,
1315
+ F,
1316
+ pn,
1317
+ Et,
1314
1318
  "Log in to use Pluno on this page.",
1315
1319
  t.loginButtonLabel,
1316
1320
  t.loginUrl,
@@ -1319,11 +1323,11 @@ async function Ga(e = {}) {
1319
1323
  return;
1320
1324
  }
1321
1325
  if (t.signupRequired) {
1322
- tn.clear(), Io(
1326
+ an.clear(), Ro(
1323
1327
  z,
1324
- B,
1325
- an,
1326
- St,
1328
+ F,
1329
+ pn,
1330
+ Et,
1327
1331
  "Complete signup to unlock your free trial credits.",
1328
1332
  t.signupButtonLabel,
1329
1333
  t.signupUrl,
@@ -1331,67 +1335,67 @@ async function Ga(e = {}) {
1331
1335
  );
1332
1336
  return;
1333
1337
  }
1334
- const s = lr(a), m = s !== Bn;
1335
- Bn = s;
1336
- const C = Ee || Oe.enabled;
1337
- Ee = !1, Hr(
1338
+ const s = sr(a), m = s !== Wn;
1339
+ Wn = s;
1340
+ const S = Le || Be.enabled;
1341
+ Le = !1, Gr(
1338
1342
  z,
1339
- et,
1340
- B,
1341
- an,
1343
+ tt,
1344
+ F,
1345
+ pn,
1342
1346
  me,
1343
1347
  a,
1344
- Xe,
1345
- Xe !== null && bn(a, nn()),
1346
- C,
1347
- () => Oe.enabled,
1348
- Ft,
1349
- tn,
1350
- F,
1351
- St,
1348
+ Je,
1349
+ Je !== null && xn(a, rn()),
1350
+ S,
1351
+ () => Be.enabled,
1352
+ $t,
1353
+ an,
1354
+ W,
1355
+ Et,
1352
1356
  (k) => {
1353
- le() || (At(), Ee = !0, ae(!0, "send"), re(), _.sendMessage(k));
1357
+ le() || (It(), Le = !0, ae(!0, "send"), re(), b.sendMessage(k));
1354
1358
  },
1355
1359
  () => {
1356
- Ee = !0, ae(!0, "send"), re(), _.retryLastMessage();
1360
+ Le = !0, ae(!0, "send"), re(), b.retryLastMessage();
1357
1361
  },
1358
1362
  t.morningReport,
1359
1363
  () => {
1360
- t.morningReport = null, t.onMorningReportSnooze?.(), jt(), D(_.getState());
1364
+ t.morningReport = null, t.onMorningReportSnooze?.(), Yt(), O(b.getState());
1361
1365
  },
1362
- Zt,
1366
+ en,
1363
1367
  t.attachmentPreviewUrlResolver,
1364
1368
  t.integrationAuthHandler ? {
1365
- states: xe,
1369
+ states: ye,
1366
1370
  initialStatus: t.integrationAuthStatusLoader ? "checking" : "pending",
1367
1371
  onConnect: (k) => {
1368
- Ii(k);
1372
+ Ri(k);
1369
1373
  }
1370
1374
  } : void 0,
1371
- Ai && !Wt ? {
1372
- dismissedCandidateIds: tt,
1373
- actionCandidate: Ct,
1374
- error: ct,
1375
- characterIconOptions: St(),
1375
+ Ii && !Gt ? {
1376
+ dismissedCandidateIds: nt,
1377
+ actionCandidate: kt,
1378
+ error: ut,
1379
+ characterIconOptions: Et(),
1376
1380
  socialPostRewardsUrl: t.socialPostRewardsUrl,
1377
1381
  onSeen: (k) => {
1378
- De.add(k.id), F();
1382
+ Ue.add(k.id), W();
1379
1383
  },
1380
1384
  onReferralCopy: (k) => {
1381
- Ni(k);
1385
+ zi(k);
1382
1386
  },
1383
1387
  onSocialShare: (k) => {
1384
- De.add(k.id), tt.add(k.id), F();
1388
+ Ue.add(k.id), nt.add(k.id), W();
1385
1389
  },
1386
1390
  onDismiss: (k) => {
1387
- De.add(k.id), tt.add(k.id), F(), ct = null, D(_.getState());
1391
+ Ue.add(k.id), nt.add(k.id), W(), ut = null, O(b.getState());
1388
1392
  },
1389
1393
  onDisable: (k) => {
1390
- Wt = !0, De.add(k.id), tt.add(k.id), F(), bl(t, !0), ct = null, D(_.getState());
1394
+ Gt = !0, Ue.add(k.id), nt.add(k.id), W(), xl(t, !0), ut = null, O(b.getState());
1391
1395
  }
1392
1396
  } : void 0
1393
- ), C ? (Ue = z.scrollTop, re()) : m && pr(a) && fi();
1394
- }, eo = async (a) => {
1397
+ ), S ? (Fe = z.scrollTop, re()) : m && dr(a) && bi();
1398
+ }, no = async (a) => {
1395
1399
  if (!t.integrationAuthStatusLoader)
1396
1400
  return;
1397
1401
  const s = a.messages.map((m) => m.integrationAuthRequest).filter(
@@ -1399,47 +1403,47 @@ async function Ga(e = {}) {
1399
1403
  );
1400
1404
  await Promise.all(
1401
1405
  s.map(async (m) => {
1402
- if (!(xe.has(m.authRequestId) || Tt.has(m.authRequestId))) {
1403
- Tt.add(m.authRequestId), xe.set(m.authRequestId, {
1406
+ if (!(ye.has(m.authRequestId) || Pt.has(m.authRequestId))) {
1407
+ Pt.add(m.authRequestId), ye.set(m.authRequestId, {
1404
1408
  status: "checking"
1405
- }), D(_.getState());
1409
+ }), O(b.getState());
1406
1410
  try {
1407
- const C = await t.integrationAuthStatusLoader(m);
1408
- xe.set(m.authRequestId, { status: C });
1409
- } catch (C) {
1410
- xe.set(m.authRequestId, {
1411
+ const S = await t.integrationAuthStatusLoader(m);
1412
+ ye.set(m.authRequestId, { status: S });
1413
+ } catch (S) {
1414
+ ye.set(m.authRequestId, {
1411
1415
  status: "error",
1412
- error: C instanceof Error ? C.message : `Could not load ${m.appName} connection status.`
1416
+ error: S instanceof Error ? S.message : `Could not load ${m.appName} connection status.`
1413
1417
  });
1414
1418
  } finally {
1415
- Tt.delete(m.authRequestId);
1419
+ Pt.delete(m.authRequestId);
1416
1420
  }
1417
- Y || D(_.getState());
1421
+ Y || O(b.getState());
1418
1422
  }
1419
1423
  })
1420
1424
  );
1421
1425
  };
1422
- return Qn = Zi(
1426
+ return to = Qi(
1423
1427
  (a) => {
1424
- Xe = a, !Y && bn(_.getState(), nn()) && D(_.getState());
1428
+ Je = a, !Y && xn(b.getState(), rn()) && O(b.getState());
1425
1429
  },
1426
1430
  {
1427
1431
  backendUrl: t.backendUrl,
1428
- fetcher: mi,
1432
+ fetcher: wi,
1429
1433
  loader: t.activeUsersLoader
1430
1434
  }
1431
- ), _.on("state", (a) => {
1432
- Lt();
1433
- const s = Xn && !a.isThinking;
1434
- Xn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && ut && !Ke && Ve === null && ze?.hidden !== !1 && (Ve = window.setTimeout(() => {
1435
- Ve = null, Ti();
1436
- }, ca)), (!a.isThinking || a.assistantDraft.trim()) && (Zn(), Et()), s && !o.classList.contains("pluno-pa-widget--open") && (st = !0), Xt(), a.appearance ? (en = !0, J(
1435
+ ), b.on("state", (a) => {
1436
+ At();
1437
+ const s = Jn && !a.isThinking;
1438
+ Jn = a.isThinking, a.isThinking && !a.assistantDraft.trim() && gt && !Xe && Ye === null && De?.hidden !== !1 && (Ye = window.setTimeout(() => {
1439
+ Ye = null, Pi();
1440
+ }, ga)), (!a.isThinking || a.assistantDraft.trim()) && (Qn(), Lt()), s && !o.classList.contains("pluno-pa-widget--open") && (dt = !0), Qt(), a.appearance ? (on = !0, J(
1437
1441
  "web-sdk.widget",
1438
1442
  "Agent state supplied appearance",
1439
1443
  {
1440
1444
  appearance: a.appearance
1441
1445
  }
1442
- ), rn(a.appearance, "agent.state.appearance")) : en && (en = !1, J(
1446
+ ), sn(a.appearance, "agent.state.appearance")) : on && (on = !1, J(
1443
1447
  "web-sdk.widget",
1444
1448
  "Agent state cleared appearance; reverting to configured widget options",
1445
1449
  {
@@ -1447,79 +1451,75 @@ async function Ga(e = {}) {
1447
1451
  fallbackColorScheme: t.colorScheme,
1448
1452
  fallbackFontFamily: t.fontFamily
1449
1453
  }
1450
- ), rn({}, "agent.state.appearance-cleared")), D(a), eo(a), V(), s && qn();
1451
- }), D(_.getState()), eo(_.getState()), V(), Zt(), {
1452
- agent: _,
1453
- startNewChat: on,
1454
+ ), sn({}, "agent.state.appearance-cleared")), O(a), no(a), V(), s && Vn();
1455
+ }), O(b.getState()), no(b.getState()), V(), en(), {
1456
+ agent: b,
1457
+ startNewChat: ln,
1454
1458
  host: n,
1455
1459
  updateAppearance: (a) => {
1456
- a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), rn(a, "widgetHandle.updateAppearance");
1460
+ a.scribbleStyle !== void 0 && (t.scribbleStyle = a.scribbleStyle), sn(a, "widgetHandle.updateAppearance");
1457
1461
  },
1458
1462
  updateBillingStatus: (a) => {
1459
1463
  const s = a ?? null;
1460
- To(
1464
+ Po(
1461
1465
  t.billingStatus,
1462
1466
  s,
1463
- je
1464
- ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !pe(t.billingStatus) && (je = null), wn(
1465
- o.querySelector(".pluno-pa-widget__billing-status"),
1466
- t.billingStatus,
1467
- je
1468
- ), V());
1467
+ Ke
1468
+ ) && (t.billingStatus = s, t.billingStatus?.creditsUsed !== null && !pe(t.billingStatus) && (Ke = null), P(Ke), V());
1469
1469
  },
1470
1470
  updateAuthGate: (a) => {
1471
- const s = pt();
1472
- 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), qe(), D(_.getState()), V(), s && !pt() && Zt();
1471
+ const s = st();
1472
+ 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), Ve(), O(b.getState()), V(), s && !st() && en();
1473
1473
  },
1474
1474
  openPanel: (a) => {
1475
- const s = typeof a == "string" ? a : S.value, m = typeof a == "object" ? a.focusComposer !== !1 : !0;
1476
- be(s, !1, m);
1475
+ const s = typeof a == "string" ? a : v.value, m = typeof a == "object" ? a.focusComposer !== !1 : !0;
1476
+ _e(s, !1, m);
1477
1477
  },
1478
- closePanel: jt,
1478
+ closePanel: Yt,
1479
1479
  updateDisplayState: (a) => {
1480
1480
  if (a === "shown") {
1481
- it("shown", !1);
1481
+ at("shown", !1);
1482
1482
  return;
1483
1483
  }
1484
- it("minimized", !1);
1484
+ at("minimized", !1);
1485
1485
  },
1486
1486
  updateMorningReport: (a) => {
1487
- t.morningReport = a ?? null, D(_.getState());
1487
+ t.morningReport = a ?? null, O(b.getState());
1488
1488
  },
1489
1489
  destroy: () => {
1490
- Y || (F(), Y = !0, Hn.disconnect(), Yn?.disconnect(), Ci(), y.defaultView?.removeEventListener(
1490
+ Y || (W(), Y = !0, Gn.disconnect(), Zn?.disconnect(), ki(), x.defaultView?.removeEventListener(
1491
1491
  "pointerdown",
1492
- Kn,
1492
+ Xn,
1493
1493
  !0
1494
- ), y.defaultView?.removeEventListener(
1494
+ ), x.defaultView?.removeEventListener(
1495
1495
  "focus",
1496
- vt,
1496
+ Ct,
1497
1497
  !0
1498
- ), y.defaultView?.removeEventListener(
1498
+ ), x.defaultView?.removeEventListener(
1499
1499
  "focusin",
1500
- vt,
1500
+ Ct,
1501
1501
  !0
1502
- ), window.removeEventListener("resize", $n), Gn(), yi(), L !== null && window.clearTimeout(L), Zn(), Qn(), _.destroy(), Bt.release(), n.remove());
1502
+ ), window.removeEventListener("resize", qn), jn(), Si(), fe !== null && window.clearTimeout(fe), Qn(), to(), b.destroy(), Ht.release(), n.remove());
1503
1503
  }
1504
1504
  };
1505
- async function Ni(a) {
1506
- if (!Ct) {
1507
- Ct = a, ct = null, D(_.getState());
1505
+ async function zi(a) {
1506
+ if (!kt) {
1507
+ kt = a, ut = null, O(b.getState());
1508
1508
  try {
1509
1509
  if (!t.referralLinkLoader)
1510
1510
  throw new Error("Referral sharing is not available here.");
1511
1511
  const s = await t.referralLinkLoader();
1512
1512
  if (!s)
1513
1513
  throw new Error("Pluno did not return a referral link.");
1514
- await Ri(s), De.add(a.id), tt.add(a.id), F();
1514
+ await Mi(s), Ue.add(a.id), nt.add(a.id), W();
1515
1515
  } catch (s) {
1516
- ct = s instanceof Error ? s.message : "Could not copy referral link.";
1516
+ ut = s instanceof Error ? s.message : "Could not copy referral link.";
1517
1517
  } finally {
1518
- Ct = null, D(_.getState());
1518
+ kt = null, O(b.getState());
1519
1519
  }
1520
1520
  }
1521
1521
  }
1522
- async function Ri(a) {
1522
+ async function Mi(a) {
1523
1523
  if (navigator.clipboard?.writeText)
1524
1524
  try {
1525
1525
  await navigator.clipboard.writeText(a);
@@ -1535,35 +1535,35 @@ async function Ga(e = {}) {
1535
1535
  m.remove(), s?.isConnected && s.focus({ preventScroll: !0 });
1536
1536
  }
1537
1537
  }
1538
- function rn(a, s) {
1539
- const m = a.accentColor ?? t.accentColor, C = a.colorScheme ?? t.colorScheme, k = a.fontFamily ?? t.fontFamily, Te = a.scribbleStyle ?? t.scribbleStyle;
1540
- r = wo(
1538
+ function sn(a, s) {
1539
+ const m = a.accentColor ?? t.accentColor, S = a.colorScheme ?? t.colorScheme, k = a.fontFamily ?? t.fontFamily, Pe = a.scribbleStyle ?? t.scribbleStyle;
1540
+ r = _o(
1541
1541
  m,
1542
- Te
1543
- ), bo(o, r, {
1542
+ Pe
1543
+ ), xo(o, r, {
1544
1544
  accentColor: m,
1545
- colorScheme: C,
1545
+ colorScheme: S,
1546
1546
  fontFamily: k,
1547
- scribbleStyle: Te
1547
+ scribbleStyle: Pe
1548
1548
  }), J("web-sdk.widget", "Updated widget appearance", {
1549
1549
  source: s,
1550
1550
  inputAppearance: a,
1551
1551
  appliedAccentColor: m,
1552
- appliedColorScheme: C,
1552
+ appliedColorScheme: S,
1553
1553
  appliedFontFamily: k,
1554
- appliedScribbleStyle: Te,
1554
+ appliedScribbleStyle: Pe,
1555
1555
  cssAccent: o.style.getPropertyValue("--pluno-pa-accent")
1556
1556
  });
1557
1557
  }
1558
1558
  }
1559
- function wo(e, t) {
1559
+ function _o(e, t) {
1560
1560
  return { accentColor: e, scribbleStyle: t };
1561
1561
  }
1562
- function qa(e) {
1563
- const t = ja(e);
1564
- return t === null ? "#fafafa" : Va(t) > 0.5 ? "#18181b" : "#fafaf9";
1562
+ function Va(e) {
1563
+ const t = Ka(e);
1564
+ return t === null ? "#fafafa" : Ya(t) > 0.5 ? "#18181b" : "#fafaf9";
1565
1565
  }
1566
- function ja(e) {
1566
+ function Ka(e) {
1567
1567
  const t = e.trim();
1568
1568
  return /^#[0-9a-f]{6}$/i.test(t) ? [
1569
1569
  Number.parseInt(t.slice(1, 3), 16),
@@ -1575,14 +1575,14 @@ function ja(e) {
1575
1575
  Number.parseInt(t[3] + t[3], 16)
1576
1576
  ] : null;
1577
1577
  }
1578
- function Va([e, t, n]) {
1578
+ function Ya([e, t, n]) {
1579
1579
  const i = (o) => {
1580
1580
  const r = o / 255;
1581
1581
  return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
1582
1582
  };
1583
1583
  return 0.2126 * i(e) + 0.7152 * i(t) + 0.0722 * i(n);
1584
1584
  }
1585
- function bo(e, t, n) {
1585
+ function xo(e, t, n) {
1586
1586
  e.classList.toggle(
1587
1587
  "pluno-pa-widget--dark",
1588
1588
  n.colorScheme === "dark"
@@ -1590,27 +1590,27 @@ function bo(e, t, n) {
1590
1590
  "pluno-pa-widget--light",
1591
1591
  n.colorScheme !== "dark"
1592
1592
  ), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
1593
- const i = n.scribbleStyle ? Uo(n.accentColor) : n.accentColor;
1593
+ const i = n.scribbleStyle ? Fo(n.accentColor) : n.accentColor;
1594
1594
  e.style.setProperty("--pluno-pa-accent", i), n.scribbleStyle ? e.style.setProperty(
1595
1595
  "--pluno-pa-accent-contrast",
1596
- qa(i)
1597
- ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Aa : n.fontFamily, n.scribbleStyle && Ka(e.ownerDocument);
1596
+ Va(i)
1597
+ ) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Ia : n.fontFamily, n.scribbleStyle && Xa(e.ownerDocument);
1598
1598
  const o = Array.from(
1599
1599
  e.querySelectorAll(".pluno-pa-widget__character")
1600
1600
  );
1601
1601
  for (const r of o)
1602
1602
  r.replaceWith(
1603
- Ie(
1603
+ Re(
1604
1604
  Array.from(r.classList).join(" "),
1605
1605
  t
1606
1606
  )
1607
1607
  );
1608
1608
  }
1609
- function Ka(e) {
1610
- if (e.getElementById(ho))
1609
+ function Xa(e) {
1610
+ if (e.getElementById(fo))
1611
1611
  return;
1612
1612
  const t = e.createElement("style");
1613
- t.id = ho, t.textContent = `@font-face {
1613
+ t.id = fo, t.textContent = `@font-face {
1614
1614
  font-family: "Architects Daughter";
1615
1615
  font-style: normal;
1616
1616
  font-weight: 400;
@@ -1618,7 +1618,7 @@ function Ka(e) {
1618
1618
  src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
1619
1619
  }`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
1620
1620
  }
1621
- function Ya({
1621
+ function Za({
1622
1622
  root: e,
1623
1623
  launcher: t,
1624
1624
  launcherDragHandle: n,
@@ -1631,15 +1631,15 @@ function Ya({
1631
1631
  l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--dragging");
1632
1632
  }, f = (w) => {
1633
1633
  e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing") || (w.preventDefault(), w.stopPropagation(), l = w.pointerId, p = { x: w.clientX, y: w.clientY }, d = i(), c = !1, t.setPointerCapture?.(w.pointerId));
1634
- }, y = (w) => {
1634
+ }, x = (w) => {
1635
1635
  if (l !== w.pointerId || !p || !d)
1636
1636
  return;
1637
1637
  w.preventDefault();
1638
- const R = w.clientX - p.x, M = w.clientY - p.y;
1639
- !c && Math.hypot(R, M) < kn || (c = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: d.x + R, y: d.y + M }));
1640
- }, v = (w) => {
1638
+ const R = w.clientX - p.x, D = w.clientY - p.y;
1639
+ !c && Math.hypot(R, D) < Tn || (c = !0, e.classList.add("pluno-pa-widget--dragging"), o({ x: d.x + R, y: d.y + D }));
1640
+ }, y = (w) => {
1641
1641
  l === w.pointerId && (w.preventDefault(), w.stopPropagation(), c && (g = { x: w.clientX, y: w.clientY }, r()), h());
1642
- }, O = (w) => {
1642
+ }, U = (w) => {
1643
1643
  l === w.pointerId && (w.preventDefault(), h());
1644
1644
  }, u = (w) => {
1645
1645
  if (!g)
@@ -1647,20 +1647,20 @@ function Ya({
1647
1647
  const R = Math.hypot(
1648
1648
  w.clientX - g.x,
1649
1649
  w.clientY - g.y
1650
- ) <= kn;
1650
+ ) <= Tn;
1651
1651
  g = null, R && (w.preventDefault(), w.stopPropagation());
1652
- }, W = (w) => {
1652
+ }, H = (w) => {
1653
1653
  if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
1654
1654
  return;
1655
- const R = w.shiftKey ? Ko : Vo, M = i();
1656
- let T = null;
1657
- w.key === "ArrowUp" ? T = { x: M.x, y: M.y - R } : w.key === "ArrowDown" ? T = { x: M.x, y: M.y + R } : w.key === "ArrowLeft" ? T = { x: M.x - R, y: M.y } : w.key === "ArrowRight" && (T = { x: M.x + R, y: M.y }), T && (w.preventDefault(), w.stopPropagation(), o(T), r());
1655
+ const R = w.shiftKey ? Xo : Yo, D = i();
1656
+ let L = null;
1657
+ w.key === "ArrowUp" ? L = { x: D.x, y: D.y - R } : w.key === "ArrowDown" ? L = { x: D.x, y: D.y + R } : w.key === "ArrowLeft" ? L = { x: D.x - R, y: D.y } : w.key === "ArrowRight" && (L = { x: D.x + R, y: D.y }), L && (w.preventDefault(), w.stopPropagation(), o(L), r());
1658
1658
  };
1659
- return t.addEventListener("pointerdown", f), t.addEventListener("pointermove", y), t.addEventListener("pointerup", v), t.addEventListener("pointercancel", O), t.addEventListener("click", u, !0), n.addEventListener("keydown", W), () => {
1660
- t.removeEventListener("pointerdown", f), t.removeEventListener("pointermove", y), t.removeEventListener("pointerup", v), t.removeEventListener("pointercancel", O), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", W);
1659
+ return t.addEventListener("pointerdown", f), t.addEventListener("pointermove", x), t.addEventListener("pointerup", y), t.addEventListener("pointercancel", U), t.addEventListener("click", u, !0), n.addEventListener("keydown", H), () => {
1660
+ t.removeEventListener("pointerdown", f), t.removeEventListener("pointermove", x), t.removeEventListener("pointerup", y), t.removeEventListener("pointercancel", U), t.removeEventListener("click", u, !0), n.removeEventListener("keydown", H);
1661
1661
  };
1662
1662
  }
1663
- function Xa({
1663
+ function Ja({
1664
1664
  root: e,
1665
1665
  handles: t,
1666
1666
  getBounds: n,
@@ -1671,37 +1671,37 @@ function Xa({
1671
1671
  const g = () => {
1672
1672
  r = null, l = null, p = null, d = null, c = !1, e.classList.remove("pluno-pa-widget--resizing");
1673
1673
  }, h = (u) => {
1674
- const W = u.currentTarget, w = W.dataset.resizeDirection;
1675
- !e.classList.contains("pluno-pa-widget--open") || !_o(w) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = w, p = { x: u.clientX, y: u.clientY }, d = n(), c = !1, W.setPointerCapture?.(u.pointerId));
1674
+ const H = u.currentTarget, w = H.dataset.resizeDirection;
1675
+ !e.classList.contains("pluno-pa-widget--open") || !yo(w) || (u.preventDefault(), u.stopPropagation(), r = u.pointerId, l = w, p = { x: u.clientX, y: u.clientY }, d = n(), c = !1, H.setPointerCapture?.(u.pointerId));
1676
1676
  }, f = (u) => {
1677
1677
  if (r !== u.pointerId || !l || !p || !d)
1678
1678
  return;
1679
1679
  u.preventDefault(), u.stopPropagation();
1680
- const W = u.clientX - p.x, w = u.clientY - p.y;
1681
- !c && Math.hypot(W, w) < kn || (c = !0, e.classList.add("pluno-pa-widget--resizing"), i(
1682
- xo(d, l, W, w)
1680
+ const H = u.clientX - p.x, w = u.clientY - p.y;
1681
+ !c && Math.hypot(H, w) < Tn || (c = !0, e.classList.add("pluno-pa-widget--resizing"), i(
1682
+ vo(d, l, H, w)
1683
1683
  ));
1684
- }, y = (u) => {
1684
+ }, x = (u) => {
1685
1685
  r === u.pointerId && (u.preventDefault(), u.stopPropagation(), c && o(), g());
1686
- }, v = (u) => {
1686
+ }, y = (u) => {
1687
1687
  r === u.pointerId && (u.preventDefault(), g());
1688
- }, O = (u) => {
1689
- const w = u.currentTarget.dataset.resizeDirection, R = u.shiftKey ? Ko : Vo, M = n();
1690
- let T = 0, ne = 0;
1691
- _o(w) && (u.key === "ArrowLeft" ? T = -R : u.key === "ArrowRight" ? T = R : u.key === "ArrowUp" ? ne = -R : u.key === "ArrowDown" && (ne = R), !(T === 0 && ne === 0) && (u.preventDefault(), u.stopPropagation(), i(xo(M, w, T, ne)), o()));
1688
+ }, U = (u) => {
1689
+ const w = u.currentTarget.dataset.resizeDirection, R = u.shiftKey ? Xo : Yo, D = n();
1690
+ let L = 0, ne = 0;
1691
+ yo(w) && (u.key === "ArrowLeft" ? L = -R : u.key === "ArrowRight" ? L = R : u.key === "ArrowUp" ? ne = -R : u.key === "ArrowDown" && (ne = R), !(L === 0 && ne === 0) && (u.preventDefault(), u.stopPropagation(), i(vo(D, w, L, ne)), o()));
1692
1692
  };
1693
1693
  for (const u of t)
1694
- u.addEventListener("pointerdown", h), u.addEventListener("pointermove", f), u.addEventListener("pointerup", y), u.addEventListener("pointercancel", v), u.addEventListener("keydown", O);
1694
+ u.addEventListener("pointerdown", h), u.addEventListener("pointermove", f), u.addEventListener("pointerup", x), u.addEventListener("pointercancel", y), u.addEventListener("keydown", U);
1695
1695
  return () => {
1696
1696
  for (const u of t)
1697
- u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", f), u.removeEventListener("pointerup", y), u.removeEventListener("pointercancel", v), u.removeEventListener("keydown", O);
1697
+ u.removeEventListener("pointerdown", h), u.removeEventListener("pointermove", f), u.removeEventListener("pointerup", x), u.removeEventListener("pointercancel", y), u.removeEventListener("keydown", U);
1698
1698
  };
1699
1699
  }
1700
- function _o(e) {
1700
+ function yo(e) {
1701
1701
  return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "top-left" || e === "top-right" || e === "bottom-left" || e === "bottom-right";
1702
1702
  }
1703
- function xo(e, t, n, i) {
1704
- const o = te(), r = yo({
1703
+ function vo(e, t, n, i) {
1704
+ const o = te(), r = So({
1705
1705
  leading: e.position.x,
1706
1706
  length: e.size.width,
1707
1707
  delta: n,
@@ -1710,20 +1710,20 @@ function xo(e, t, n, i) {
1710
1710
  minLeading: N,
1711
1711
  maxTrailing: o.width - N,
1712
1712
  minLength: Math.min(
1713
- Rn,
1713
+ Mn,
1714
1714
  o.width - N * 2
1715
1715
  )
1716
- }), l = yo({
1716
+ }), l = So({
1717
1717
  leading: e.position.y,
1718
1718
  length: e.size.height,
1719
1719
  delta: i,
1720
1720
  resizeLeading: t.startsWith("top") || t === "top",
1721
1721
  resizeTrailing: t.startsWith("bottom") || t === "bottom",
1722
- minLeading: He,
1722
+ minLeading: Ge,
1723
1723
  maxTrailing: o.height - N,
1724
1724
  minLength: Math.min(
1725
- zn,
1726
- o.height - He - N
1725
+ Dn,
1726
+ o.height - Ge - N
1727
1727
  )
1728
1728
  });
1729
1729
  return {
@@ -1731,7 +1731,7 @@ function xo(e, t, n, i) {
1731
1731
  size: { width: r.length, height: l.length }
1732
1732
  };
1733
1733
  }
1734
- function yo({
1734
+ function So({
1735
1735
  leading: e,
1736
1736
  length: t,
1737
1737
  delta: n,
@@ -1778,49 +1778,49 @@ function yo({
1778
1778
  }
1779
1779
  return { leading: e, length: t };
1780
1780
  }
1781
- function Dt(e, t = !0) {
1781
+ function Ut(e, t = !0) {
1782
1782
  const n = te();
1783
1783
  if (e.classList.contains("pluno-pa-widget--minimized")) {
1784
- const r = typeof window.matchMedia == "function" && window.matchMedia("(hover: none), (pointer: coarse)").matches ? Ia : Pa;
1784
+ const r = typeof window.matchMedia == "function" && window.matchMedia("(hover: none), (pointer: coarse)").matches ? Ra : Na;
1785
1785
  return { width: r, height: r };
1786
1786
  }
1787
1787
  const i = e.getBoundingClientRect(), o = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
1788
1788
  return {
1789
- width: t && o && i.width > 0 ? i.width : Math.min(Go, n.width - 36),
1790
- height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? Ra : qo
1789
+ width: t && o && i.width > 0 ? i.width : Math.min(jo, n.width - 36),
1790
+ height: t && o && i.height > 0 ? i.height : e.classList.contains("pluno-pa-widget--scribble") ? Ma : Vo
1791
1791
  };
1792
1792
  }
1793
- function Za() {
1793
+ function Qa() {
1794
1794
  const e = te();
1795
1795
  return {
1796
1796
  width: Math.min(
1797
1797
  ee(
1798
- e.width * Ma,
1799
- Rn,
1800
- za
1798
+ e.width * Oa,
1799
+ Mn,
1800
+ Da
1801
1801
  ),
1802
1802
  e.width - N * 2
1803
1803
  ),
1804
1804
  height: Math.min(
1805
1805
  ee(
1806
- e.height * Oa,
1807
- zn,
1808
- Da
1806
+ e.height * Ba,
1807
+ Dn,
1808
+ Ua
1809
1809
  ),
1810
- e.height - He - N
1810
+ e.height - Ge - N
1811
1811
  )
1812
1812
  };
1813
1813
  }
1814
- function Je(e = null) {
1815
- return e ? Ot(e) : Za();
1814
+ function et(e = null) {
1815
+ return e ? Ft(e) : Qa();
1816
1816
  }
1817
- function Ot(e) {
1817
+ function Ft(e) {
1818
1818
  const t = te();
1819
1819
  return {
1820
1820
  width: ee(
1821
1821
  e.width,
1822
1822
  Math.min(
1823
- Rn,
1823
+ Mn,
1824
1824
  t.width - N * 2
1825
1825
  ),
1826
1826
  Math.max(
@@ -1831,25 +1831,25 @@ function Ot(e) {
1831
1831
  height: ee(
1832
1832
  e.height,
1833
1833
  Math.min(
1834
- zn,
1835
- t.height - He - N
1834
+ Dn,
1835
+ t.height - Ge - N
1836
1836
  ),
1837
1837
  Math.max(
1838
1838
  N,
1839
- t.height - He - N
1839
+ t.height - Ge - N
1840
1840
  )
1841
1841
  )
1842
1842
  };
1843
1843
  }
1844
- function dn(e, t) {
1844
+ function gn(e, t) {
1845
1845
  if (!t) {
1846
1846
  e.style.removeProperty("--pluno-pa-panel-width"), e.style.removeProperty("--pluno-pa-panel-height");
1847
1847
  return;
1848
1848
  }
1849
- const n = Ot(t);
1849
+ const n = Ft(t);
1850
1850
  e.style.setProperty("--pluno-pa-panel-width", `${n.width}px`), e.style.setProperty("--pluno-pa-panel-height", `${n.height}px`);
1851
1851
  }
1852
- function Ja(e, t, n) {
1852
+ function er(e, t, n) {
1853
1853
  const i = Number.parseFloat(e.style.left), o = Number.parseFloat(e.style.top);
1854
1854
  if (Number.isFinite(i) && Number.isFinite(o))
1855
1855
  return { x: i, y: o };
@@ -1862,23 +1862,23 @@ function Ja(e, t, n) {
1862
1862
  y: l.height - 24 - n.height
1863
1863
  };
1864
1864
  }
1865
- function cn(e, t, n) {
1866
- const i = Dt(e, !1);
1867
- return t ? Ln(
1865
+ function hn(e, t, n) {
1866
+ const i = Ut(e, !1);
1867
+ return t ? An(
1868
1868
  e,
1869
- Nt(t, i),
1869
+ zt(t, i),
1870
1870
  i
1871
- ) : Qa(n === "bottom-left" ? "bottom-left" : "bottom-right", i, Na);
1871
+ ) : tr(n === "bottom-left" ? "bottom-left" : "bottom-right", i, za);
1872
1872
  }
1873
- function Qa(e, t, n) {
1873
+ function tr(e, t, n) {
1874
1874
  const i = te();
1875
1875
  return {
1876
1876
  x: e.endsWith("right") ? Math.max(0, i.width - t.width - n) : n,
1877
1877
  y: e.startsWith("bottom") ? Math.max(0, i.height - t.height - n) : n
1878
1878
  };
1879
1879
  }
1880
- function Ln(e, t, n) {
1881
- const i = te(), o = N + tr(e);
1880
+ function An(e, t, n) {
1881
+ const i = te(), o = N + or(e);
1882
1882
  return {
1883
1883
  x: ee(
1884
1884
  t.x,
@@ -1898,36 +1898,36 @@ function Ln(e, t, n) {
1898
1898
  )
1899
1899
  };
1900
1900
  }
1901
- function Nt(e, t) {
1901
+ function zt(e, t) {
1902
1902
  const n = te();
1903
1903
  return {
1904
1904
  x: e.anchor.endsWith("right") ? n.width - t.width - e.x : e.x,
1905
1905
  y: e.anchor.startsWith("bottom") ? n.height - t.height - e.y : e.y
1906
1906
  };
1907
1907
  }
1908
- function vo(e, t) {
1909
- const n = er(e, t), i = te();
1908
+ function Co(e, t) {
1909
+ const n = nr(e, t), i = te();
1910
1910
  return {
1911
1911
  anchor: n,
1912
1912
  x: n.endsWith("right") ? i.width - e.x - t.width : e.x,
1913
1913
  y: n.startsWith("bottom") ? i.height - e.y - t.height : e.y
1914
1914
  };
1915
1915
  }
1916
- function er(e, t) {
1916
+ function nr(e, t) {
1917
1917
  const n = te(), i = e.x + t.width / 2, r = e.y + t.height / 2 <= n.height / 2 ? "top" : "bottom", l = i <= n.width / 2 ? "left" : "right";
1918
1918
  return `${r}-${l}`;
1919
1919
  }
1920
- function tr(e) {
1921
- return e.classList.contains("pluno-pa-widget--scribble") ? Wa : Fa;
1920
+ function or(e) {
1921
+ return e.classList.contains("pluno-pa-widget--scribble") ? $a : Ha;
1922
1922
  }
1923
- function un(e, t, n, i = null) {
1924
- const o = Dt(e), r = Je(i), l = {
1923
+ function mn(e, t, n, i = null) {
1924
+ const o = Ut(e), r = et(i), l = {
1925
1925
  x: n === "bottom-left" ? t.x : t.x + o.width - r.width,
1926
1926
  y: t.y + o.height - r.height
1927
1927
  };
1928
- return Rt(l, r);
1928
+ return Mt(l, r);
1929
1929
  }
1930
- function Rt(e, t) {
1930
+ function Mt(e, t) {
1931
1931
  const n = te();
1932
1932
  return {
1933
1933
  x: ee(
@@ -1940,34 +1940,34 @@ function Rt(e, t) {
1940
1940
  ),
1941
1941
  y: ee(
1942
1942
  e.y,
1943
- He,
1943
+ Ge,
1944
1944
  Math.max(
1945
- He,
1945
+ Ge,
1946
1946
  n.height - t.height - N
1947
1947
  )
1948
1948
  )
1949
1949
  };
1950
1950
  }
1951
- function We(e, t) {
1951
+ function $e(e, t) {
1952
1952
  if (e.classList.toggle("pluno-pa-widget--custom-position", t !== null), !t) {
1953
1953
  e.style.removeProperty("left"), e.style.removeProperty("top"), e.style.removeProperty("right"), e.style.removeProperty("bottom");
1954
1954
  return;
1955
1955
  }
1956
1956
  e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
1957
1957
  }
1958
- function nr(e, t) {
1958
+ function ir(e, t) {
1959
1959
  e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
1960
1960
  }
1961
- function So(e) {
1961
+ function Eo(e) {
1962
1962
  e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
1963
1963
  }
1964
1964
  function te() {
1965
1965
  return {
1966
- width: window.innerWidth || document.documentElement.clientWidth || Go + N * 2,
1967
- height: window.innerHeight || document.documentElement.clientHeight || qo + N * 2
1966
+ width: window.innerWidth || document.documentElement.clientWidth || jo + N * 2,
1967
+ height: window.innerHeight || document.documentElement.clientHeight || Vo + N * 2
1968
1968
  };
1969
1969
  }
1970
- function gn(e) {
1970
+ function fn(e) {
1971
1971
  const t = e.getBoundingClientRect();
1972
1972
  return {
1973
1973
  x: Math.round(t.x),
@@ -1989,42 +1989,42 @@ function J(e, t, n) {
1989
1989
  details: n
1990
1990
  }, r = i.__plunoProductAgentDiagnostics__ ?? [];
1991
1991
  r.push(o), r.length > 120 && r.splice(0, r.length - 120), i.__plunoProductAgentDiagnostics__ = r, i.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(
1992
- new CustomEvent(Ca, { detail: o })
1992
+ new CustomEvent(ka, { detail: o })
1993
1993
  );
1994
1994
  }
1995
- function or(e, t) {
1995
+ function ar(e, t) {
1996
1996
  J("web-sdk.widget.position", e, t);
1997
1997
  }
1998
- function hn(e, t, n, i) {
1998
+ function wn(e, t, n, i) {
1999
1999
  const o = t.value.trim();
2000
2000
  return !o && n.length === 0 ? n : (i(), t.value = "", t.style.height = "22px", t.style.overflowY = "hidden", e.sendMessage(o, {
2001
- attachments: n.length > 0 ? n.map(rr) : void 0
2001
+ attachments: n.length > 0 ? n.map(pr) : void 0
2002
2002
  }), t.dispatchEvent(new Event("input", { bubbles: !0 })), []);
2003
2003
  }
2004
- function ir(e, t, n) {
2004
+ function rr(e, t, n) {
2005
2005
  const i = e.activeElement;
2006
2006
  return i === n ? "composer" : i === t ? "launcher" : null;
2007
2007
  }
2008
- function ar(e, t, n, i) {
2009
- if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > ua)
2008
+ function lr(e, t, n, i) {
2009
+ if (!e.focusedInput || !e.focusedInputAt || Date.now() - e.focusedInputAt > ha)
2010
2010
  return;
2011
2011
  const o = e.focusedInput === "composer" ? i : n;
2012
2012
  o === i && !t.classList.contains("pluno-pa-widget--open") || o === n && t.classList.contains("pluno-pa-widget--open") || window.requestAnimationFrame(() => {
2013
2013
  !o.isConnected || o.readOnly || (o.focus(), o.setSelectionRange(o.value.length, o.value.length));
2014
2014
  });
2015
2015
  }
2016
- function rr(e) {
2016
+ function pr(e) {
2017
2017
  return e;
2018
2018
  }
2019
- function gt(e) {
2019
+ function ht(e) {
2020
2020
  e.style.height = "0px", e.style.height = `${e.scrollHeight}px`, e.style.overflowY = e.scrollHeight > e.clientHeight ? "auto" : "hidden";
2021
2021
  }
2022
- function ht(e, t = () => !0) {
2022
+ function mt(e, t = () => !0) {
2023
2023
  e.scrollTop = e.scrollHeight, window.requestAnimationFrame(() => {
2024
2024
  t() && (e.scrollTop = e.scrollHeight);
2025
2025
  });
2026
2026
  }
2027
- function lr(e) {
2027
+ function sr(e) {
2028
2028
  const t = e.messages[e.messages.length - 1];
2029
2029
  return [
2030
2030
  e.messages.length,
@@ -2035,13 +2035,13 @@ function lr(e) {
2035
2035
  e.lastError ?? ""
2036
2036
  ].join(":");
2037
2037
  }
2038
- function pr(e) {
2038
+ function dr(e) {
2039
2039
  return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
2040
2040
  }
2041
- function sr(e) {
2041
+ function cr(e) {
2042
2042
  return e.firstUserMessage?.trim() ? e.firstUserMessage : e.title?.trim() ? e.title : "Untitled chat";
2043
2043
  }
2044
- function dr(e) {
2044
+ function ur(e) {
2045
2045
  const t = e.currentPage;
2046
2046
  if (typeof t?.url == "string" && t.url.trim())
2047
2047
  try {
@@ -2052,7 +2052,7 @@ function dr(e) {
2052
2052
  }
2053
2053
  return typeof t?.origin == "string" && t.origin.trim() ? t.origin : "Current origin";
2054
2054
  }
2055
- function cr(e, t) {
2055
+ function gr(e, t) {
2056
2056
  const n = new Date(e).getTime();
2057
2057
  if (!Number.isFinite(n))
2058
2058
  return "now";
@@ -2068,24 +2068,24 @@ function cr(e, t) {
2068
2068
  }
2069
2069
  return "now";
2070
2070
  }
2071
- function ur(e, t, n, i, o) {
2072
- e.appendChild(vr()), e.appendChild(
2073
- gr(
2071
+ function hr(e, t, n, i, o) {
2072
+ e.appendChild(Cr()), e.appendChild(
2073
+ mr(
2074
2074
  t,
2075
2075
  n,
2076
2076
  i,
2077
2077
  o
2078
2078
  )
2079
2079
  ), e.appendChild(
2080
- Ut(
2080
+ Wt(
2081
2081
  "pluno-pa-widget__close",
2082
2082
  "Close",
2083
- Sr(16),
2083
+ Er(16),
2084
2084
  !0
2085
2085
  )
2086
- ), e.appendChild(hr(n));
2086
+ ), e.appendChild(fr(n));
2087
2087
  }
2088
- function gr(e, t, n, i) {
2088
+ function mr(e, t, n, i) {
2089
2089
  const o = document.createElement("form");
2090
2090
  if (o.className = "pluno-pa-widget__launcher", i && o.classList.add("pluno-pa-widget__launcher--minimizable"), n) {
2091
2091
  o.classList.add("pluno-pa-widget__launcher--movable");
@@ -2093,12 +2093,12 @@ function gr(e, t, n, i) {
2093
2093
  d.type = "button", d.className = "pluno-pa-widget__launcher-drag-handle", d.setAttribute("aria-label", "Move Pluno launcher"), d.title = "Move Pluno launcher", o.appendChild(d);
2094
2094
  }
2095
2095
  o.appendChild(
2096
- ei(
2096
+ ni(
2097
2097
  "pluno-pa-widget__scribble-spirals--launcher",
2098
2098
  10
2099
2099
  )
2100
2100
  ), o.appendChild(
2101
- Ie(
2101
+ Re(
2102
2102
  "pluno-pa-widget__character--launcher",
2103
2103
  t
2104
2104
  )
@@ -2107,22 +2107,22 @@ function gr(e, t, n, i) {
2107
2107
  r.className = "pluno-pa-widget__launcher-run-indicator", o.appendChild(r);
2108
2108
  const l = document.createElement("input");
2109
2109
  l.className = "pluno-pa-widget__launcher-input", l.type = "text", l.placeholder = e, l.setAttribute("aria-label", e), o.appendChild(l);
2110
- const p = ft("Working...");
2110
+ const p = wt("Working...");
2111
2111
  if (p.classList.add("pluno-pa-widget__status--launcher"), o.appendChild(p), i) {
2112
2112
  const d = document.createElement("button");
2113
2113
  d.type = "button", d.className = "pluno-pa-widget__launcher-minimize", d.textContent = "-", d.setAttribute("aria-label", "Minimize Pluno on this site"), d.title = "Minimize Pluno on this site", o.appendChild(d);
2114
2114
  }
2115
2115
  return o;
2116
2116
  }
2117
- function hr(e) {
2117
+ function fr(e) {
2118
2118
  const t = document.createElement("section");
2119
2119
  t.className = "pluno-pa-widget__panel", t.hidden = !0, t.appendChild(
2120
- ei("pluno-pa-widget__scribble-spirals--panel", 16)
2120
+ ni("pluno-pa-widget__scribble-spirals--panel", 16)
2121
2121
  );
2122
2122
  const n = document.createElement("div");
2123
2123
  n.className = "pluno-pa-widget__timeline-wrap";
2124
2124
  const i = document.createElement("main");
2125
- i.className = "pluno-pa-widget__timeline", i.appendChild(_r(e));
2125
+ i.className = "pluno-pa-widget__timeline", i.appendChild(yr(e));
2126
2126
  const o = document.createElement("div");
2127
2127
  o.className = "pluno-pa-widget__timeline-bottom-sentinel", o.setAttribute("aria-hidden", "true"), i.appendChild(o), n.appendChild(i);
2128
2128
  const r = document.createElement("div");
@@ -2131,34 +2131,34 @@ function hr(e) {
2131
2131
  l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l);
2132
2132
  const p = document.createElement("div");
2133
2133
  return p.className = "pluno-pa-widget__top-actions", p.appendChild(
2134
- Ut(
2134
+ Wt(
2135
2135
  "pluno-pa-widget__history",
2136
- Tn(),
2137
- Er(),
2136
+ Pn(),
2137
+ Lr(),
2138
2138
  !0
2139
2139
  )
2140
- ), n.appendChild(p), n.appendChild(br()), t.appendChild(n), t.appendChild(mr()), t.appendChild(fr()), t.appendChild(wr()), t.appendChild(Ae("left", "Resize Pluno from left")), t.appendChild(
2141
- Ae("right", "Resize Pluno from right")
2142
- ), t.appendChild(Ae("top", "Resize Pluno from top")), t.appendChild(
2143
- Ae("bottom", "Resize Pluno from bottom")
2140
+ ), n.appendChild(p), n.appendChild(xr()), t.appendChild(n), t.appendChild(wr()), t.appendChild(br()), t.appendChild(_r()), t.appendChild(Ie("left", "Resize Pluno from left")), t.appendChild(
2141
+ Ie("right", "Resize Pluno from right")
2142
+ ), t.appendChild(Ie("top", "Resize Pluno from top")), t.appendChild(
2143
+ Ie("bottom", "Resize Pluno from bottom")
2144
2144
  ), t.appendChild(
2145
- Ae("top-left", "Resize Pluno from top left")
2145
+ Ie("top-left", "Resize Pluno from top left")
2146
2146
  ), t.appendChild(
2147
- Ae("top-right", "Resize Pluno from top right")
2147
+ Ie("top-right", "Resize Pluno from top right")
2148
2148
  ), t.appendChild(
2149
- Ae("bottom-left", "Resize Pluno from bottom left")
2149
+ Ie("bottom-left", "Resize Pluno from bottom left")
2150
2150
  ), t.appendChild(
2151
- Ae("bottom-right", "Resize Pluno from bottom right")
2151
+ Ie("bottom-right", "Resize Pluno from bottom right")
2152
2152
  ), t;
2153
2153
  }
2154
- function Ae(e, t) {
2154
+ function Ie(e, t) {
2155
2155
  const n = document.createElement("button");
2156
2156
  return n.type = "button", n.className = [
2157
2157
  "pluno-pa-widget__resize-handle",
2158
2158
  `pluno-pa-widget__resize-handle--${e}`
2159
2159
  ].join(" "), n.dataset.resizeDirection = e, n.setAttribute("aria-label", t), n.title = t, n;
2160
2160
  }
2161
- function mr() {
2161
+ function wr() {
2162
2162
  const e = document.createElement("div");
2163
2163
  e.className = "pluno-pa-widget__notify-suggestion", e.hidden = !0;
2164
2164
  const t = document.createElement("span");
@@ -2172,7 +2172,7 @@ function mr() {
2172
2172
  const r = document.createElement("button");
2173
2173
  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;
2174
2174
  }
2175
- function fr() {
2175
+ function br() {
2176
2176
  const e = document.createElement("div");
2177
2177
  e.className = "pluno-pa-widget__notify-suggestion pluno-pa-widget__tab-groups-suggestion", e.hidden = !0;
2178
2178
  const t = document.createElement("span");
@@ -2184,7 +2184,7 @@ function fr() {
2184
2184
  const o = document.createElement("button");
2185
2185
  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;
2186
2186
  }
2187
- function wr() {
2187
+ function _r() {
2188
2188
  const e = document.createElement("form");
2189
2189
  e.className = "pluno-pa-widget__composer";
2190
2190
  const t = document.createElement("div");
@@ -2198,11 +2198,11 @@ function wr() {
2198
2198
  const r = document.createElement("input");
2199
2199
  r.className = "pluno-pa-widget__attachment-input", r.type = "file", r.multiple = !0, r.tabIndex = -1, r.setAttribute("aria-hidden", "true"), o.appendChild(r);
2200
2200
  const l = document.createElement("button");
2201
- l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Lr()), l.appendChild(Tr()), o.appendChild(l);
2201
+ l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(Tr()), l.appendChild(Ar()), o.appendChild(l);
2202
2202
  const p = document.createElement("textarea");
2203
2203
  p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", o.appendChild(p);
2204
2204
  const d = document.createElement("button");
2205
- d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(ni()), o.appendChild(d), e.appendChild(o);
2205
+ d.type = "button", d.className = "pluno-pa-widget__send", d.setAttribute("aria-label", "Send"), d.appendChild(ai()), o.appendChild(d), e.appendChild(o);
2206
2206
  const c = document.createElement("div");
2207
2207
  c.className = "pluno-pa-widget__composer-meta";
2208
2208
  const g = document.createElement("a");
@@ -2210,20 +2210,20 @@ function wr() {
2210
2210
  const h = document.createElement("span");
2211
2211
  return h.className = "pluno-pa-widget__ai-disclaimer", h.textContent = "AI can make mistakes. Verify outputs.", c.appendChild(h), e.appendChild(c), e;
2212
2212
  }
2213
- function Tn() {
2213
+ function Pn() {
2214
2214
  return location.hostname ? `Recent chats on ${location.hostname}` : "Recent chats";
2215
2215
  }
2216
- function br() {
2216
+ function xr() {
2217
2217
  const e = document.createElement("section");
2218
- e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Tn());
2218
+ e.className = "pluno-pa-widget__history-panel", e.hidden = !0, e.setAttribute("aria-label", Pn());
2219
2219
  const t = document.createElement("div");
2220
2220
  t.className = "pluno-pa-widget__history-header";
2221
2221
  const n = document.createElement("strong");
2222
- n.textContent = Tn();
2223
- const i = Ut(
2222
+ n.textContent = Pn();
2223
+ const i = Wt(
2224
2224
  "pluno-pa-widget__history-close",
2225
2225
  "Close recent chats",
2226
- kr(),
2226
+ ii(),
2227
2227
  !1
2228
2228
  );
2229
2229
  t.append(n, i);
@@ -2232,20 +2232,20 @@ function br() {
2232
2232
  const r = document.createElement("p");
2233
2233
  return r.className = "pluno-pa-widget__history-status", r.hidden = !0, e.append(t, o, r), e;
2234
2234
  }
2235
- function _r(e) {
2235
+ function yr(e) {
2236
2236
  const t = document.createElement("div");
2237
2237
  return t.className = "pluno-pa-widget__empty-state", t.appendChild(
2238
- Ie(
2238
+ Re(
2239
2239
  "pluno-pa-widget__character--empty",
2240
2240
  e
2241
2241
  )
2242
- ), t.appendChild(Zo()), t;
2242
+ ), t.appendChild(Qo()), t;
2243
2243
  }
2244
- function Zo() {
2244
+ function Qo() {
2245
2245
  const e = document.createElement("div");
2246
2246
  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;
2247
2247
  }
2248
- function Jo(e, t) {
2248
+ function ei(e, t) {
2249
2249
  e.replaceChildren(), e.setAttribute(
2250
2250
  "aria-label",
2251
2251
  `${t.toLocaleString("en-US")} users currently active`
@@ -2257,17 +2257,17 @@ function Jo(e, t) {
2257
2257
  )
2258
2258
  );
2259
2259
  }
2260
- function Ie(e, t) {
2261
- const n = `pluno-pa-character-${fo}`;
2262
- fo += 1;
2263
- const i = t.scribbleStyle ? yr(t.accentColor, n) : xr(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
2260
+ function Re(e, t) {
2261
+ const n = `pluno-pa-character-${bo}`;
2262
+ bo += 1;
2263
+ const i = t.scribbleStyle ? Sr(t.accentColor, n) : vr(t.accentColor, n), o = e.split(/\s+/).filter(Boolean);
2264
2264
  return i.setAttribute(
2265
2265
  "class",
2266
2266
  o.includes("pluno-pa-widget__character") ? e : `pluno-pa-widget__character ${e}`
2267
2267
  ), i.setAttribute("aria-hidden", "true"), i.setAttribute("focusable", "false"), i.removeAttribute("role"), i.removeAttribute("aria-label"), i;
2268
2268
  }
2269
- function xr(e, t) {
2270
- const n = Ui(e), i = {
2269
+ function vr(e, t) {
2270
+ const n = Fi(e), i = {
2271
2271
  boltFill: `${t}-boltFill`,
2272
2272
  boltEdge: `${t}-boltEdge`,
2273
2273
  boltGlow: `${t}-boltGlow`,
@@ -2278,7 +2278,7 @@ function xr(e, t) {
2278
2278
  eyeShadow: `${t}-eyeShadow`,
2279
2279
  pupilGloss: `${t}-pupilGloss`,
2280
2280
  boltClip: `${t}-boltClip`
2281
- }, o = Qo(), r = x(o, "defs"), l = x(r, "linearGradient", {
2281
+ }, o = ti(), r = _(o, "defs"), l = _(r, "linearGradient", {
2282
2282
  id: i.boltFill,
2283
2283
  x1: "420",
2284
2284
  y1: "180",
@@ -2286,8 +2286,8 @@ function xr(e, t) {
2286
2286
  y2: "1040",
2287
2287
  gradientUnits: "userSpaceOnUse"
2288
2288
  });
2289
- $(l, "0", n.top), $(l, "0.36", n.middle), $(l, "0.72", n.bottom), $(l, "1", n.bottom);
2290
- const p = x(r, "linearGradient", {
2289
+ G(l, "0", n.top), G(l, "0.36", n.middle), G(l, "0.72", n.bottom), G(l, "1", n.bottom);
2290
+ const p = _(r, "linearGradient", {
2291
2291
  id: i.boltEdge,
2292
2292
  x1: "470",
2293
2293
  y1: "145",
@@ -2295,29 +2295,29 @@ function xr(e, t) {
2295
2295
  y2: "980",
2296
2296
  gradientUnits: "userSpaceOnUse"
2297
2297
  });
2298
- $(p, "0", n.edgeStart), $(p, "0.32", n.edgeMiddle), $(p, "0.78", n.edgeEnd), $(p, "1", n.edgeEnd);
2299
- const d = x(r, "radialGradient", {
2298
+ G(p, "0", n.edgeStart), G(p, "0.32", n.edgeMiddle), G(p, "0.78", n.edgeEnd), G(p, "1", n.edgeEnd);
2299
+ const d = _(r, "radialGradient", {
2300
2300
  id: i.boltGlow,
2301
2301
  cx: "50%",
2302
2302
  cy: "22%",
2303
2303
  r: "82%"
2304
2304
  });
2305
- $(d, "0", n.glow, "0.72"), $(d, "0.5", n.middle, "0.44"), $(d, "1", n.bottom, "0");
2306
- const c = x(r, "radialGradient", {
2305
+ G(d, "0", n.glow, "0.72"), G(d, "0.5", n.middle, "0.44"), G(d, "1", n.bottom, "0");
2306
+ const c = _(r, "radialGradient", {
2307
2307
  id: i.eyeWhite,
2308
2308
  cx: "35%",
2309
2309
  cy: "25%",
2310
2310
  r: "70%"
2311
2311
  });
2312
- $(c, "0", "#ffffff"), $(c, "0.72", "#ffffff"), $(c, "1", "#e5e5e5");
2313
- const g = x(r, "radialGradient", {
2312
+ G(c, "0", "#ffffff"), G(c, "0.72", "#ffffff"), G(c, "1", "#e5e5e5");
2313
+ const g = _(r, "radialGradient", {
2314
2314
  id: i.pupil,
2315
2315
  cx: "42%",
2316
2316
  cy: "38%",
2317
2317
  r: "65%"
2318
2318
  });
2319
- $(g, "0", "#2a1f10"), $(g, "0.52", "#080604"), $(g, "1", "#000000");
2320
- const h = x(r, "filter", {
2319
+ G(g, "0", "#2a1f10"), G(g, "0.52", "#080604"), G(g, "1", "#000000");
2320
+ const h = _(r, "filter", {
2321
2321
  id: i.softDropShadow,
2322
2322
  x: "-18%",
2323
2323
  y: "-12%",
@@ -2325,14 +2325,14 @@ function xr(e, t) {
2325
2325
  height: "136%",
2326
2326
  "color-interpolation-filters": "sRGB"
2327
2327
  });
2328
- x(h, "feDropShadow", {
2328
+ _(h, "feDropShadow", {
2329
2329
  dx: "0",
2330
2330
  dy: "12",
2331
2331
  stdDeviation: "18",
2332
2332
  "flood-color": n.shadow,
2333
2333
  "flood-opacity": "0.24"
2334
2334
  });
2335
- const f = x(r, "filter", {
2335
+ const f = _(r, "filter", {
2336
2336
  id: i.innerDepth,
2337
2337
  x: "-8%",
2338
2338
  y: "-8%",
@@ -2340,32 +2340,32 @@ function xr(e, t) {
2340
2340
  height: "116%",
2341
2341
  "color-interpolation-filters": "sRGB"
2342
2342
  });
2343
- x(f, "feGaussianBlur", {
2343
+ _(f, "feGaussianBlur", {
2344
2344
  in: "SourceAlpha",
2345
2345
  stdDeviation: "8",
2346
2346
  result: "blur"
2347
- }), x(f, "feOffset", {
2347
+ }), _(f, "feOffset", {
2348
2348
  dx: "-7",
2349
2349
  dy: "-9",
2350
2350
  result: "topLeft"
2351
- }), x(f, "feComposite", {
2351
+ }), _(f, "feComposite", {
2352
2352
  in: "topLeft",
2353
2353
  in2: "SourceAlpha",
2354
2354
  operator: "arithmetic",
2355
2355
  k2: "-1",
2356
2356
  k3: "1",
2357
2357
  result: "innerShadow"
2358
- }), x(f, "feColorMatrix", {
2358
+ }), _(f, "feColorMatrix", {
2359
2359
  in: "innerShadow",
2360
2360
  type: "matrix",
2361
2361
  values: "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0.42 0",
2362
2362
  result: "innerLight"
2363
- }), x(f, "feBlend", {
2363
+ }), _(f, "feBlend", {
2364
2364
  in: "SourceGraphic",
2365
2365
  in2: "innerLight",
2366
2366
  mode: "screen"
2367
2367
  });
2368
- const y = x(r, "filter", {
2368
+ const x = _(r, "filter", {
2369
2369
  id: i.eyeShadow,
2370
2370
  x: "-24%",
2371
2371
  y: "-20%",
@@ -2373,14 +2373,14 @@ function xr(e, t) {
2373
2373
  height: "148%",
2374
2374
  "color-interpolation-filters": "sRGB"
2375
2375
  });
2376
- x(y, "feDropShadow", {
2376
+ _(x, "feDropShadow", {
2377
2377
  dx: "0",
2378
2378
  dy: "8",
2379
2379
  stdDeviation: "5",
2380
2380
  "flood-color": n.shadow,
2381
2381
  "flood-opacity": "0.3"
2382
2382
  });
2383
- const v = x(r, "filter", {
2383
+ const y = _(r, "filter", {
2384
2384
  id: i.pupilGloss,
2385
2385
  x: "-15%",
2386
2386
  y: "-15%",
@@ -2388,51 +2388,51 @@ function xr(e, t) {
2388
2388
  height: "130%",
2389
2389
  "color-interpolation-filters": "sRGB"
2390
2390
  });
2391
- x(v, "feDropShadow", {
2391
+ _(y, "feDropShadow", {
2392
2392
  dx: "0",
2393
2393
  dy: "3",
2394
2394
  stdDeviation: "3",
2395
2395
  "flood-color": "#000000",
2396
2396
  "flood-opacity": "0.22"
2397
2397
  });
2398
- const O = x(r, "clipPath", { id: i.boltClip });
2399
- x(O, "path", { d: zt });
2400
- const u = x(o, "g", {
2398
+ const U = _(r, "clipPath", { id: i.boltClip });
2399
+ _(U, "path", { d: Dt });
2400
+ const u = _(o, "g", {
2401
2401
  filter: Q(i.softDropShadow)
2402
2402
  });
2403
- x(u, "path", {
2404
- d: zt,
2403
+ _(u, "path", {
2404
+ d: Dt,
2405
2405
  fill: Q(i.boltEdge)
2406
2406
  });
2407
- const W = "M546 166 C522 166 505 180 499 204 L397 606 C390 630 406 646 432 646 L526 646 C568 646 590 672 581 712 L512 1001 C510 1010 518 1014 524 1006 L875 475 C886 458 878 449 855 449 L814 449 C764 449 745 415 769 374 L884 200 C894 181 883 161 858 161 Z";
2408
- x(u, "path", {
2409
- d: W,
2407
+ const H = "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";
2408
+ _(u, "path", {
2409
+ d: H,
2410
2410
  fill: Q(i.boltFill),
2411
2411
  filter: Q(i.innerDepth)
2412
- }), x(u, "path", {
2413
- d: W,
2412
+ }), _(u, "path", {
2413
+ d: H,
2414
2414
  fill: Q(i.boltGlow),
2415
2415
  opacity: "0.74"
2416
2416
  });
2417
- const w = x(u, "g", {
2417
+ const w = _(u, "g", {
2418
2418
  "clip-path": Q(i.boltClip),
2419
2419
  opacity: "0.42"
2420
2420
  });
2421
- x(w, "path", {
2421
+ _(w, "path", {
2422
2422
  d: "M523 181 C505 189 496 206 489 232 L400 594 C397 606 400 619 411 626",
2423
2423
  fill: "none",
2424
2424
  stroke: n.highlight,
2425
2425
  "stroke-width": "22",
2426
2426
  "stroke-linecap": "round",
2427
2427
  opacity: "0.65"
2428
- }), x(w, "path", {
2428
+ }), _(w, "path", {
2429
2429
  d: "M556 685 L501 994",
2430
2430
  fill: "none",
2431
2431
  stroke: n.highlight,
2432
2432
  "stroke-width": "20",
2433
2433
  "stroke-linecap": "round",
2434
2434
  opacity: "0.55"
2435
- }), x(w, "path", {
2435
+ }), _(w, "path", {
2436
2436
  d: "M858 160 C882 166 893 181 883 204",
2437
2437
  fill: "none",
2438
2438
  stroke: n.inner,
@@ -2440,8 +2440,8 @@ function xr(e, t) {
2440
2440
  "stroke-linecap": "round",
2441
2441
  opacity: "0.48"
2442
2442
  });
2443
- const R = x(o, "g", { filter: Q(i.eyeShadow) });
2444
- return Co(
2443
+ const R = _(o, "g", { filter: Q(i.eyeShadow) });
2444
+ return ko(
2445
2445
  R,
2446
2446
  "rotate(-2 528 463)",
2447
2447
  "528",
@@ -2451,7 +2451,7 @@ function xr(e, t) {
2451
2451
  "557",
2452
2452
  "447",
2453
2453
  i
2454
- ), Co(
2454
+ ), ko(
2455
2455
  R,
2456
2456
  "rotate(2 717 462)",
2457
2457
  "717",
@@ -2463,13 +2463,13 @@ function xr(e, t) {
2463
2463
  i
2464
2464
  ), o;
2465
2465
  }
2466
- function yr(e, t) {
2467
- const n = Uo(e), i = {
2466
+ function Sr(e, t) {
2467
+ const n = Fo(e), i = {
2468
2468
  clip: `${t}-scribbleBoltClip`,
2469
2469
  wobble: `${t}-scribbleBoltWobble`
2470
- }, o = Qo(), r = x(o, "defs"), l = x(r, "clipPath", { id: i.clip });
2471
- x(l, "path", { d: zt });
2472
- const p = x(r, "filter", {
2470
+ }, o = ti(), r = _(o, "defs"), l = _(r, "clipPath", { id: i.clip });
2471
+ _(l, "path", { d: Dt });
2472
+ const p = _(r, "filter", {
2473
2473
  id: i.wobble,
2474
2474
  x: "-10%",
2475
2475
  y: "-10%",
@@ -2477,24 +2477,24 @@ function yr(e, t) {
2477
2477
  height: "120%",
2478
2478
  "color-interpolation-filters": "sRGB"
2479
2479
  });
2480
- x(p, "feTurbulence", {
2480
+ _(p, "feTurbulence", {
2481
2481
  type: "fractalNoise",
2482
2482
  baseFrequency: "0.011",
2483
2483
  numOctaves: "3",
2484
2484
  seed: "7",
2485
2485
  result: "noise"
2486
- }), x(p, "feDisplacementMap", {
2486
+ }), _(p, "feDisplacementMap", {
2487
2487
  in: "SourceGraphic",
2488
2488
  in2: "noise",
2489
2489
  scale: "16",
2490
2490
  xChannelSelector: "R",
2491
2491
  yChannelSelector: "G"
2492
2492
  });
2493
- const d = x(o, "g", { filter: Q(i.wobble) }), c = x(d, "g", {
2493
+ const d = _(o, "g", { filter: Q(i.wobble) }), c = _(d, "g", {
2494
2494
  "clip-path": Q(i.clip)
2495
2495
  });
2496
- return x(c, "path", {
2497
- d: Oi(),
2496
+ return _(c, "path", {
2497
+ d: Bi(),
2498
2498
  fill: "none",
2499
2499
  stroke: n,
2500
2500
  "stroke-width": "56",
@@ -2502,13 +2502,13 @@ function yr(e, t) {
2502
2502
  "stroke-linejoin": "round",
2503
2503
  opacity: "0.9",
2504
2504
  transform: "rotate(-14 627 600)"
2505
- }), x(d, "path", {
2506
- d: zt,
2505
+ }), _(d, "path", {
2506
+ d: Dt,
2507
2507
  fill: "none",
2508
- stroke: Mt,
2508
+ stroke: Ot,
2509
2509
  "stroke-width": "18",
2510
2510
  "stroke-linejoin": "round"
2511
- }), Eo(
2511
+ }), Lo(
2512
2512
  d,
2513
2513
  "rotate(-2 528 463)",
2514
2514
  "528",
@@ -2517,7 +2517,7 @@ function yr(e, t) {
2517
2517
  "473",
2518
2518
  "557",
2519
2519
  "447"
2520
- ), Eo(
2520
+ ), Lo(
2521
2521
  d,
2522
2522
  "rotate(2 717 462)",
2523
2523
  "717",
@@ -2528,123 +2528,123 @@ function yr(e, t) {
2528
2528
  "447"
2529
2529
  ), o;
2530
2530
  }
2531
- function Qo() {
2532
- return P("svg", {
2533
- xmlns: jo,
2531
+ function ti() {
2532
+ return A("svg", {
2533
+ xmlns: Ko,
2534
2534
  viewBox: "0 0 1254 1254"
2535
2535
  });
2536
2536
  }
2537
- function Co(e, t, n, i, o, r, l, p, d) {
2538
- const c = x(e, "g", { transform: t });
2539
- x(c, "ellipse", {
2537
+ function ko(e, t, n, i, o, r, l, p, d) {
2538
+ const c = _(e, "g", { transform: t });
2539
+ _(c, "ellipse", {
2540
2540
  cx: n,
2541
2541
  cy: i,
2542
2542
  rx: "73",
2543
2543
  ry: "80",
2544
2544
  fill: Q(d.eyeWhite)
2545
- }), x(c, "ellipse", {
2545
+ }), _(c, "ellipse", {
2546
2546
  cx: o,
2547
2547
  cy: r,
2548
2548
  rx: "49",
2549
2549
  ry: "57",
2550
2550
  fill: Q(d.pupil),
2551
2551
  filter: Q(d.pupilGloss)
2552
- }), x(c, "circle", {
2552
+ }), _(c, "circle", {
2553
2553
  cx: l,
2554
2554
  cy: p,
2555
2555
  r: "18",
2556
2556
  fill: "#ffffff"
2557
2557
  });
2558
2558
  }
2559
- function Eo(e, t, n, i, o, r, l, p) {
2560
- const d = x(e, "g", { transform: t });
2561
- x(d, "ellipse", {
2559
+ function Lo(e, t, n, i, o, r, l, p) {
2560
+ const d = _(e, "g", { transform: t });
2561
+ _(d, "ellipse", {
2562
2562
  cx: n,
2563
2563
  cy: i,
2564
2564
  rx: "73",
2565
2565
  ry: "80",
2566
2566
  fill: "#ffffff",
2567
- stroke: Mt,
2567
+ stroke: Ot,
2568
2568
  "stroke-width": "13"
2569
- }), x(d, "ellipse", {
2569
+ }), _(d, "ellipse", {
2570
2570
  cx: o,
2571
2571
  cy: r,
2572
2572
  rx: "45",
2573
2573
  ry: "53",
2574
- fill: Mt
2575
- }), x(d, "circle", {
2574
+ fill: Ot
2575
+ }), _(d, "circle", {
2576
2576
  cx: l,
2577
2577
  cy: p,
2578
2578
  r: "16",
2579
2579
  fill: "#ffffff"
2580
2580
  });
2581
2581
  }
2582
- function x(e, t, n = {}) {
2583
- const i = P(t, n);
2582
+ function _(e, t, n = {}) {
2583
+ const i = A(t, n);
2584
2584
  return e.appendChild(i), i;
2585
2585
  }
2586
- function $(e, t, n, i) {
2586
+ function G(e, t, n, i) {
2587
2587
  const o = { offset: t, "stop-color": n };
2588
- i !== void 0 && (o["stop-opacity"] = i), x(e, "stop", o);
2588
+ i !== void 0 && (o["stop-opacity"] = i), _(e, "stop", o);
2589
2589
  }
2590
2590
  function Q(e) {
2591
2591
  return `url(#${e})`;
2592
2592
  }
2593
- function Ut(e, t, n, i) {
2593
+ function Wt(e, t, n, i) {
2594
2594
  const o = document.createElement("button");
2595
2595
  return o.type = "button", o.className = e, o.setAttribute("aria-label", t), o.title = t, o.hidden = i, o.appendChild(n), o;
2596
2596
  }
2597
- function vr() {
2598
- const e = P("svg", {
2597
+ function Cr() {
2598
+ const e = A("svg", {
2599
2599
  class: "pluno-pa-widget__scribble-defs",
2600
2600
  "aria-hidden": "true",
2601
2601
  focusable: "false",
2602
2602
  width: "0",
2603
2603
  height: "0"
2604
- }), t = P("defs");
2605
- return t.appendChild(fn("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2606
- fn("pluno-pa-scribble-wobble-2", "5", "15")
2604
+ }), t = A("defs");
2605
+ return t.appendChild(_n("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(
2606
+ _n("pluno-pa-scribble-wobble-2", "5", "15")
2607
2607
  ), t.appendChild(
2608
- fn("pluno-pa-scribble-wobble-3", "9", "19")
2608
+ _n("pluno-pa-scribble-wobble-3", "9", "19")
2609
2609
  ), e.appendChild(t), e;
2610
2610
  }
2611
- function ei(e, t) {
2612
- const n = P("svg", {
2611
+ function ni(e, t) {
2612
+ const n = A("svg", {
2613
2613
  class: `pluno-pa-widget__scribble-spirals ${e}`,
2614
2614
  preserveAspectRatio: "xMidYMid meet",
2615
2615
  "aria-hidden": "true",
2616
2616
  focusable: "false"
2617
2617
  });
2618
- return ti(n, t), n;
2618
+ return oi(n, t), n;
2619
2619
  }
2620
- function mn(e, t) {
2620
+ function bn(e, t) {
2621
2621
  if (!e)
2622
2622
  return;
2623
2623
  const n = Math.max(
2624
2624
  0,
2625
- t - En * 2
2625
+ t - Ln * 2
2626
2626
  ), i = Math.max(
2627
- Ba,
2627
+ Wa,
2628
2628
  Math.floor(
2629
- (n - Cn * 2) / Sn
2629
+ (n - kn * 2) / En
2630
2630
  )
2631
2631
  );
2632
- ti(e, i);
2632
+ oi(e, i);
2633
2633
  }
2634
- function ti(e, t) {
2634
+ function oi(e, t) {
2635
2635
  if (e.dataset.spiralCount === `${t}`)
2636
2636
  return;
2637
- const n = t * Sn + Cn * 2;
2637
+ const n = t * En + kn * 2;
2638
2638
  e.dataset.spiralCount = `${t}`, e.setAttribute(
2639
2639
  "viewBox",
2640
- `0 0 ${n} ${Ua}`
2640
+ `0 0 ${n} ${Fa}`
2641
2641
  ), e.replaceChildren();
2642
2642
  for (let i = 0; i < t; i += 1) {
2643
- const o = mo[i % mo.length], r = P("g", {
2644
- transform: `translate(${Cn + i * Sn} 0)`
2643
+ const o = wo[i % wo.length], r = A("g", {
2644
+ transform: `translate(${kn + i * En} 0)`
2645
2645
  });
2646
2646
  r.appendChild(
2647
- P("ellipse", {
2647
+ A("ellipse", {
2648
2648
  cx: o.ellipseCx,
2649
2649
  cy: o.ellipseCy,
2650
2650
  rx: o.ellipseRx,
@@ -2655,7 +2655,7 @@ function ti(e, t) {
2655
2655
  opacity: "0.8"
2656
2656
  })
2657
2657
  ), r.appendChild(
2658
- P("path", {
2658
+ A("path", {
2659
2659
  d: o.path,
2660
2660
  fill: "none",
2661
2661
  stroke: "#2c2a1e",
@@ -2665,8 +2665,8 @@ function ti(e, t) {
2665
2665
  ), e.appendChild(r);
2666
2666
  }
2667
2667
  }
2668
- function fn(e, t, n) {
2669
- const i = P("filter", {
2668
+ function _n(e, t, n) {
2669
+ const i = A("filter", {
2670
2670
  id: e,
2671
2671
  x: "-8%",
2672
2672
  y: "-8%",
@@ -2674,7 +2674,7 @@ function fn(e, t, n) {
2674
2674
  height: "116%"
2675
2675
  });
2676
2676
  return i.appendChild(
2677
- P("feTurbulence", {
2677
+ A("feTurbulence", {
2678
2678
  type: "fractalNoise",
2679
2679
  baseFrequency: "0.012 0.028",
2680
2680
  numOctaves: "3",
@@ -2682,7 +2682,7 @@ function fn(e, t, n) {
2682
2682
  result: "stroke-noise"
2683
2683
  })
2684
2684
  ), i.appendChild(
2685
- P("feDisplacementMap", {
2685
+ A("feDisplacementMap", {
2686
2686
  in: "SourceGraphic",
2687
2687
  in2: "stroke-noise",
2688
2688
  scale: "3.5",
@@ -2691,7 +2691,7 @@ function fn(e, t, n) {
2691
2691
  result: "warped"
2692
2692
  })
2693
2693
  ), i.appendChild(
2694
- P("feTurbulence", {
2694
+ A("feTurbulence", {
2695
2695
  type: "fractalNoise",
2696
2696
  baseFrequency: "0.7",
2697
2697
  numOctaves: "1",
@@ -2699,7 +2699,7 @@ function fn(e, t, n) {
2699
2699
  result: "ink-noise"
2700
2700
  })
2701
2701
  ), i.appendChild(
2702
- P("feDisplacementMap", {
2702
+ A("feDisplacementMap", {
2703
2703
  in: "warped",
2704
2704
  in2: "ink-noise",
2705
2705
  scale: "0.9",
@@ -2708,7 +2708,7 @@ function fn(e, t, n) {
2708
2708
  })
2709
2709
  ), i;
2710
2710
  }
2711
- function Sr(e) {
2711
+ function Er(e) {
2712
2712
  const t = ue(
2713
2713
  "0 0 24 24",
2714
2714
  e,
@@ -2717,9 +2717,9 @@ function Sr(e) {
2717
2717
  "currentColor",
2718
2718
  "2.25"
2719
2719
  );
2720
- return t.appendChild(P("path", { d: "m6 9 6 6 6-6" })), t;
2720
+ return t.appendChild(A("path", { d: "m6 9 6 6 6-6" })), t;
2721
2721
  }
2722
- function Cr() {
2722
+ function kr() {
2723
2723
  const e = ue(
2724
2724
  "0 0 24 24",
2725
2725
  17,
@@ -2729,16 +2729,16 @@ function Cr() {
2729
2729
  "2.25"
2730
2730
  );
2731
2731
  return e.appendChild(
2732
- P("path", {
2732
+ A("path", {
2733
2733
  d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
2734
2734
  })
2735
2735
  ), e.appendChild(
2736
- P("path", {
2736
+ A("path", {
2737
2737
  d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
2738
2738
  })
2739
2739
  ), e;
2740
2740
  }
2741
- function Er() {
2741
+ function Lr() {
2742
2742
  const e = ue(
2743
2743
  "0 0 24 24",
2744
2744
  17,
@@ -2747,9 +2747,9 @@ function Er() {
2747
2747
  "currentColor",
2748
2748
  "2.25"
2749
2749
  );
2750
- return e.appendChild(P("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(P("path", { d: "M3 4v5h5" })), e.appendChild(P("path", { d: "M12 7v5l3 2" })), e;
2750
+ return e.appendChild(A("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), e.appendChild(A("path", { d: "M3 4v5h5" })), e.appendChild(A("path", { d: "M12 7v5l3 2" })), e;
2751
2751
  }
2752
- function kr() {
2752
+ function ii() {
2753
2753
  const e = ue(
2754
2754
  "0 0 24 24",
2755
2755
  15,
@@ -2758,9 +2758,9 @@ function kr() {
2758
2758
  "currentColor",
2759
2759
  "2.4"
2760
2760
  );
2761
- return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
2761
+ return e.appendChild(A("path", { d: "M18 6 6 18" })), e.appendChild(A("path", { d: "m6 6 12 12" })), e;
2762
2762
  }
2763
- function ni() {
2763
+ function ai() {
2764
2764
  const e = ue(
2765
2765
  "0 0 24 24",
2766
2766
  14,
@@ -2770,10 +2770,10 @@ function ni() {
2770
2770
  "2.75"
2771
2771
  );
2772
2772
  return e.appendChild(
2773
- P("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2774
- ), e.appendChild(P("polyline", { points: "5 12 12 5 19 12" })), e;
2773
+ A("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
2774
+ ), e.appendChild(A("polyline", { points: "5 12 12 5 19 12" })), e;
2775
2775
  }
2776
- function Lr() {
2776
+ function Tr() {
2777
2777
  const e = ue(
2778
2778
  "0 0 24 24",
2779
2779
  16,
@@ -2786,18 +2786,18 @@ function Lr() {
2786
2786
  "class",
2787
2787
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
2788
2788
  ), e.appendChild(
2789
- P("path", {
2789
+ A("path", {
2790
2790
  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"
2791
2791
  })
2792
2792
  ), e;
2793
2793
  }
2794
- function Tr() {
2794
+ function Ar() {
2795
2795
  const e = ue("0 0 24 24", 19, 19, "none", "currentColor");
2796
2796
  return e.setAttribute(
2797
2797
  "class",
2798
2798
  "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
2799
2799
  ), e.appendChild(
2800
- P("path", {
2800
+ A("path", {
2801
2801
  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",
2802
2802
  stroke: "currentColor",
2803
2803
  "stroke-width": "2",
@@ -2806,10 +2806,10 @@ function Tr() {
2806
2806
  })
2807
2807
  ), e;
2808
2808
  }
2809
- function Ar() {
2809
+ function Pr() {
2810
2810
  const e = ue("0 0 24 24", 18, 18, "currentColor");
2811
2811
  return e.appendChild(
2812
- P("rect", {
2812
+ A("rect", {
2813
2813
  x: "6",
2814
2814
  y: "6",
2815
2815
  width: "12",
@@ -2818,7 +2818,7 @@ function Ar() {
2818
2818
  })
2819
2819
  ), e;
2820
2820
  }
2821
- function Pr() {
2821
+ function Ir() {
2822
2822
  const e = ue(
2823
2823
  "0 0 24 24",
2824
2824
  12,
@@ -2827,9 +2827,9 @@ function Pr() {
2827
2827
  "currentColor",
2828
2828
  "2.4"
2829
2829
  );
2830
- return e.appendChild(P("path", { d: "M18 6 6 18" })), e.appendChild(P("path", { d: "m6 6 12 12" })), e;
2830
+ return e.appendChild(A("path", { d: "M18 6 6 18" })), e.appendChild(A("path", { d: "m6 6 12 12" })), e;
2831
2831
  }
2832
- function Ir() {
2832
+ function Nr() {
2833
2833
  const e = ue(
2834
2834
  "0 0 24 24",
2835
2835
  13,
@@ -2839,7 +2839,7 @@ function Ir() {
2839
2839
  "2.25"
2840
2840
  );
2841
2841
  return e.appendChild(
2842
- P("rect", {
2842
+ A("rect", {
2843
2843
  width: "14",
2844
2844
  height: "14",
2845
2845
  x: "8",
@@ -2848,7 +2848,7 @@ function Ir() {
2848
2848
  ry: "2"
2849
2849
  })
2850
2850
  ), e.appendChild(
2851
- P("path", {
2851
+ A("path", {
2852
2852
  d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
2853
2853
  })
2854
2854
  ), e;
@@ -2861,33 +2861,33 @@ function ue(e, t, n, i, o, r) {
2861
2861
  fill: i,
2862
2862
  "aria-hidden": "true"
2863
2863
  };
2864
- return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), P("svg", l);
2864
+ return o && (l.stroke = o, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), r && (l["stroke-width"] = r), A("svg", l);
2865
2865
  }
2866
- function P(e, t = {}) {
2867
- const n = document.createElementNS(jo, e);
2866
+ function A(e, t = {}) {
2867
+ const n = document.createElementNS(Ko, e);
2868
2868
  for (const [i, o] of Object.entries(t))
2869
2869
  n.setAttribute(i, o);
2870
2870
  return n;
2871
2871
  }
2872
- function ko(e) {
2872
+ function To(e) {
2873
2873
  for (const t of ["keydown", "keypress", "keyup"])
2874
2874
  e.addEventListener(t, (n) => {
2875
2875
  n.stopPropagation();
2876
2876
  });
2877
2877
  }
2878
- function Nr(e, t, n) {
2878
+ function Rr(e, t, n) {
2879
2879
  e.replaceChildren(), e.hidden = t.length === 0;
2880
2880
  for (const [i, o] of t.entries()) {
2881
2881
  const r = document.createElement("div");
2882
- r.className = "pluno-pa-widget__attachment", r.appendChild(Rr(o));
2882
+ r.className = "pluno-pa-widget__attachment", r.appendChild(zr(o));
2883
2883
  const l = document.createElement("span");
2884
2884
  l.textContent = o.name, r.appendChild(l);
2885
2885
  const p = document.createElement("button");
2886
- p.type = "button", p.setAttribute("aria-label", `Remove ${o.name}`), p.appendChild(Pr()), p.addEventListener("click", () => n(i)), r.appendChild(p), e.appendChild(r);
2886
+ p.type = "button", p.setAttribute("aria-label", `Remove ${o.name}`), p.appendChild(Ir()), p.addEventListener("click", () => n(i)), r.appendChild(p), e.appendChild(r);
2887
2887
  }
2888
2888
  }
2889
- function Rr(e) {
2890
- const t = Mn(e), n = oi(e);
2889
+ function zr(e) {
2890
+ const t = On(e), n = ri(e);
2891
2891
  if (t === "image" && n) {
2892
2892
  const i = document.createElement("img");
2893
2893
  return i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), i.addEventListener(
@@ -2907,8 +2907,8 @@ function Rr(e) {
2907
2907
  }
2908
2908
  return ce(e);
2909
2909
  }
2910
- function zr(e, t) {
2911
- const n = Mn(e), i = oi(e);
2910
+ function Mr(e, t) {
2911
+ const n = On(e), i = ri(e);
2912
2912
  if (n === "image" && i) {
2913
2913
  const o = document.createElement("img");
2914
2914
  o.className = "pluno-pa-widget__message-attachment-preview", o.alt = e.name;
@@ -2950,47 +2950,50 @@ function zr(e, t) {
2950
2950
  function ce(e, t = "composer") {
2951
2951
  if (t === "composer") {
2952
2952
  const r = document.createElement("span");
2953
- return r.className = "pluno-pa-widget__attachment-file", r.textContent = Lo(e), r;
2953
+ return r.className = "pluno-pa-widget__attachment-file", r.textContent = Ao(e), r;
2954
2954
  }
2955
2955
  const n = document.createElement("div");
2956
2956
  n.className = "pluno-pa-widget__message-attachment-file";
2957
2957
  const i = document.createElement("span");
2958
- i.textContent = Lo(e);
2958
+ i.textContent = Ao(e);
2959
2959
  const o = document.createElement("strong");
2960
2960
  return o.textContent = e.name, n.append(i, o), n;
2961
2961
  }
2962
- function Mn(e) {
2962
+ function On(e) {
2963
2963
  return e.mimeType.startsWith("image/") ? "image" : e.mimeType === "application/pdf" ? "pdf" : e.mimeType.startsWith("video/") ? "video" : "file";
2964
2964
  }
2965
- function oi(e) {
2965
+ function ri(e) {
2966
2966
  return "previewUrl" in e && e.previewUrl ? e.previewUrl : e.fileUrl ?? "";
2967
2967
  }
2968
- function Lo(e) {
2969
- const t = Mn(e);
2968
+ function Ao(e) {
2969
+ const t = On(e);
2970
2970
  return t === "image" ? "IMG" : t === "pdf" ? "PDF" : t === "video" ? "VID" : "FILE";
2971
2971
  }
2972
- function Mr(e, t) {
2972
+ function Dr(e, t) {
2973
2973
  return t ? Array.from(t).map((i) => ({
2974
2974
  ...e.createLocalAttachment(i),
2975
- previewUrl: Dr(i)
2975
+ previewUrl: Or(i)
2976
2976
  })) : [];
2977
2977
  }
2978
- function Dr(e) {
2978
+ function Or(e) {
2979
2979
  return typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : void 0;
2980
2980
  }
2981
- function Pt(e) {
2981
+ function Nt(e) {
2982
2982
  return !!(e && Array.from(e.types).includes("Files"));
2983
2983
  }
2984
- function wn(e, t, n = null) {
2985
- if (!e || !An(t, n)) {
2984
+ function Ur(e, t, n = null, i = !1, o) {
2985
+ const r = pe(t) || Un(n), l = !r && i && Bt(t);
2986
+ if (!e || !In(t, n) || l) {
2986
2987
  e && (e.hidden = !0, e.replaceChildren());
2987
2988
  return;
2988
2989
  }
2989
- e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", pe(t) || Dn(n) ? e.appendChild(
2990
- Or(t, n)
2991
- ) : ii(t) && e.appendChild(Ur(t));
2990
+ e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", r ? e.appendChild(
2991
+ Br(t, n)
2992
+ ) : Bt(t) && e.appendChild(
2993
+ Fr(t, o)
2994
+ );
2992
2995
  }
2993
- function Or(e, t) {
2996
+ function Br(e, t) {
2994
2997
  const n = document.createElement("div");
2995
2998
  n.className = "pluno-pa-widget__billing-action-card";
2996
2999
  const i = e.limitExceeded || t === "limit_exceeded", o = i && e.onboardingIncomplete === !0, r = document.createElement("strong");
@@ -2999,11 +3002,11 @@ function Or(e, t) {
2999
3002
  if (l.textContent = o ? "Complete onboarding to unlock credits and start using Pluno." : i ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(l), o) {
3000
3003
  const p = document.createElement("div");
3001
3004
  p.className = "pluno-pa-widget__billing-action-card-actions", p.appendChild(
3002
- Pn("Complete onboarding", e.onboardingUrl ?? "")
3005
+ Nn("Complete onboarding", e.onboardingUrl ?? "")
3003
3006
  ), n.appendChild(p);
3004
3007
  } else
3005
3008
  n.appendChild(
3006
- ai(
3009
+ li(
3007
3010
  e,
3008
3011
  "Upgrade plan",
3009
3012
  "pluno-pa-widget__billing-action-card-actions"
@@ -3011,55 +3014,58 @@ function Or(e, t) {
3011
3014
  );
3012
3015
  return n;
3013
3016
  }
3014
- function Ur(e) {
3015
- const t = document.createElement("div");
3016
- t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
3017
- const n = document.createElement("strong");
3018
- n.textContent = "Credits running low", t.appendChild(n);
3019
- const i = document.createElement("span");
3020
- return i.textContent = Fr(e) ?? "Credits are running low for this period.", t.appendChild(i), t.appendChild(
3021
- ai(
3017
+ function Fr(e, t) {
3018
+ const n = document.createElement("div");
3019
+ if (n.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low", t) {
3020
+ const r = document.createElement("button");
3021
+ r.type = "button", r.className = "pluno-pa-widget__billing-action-card-dismiss", r.setAttribute("aria-label", "Dismiss low credits warning"), r.title = "Dismiss", r.appendChild(ii()), r.addEventListener("click", t), n.appendChild(r);
3022
+ }
3023
+ const i = document.createElement("strong");
3024
+ i.textContent = "Credits running low", n.appendChild(i);
3025
+ const o = document.createElement("span");
3026
+ return o.textContent = Hr(e) ?? "Credits are running low for this period.", n.appendChild(o), n.appendChild(
3027
+ li(
3022
3028
  e,
3023
3029
  "Upgrade",
3024
3030
  "pluno-pa-widget__billing-action-card-actions"
3025
3031
  )
3026
- ), t;
3032
+ ), n;
3027
3033
  }
3028
- function An(e, t) {
3029
- return e !== null && (pe(e) || ii(e) || Dn(t));
3034
+ function In(e, t) {
3035
+ return e !== null && (pe(e) || Bt(e) || Un(t));
3030
3036
  }
3031
- function To(e, t, n) {
3032
- return An(t, n) || Br(t) ? !0 : !An(e, n);
3037
+ function Po(e, t, n) {
3038
+ return In(t, n) || Wr(t) ? !0 : !In(e, n);
3033
3039
  }
3034
- function Br(e) {
3040
+ function Wr(e) {
3035
3041
  return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || pe(e));
3036
3042
  }
3037
3043
  function pe(e) {
3038
3044
  return e?.limitExceeded === !0 || !!e?.paymentIssue;
3039
3045
  }
3040
- function Dn(e) {
3046
+ function Un(e) {
3041
3047
  return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
3042
3048
  }
3043
- function ii(e) {
3044
- return !pe(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
3049
+ function Bt(e) {
3050
+ return e != null && !pe(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
3045
3051
  }
3046
- function Fr(e) {
3047
- return e.creditsRemaining === null ? null : `${Wr(e.creditsRemaining)} credits left`;
3052
+ function Hr(e) {
3053
+ return e.creditsRemaining === null ? null : `${$r(e.creditsRemaining)} credits left`;
3048
3054
  }
3049
- function Wr(e) {
3055
+ function $r(e) {
3050
3056
  return new Intl.NumberFormat("en-US", {
3051
3057
  maximumFractionDigits: 0
3052
3058
  }).format(Math.ceil(e));
3053
3059
  }
3054
- function ai(e, t, n) {
3060
+ function li(e, t, n) {
3055
3061
  const i = document.createElement("div");
3056
3062
  return i.className = n, i.appendChild(
3057
- Pn(t, e.pricingUrl)
3063
+ Nn(t, e.pricingUrl)
3058
3064
  ), i.appendChild(
3059
- Pn("Earn credits", e.earnCreditsUrl)
3065
+ Nn("Earn credits", e.earnCreditsUrl)
3060
3066
  ), i;
3061
3067
  }
3062
- function Pn(e, t) {
3068
+ function Nn(e, t) {
3063
3069
  const n = document.createElement("button");
3064
3070
  if (n.type = "button", e === "Earn credits") {
3065
3071
  const i = document.createElement("span");
@@ -3070,191 +3076,191 @@ function Pn(e, t) {
3070
3076
  t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
3071
3077
  }), n;
3072
3078
  }
3073
- function bn(e, t) {
3079
+ function xn(e, t) {
3074
3080
  return e.messages.filter(
3075
- (i) => !li(i)
3081
+ (i) => !si(i)
3076
3082
  ).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
3077
3083
  }
3078
- function Hr(e, t, n, i, o, r, l, p, d, c, g, h, f, y, v, O, u, W, w, R, M, T) {
3079
- const ne = Vr(r), H = Kr(
3080
- ne.filter((E) => !li(E))
3081
- ), Qe = e.scrollTop, $e = [], ge = /* @__PURE__ */ new Set(), U = (E) => {
3082
- $e.push(E);
3084
+ function Gr(e, t, n, i, o, r, l, p, d, c, g, h, f, x, y, U, u, H, w, R, D, L) {
3085
+ const ne = Yr(r), $ = Xr(
3086
+ ne.filter((C) => !si(C))
3087
+ ), bt = e.scrollTop, qe = [], ge = /* @__PURE__ */ new Set(), B = (C) => {
3088
+ qe.push(C);
3083
3089
  };
3084
- di(n, r.isThinking), o.hidden = !p, p && l !== null && Jo(o, l);
3085
- const S = H.length > 0 || !!r.assistantDraft || r.isThinking;
3086
- if (i(S), u || H.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
3087
- const E = document.createElement("div");
3088
- E.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
3089
- const A = document.createElement("div");
3090
- A.className = "pluno-pa-widget__empty-hero";
3091
- const I = Ie(
3090
+ ui(n, r.isThinking), o.hidden = !p, p && l !== null && ei(o, l);
3091
+ const v = $.length > 0 || !!r.assistantDraft || r.isThinking;
3092
+ if (i(v), u || $.length === 0 && !r.assistantDraft && !r.lastError && !r.isThinking) {
3093
+ const C = document.createElement("div");
3094
+ C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter" + (u ? " pluno-pa-widget__empty-state--morning-report" : "");
3095
+ const T = document.createElement("div");
3096
+ T.className = "pluno-pa-widget__empty-hero";
3097
+ const I = Re(
3092
3098
  "pluno-pa-widget__character--empty",
3093
- y()
3099
+ x()
3094
3100
  );
3095
- if (A.appendChild(I), E.appendChild(A), u) {
3096
- const b = document.createElement("h2");
3097
- b.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", b.textContent = u.opening, E.appendChild(b);
3101
+ if (T.appendChild(I), C.appendChild(T), u) {
3102
+ const E = document.createElement("h2");
3103
+ E.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", E.textContent = u.opening, C.appendChild(E);
3098
3104
  } else
3099
- E.appendChild(Zo());
3100
- const Ce = u?.prompts ?? r.starterPrompts, oe = document.createElement("div");
3101
- if (oe.className = Ce.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", Ce.length === 0 && !r.starterPromptsLoading && oe.setAttribute("aria-hidden", "true"), Ce.length > 0)
3102
- for (const b of Ce) {
3103
- const L = document.createElement("button");
3104
- L.type = "button", L.className = "pluno-pa-widget__starter-prompt", L.textContent = `"${b}"`, L.addEventListener("click", () => {
3105
- v(b);
3106
- }), oe.appendChild(L);
3105
+ C.appendChild(Qo());
3106
+ const Ee = u?.prompts ?? r.starterPrompts, oe = document.createElement("div");
3107
+ if (oe.className = Ee.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", Ee.length === 0 && !r.starterPromptsLoading && oe.setAttribute("aria-hidden", "true"), Ee.length > 0)
3108
+ for (const E of Ee) {
3109
+ const P = document.createElement("button");
3110
+ P.type = "button", P.className = "pluno-pa-widget__starter-prompt", P.textContent = `"${E}"`, P.addEventListener("click", () => {
3111
+ y(E);
3112
+ }), oe.appendChild(P);
3107
3113
  }
3108
3114
  else if (r.starterPromptsLoading) {
3109
- const b = document.createElement("button");
3110
- b.type = "button", b.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", b.disabled = !0, b.tabIndex = -1, b.textContent = "Generating example tasks...", oe.appendChild(b);
3115
+ const E = document.createElement("button");
3116
+ E.type = "button", E.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder pluno-pa-widget__starter-prompt--loading", E.disabled = !0, E.tabIndex = -1, E.textContent = "Generating example tasks...", oe.appendChild(E);
3111
3117
  } else
3112
- for (let b = 0; b < Ea; b += 1) {
3113
- const L = document.createElement("button");
3114
- L.type = "button", L.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", L.disabled = !0, L.tabIndex = -1, L.textContent = "", oe.appendChild(L);
3118
+ for (let E = 0; E < La; E += 1) {
3119
+ const P = document.createElement("button");
3120
+ P.type = "button", P.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", P.disabled = !0, P.tabIndex = -1, P.textContent = "", oe.appendChild(P);
3115
3121
  }
3116
- if (E.appendChild(oe), u) {
3117
- const b = document.createElement("button");
3118
- b.type = "button", b.className = "pluno-pa-widget__morning-report-snooze", b.textContent = "Snooze morning report", b.addEventListener("click", W), E.appendChild(b);
3122
+ if (C.appendChild(oe), u) {
3123
+ const E = document.createElement("button");
3124
+ E.type = "button", E.className = "pluno-pa-widget__morning-report-snooze", E.textContent = "Snooze morning report", E.addEventListener("click", H), C.appendChild(E);
3119
3125
  }
3120
- h.clear(), U(E), U(t), Ao(e, $e);
3126
+ h.clear(), B(C), B(t), Io(e, qe);
3121
3127
  return;
3122
3128
  }
3123
- let B = null, q = null, Z = [], Ne = [];
3124
- const K = H.length - 1, wt = K >= 0 && In(H[K]), Re = Yr(H);
3129
+ let F = null, j = null, Z = [], ze = [];
3130
+ const K = $.length - 1, _t = K >= 0 && Rn($[K]), Me = Zr($);
3125
3131
  let he = !1;
3126
3132
  const me = () => {
3127
3133
  if (Z.length === 0)
3128
3134
  return he = !1, !1;
3129
- const E = Re !== null && Z.some(
3130
- (I) => ri(I, Re)
3131
- ), A = ol(
3135
+ const C = Me !== null && Z.some(
3136
+ (I) => pi(I, Me)
3137
+ ), T = al(
3132
3138
  Z,
3133
- E,
3139
+ C,
3134
3140
  g,
3135
3141
  f,
3136
- y()
3142
+ x()
3137
3143
  );
3138
- return U(A), B = null, q = A, Z = [], he = E, !0;
3144
+ return B(T), F = null, j = T, Z = [], he = C, !0;
3139
3145
  }, z = () => {
3140
- for (const E of Ne)
3141
- U(E), B = null, q = E;
3142
- Ne = [];
3146
+ for (const C of ze)
3147
+ B(C), F = null, j = C;
3148
+ ze = [];
3143
3149
  };
3144
- for (let E = 0; E < H.length; E += 1) {
3145
- const A = H[E];
3146
- if (A.role === "tool" && A.integrationAuthRequest && M) {
3147
- const b = $r(
3148
- A.integrationAuthRequest,
3149
- M.states.get(
3150
- A.integrationAuthRequest.authRequestId
3150
+ for (let C = 0; C < $.length; C += 1) {
3151
+ const T = $[C];
3152
+ if (T.role === "tool" && T.integrationAuthRequest && D) {
3153
+ const E = qr(
3154
+ T.integrationAuthRequest,
3155
+ D.states.get(
3156
+ T.integrationAuthRequest.authRequestId
3151
3157
  ) ?? {
3152
- status: M.initialStatus
3158
+ status: D.initialStatus
3153
3159
  },
3154
- M.onConnect
3160
+ D.onConnect
3155
3161
  );
3156
- Ne.push(b);
3162
+ ze.push(E);
3157
3163
  continue;
3158
3164
  }
3159
- if (A.role === "tool") {
3160
- Z.push(A);
3165
+ if (T.role === "tool") {
3166
+ Z.push(T);
3161
3167
  continue;
3162
3168
  }
3163
- if (In(A)) {
3164
- if (E !== K)
3169
+ if (Rn(T)) {
3170
+ if (C !== K)
3165
3171
  continue;
3166
3172
  if (me()) {
3167
3173
  if (!he) {
3168
- const L = ft();
3169
- U(L), B = null, q = L;
3174
+ const P = wt();
3175
+ B(P), F = null, j = P;
3170
3176
  }
3171
3177
  } else {
3172
- const L = No(y());
3173
- U(L), B = null, q = L;
3178
+ const P = zo(x());
3179
+ B(P), F = null, j = P;
3174
3180
  }
3175
3181
  continue;
3176
3182
  }
3177
- if (A.role === "system") {
3178
- if (A.dataType === "run_error" || A.dataType === "run_status") {
3183
+ if (T.role === "system") {
3184
+ if (T.dataType === "run_error" || T.dataType === "run_status") {
3179
3185
  me();
3180
- const b = document.createElement("div"), L = A.dataType === "run_error";
3181
- if (b.className = L ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", b.textContent = Nn(
3182
- A.content
3183
- ), L && A.securitySettingsUrl) {
3184
- const j = document.createElement("a");
3185
- j.className = "pluno-pa-widget__error-retry", j.href = A.securitySettingsUrl, j.target = "_blank", j.rel = "noreferrer", j.textContent = "Security settings", b.appendChild(j);
3186
+ const E = document.createElement("div"), P = T.dataType === "run_error";
3187
+ if (E.className = P ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", E.textContent = zn(
3188
+ T.content
3189
+ ), P && T.securitySettingsUrl) {
3190
+ const M = document.createElement("a");
3191
+ M.className = "pluno-pa-widget__error-retry", M.href = T.securitySettingsUrl, M.target = "_blank", M.rel = "noreferrer", M.textContent = "Security settings", E.appendChild(M);
3186
3192
  }
3187
- U(b), B = L ? b : null, q = L ? null : b, z();
3193
+ B(E), F = P ? E : null, j = P ? null : E, z();
3188
3194
  }
3189
3195
  continue;
3190
3196
  }
3191
- A.role === "user" && z();
3192
- const I = me(), Ce = Nn(A.content);
3193
- if (A.role === "assistant" && !I) {
3194
- const b = si(y());
3195
- U(b), B = null, q = b;
3197
+ T.role === "user" && z();
3198
+ const I = me(), Ee = zn(T.content);
3199
+ if (T.role === "assistant" && !I) {
3200
+ const E = ci(x());
3201
+ B(E), F = null, j = E;
3196
3202
  }
3197
- const oe = Gr(
3198
- A,
3199
- Ce,
3203
+ const oe = jr(
3204
+ T,
3205
+ Ee,
3200
3206
  h,
3201
3207
  ge,
3202
3208
  R
3203
3209
  );
3204
- U(oe), B = oe, q = null, A.role === "assistant" && z();
3210
+ B(oe), F = oe, j = null, T.role === "assistant" && z();
3205
3211
  }
3206
- const et = me(), ze = H[H.length - 1]?.role === "assistant";
3207
- if (r.isThinking && !ze && !wt)
3208
- if (et) {
3212
+ const tt = me(), De = $[$.length - 1]?.role === "assistant";
3213
+ if (r.isThinking && !De && !_t)
3214
+ if (tt) {
3209
3215
  if (!he) {
3210
- const E = ft();
3211
- U(E), B = null, q = E;
3216
+ const C = wt();
3217
+ B(C), F = null, j = C;
3212
3218
  }
3213
3219
  } else {
3214
- const E = No(y());
3215
- U(E), B = null, q = E;
3220
+ const C = zo(x());
3221
+ B(C), F = null, j = C;
3216
3222
  }
3217
3223
  if (r.lastError) {
3218
- const E = document.createElement("div");
3219
- E.className = "pluno-pa-widget__error";
3220
- const A = document.createElement("span");
3221
- if (A.textContent = r.lastError, E.appendChild(A), r.lastErrorSecuritySettingsUrl) {
3224
+ const C = document.createElement("div");
3225
+ C.className = "pluno-pa-widget__error";
3226
+ const T = document.createElement("span");
3227
+ if (T.textContent = r.lastError, C.appendChild(T), r.lastErrorSecuritySettingsUrl) {
3222
3228
  const I = document.createElement("a");
3223
- I.className = "pluno-pa-widget__error-retry", I.href = r.lastErrorSecuritySettingsUrl, I.target = "_blank", I.rel = "noreferrer", I.textContent = "Security settings", E.appendChild(I);
3229
+ I.className = "pluno-pa-widget__error-retry", I.href = r.lastErrorSecuritySettingsUrl, I.target = "_blank", I.rel = "noreferrer", I.textContent = "Security settings", C.appendChild(I);
3224
3230
  }
3225
3231
  if (r.lastErrorCode === "run_recovery_exhausted" || r.lastErrorCode === "transient_model_error" || r.lastErrorCode === "run_still_active" || r.lastErrorCode === "connection_failed") {
3226
3232
  const I = document.createElement("button");
3227
3233
  I.type = "button", I.className = "pluno-pa-widget__error-retry", I.textContent = "Try again", I.addEventListener(
3228
3234
  "click",
3229
- r.lastErrorCode === "connection_failed" ? w : O
3230
- ), E.appendChild(I);
3235
+ r.lastErrorCode === "connection_failed" ? w : U
3236
+ ), C.appendChild(I);
3231
3237
  }
3232
- U(E), B = E, q = null;
3238
+ B(C), F = C, j = null;
3233
3239
  }
3234
- const Me = T ? T.actionCandidate ?? (r.isThinking ? null : Hi(ne)) : null;
3235
- if (T && Me && !T.dismissedCandidateIds.has(Me.id)) {
3236
- const E = el(Me, {
3237
- isActing: T.actionCandidate?.id === Me.id,
3238
- error: T.error,
3239
- characterIconOptions: T.characterIconOptions,
3240
- socialPostRewardsUrl: T.socialPostRewardsUrl,
3241
- onReferralCopy: T.onReferralCopy,
3242
- onSocialShare: T.onSocialShare,
3243
- onDismiss: T.onDismiss,
3244
- onDisable: T.onDisable
3240
+ const Oe = L ? L.actionCandidate ?? (r.isThinking ? null : Gi(ne)) : null;
3241
+ if (L && Oe && !L.dismissedCandidateIds.has(Oe.id)) {
3242
+ const C = nl(Oe, {
3243
+ isActing: L.actionCandidate?.id === Oe.id,
3244
+ error: L.error,
3245
+ characterIconOptions: L.characterIconOptions,
3246
+ socialPostRewardsUrl: L.socialPostRewardsUrl,
3247
+ onReferralCopy: L.onReferralCopy,
3248
+ onSocialShare: L.onSocialShare,
3249
+ onDismiss: L.onDismiss,
3250
+ onDisable: L.onDisable
3245
3251
  });
3246
- U(E), T.onSeen(Me), B = null, q = E;
3252
+ B(C), L.onSeen(Oe), F = null, j = C;
3247
3253
  }
3248
- z(), B?.classList.add(
3254
+ z(), F?.classList.add(
3249
3255
  "pluno-pa-widget__message--bottom-reserve"
3250
- ), q?.classList.add(
3256
+ ), j?.classList.add(
3251
3257
  "pluno-pa-widget__bottom-reserve-compact"
3252
- ), U(t), jr(
3258
+ ), B(t), Kr(
3253
3259
  h,
3254
3260
  ge
3255
- ), Ao(e, $e), d ? ht(e, c) : e.scrollTop = Qe;
3261
+ ), Io(e, qe), d ? mt(e, c) : e.scrollTop = bt;
3256
3262
  }
3257
- function $r(e, t, n) {
3263
+ function qr(e, t, n) {
3258
3264
  const i = document.createElement("section");
3259
3265
  i.className = "pluno-pa-widget__integration-auth-card", i.setAttribute("aria-label", `Connect ${e.appName}`);
3260
3266
  const o = document.createElement("div");
@@ -3272,25 +3278,25 @@ function $r(e, t, n) {
3272
3278
  const d = document.createElement("button");
3273
3279
  return d.type = "button", d.className = "pluno-pa-widget__integration-auth-button", d.disabled = t.status === "checking" || t.status === "connecting" || t.status === "completed", t.status === "checking" ? d.textContent = "Checking connection..." : t.status === "connecting" ? d.textContent = "Connecting..." : t.status === "completed" ? d.textContent = "Connected" : t.status === "expired" || t.status === "cancelled" ? d.textContent = `Reconnect ${e.appName}` : t.status === "error" ? d.textContent = "Try again" : d.textContent = `Connect ${e.appName}`, d.addEventListener("click", () => n(e)), i.appendChild(d), i;
3274
3280
  }
3275
- function Gr(e, t, n, i, o) {
3276
- const r = qr(e, t), l = r ? n.get(r) : void 0;
3281
+ function jr(e, t, n, i, o) {
3282
+ const r = Vr(e, t), l = r ? n.get(r) : void 0;
3277
3283
  if (r && l)
3278
3284
  return l.classList.remove(
3279
3285
  "pluno-pa-widget__message--bottom-reserve"
3280
3286
  ), i.add(r), l;
3281
3287
  const p = document.createElement("div");
3282
- if (p.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? (e.phase && (p.dataset.phase = e.phase), sl(p, t)) : p.textContent = t, e.role === "user" && e.attachments?.length && p.appendChild(
3283
- Jr(
3288
+ if (p.className = `pluno-pa-widget__message pluno-pa-widget__message--${e.role}`, e.role === "assistant" ? (e.phase && (p.dataset.phase = e.phase), cl(p, t)) : p.textContent = t, e.role === "user" && e.attachments?.length && p.appendChild(
3289
+ el(
3284
3290
  e.attachments,
3285
3291
  o
3286
3292
  )
3287
3293
  ), e.phase !== "commentary") {
3288
3294
  const d = document.createElement("div");
3289
- d.className = "pluno-pa-widget__message-actions", d.appendChild(Qr(t)), p.appendChild(d);
3295
+ d.className = "pluno-pa-widget__message-actions", d.appendChild(tl(t)), p.appendChild(d);
3290
3296
  }
3291
3297
  return r && (n.set(r, p), i.add(r)), p;
3292
3298
  }
3293
- function qr(e, t) {
3299
+ function Vr(e, t) {
3294
3300
  return e.role !== "user" || !e.attachments?.length ? null : JSON.stringify({
3295
3301
  id: e.id,
3296
3302
  content: t,
@@ -3308,11 +3314,11 @@ function qr(e, t) {
3308
3314
  })
3309
3315
  });
3310
3316
  }
3311
- function jr(e, t) {
3317
+ function Kr(e, t) {
3312
3318
  for (const n of e.keys())
3313
3319
  t.has(n) || e.delete(n);
3314
3320
  }
3315
- function Ao(e, t) {
3321
+ function Io(e, t) {
3316
3322
  let n = e.firstChild;
3317
3323
  for (const i of t) {
3318
3324
  if (i === n) {
@@ -3326,7 +3332,7 @@ function Ao(e, t) {
3326
3332
  n = n.nextSibling, e.removeChild(i);
3327
3333
  }
3328
3334
  }
3329
- function Vr(e) {
3335
+ function Yr(e) {
3330
3336
  if (!e.assistantDraft)
3331
3337
  return [...e.messages];
3332
3338
  const t = {
@@ -3347,7 +3353,7 @@ function Vr(e) {
3347
3353
  if (n === -1)
3348
3354
  return [...e.messages, t];
3349
3355
  const i = e.messages.findIndex(
3350
- (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && Po(r, t) && In(r)
3356
+ (r, l) => l > n && r.role !== "user" && r.respondsToUserMessageId === t.respondsToUserMessageId && No(r, t) && Rn(r)
3351
3357
  );
3352
3358
  if (i !== -1)
3353
3359
  return [
@@ -3356,7 +3362,7 @@ function Vr(e) {
3356
3362
  ...e.messages.slice(i + 1)
3357
3363
  ];
3358
3364
  let o = n + 1;
3359
- for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && Po(e.messages[o], t); )
3365
+ for (; o < e.messages.length && e.messages[o].role !== "user" && e.messages[o].respondsToUserMessageId === t.respondsToUserMessageId && No(e.messages[o], t); )
3360
3366
  o += 1;
3361
3367
  return [
3362
3368
  ...e.messages.slice(0, o),
@@ -3364,42 +3370,42 @@ function Vr(e) {
3364
3370
  ...e.messages.slice(o)
3365
3371
  ];
3366
3372
  }
3367
- function Kr(e) {
3373
+ function Xr(e) {
3368
3374
  return e.map(
3369
3375
  (t) => t.role === "assistant" && t.phase === "commentary" ? { ...t, role: "tool" } : t
3370
3376
  );
3371
3377
  }
3372
- function Yr(e) {
3378
+ function Zr(e) {
3373
3379
  const t = [...e].reverse().find((n) => n.role === "user");
3374
3380
  for (let n = e.length - 1; n >= 0; n -= 1) {
3375
3381
  const i = e[n];
3376
3382
  if (!(i.role !== "tool" || e.slice(n + 1).some(
3377
- (r) => (Xr(r) || Zr(r)) && ri(i, r)
3383
+ (r) => (Jr(r) || Qr(r)) && pi(i, r)
3378
3384
  )) && (i.loading || i.dataType === "assistant_draft" || t && i.respondsToUserMessageId === t.id))
3379
3385
  return i;
3380
3386
  }
3381
3387
  return null;
3382
3388
  }
3383
- function Xr(e) {
3389
+ function Jr(e) {
3384
3390
  return e.role === "assistant" && e.phase !== "commentary";
3385
3391
  }
3386
- function Zr(e) {
3392
+ function Qr(e) {
3387
3393
  return e.role === "system" && (e.dataType === "run_error" || e.dataType === "run_status" && e.loading !== !0);
3388
3394
  }
3389
- function ri(e, t) {
3395
+ function pi(e, t) {
3390
3396
  return e.respondsToUserMessageId && t.respondsToUserMessageId ? e.respondsToUserMessageId === t.respondsToUserMessageId : e.runId && t.runId ? e.runId === t.runId : e.id === t.id;
3391
3397
  }
3392
- function In(e) {
3398
+ function Rn(e) {
3393
3399
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
3394
3400
  }
3395
- function Po(e, t) {
3401
+ function No(e, t) {
3396
3402
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
3397
3403
  }
3398
- function Io(e, t, n, i, o, r, l, p) {
3399
- e.replaceChildren(), di(t, !1), t.disabled = !0, n(!1);
3404
+ function Ro(e, t, n, i, o, r, l, p) {
3405
+ e.replaceChildren(), ui(t, !1), t.disabled = !0, n(!1);
3400
3406
  const d = document.createElement("div");
3401
3407
  d.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
3402
- const c = Ie(
3408
+ const c = Re(
3403
3409
  "pluno-pa-widget__character--empty",
3404
3410
  i()
3405
3411
  );
@@ -3414,27 +3420,27 @@ function Io(e, t, n, i, o, r, l, p) {
3414
3420
  }
3415
3421
  e.appendChild(d);
3416
3422
  }
3417
- function Jr(e, t) {
3423
+ function el(e, t) {
3418
3424
  const n = document.createElement("div");
3419
3425
  n.className = "pluno-pa-widget__message-attachments";
3420
3426
  for (const i of e)
3421
3427
  n.appendChild(
3422
- zr(i, t)
3428
+ Mr(i, t)
3423
3429
  );
3424
3430
  return n;
3425
3431
  }
3426
- function Qr(e) {
3432
+ function tl(e) {
3427
3433
  const t = document.createElement("button");
3428
- return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ir()), t.addEventListener("click", (n) => {
3434
+ return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Nr()), t.addEventListener("click", (n) => {
3429
3435
  n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
3430
3436
  }), t;
3431
3437
  }
3432
- function el(e, t) {
3433
- const n = $i(e.id), i = document.createElement("article");
3438
+ function nl(e, t) {
3439
+ const n = qi(e.id), i = document.createElement("article");
3434
3440
  i.className = "pluno-pa-widget__share-prompt";
3435
3441
  const o = document.createElement("div");
3436
3442
  o.className = "pluno-pa-widget__share-prompt-body", o.appendChild(
3437
- Ie(
3443
+ Re(
3438
3444
  "pluno-pa-widget__share-prompt-icon",
3439
3445
  t.characterIconOptions
3440
3446
  )
@@ -3468,18 +3474,18 @@ function el(e, t) {
3468
3474
  const f = document.createElement("button");
3469
3475
  f.type = "button", f.className = "pluno-pa-widget__share-prompt-draft", f.disabled = t.isActing, f.addEventListener("click", () => {
3470
3476
  t.onReferralCopy(e);
3471
- }), t.isActing ? (f.appendChild(rl()), f.appendChild(document.createTextNode("Copying..."))) : f.textContent = "Copy invite link", c.appendChild(f);
3477
+ }), t.isActing ? (f.appendChild(pl()), f.appendChild(document.createTextNode("Copying..."))) : f.textContent = "Copy invite link", c.appendChild(f);
3472
3478
  } else
3473
- for (const f of tl()) {
3474
- const y = document.createElement("a");
3475
- y.className = "pluno-pa-widget__share-prompt-social", y.href = f.href, y.target = "_blank", y.rel = "noopener noreferrer", y.setAttribute("aria-label", `Open ${f.label}`), y.title = f.label, y.appendChild(nl(f.id)), y.addEventListener("click", () => t.onSocialShare(e)), c.appendChild(y);
3479
+ for (const f of ol()) {
3480
+ const x = document.createElement("a");
3481
+ x.className = "pluno-pa-widget__share-prompt-social", x.href = f.href, x.target = "_blank", x.rel = "noopener noreferrer", x.setAttribute("aria-label", `Open ${f.label}`), x.title = f.label, x.appendChild(il(f.id)), x.addEventListener("click", () => t.onSocialShare(e)), c.appendChild(x);
3476
3482
  }
3477
3483
  const g = document.createElement("button");
3478
3484
  g.type = "button", g.className = "pluno-pa-widget__share-prompt-dismiss", g.setAttribute("aria-label", "Dismiss share prompt"), g.title = "Dismiss", g.textContent = "Dismiss", g.addEventListener("click", () => t.onDismiss(e)), c.appendChild(g), d.appendChild(c);
3479
3485
  const h = document.createElement("button");
3480
3486
  return h.type = "button", h.className = "pluno-pa-widget__share-prompt-disable", h.textContent = "Don't ask again", h.addEventListener("click", () => t.onDisable(e)), d.appendChild(h), o.appendChild(d), i.appendChild(o), i;
3481
3487
  }
3482
- function tl() {
3488
+ function ol() {
3483
3489
  const e = "https://pluno.ai/browser", t = `I just used @pluno_ai to get work done directly inside my tools. Worth trying: ${e}`;
3484
3490
  return [
3485
3491
  {
@@ -3499,7 +3505,7 @@ function tl() {
3499
3505
  }
3500
3506
  ];
3501
3507
  }
3502
- function nl(e) {
3508
+ function il(e) {
3503
3509
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3504
3510
  t.setAttribute("class", "pluno-pa-widget__share-prompt-platform-logo"), t.setAttribute("viewBox", "0 0 32 32"), t.setAttribute("aria-hidden", "true");
3505
3511
  const n = (i, o) => {
@@ -3508,41 +3514,41 @@ function nl(e) {
3508
3514
  };
3509
3515
  return e === "linkedin" ? (n("M6.7 13.2c.4 4.1.2 8.1.1 12.3"), n("M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), n("M14.4 13.3c.1 3.8.1 7.8 0 11.9"), n("M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), n("M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (n("M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), n("M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), n("M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (n("M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), n("M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), n("M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), n("M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
3510
3516
  }
3511
- function li(e) {
3512
- return e.role === "tool" && e.toolName === Fo;
3517
+ function si(e) {
3518
+ return e.role === "tool" && e.toolName === Ho;
3513
3519
  }
3514
- function Nn(e) {
3520
+ function zn(e) {
3515
3521
  return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
3516
3522
  }
3517
- function ol(e, t, n, i, o) {
3523
+ function al(e, t, n, i, o) {
3518
3524
  const r = document.createElement("article");
3519
3525
  r.className = "pluno-pa-widget__tool-group", r.classList.toggle("pluno-pa-widget__tool-group--active", t), r.title = new Date(
3520
3526
  e[e.length - 1].createdAt
3521
3527
  ).toLocaleString(), r.appendChild(
3522
- Ie(
3528
+ Re(
3523
3529
  "pluno-pa-widget__character--tool-group",
3524
3530
  o
3525
3531
  )
3526
3532
  );
3527
- const l = il(e, t);
3533
+ const l = rl(e, t);
3528
3534
  if (t) {
3529
- const v = document.createElement("div");
3530
- return v.className = "pluno-pa-widget__tool-active-content", v.appendChild(ft()), v.appendChild(l), r.appendChild(v), r;
3535
+ const y = document.createElement("div");
3536
+ return y.className = "pluno-pa-widget__tool-active-content", y.appendChild(wt()), y.appendChild(l), r.appendChild(y), r;
3531
3537
  }
3532
- const p = document.createElement("details"), d = al(e);
3538
+ const p = document.createElement("details"), d = ll(e);
3533
3539
  p.open = n.has(d), r.classList.toggle("pluno-pa-widget__tool-group--open", p.open), p.addEventListener("toggle", () => {
3534
3540
  r.classList.toggle("pluno-pa-widget__tool-group--open", p.open), p.open ? n.add(d) : n.delete(d), i();
3535
3541
  });
3536
3542
  const c = document.createElement("summary");
3537
3543
  c.className = "pluno-pa-widget__tool-summary";
3538
- const g = [...e].reverse().find((v) => v.phase !== "commentary"), h = e.some(
3539
- (v) => v.phase !== "commentary" && v.loading
3544
+ const g = [...e].reverse().find((y) => y.phase !== "commentary"), h = e.some(
3545
+ (y) => y.phase !== "commentary" && y.loading
3540
3546
  ), f = document.createElement("span");
3541
3547
  f.className = "pluno-pa-widget__tool-summary-title";
3542
- const y = g ? pi(g.content) : "Activity";
3543
- return f.textContent = y, h && (f.classList.add("pluno-pa-widget__tool-summary-title--loading"), f.dataset.loadingText = y), c.appendChild(f), p.appendChild(c), p.appendChild(l), r.appendChild(p), r;
3548
+ const x = g ? di(g.content) : "Activity";
3549
+ return f.textContent = x, h && (f.classList.add("pluno-pa-widget__tool-summary-title--loading"), f.dataset.loadingText = x), c.appendChild(f), p.appendChild(c), p.appendChild(l), r.appendChild(p), r;
3544
3550
  }
3545
- function il(e, t) {
3551
+ function rl(e, t) {
3546
3552
  const n = document.createElement("div");
3547
3553
  n.className = "pluno-pa-widget__tool-lines";
3548
3554
  const i = e[e.length - 1];
@@ -3551,29 +3557,29 @@ function il(e, t) {
3551
3557
  r.className = "pluno-pa-widget__tool-line", r.dataset.eventType = o.phase === "commentary" ? "commentary" : "tool";
3552
3558
  const l = document.createElement("span");
3553
3559
  l.className = "pluno-pa-widget__tool-line-text";
3554
- const p = Nn(o.content) || (o.phase === "commentary" ? "" : "Run tool"), d = o.phase === "commentary" ? p : pi(p);
3560
+ const p = zn(o.content) || (o.phase === "commentary" ? "" : "Run tool"), d = o.phase === "commentary" ? p : di(p);
3555
3561
  t && o === i && o.phase !== "commentary" && (l.classList.add("pluno-pa-widget__tool-line-text--loading"), l.dataset.loadingText = d), l.textContent = d, r.appendChild(l), n.appendChild(r);
3556
3562
  }
3557
3563
  return n;
3558
3564
  }
3559
- function pi(e) {
3565
+ function di(e) {
3560
3566
  const t = e.trim() || "Run tool", n = t.codePointAt(0) ?? 0;
3561
3567
  return n >= 126976 && n <= 129791 || n >= 9728 && n <= 10175 || n >= 127462 && n <= 127487 ? t : `🛠️ ${t}`;
3562
3568
  }
3563
- function si(e) {
3569
+ function ci(e) {
3564
3570
  const t = document.createElement("article");
3565
3571
  return t.className = "pluno-pa-widget__tool-group pluno-pa-widget__assistant-marker", t.appendChild(
3566
- Ie(
3572
+ Re(
3567
3573
  "pluno-pa-widget__character--tool-group",
3568
3574
  e
3569
3575
  )
3570
3576
  ), t;
3571
3577
  }
3572
- function No(e) {
3573
- const t = si(e);
3574
- return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(ft()), t;
3578
+ function zo(e) {
3579
+ const t = ci(e);
3580
+ return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(wt()), t;
3575
3581
  }
3576
- function ft(e = "Thinking...") {
3582
+ function wt(e = "Thinking...") {
3577
3583
  const t = document.createElement("div");
3578
3584
  t.className = "pluno-pa-widget__status";
3579
3585
  const n = document.createElement("span");
@@ -3581,17 +3587,17 @@ function ft(e = "Thinking...") {
3581
3587
  const i = document.createElement("span");
3582
3588
  return i.textContent = e, t.appendChild(i), t;
3583
3589
  }
3584
- function al(e) {
3590
+ function ll(e) {
3585
3591
  return `tools:${e[0]?.id ?? ""}`;
3586
3592
  }
3587
- function rl() {
3593
+ function pl() {
3588
3594
  const e = document.createElement("span");
3589
3595
  return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
3590
3596
  }
3591
- function di(e, t) {
3592
- e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Ar() : ni());
3597
+ function ui(e, t) {
3598
+ e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Pr() : ai());
3593
3599
  }
3594
- function _n(e) {
3600
+ function yn(e) {
3595
3601
  let t = e.trim();
3596
3602
  if (!t.includes("|"))
3597
3603
  return null;
@@ -3604,18 +3610,18 @@ function _n(e) {
3604
3610
  }
3605
3611
  return n.push(i.trim()), n.length > 1 ? n : null;
3606
3612
  }
3607
- function ll(e) {
3613
+ function sl(e) {
3608
3614
  const t = e.trim();
3609
3615
  if (/^:?-{3,}:?$/.test(t))
3610
3616
  return t.startsWith(":") && t.endsWith(":") ? "center" : t.endsWith(":") ? "right" : t.startsWith(":") ? "left" : null;
3611
3617
  }
3612
- function pl(e, t) {
3613
- const n = _n(e[t] ?? ""), i = _n(e[t + 1] ?? "");
3618
+ function dl(e, t) {
3619
+ const n = yn(e[t] ?? ""), i = yn(e[t + 1] ?? "");
3614
3620
  if (!n || !i || n.length !== i.length)
3615
3621
  return null;
3616
3622
  const o = [];
3617
3623
  for (const h of i) {
3618
- const f = ll(h);
3624
+ const f = sl(h);
3619
3625
  if (f === void 0)
3620
3626
  return null;
3621
3627
  o.push(f);
@@ -3624,25 +3630,25 @@ function pl(e, t) {
3624
3630
  r.className = "pluno-pa-widget__table-scroll";
3625
3631
  const l = document.createElement("table"), p = document.createElement("thead"), d = document.createElement("tr");
3626
3632
  n.forEach((h, f) => {
3627
- const y = document.createElement("th"), v = o[f];
3628
- v && y.classList.add(`pluno-pa-widget__table-cell--${v}`), Pe(y, h), d.appendChild(y);
3633
+ const x = document.createElement("th"), y = o[f];
3634
+ y && x.classList.add(`pluno-pa-widget__table-cell--${y}`), Ne(x, h), d.appendChild(x);
3629
3635
  }), p.appendChild(d), l.appendChild(p);
3630
3636
  const c = document.createElement("tbody");
3631
3637
  let g = t + 2;
3632
3638
  for (; g < e.length && e[g].trim(); ) {
3633
- const h = _n(e[g]);
3639
+ const h = yn(e[g]);
3634
3640
  if (!h)
3635
3641
  break;
3636
3642
  const f = document.createElement("tr");
3637
- n.forEach((y, v) => {
3638
- const O = document.createElement("td"), u = o[v];
3639
- u && O.classList.add(`pluno-pa-widget__table-cell--${u}`), Pe(O, h[v] ?? ""), f.appendChild(O);
3643
+ n.forEach((x, y) => {
3644
+ const U = document.createElement("td"), u = o[y];
3645
+ u && U.classList.add(`pluno-pa-widget__table-cell--${u}`), Ne(U, h[y] ?? ""), f.appendChild(U);
3640
3646
  }), c.appendChild(f), g += 1;
3641
3647
  }
3642
3648
  return l.appendChild(c), r.appendChild(l), { element: r, nextIndex: g };
3643
3649
  }
3644
- function sl(e, t) {
3645
- const n = pa(t).replace(/\r\n/g, `
3650
+ function cl(e, t) {
3651
+ const n = da(t).replace(/\r\n/g, `
3646
3652
  `).split(`
3647
3653
  `);
3648
3654
  let i = 0;
@@ -3657,12 +3663,12 @@ function sl(e, t) {
3657
3663
  for (i += 1; i < n.length && !/^```\s*$/.test(n[i]); )
3658
3664
  h.push(n[i]), i += 1;
3659
3665
  i += i < n.length ? 1 : 0;
3660
- const f = document.createElement("pre"), y = document.createElement("code");
3661
- y.textContent = h.join(`
3662
- `), f.appendChild(y), e.appendChild(f);
3666
+ const f = document.createElement("pre"), x = document.createElement("code");
3667
+ x.textContent = h.join(`
3668
+ `), f.appendChild(x), e.appendChild(f);
3663
3669
  continue;
3664
3670
  }
3665
- const l = pl(n, i);
3671
+ const l = dl(n, i);
3666
3672
  if (l) {
3667
3673
  e.appendChild(l.element), i = l.nextIndex;
3668
3674
  continue;
@@ -3670,14 +3676,14 @@ function sl(e, t) {
3670
3676
  const p = o.match(/^(#{1,3})\s+(.+)$/);
3671
3677
  if (p) {
3672
3678
  const h = document.createElement(`h${p[1].length + 2}`);
3673
- Pe(h, p[2]), e.appendChild(h), i += 1;
3679
+ Ne(h, p[2]), e.appendChild(h), i += 1;
3674
3680
  continue;
3675
3681
  }
3676
3682
  if (/^\s*[-*+]\s+/.test(o)) {
3677
3683
  const h = document.createElement("ul");
3678
3684
  for (; i < n.length && /^\s*[-*+]\s+/.test(n[i]); ) {
3679
3685
  const f = document.createElement("li");
3680
- Pe(f, n[i].replace(/^\s*[-*+]\s+/, "")), h.appendChild(f), i += 1;
3686
+ Ne(f, n[i].replace(/^\s*[-*+]\s+/, "")), h.appendChild(f), i += 1;
3681
3687
  }
3682
3688
  e.appendChild(h);
3683
3689
  continue;
@@ -3687,7 +3693,7 @@ function sl(e, t) {
3687
3693
  const h = document.createElement("ol");
3688
3694
  for (h.start = Number(d[1]); i < n.length && /^\s*\d+\.\s+/.test(n[i]); ) {
3689
3695
  const f = document.createElement("li");
3690
- Pe(f, n[i].replace(/^\s*\d+\.\s+/, "")), h.appendChild(f), i += 1;
3696
+ Ne(f, n[i].replace(/^\s*\d+\.\s+/, "")), h.appendChild(f), i += 1;
3691
3697
  }
3692
3698
  e.appendChild(h);
3693
3699
  continue;
@@ -3697,11 +3703,11 @@ function sl(e, t) {
3697
3703
  c.push(n[i]), i += 1;
3698
3704
  const g = document.createElement("p");
3699
3705
  c.forEach((h, f) => {
3700
- f > 0 && g.appendChild(document.createElement("br")), Pe(g, h);
3706
+ f > 0 && g.appendChild(document.createElement("br")), Ne(g, h);
3701
3707
  }), e.appendChild(g);
3702
3708
  }
3703
3709
  }
3704
- function Pe(e, t) {
3710
+ function Ne(e, t) {
3705
3711
  const n = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[[^\]]+\]\(([^)\s]+)\))/g;
3706
3712
  let i = 0;
3707
3713
  for (const o of t.matchAll(n)) {
@@ -3715,13 +3721,13 @@ function Pe(e, t) {
3715
3721
  p.textContent = l.slice(1, -1), e.appendChild(p);
3716
3722
  } else if (l.startsWith("**")) {
3717
3723
  const p = document.createElement("strong");
3718
- Pe(p, l.slice(2, -2)), e.appendChild(p);
3724
+ Ne(p, l.slice(2, -2)), e.appendChild(p);
3719
3725
  } else if (l.startsWith("*")) {
3720
3726
  const p = document.createElement("em");
3721
- Pe(p, l.slice(1, -1)), e.appendChild(p);
3727
+ Ne(p, l.slice(1, -1)), e.appendChild(p);
3722
3728
  } else {
3723
3729
  const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
3724
- if (p && dl(p[2])) {
3730
+ if (p && ul(p[2])) {
3725
3731
  const d = document.createElement("a");
3726
3732
  d.href = p[2], d.target = "_top", d.rel = "noreferrer", d.textContent = p[1], e.appendChild(d);
3727
3733
  } else
@@ -3731,7 +3737,7 @@ function Pe(e, t) {
3731
3737
  }
3732
3738
  i < t.length && e.appendChild(document.createTextNode(t.slice(i)));
3733
3739
  }
3734
- function dl(e) {
3740
+ function ul(e) {
3735
3741
  if (e.startsWith("/") || e.startsWith("#"))
3736
3742
  return !0;
3737
3743
  try {
@@ -3741,8 +3747,8 @@ function dl(e) {
3741
3747
  return !1;
3742
3748
  }
3743
3749
  }
3744
- function Ro(e, t) {
3745
- if (cl(e))
3750
+ function Mo(e, t) {
3751
+ if (gl(e))
3746
3752
  return;
3747
3753
  const n = `
3748
3754
  :host {
@@ -3801,7 +3807,7 @@ function Ro(e, t) {
3801
3807
  --pluno-pa-accent-contrast: #fafafa;
3802
3808
  position: fixed;
3803
3809
  z-index: 2147483645;
3804
- font-family: ${ve.fontFamily};
3810
+ font-family: ${Se.fontFamily};
3805
3811
  font-size: 14px;
3806
3812
  color: var(--pluno-pa-text);
3807
3813
  width: var(--pluno-pa-launcher-width);
@@ -5190,6 +5196,7 @@ function Ro(e, t) {
5190
5196
  display: none;
5191
5197
  }
5192
5198
  .pluno-pa-widget__billing-action-card {
5199
+ position: relative;
5193
5200
  display: grid;
5194
5201
  gap: 7px;
5195
5202
  padding: 10px;
@@ -5209,6 +5216,32 @@ function Ro(e, t) {
5209
5216
  .pluno-pa-widget__billing-action-card span {
5210
5217
  color: var(--pluno-pa-muted);
5211
5218
  }
5219
+ .pluno-pa-widget__billing-action-card-dismiss {
5220
+ position: absolute;
5221
+ top: 7px;
5222
+ right: 7px;
5223
+ width: 24px;
5224
+ height: 24px;
5225
+ padding: 0;
5226
+ border: 0;
5227
+ border-radius: 50%;
5228
+ background: transparent;
5229
+ color: var(--pluno-pa-muted);
5230
+ cursor: pointer;
5231
+ display: inline-grid;
5232
+ place-items: center;
5233
+ }
5234
+ .pluno-pa-widget__billing-action-card-dismiss:hover {
5235
+ background: color-mix(in srgb, var(--pluno-pa-text) 8%, transparent);
5236
+ color: var(--pluno-pa-text);
5237
+ }
5238
+ .pluno-pa-widget__billing-action-card-dismiss:focus-visible {
5239
+ outline: 2px solid var(--pluno-pa-accent);
5240
+ outline-offset: 1px;
5241
+ }
5242
+ .pluno-pa-widget__billing-action-card--low strong {
5243
+ padding-right: 24px;
5244
+ }
5212
5245
  .pluno-pa-widget__billing-action-card-actions {
5213
5246
  display: flex;
5214
5247
  flex-wrap: wrap;
@@ -5795,8 +5828,8 @@ function Ro(e, t) {
5795
5828
  .pluno-pa-widget--scribble .pluno-pa-widget__scribble-spirals--panel {
5796
5829
  position: absolute;
5797
5830
  top: -16px;
5798
- left: ${En}px;
5799
- width: calc(100% - ${En * 2}px);
5831
+ left: ${Ln}px;
5832
+ width: calc(100% - ${Ln * 2}px);
5800
5833
  height: 36px;
5801
5834
  z-index: 3;
5802
5835
  filter: url(#pluno-pa-scribble-wobble-2);
@@ -6288,28 +6321,28 @@ function Ro(e, t) {
6288
6321
  }
6289
6322
  }
6290
6323
  `;
6291
- if (ul(e, n))
6324
+ if (hl(e, n))
6292
6325
  return;
6293
6326
  const i = e.ownerDocument.createElement("style");
6294
- i.id = Yo, i.textContent = n, e.appendChild(i), ci(e);
6327
+ i.id = Zo, i.textContent = n, e.appendChild(i), gi(e);
6295
6328
  }
6296
- function cl(e) {
6297
- return e.getElementById(Yo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Xo) === "true";
6329
+ function gl(e) {
6330
+ return e.getElementById(Zo) !== null || e.host instanceof HTMLElement && e.host.getAttribute(Jo) === "true";
6298
6331
  }
6299
- function ci(e) {
6300
- e.host instanceof HTMLElement && e.host.setAttribute(Xo, "true");
6332
+ function gi(e) {
6333
+ e.host instanceof HTMLElement && e.host.setAttribute(Jo, "true");
6301
6334
  }
6302
- function ul(e, t) {
6335
+ function hl(e, t) {
6303
6336
  if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
6304
6337
  return !1;
6305
6338
  try {
6306
6339
  const n = new CSSStyleSheet();
6307
- return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], ci(e), !0;
6340
+ return n.replaceSync(t), e.adoptedStyleSheets = [...e.adoptedStyleSheets, n], gi(e), !0;
6308
6341
  } catch {
6309
6342
  return !1;
6310
6343
  }
6311
6344
  }
6312
- async function gl() {
6345
+ async function ml() {
6313
6346
  return document.body ? document.body : await new Promise((e) => {
6314
6347
  const t = new MutationObserver(() => {
6315
6348
  document.body && (t.disconnect(), e(document.body));
@@ -6317,25 +6350,25 @@ async function gl() {
6317
6350
  t.observe(document.documentElement, { childList: !0 });
6318
6351
  });
6319
6352
  }
6320
- function On(e) {
6353
+ function Bn(e) {
6321
6354
  return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
6322
6355
  }
6323
- function ui(e) {
6324
- return `${On(e)}.displayState`;
6356
+ function hi(e) {
6357
+ return `${Bn(e)}.displayState`;
6325
6358
  }
6326
- function hl(e) {
6359
+ function fl(e) {
6327
6360
  try {
6328
6361
  return window.sessionStorage.getItem(
6329
- ui(e)
6362
+ hi(e)
6330
6363
  ) === "minimized" ? "minimized" : "shown";
6331
6364
  } catch {
6332
6365
  return "shown";
6333
6366
  }
6334
6367
  }
6335
- function zo(e, t) {
6368
+ function Do(e, t) {
6336
6369
  if (e.layout === "floating")
6337
6370
  try {
6338
- const n = ui(e);
6371
+ const n = hi(e);
6339
6372
  if (t === "minimized") {
6340
6373
  window.sessionStorage.setItem(n, t);
6341
6374
  return;
@@ -6345,15 +6378,15 @@ function zo(e, t) {
6345
6378
  return;
6346
6379
  }
6347
6380
  }
6348
- function ml(e) {
6381
+ function wl(e) {
6349
6382
  if (e)
6350
6383
  return { clientId: e, release: () => {
6351
6384
  } };
6352
6385
  let t = 0;
6353
- for (; sn.has(t); )
6386
+ for (; un.has(t); )
6354
6387
  t += 1;
6355
- sn.add(t);
6356
- const n = `${Sa}${t}`;
6388
+ un.add(t);
6389
+ const n = `${Ea}${t}`;
6357
6390
  let i = crypto.randomUUID();
6358
6391
  try {
6359
6392
  i = window.sessionStorage.getItem(n) ?? i, window.sessionStorage.setItem(n, i);
@@ -6363,15 +6396,15 @@ function ml(e) {
6363
6396
  return {
6364
6397
  clientId: i,
6365
6398
  release: () => {
6366
- o || (o = !0, sn.delete(t));
6399
+ o || (o = !0, un.delete(t));
6367
6400
  }
6368
6401
  };
6369
6402
  }
6370
- function fl(e) {
6403
+ function bl(e) {
6371
6404
  try {
6372
- const t = window.localStorage.getItem(On(e));
6405
+ const t = window.localStorage.getItem(Bn(e));
6373
6406
  if (!t)
6374
- return Mo();
6407
+ return Oo();
6375
6408
  const n = JSON.parse(t);
6376
6409
  return {
6377
6410
  isOpen: n.isOpen === !0,
@@ -6381,25 +6414,25 @@ function fl(e) {
6381
6414
  openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter(
6382
6415
  (i) => typeof i == "string"
6383
6416
  ) : [],
6384
- launcherPosition: xl(n.launcherPosition) ? n.launcherPosition : null,
6385
- panelSize: yl(n.panelSize) ? Ot(n.panelSize) : null,
6386
- seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-Wo) : [],
6417
+ launcherPosition: vl(n.launcherPosition) ? n.launcherPosition : null,
6418
+ panelSize: Sl(n.panelSize) ? Ft(n.panelSize) : null,
6419
+ seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((i) => typeof i == "string").slice(-$o) : [],
6387
6420
  sharePromptsDisabled: n.sharePromptsDisabled === !0
6388
6421
  };
6389
6422
  } catch {
6390
- return Mo();
6423
+ return Oo();
6391
6424
  }
6392
6425
  }
6393
- async function wl(e) {
6426
+ async function _l(e) {
6394
6427
  if (e.loadSharePromptsDisabled)
6395
6428
  return e.loadSharePromptsDisabled();
6396
6429
  try {
6397
- return window.localStorage.getItem($o) === "true";
6430
+ return window.localStorage.getItem(qo) === "true";
6398
6431
  } catch {
6399
6432
  return !1;
6400
6433
  }
6401
6434
  }
6402
- function bl(e, t) {
6435
+ function xl(e, t) {
6403
6436
  if (e.persistSharePromptsDisabled) {
6404
6437
  Promise.resolve(e.persistSharePromptsDisabled(t)).catch(
6405
6438
  () => {
@@ -6408,12 +6441,12 @@ function bl(e, t) {
6408
6441
  return;
6409
6442
  }
6410
6443
  try {
6411
- t && window.localStorage.setItem($o, "true");
6444
+ t && window.localStorage.setItem(qo, "true");
6412
6445
  } catch {
6413
6446
  return;
6414
6447
  }
6415
6448
  }
6416
- function Mo() {
6449
+ function Oo() {
6417
6450
  return {
6418
6451
  isOpen: !1,
6419
6452
  composerValue: "",
@@ -6426,29 +6459,29 @@ function Mo() {
6426
6459
  sharePromptsDisabled: !1
6427
6460
  };
6428
6461
  }
6429
- function _l(e, t) {
6462
+ function yl(e, t) {
6430
6463
  try {
6431
6464
  window.localStorage.setItem(
6432
- On(e),
6465
+ Bn(e),
6433
6466
  JSON.stringify(t)
6434
6467
  );
6435
6468
  } catch {
6436
6469
  return;
6437
6470
  }
6438
6471
  }
6439
- function xl(e) {
6472
+ function vl(e) {
6440
6473
  if (!e || typeof e != "object")
6441
6474
  return !1;
6442
6475
  const t = e;
6443
6476
  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");
6444
6477
  }
6445
- function yl(e) {
6478
+ function Sl(e) {
6446
6479
  if (!e || typeof e != "object")
6447
6480
  return !1;
6448
6481
  const t = e;
6449
6482
  return typeof t.width == "number" && Number.isFinite(t.width) && typeof t.height == "number" && Number.isFinite(t.height);
6450
6483
  }
6451
- async function gi(e, t) {
6484
+ async function mi(e, t) {
6452
6485
  const n = await fetch(e, {
6453
6486
  method: "POST",
6454
6487
  credentials: "include",
@@ -6460,7 +6493,7 @@ async function gi(e, t) {
6460
6493
  ...t ? { signal: t } : {}
6461
6494
  });
6462
6495
  if (!n.ok) {
6463
- const o = await n.text(), r = Mi(o);
6496
+ const o = await n.text(), r = Oi(o);
6464
6497
  throw r ? (console.error(r), new Error(r)) : new Error(`Failed to load Pluno token (${n.status})`);
6465
6498
  }
6466
6499
  const i = await n.json();
@@ -6468,15 +6501,15 @@ async function gi(e, t) {
6468
6501
  throw new Error("Pluno token endpoint did not return a token");
6469
6502
  return i.token;
6470
6503
  }
6471
- function vl(e) {
6504
+ function Cl(e) {
6472
6505
  let t = !1, n = !1;
6473
6506
  const i = async () => {
6474
6507
  const o = new AbortController();
6475
6508
  let r = !1;
6476
6509
  const l = new Promise((p, d) => {
6477
6510
  const c = window.setTimeout(() => {
6478
- r = !0, o.abort(), d(new Error(co));
6479
- }, ya);
6511
+ r = !0, o.abort(), d(new Error(go));
6512
+ }, Sa);
6480
6513
  o.signal.addEventListener(
6481
6514
  "abort",
6482
6515
  () => window.clearTimeout(c),
@@ -6485,12 +6518,12 @@ function vl(e) {
6485
6518
  });
6486
6519
  try {
6487
6520
  const p = await Promise.race([
6488
- gi(e, o.signal),
6521
+ mi(e, o.signal),
6489
6522
  l
6490
6523
  ]);
6491
6524
  return o.abort(), p;
6492
6525
  } catch (p) {
6493
- throw o.abort(), r ? new Error(co) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(va);
6526
+ throw o.abort(), r ? new Error(go) : p instanceof Error && p.message.startsWith("Pluno widget blocked on ") ? p : new Error(Ca);
6494
6527
  }
6495
6528
  };
6496
6529
  return {
@@ -6513,32 +6546,32 @@ function vl(e) {
6513
6546
  }
6514
6547
  };
6515
6548
  }
6516
- const Do = /* @__PURE__ */ new WeakSet();
6517
- function Sl(e) {
6549
+ const Uo = /* @__PURE__ */ new WeakSet();
6550
+ function El(e) {
6518
6551
  return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
6519
6552
  }
6520
- function Oo(e) {
6553
+ function Bo(e) {
6521
6554
  const t = e.pathname.split("/");
6522
6555
  return t[t.length - 1] ?? "";
6523
6556
  }
6524
- function Cl(e, t) {
6557
+ function kl(e, t) {
6525
6558
  const n = new URL(e.src, document.baseURI);
6526
- return n.href === t.href || n.pathname === t.pathname ? !0 : Oo(n) === Oo(t);
6559
+ return n.href === t.href || n.pathname === t.pathname ? !0 : Bo(n) === Bo(t);
6527
6560
  }
6528
- class Se extends EventTarget {
6561
+ class Ce extends EventTarget {
6529
6562
  constructor(t, n) {
6530
- super(), this.channelId = n, this.url = t, this.addPreviewListener(fa, () => {
6531
- this.readyState = Se.OPEN, this.dispatchEvent(new Event("open"));
6532
- }), this.addPreviewListener(wa, (i) => {
6563
+ super(), this.channelId = n, this.url = t, this.addPreviewListener(ba, () => {
6564
+ this.readyState = Ce.OPEN, this.dispatchEvent(new Event("open"));
6565
+ }), this.addPreviewListener(_a, (i) => {
6533
6566
  const o = i;
6534
6567
  this.dispatchEvent(
6535
6568
  new MessageEvent("message", { data: o.detail?.data ?? "" })
6536
6569
  );
6537
- }), this.addPreviewListener(ba, () => {
6538
- this.readyState = Se.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
6539
- }), this.addPreviewListener(_a, (i) => {
6570
+ }), this.addPreviewListener(xa, () => {
6571
+ this.readyState = Ce.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
6572
+ }), this.addPreviewListener(ya, (i) => {
6540
6573
  const o = i;
6541
- this.readyState = Se.CLOSED, this.dispatchEvent(
6574
+ this.readyState = Ce.CLOSED, this.dispatchEvent(
6542
6575
  new CloseEvent("close", {
6543
6576
  code: o.detail?.code ?? 1e3,
6544
6577
  reason: o.detail?.reason ?? "",
@@ -6547,8 +6580,8 @@ class Se extends EventTarget {
6547
6580
  ), this.cleanup();
6548
6581
  }), window.dispatchEvent(
6549
6582
  new CustomEvent(
6550
- It(
6551
- ga,
6583
+ Rt(
6584
+ ma,
6552
6585
  this.channelId
6553
6586
  ),
6554
6587
  {
@@ -6567,18 +6600,18 @@ class Se extends EventTarget {
6567
6600
  extensions = "";
6568
6601
  binaryType = "blob";
6569
6602
  bufferedAmount = 0;
6570
- readyState = Se.CONNECTING;
6571
- socketId = El();
6603
+ readyState = Ce.CONNECTING;
6604
+ socketId = Ll();
6572
6605
  listeners = /* @__PURE__ */ new Map();
6573
6606
  send(t) {
6574
- if (this.readyState !== Se.OPEN)
6607
+ if (this.readyState !== Ce.OPEN)
6575
6608
  throw new DOMException(
6576
6609
  "Pluno preview websocket is not open",
6577
6610
  "InvalidStateError"
6578
6611
  );
6579
6612
  window.dispatchEvent(
6580
6613
  new CustomEvent(
6581
- It(ha, this.channelId),
6614
+ Rt(fa, this.channelId),
6582
6615
  {
6583
6616
  detail: {
6584
6617
  socketId: this.socketId,
@@ -6589,9 +6622,9 @@ class Se extends EventTarget {
6589
6622
  );
6590
6623
  }
6591
6624
  close(t, n) {
6592
- this.readyState !== Se.CLOSED && (this.readyState = Se.CLOSING, window.dispatchEvent(
6625
+ this.readyState !== Ce.CLOSED && (this.readyState = Ce.CLOSING, window.dispatchEvent(
6593
6626
  new CustomEvent(
6594
- It(ma, this.channelId),
6627
+ Rt(wa, this.channelId),
6595
6628
  {
6596
6629
  detail: { socketId: this.socketId, code: t, reason: n }
6597
6630
  }
@@ -6599,7 +6632,7 @@ class Se extends EventTarget {
6599
6632
  ), this.cleanup());
6600
6633
  }
6601
6634
  addPreviewListener(t, n) {
6602
- const i = It(
6635
+ const i = Rt(
6603
6636
  t,
6604
6637
  this.channelId
6605
6638
  ), o = (r) => {
@@ -6613,19 +6646,19 @@ class Se extends EventTarget {
6613
6646
  this.listeners.clear();
6614
6647
  }
6615
6648
  }
6616
- function El() {
6649
+ function Ll() {
6617
6650
  const e = window.sessionStorage.getItem(
6618
- so
6651
+ uo
6619
6652
  );
6620
6653
  if (e)
6621
6654
  return e;
6622
6655
  const t = crypto.randomUUID();
6623
- return window.sessionStorage.setItem(so, t), t;
6656
+ return window.sessionStorage.setItem(uo, t), t;
6624
6657
  }
6625
- function It(e, t) {
6658
+ function Rt(e, t) {
6626
6659
  return `${e}:${t}`;
6627
6660
  }
6628
- function kl(e) {
6661
+ function Tl(e) {
6629
6662
  const t = document.currentScript;
6630
6663
  if (t instanceof HTMLScriptElement)
6631
6664
  return [t];
@@ -6633,35 +6666,35 @@ function kl(e) {
6633
6666
  return Array.from(
6634
6667
  document.querySelectorAll("script[type='module'][src]")
6635
6668
  ).filter(
6636
- (o) => o instanceof HTMLScriptElement && Sl(o) && Cl(o, i)
6669
+ (o) => o instanceof HTMLScriptElement && El(o) && kl(o, i)
6637
6670
  );
6638
6671
  }
6639
- function Ll(e) {
6640
- for (const t of kl(e))
6641
- Do.has(t) || t.dataset.plunoAutoMount === "false" || (Do.add(t), hi(t).catch((n) => {
6672
+ function Al(e) {
6673
+ for (const t of Tl(e))
6674
+ Uo.has(t) || t.dataset.plunoAutoMount === "false" || (Uo.add(t), fi(t).catch((n) => {
6642
6675
  console.error("Failed to mount Pluno widget", n);
6643
6676
  }));
6644
6677
  }
6645
- function hi(e) {
6646
- const t = window, n = t[ye];
6678
+ function fi(e) {
6679
+ const t = window, n = t[ve];
6647
6680
  if (n) {
6648
6681
  if (n.host === null)
6649
6682
  return n.mountPromise.catch(() => {
6650
- const d = t[ye];
6651
- return d ? d.mountPromise : hi(e);
6683
+ const d = t[ve];
6684
+ return d ? d.mountPromise : fi(e);
6652
6685
  });
6653
- if (Tl(n.host))
6686
+ if (Pl(n.host))
6654
6687
  return n.retryPendingTokenFailureOnce?.(), n.mountPromise;
6655
- n.destroy?.(), delete t[ye];
6688
+ n.destroy?.(), delete t[ve];
6656
6689
  }
6657
- const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? vl(o) : null;
6690
+ const i = e.dataset.plunoPreviewChannel, o = e.dataset.plunoTokenEndpoint, r = !e.dataset.plunoToken && !i && o ? Cl(o) : null;
6658
6691
  let l;
6659
- const p = Ga({
6692
+ const p = ja({
6660
6693
  token: e.dataset.plunoToken,
6661
6694
  tokenProvider: r?.loadToken,
6662
6695
  tokenEndpoint: o,
6663
6696
  backendUrl: e.dataset.plunoBackendUrl,
6664
- webSocketFactory: i ? $a(i) : void 0,
6697
+ webSocketFactory: i ? qa(i) : void 0,
6665
6698
  launcherLabel: e.dataset.plunoLauncherLabel,
6666
6699
  accentColor: e.dataset.plunoAccentColor,
6667
6700
  colorScheme: e.dataset.plunoColorScheme === "dark" ? "dark" : "light",
@@ -6669,29 +6702,29 @@ function hi(e) {
6669
6702
  scribbleStyle: e.dataset.plunoScribbleStyle === void 0 ? void 0 : e.dataset.plunoScribbleStyle !== "false",
6670
6703
  position: e.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
6671
6704
  }).then((d) => {
6672
- if (t[ye] !== l) {
6705
+ if (t[ve] !== l) {
6673
6706
  d.destroy();
6674
6707
  return;
6675
6708
  }
6676
6709
  const c = d.host;
6677
- c.setAttribute(Ho, "true"), l.host = c, l.destroy = () => {
6678
- t[ye] === l && delete t[ye], l.host = null, l.destroy = null, d.destroy();
6710
+ c.setAttribute(Go, "true"), l.host = c, l.destroy = () => {
6711
+ t[ve] === l && delete t[ve], l.host = null, l.destroy = null, d.destroy();
6679
6712
  };
6680
6713
  }).catch((d) => {
6681
- throw t[ye] === l && delete t[ye], d;
6714
+ throw t[ve] === l && delete t[ve], d;
6682
6715
  });
6683
6716
  return l = {
6684
6717
  mountPromise: p,
6685
6718
  host: null,
6686
6719
  destroy: null,
6687
6720
  retryPendingTokenFailureOnce: r?.retryPendingFailureOnce ?? null
6688
- }, t[ye] = l, p;
6721
+ }, t[ve] = l, p;
6689
6722
  }
6690
- function Tl(e) {
6691
- return e.isConnected && e.getAttribute(Ho) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6723
+ function Pl(e) {
6724
+ return e.isConnected && e.getAttribute(Go) === "true" && !!e.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!e.shadowRoot?.querySelector(".pluno-pa-widget__panel");
6692
6725
  }
6693
- Ll(import.meta.url);
6726
+ Al(import.meta.url);
6694
6727
  export {
6695
- $a as createProductAgentPreviewBridgeWebSocketFactory,
6696
- Ga as mountPlunoProductAgentWidget
6728
+ qa as createProductAgentPreviewBridgeWebSocketFactory,
6729
+ ja as mountPlunoProductAgentWidget
6697
6730
  };