@pluno/product-agent-web 0.1.103 → 0.1.104

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