@pluno/product-agent-web 0.1.34 → 0.1.36
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.
- package/dist/product-agent-widget.js +300 -258
- package/package.json +1 -1
|
@@ -328,7 +328,7 @@ function Dn(e) {
|
|
|
328
328
|
function Mn(e) {
|
|
329
329
|
return e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2;
|
|
330
330
|
}
|
|
331
|
-
const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect",
|
|
331
|
+
const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", On = "product-agent:sdk-preview-socket-send", Bn = "product-agent:sdk-preview-socket-close", Fn = "product-agent:sdk-preview-socket-open", Un = "product-agent:sdk-preview-socket-message", zn = "product-agent:sdk-preview-socket-error", $n = "product-agent:sdk-preview-socket-closed", ct = "product-agent:sdk-preview-socket-id", Gn = "product-agent:preview-diagnostic", Rt = "pluno.productAgent.sharePromptsDisabled", Ce = 10, Hn = 10 * 1024 * 1024, Ot = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif", "application/pdf"]), Wn = Array.from(Ot).join(","), jn = 3, j = {
|
|
332
332
|
launcherLabel: "Ask for anything...",
|
|
333
333
|
accentColor: "#7c3aed",
|
|
334
334
|
colorScheme: "light",
|
|
@@ -336,11 +336,11 @@ const Mt = 100, Rn = "product-agent:sdk-preview-socket-connect", Bn = "product-a
|
|
|
336
336
|
scribbleStyle: !1,
|
|
337
337
|
position: "bottom-right",
|
|
338
338
|
movableLauncher: !1
|
|
339
|
-
}, ut = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>',
|
|
340
|
-
function
|
|
339
|
+
}, ut = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 36"><g><ellipse cx="17.5" cy="24.5" rx="2.4" ry="3" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.5 27 C20.5 12, 7.5 2.5, 6 18.5" fill="none" stroke="%232c2a1e" stroke-width="2.5" stroke-linecap="round"/></g><g transform="translate(26 0)"><ellipse cx="17.9" cy="24.1" rx="2.5" ry="2.8" fill="none" stroke="%232c2a1e" stroke-width="1.5" opacity="0.8"/><path d="M18.9 26.4 C21.2 13, 8.6 3.6, 6.9 17.4" fill="none" stroke="%232c2a1e" stroke-width="2.35" stroke-linecap="round"/></g><g transform="translate(52 0)"><ellipse cx="17.1" cy="24.9" rx="2.2" ry="3.1" fill="none" stroke="%232c2a1e" stroke-width="1.7" opacity="0.8"/><path d="M18.1 27.5 C19.9 10.4, 6.4 2, 5.6 19.2" fill="none" stroke="%232c2a1e" stroke-width="2.6" stroke-linecap="round"/></g><g transform="translate(78 0)"><ellipse cx="17.6" cy="24.4" rx="2.4" ry="2.9" fill="none" stroke="%232c2a1e" stroke-width="1.6" opacity="0.8"/><path d="M18.7 26.8 C21 11.2, 7.1 1.6, 6.3 18.1" fill="none" stroke="%232c2a1e" stroke-width="2.45" stroke-linecap="round"/></g></svg>', Vn = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', gt = "pluno-pa-scribble-font", Bt = 190, Ft = 41, qn = 48, Kn = 420, Yn = 520, Xn = 0.24, Zn = 680, Jn = 800, Qn = 0.76, B = 8, $e = 50, eo = "http://www.w3.org/2000/svg", to = 11, no = 13, ht = 4, oo = 10, ao = 40, io = "movable-launcher-position-v2", Ut = "pluno-pa-widget-styles", zt = "data-pluno-pa-widget-styles";
|
|
340
|
+
function ro(e) {
|
|
341
341
|
return (t) => new V(t, e);
|
|
342
342
|
}
|
|
343
|
-
async function
|
|
343
|
+
async function lo(e = {}) {
|
|
344
344
|
const t = {
|
|
345
345
|
launcherLabel: e.launcherLabel ?? j.launcherLabel,
|
|
346
346
|
accentColor: e.accentColor ?? j.accentColor,
|
|
@@ -386,8 +386,8 @@ async function ro(e = {}) {
|
|
|
386
386
|
const o = n.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
387
387
|
a.className = `pluno-pa-widget pluno-pa-widget--${t.position}`, a.setAttribute("data-pluno-product-agent-ui-root", "widget");
|
|
388
388
|
let i = mt(t.accentColor, t.scribbleStyle);
|
|
389
|
-
|
|
390
|
-
const l = await
|
|
389
|
+
yo(a, t.launcherLabel, i, t.movableLauncher), o.appendChild(a);
|
|
390
|
+
const l = await ga(), p = l.ownerDocument;
|
|
391
391
|
l.appendChild(n), a.classList.add(`pluno-pa-widget--${t.colorScheme}`), Lt(o, t.accentColor), ft(a, i, {
|
|
392
392
|
accentColor: t.accentColor,
|
|
393
393
|
colorScheme: t.colorScheme,
|
|
@@ -399,18 +399,18 @@ async function ro(e = {}) {
|
|
|
399
399
|
fontFamily: t.fontFamily,
|
|
400
400
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
401
401
|
});
|
|
402
|
-
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), C = a.querySelector(".pluno-pa-widget__close"), S = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"),
|
|
403
|
-
if (!c || !s || !f || !C || !S || !x || !
|
|
402
|
+
const c = a.querySelector(".pluno-pa-widget__launcher"), d = a.querySelector(".pluno-pa-widget__launcher-drag-handle"), s = a.querySelector(".pluno-pa-widget__launcher-input"), f = a.querySelector(".pluno-pa-widget__panel"), C = a.querySelector(".pluno-pa-widget__close"), S = a.querySelector(".pluno-pa-widget__composer"), x = a.querySelector(".pluno-pa-widget__attachment-error"), R = a.querySelector(".pluno-pa-widget__billing-status"), v = a.querySelector(".pluno-pa-widget__attachments"), y = a.querySelector(".pluno-pa-widget__attachment-input"), h = a.querySelector(".pluno-pa-widget__attach"), g = a.querySelector(".pluno-pa-widget__input"), _ = a.querySelector(".pluno-pa-widget__send"), N = a.querySelector(".pluno-pa-widget__new-chat"), Z = a.querySelector(".pluno-pa-widget__timeline-jump"), de = a.querySelector(".pluno-pa-widget__active-users-counter"), E = a.querySelector(".pluno-pa-widget__timeline"), b = a.querySelector(".pluno-pa-widget__timeline-bottom-sentinel");
|
|
403
|
+
if (!c || !s || !f || !C || !S || !x || !R || !v || !y || !h || !g || !_ || !N || !Z || !de || !E || !b)
|
|
404
404
|
throw new Error("Failed to mount Pluno widget");
|
|
405
405
|
if (t.movableLauncher && !d)
|
|
406
406
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
407
407
|
_t(s), _t(g);
|
|
408
408
|
let m = [], k = null;
|
|
409
409
|
const P = () => {
|
|
410
|
-
|
|
411
|
-
m = m.filter((u,
|
|
410
|
+
Oo(v, m, (r) => {
|
|
411
|
+
m = m.filter((u, T) => T !== r), P(), O(w.getState()), U();
|
|
412
412
|
});
|
|
413
|
-
},
|
|
413
|
+
}, I = t.loginRequired || t.token || t.webSocketFactory ? void 0 : t.tokenProvider ?? (async () => {
|
|
414
414
|
if (!t.tokenEndpoint)
|
|
415
415
|
throw new Error("Pluno widget requires token or tokenEndpoint");
|
|
416
416
|
const r = await fetch(t.tokenEndpoint, {
|
|
@@ -425,11 +425,11 @@ async function ro(e = {}) {
|
|
|
425
425
|
if (!u.token)
|
|
426
426
|
throw new Error("Pluno token endpoint did not return a token");
|
|
427
427
|
return u.token;
|
|
428
|
-
}),
|
|
428
|
+
}), A = window.fetch.bind(window);
|
|
429
429
|
let w;
|
|
430
430
|
w = await sn.init({
|
|
431
431
|
token: t.token,
|
|
432
|
-
tokenProvider:
|
|
432
|
+
tokenProvider: I,
|
|
433
433
|
backendUrl: t.backendUrl,
|
|
434
434
|
metadata: () => ({
|
|
435
435
|
...t.metadata ?? {},
|
|
@@ -442,8 +442,8 @@ async function ro(e = {}) {
|
|
|
442
442
|
webSocketFactory: t.webSocketFactory,
|
|
443
443
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
444
444
|
});
|
|
445
|
-
const J =
|
|
446
|
-
let ke = J.sharePromptsDisabled || await
|
|
445
|
+
const J = ha(t), Ee = new Set(J.openToolGroupKeys), ae = new Set(J.seenShareCandidateIds), fe = new Set(ae);
|
|
446
|
+
let ke = J.sharePromptsDisabled || await ma(t), G = t.movableLauncher ? J.launcherPosition : null, qe = G !== null, q = null, Se = !1, Q = !1, ee = {
|
|
447
447
|
enabled: !0
|
|
448
448
|
}, te = 0, Ke = "";
|
|
449
449
|
const H = (r, u) => {
|
|
@@ -459,25 +459,25 @@ async function ro(e = {}) {
|
|
|
459
459
|
}, Ye = new MutationObserver(nn);
|
|
460
460
|
Ye.observe(p.documentElement, { childList: !0, subtree: !0 });
|
|
461
461
|
const Le = (r = !0) => {
|
|
462
|
-
const u =
|
|
462
|
+
const u = Ge(a, r);
|
|
463
463
|
return bt(
|
|
464
464
|
a,
|
|
465
|
-
|
|
465
|
+
G ?? ho(a, t.position, u),
|
|
466
466
|
u
|
|
467
467
|
);
|
|
468
|
-
},
|
|
469
|
-
|
|
468
|
+
}, F = () => {
|
|
469
|
+
ba(t, {
|
|
470
470
|
isOpen: a.classList.contains("pluno-pa-widget--open"),
|
|
471
471
|
composerValue: g.value,
|
|
472
472
|
openToolGroupKeys: [...Ee],
|
|
473
|
-
launcherPosition: qe ?
|
|
473
|
+
launcherPosition: qe ? G : null,
|
|
474
474
|
seenShareCandidateIds: [...ae].slice(-Mt),
|
|
475
475
|
sharePromptsDisabled: ke
|
|
476
476
|
});
|
|
477
477
|
}, ne = (r, u = {}) => {
|
|
478
|
-
|
|
479
|
-
debugVersion:
|
|
480
|
-
launcherPosition:
|
|
478
|
+
_o(r, {
|
|
479
|
+
debugVersion: io,
|
|
480
|
+
launcherPosition: G,
|
|
481
481
|
rootClasses: a.className,
|
|
482
482
|
rootStyle: {
|
|
483
483
|
left: a.style.left,
|
|
@@ -494,16 +494,16 @@ async function ro(e = {}) {
|
|
|
494
494
|
...u
|
|
495
495
|
});
|
|
496
496
|
}, be = (r = !0) => {
|
|
497
|
-
if (
|
|
497
|
+
if (!G)
|
|
498
498
|
return _e(a, null), Le(r);
|
|
499
499
|
const u = Le(r);
|
|
500
500
|
return _e(a, u), ne("Applied stored closed launcher position", { visibleLauncherPosition: u }), u;
|
|
501
501
|
}, Xe = (r, u) => {
|
|
502
502
|
if (!r || !u) {
|
|
503
|
-
|
|
503
|
+
wo(a);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
|
|
506
|
+
bo(a, {
|
|
507
507
|
x: r.x - u.x,
|
|
508
508
|
y: r.y - u.y
|
|
509
509
|
});
|
|
@@ -512,21 +512,21 @@ async function ro(e = {}) {
|
|
|
512
512
|
if (a.classList.contains("pluno-pa-widget--open") || a.classList.contains("pluno-pa-widget--closing")) {
|
|
513
513
|
const u = wt(a, r, t.position);
|
|
514
514
|
Xe(u, r), ne("Applied open panel position after viewport resize", { openPanelPosition: u });
|
|
515
|
-
} else
|
|
515
|
+
} else G && ne("Applied visible launcher position after viewport resize", { visibleLauncherPosition: r });
|
|
516
516
|
};
|
|
517
517
|
let Je = () => {
|
|
518
518
|
};
|
|
519
|
-
window.addEventListener("resize", Ze), t.movableLauncher && d ? (be(), Je =
|
|
519
|
+
window.addEventListener("resize", Ze), t.movableLauncher && d ? (be(), Je = go({
|
|
520
520
|
root: a,
|
|
521
521
|
launcher: c,
|
|
522
522
|
launcherDragHandle: d,
|
|
523
523
|
getPosition: () => Le(),
|
|
524
524
|
setPosition: (r) => {
|
|
525
525
|
const u = r;
|
|
526
|
-
|
|
526
|
+
G = bt(a, r, Ge(a)), _e(a, G), ne("Dragging closed launcher", { requestedPosition: u });
|
|
527
527
|
},
|
|
528
528
|
persist: () => {
|
|
529
|
-
qe = !0,
|
|
529
|
+
qe = !0, F(), ne("Persisted closed launcher drag position");
|
|
530
530
|
}
|
|
531
531
|
})) : _e(a, null);
|
|
532
532
|
let Pe = !1;
|
|
@@ -535,25 +535,25 @@ async function ro(e = {}) {
|
|
|
535
535
|
Pe = !0;
|
|
536
536
|
try {
|
|
537
537
|
const r = await t.billingStatusLoader();
|
|
538
|
-
vt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r,
|
|
538
|
+
vt(t.billingStatus, r, w.getState().lastErrorCode) && (t.billingStatus = r, Be(R, t.billingStatus, w.getState().lastErrorCode), U());
|
|
539
539
|
} finally {
|
|
540
540
|
Pe = !1;
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
}, oe = (r = "", u = !0) => {
|
|
544
544
|
Qe(), q !== null && (window.clearTimeout(q), q = null), f.hidden = !1, C.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
545
|
-
const
|
|
546
|
-
if (Xe(K,
|
|
547
|
-
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length),
|
|
545
|
+
const T = be(), K = wt(a, T, t.position);
|
|
546
|
+
if (Xe(K, T), ne("Opening launcher at clamped open panel position", { openPanelPosition: K, visibleLauncherPosition: T }), H(!0, "open"), W(), !u) {
|
|
547
|
+
a.classList.add("pluno-pa-widget--open"), c.hidden = !0, r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F();
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
window.requestAnimationFrame(() => {
|
|
551
|
-
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length),
|
|
551
|
+
a.classList.add("pluno-pa-widget--open"), r && (g.value = r, ge(g)), he(E, () => ee.enabled), te = E.scrollTop, g.focus(), g.setSelectionRange(g.value.length, g.value.length), F(), q = window.setTimeout(() => {
|
|
552
552
|
c.hidden = !0, he(E, () => ee.enabled), te = E.scrollTop;
|
|
553
553
|
}, 220);
|
|
554
554
|
});
|
|
555
555
|
}, on = () => {
|
|
556
|
-
q !== null && (window.clearTimeout(q), q = null), c.hidden = !1,
|
|
556
|
+
q !== null && (window.clearTimeout(q), q = null), c.hidden = !1, G && (be(!1), ne("Closing launcher at stored position")), a.classList.remove("pluno-pa-widget--open"), a.classList.add("pluno-pa-widget--closing"), F(), q = window.setTimeout(() => {
|
|
557
557
|
f.hidden = !0, C.hidden = !0, a.classList.remove("pluno-pa-widget--closing");
|
|
558
558
|
}, 220);
|
|
559
559
|
};
|
|
@@ -583,14 +583,14 @@ async function ro(e = {}) {
|
|
|
583
583
|
);
|
|
584
584
|
et?.observe(b);
|
|
585
585
|
const U = () => {
|
|
586
|
-
_.disabled =
|
|
586
|
+
_.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && m.length === 0, h.disabled = t.loginRequired || $(t.billingStatus);
|
|
587
587
|
};
|
|
588
588
|
t.loginRequired && (s.readOnly = !0, s.placeholder = t.loginButtonLabel, g.placeholder = t.loginButtonLabel, S.hidden = !0), S.addEventListener("submit", (r) => {
|
|
589
589
|
if (r.preventDefault(), t.loginRequired) {
|
|
590
590
|
t.onLoginClick?.();
|
|
591
591
|
return;
|
|
592
592
|
}
|
|
593
|
-
|
|
593
|
+
$(t.billingStatus) || (Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U());
|
|
594
594
|
});
|
|
595
595
|
let ce = 0;
|
|
596
596
|
const an = () => {
|
|
@@ -604,13 +604,13 @@ async function ro(e = {}) {
|
|
|
604
604
|
}, nt = async (r) => {
|
|
605
605
|
if (r.length === 0)
|
|
606
606
|
return;
|
|
607
|
-
const u = await
|
|
607
|
+
const u = await zo(r);
|
|
608
608
|
if (m.length + u.length > Ce)
|
|
609
609
|
throw new Error(`Attach up to ${Ce} files per message.`);
|
|
610
|
-
m = [...m, ...u], P(), rn(), U(),
|
|
610
|
+
m = [...m, ...u], P(), rn(), U(), O(w.getState()), a.classList.contains("pluno-pa-widget--open") || oe();
|
|
611
611
|
};
|
|
612
612
|
h.addEventListener("click", () => {
|
|
613
|
-
t.loginRequired ||
|
|
613
|
+
t.loginRequired || $(t.billingStatus) || y.click();
|
|
614
614
|
}), y.addEventListener("change", () => {
|
|
615
615
|
const r = Array.from(y.files ?? []);
|
|
616
616
|
y.value = "", nt(r).catch((u) => {
|
|
@@ -627,9 +627,9 @@ async function ro(e = {}) {
|
|
|
627
627
|
xe(r.dataTransfer) && (r.stopPropagation(), ce = Math.max(0, ce - 1), ce === 0 && a.classList.remove("pluno-pa-widget--drag-over"));
|
|
628
628
|
}), a.addEventListener("drop", (r) => {
|
|
629
629
|
const u = r.dataTransfer;
|
|
630
|
-
!xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), an(), nt(u.files).catch((
|
|
631
|
-
tt(
|
|
632
|
-
message:
|
|
630
|
+
!xe(u) || t.loginRequired || (r.preventDefault(), r.stopPropagation(), an(), nt(u.files).catch((T) => {
|
|
631
|
+
tt(T instanceof Error ? T.message : "Failed to attach file"), Y("web-sdk.widget", "Attachment failed", {
|
|
632
|
+
message: T instanceof Error ? T.message : String(T)
|
|
633
633
|
});
|
|
634
634
|
}));
|
|
635
635
|
}), _.addEventListener("click", () => {
|
|
@@ -641,38 +641,38 @@ async function ro(e = {}) {
|
|
|
641
641
|
w.stop();
|
|
642
642
|
return;
|
|
643
643
|
}
|
|
644
|
-
Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(),
|
|
645
|
-
}),
|
|
646
|
-
Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g),
|
|
644
|
+
Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
|
|
645
|
+
}), N.addEventListener("click", () => {
|
|
646
|
+
Q = !0, H(!0, "newSession"), W(), w.startNewSession(), Ee.clear(), g.value = "", m = [], P(), ge(g), F(), U(), g.focus(), O(w.getState());
|
|
647
647
|
}), g.addEventListener("input", () => {
|
|
648
|
-
ge(g),
|
|
648
|
+
ge(g), F(), U(), O(w.getState());
|
|
649
649
|
}), g.addEventListener("keydown", (r) => {
|
|
650
650
|
if (!(r.key !== "Enter" || r.shiftKey)) {
|
|
651
651
|
if (r.preventDefault(), t.loginRequired) {
|
|
652
652
|
t.onLoginClick?.();
|
|
653
653
|
return;
|
|
654
654
|
}
|
|
655
|
-
Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(),
|
|
655
|
+
Q = !0, H(!0, "send"), W(), m = Re(w, g, m), P(), U(), O(w.getState());
|
|
656
656
|
}
|
|
657
657
|
}), a.addEventListener("click", (r) => {
|
|
658
|
-
(r.target instanceof Element ? r.target : null)?.closest("a[href]") &&
|
|
658
|
+
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && F();
|
|
659
659
|
}), J.composerValue && (g.value = J.composerValue, ge(g)), J.isOpen && oe(g.value, !1);
|
|
660
660
|
const ot = () => i;
|
|
661
661
|
let Ae = w.getState().appearance !== null, we = null, ue = null, ie = null, at = w.getState().isThinking, re = null, Te = null, it = () => {
|
|
662
662
|
};
|
|
663
|
-
const ln = !!t.socialPostDraftHandler,
|
|
664
|
-
if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null &&
|
|
665
|
-
|
|
663
|
+
const ln = !!t.socialPostDraftHandler, O = (r) => {
|
|
664
|
+
if (Ve(r.lastErrorCode) ? re = r.lastErrorCode : t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(R, t.billingStatus, re), t.loginRequired) {
|
|
665
|
+
Qo(E, _, N, ot, t.loginButtonLabel, t.onLoginClick);
|
|
666
666
|
return;
|
|
667
667
|
}
|
|
668
|
-
const u =
|
|
668
|
+
const u = xo(r), T = u !== Ke;
|
|
669
669
|
Ke = u;
|
|
670
670
|
const K = Q || ee.enabled;
|
|
671
|
-
Q = !1,
|
|
671
|
+
Q = !1, Jo(
|
|
672
672
|
E,
|
|
673
673
|
b,
|
|
674
674
|
_,
|
|
675
|
-
|
|
675
|
+
N,
|
|
676
676
|
de,
|
|
677
677
|
r,
|
|
678
678
|
Te,
|
|
@@ -680,33 +680,33 @@ async function ro(e = {}) {
|
|
|
680
680
|
K,
|
|
681
681
|
() => ee.enabled,
|
|
682
682
|
Ee,
|
|
683
|
-
|
|
683
|
+
F,
|
|
684
684
|
ot,
|
|
685
|
-
(
|
|
686
|
-
Q = !0, H(!0, "send"), W(), w.sendMessage(
|
|
685
|
+
(M) => {
|
|
686
|
+
Q = !0, H(!0, "send"), W(), w.sendMessage(M);
|
|
687
687
|
},
|
|
688
688
|
ln && !ke ? {
|
|
689
689
|
dismissedCandidateIds: fe,
|
|
690
690
|
draftingCandidateId: we,
|
|
691
691
|
error: ue,
|
|
692
|
-
onSeen: (
|
|
693
|
-
ae.add(
|
|
692
|
+
onSeen: (M) => {
|
|
693
|
+
ae.add(M.id), F();
|
|
694
694
|
},
|
|
695
|
-
onDraft: (
|
|
696
|
-
pn(
|
|
695
|
+
onDraft: (M) => {
|
|
696
|
+
pn(M);
|
|
697
697
|
},
|
|
698
|
-
onDismiss: (
|
|
699
|
-
ae.add(
|
|
698
|
+
onDismiss: (M) => {
|
|
699
|
+
ae.add(M.id), fe.add(M.id), F(), ue = null, O(w.getState());
|
|
700
700
|
},
|
|
701
|
-
onDisable: (
|
|
702
|
-
ke = !0, ae.add(
|
|
701
|
+
onDisable: (M) => {
|
|
702
|
+
ke = !0, ae.add(M.id), fe.add(M.id), F(), fa(t, !0), ue = null, O(w.getState());
|
|
703
703
|
}
|
|
704
704
|
} : void 0
|
|
705
|
-
), K ? (te = E.scrollTop, W()) :
|
|
705
|
+
), K ? (te = E.scrollTop, W()) : T && vo(r) && en();
|
|
706
706
|
};
|
|
707
707
|
return it = Tn((r) => {
|
|
708
|
-
Te = r, !Se && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) &&
|
|
709
|
-
}, { backendUrl: t.backendUrl, fetcher:
|
|
708
|
+
Te = r, !Se && Ct(w.getState(), g.value.trim().length > 0 || m.length > 0) && O(w.getState());
|
|
709
|
+
}, { backendUrl: t.backendUrl, fetcher: A, loader: t.activeUsersLoader }), w.on("state", (r) => {
|
|
710
710
|
const u = at && !r.isThinking;
|
|
711
711
|
at = r.isThinking, r.appearance ? (Ae = !0, Y("web-sdk.widget", "Agent state supplied appearance", {
|
|
712
712
|
appearance: r.appearance
|
|
@@ -714,15 +714,15 @@ async function ro(e = {}) {
|
|
|
714
714
|
fallbackAccentColor: t.accentColor,
|
|
715
715
|
fallbackColorScheme: t.colorScheme,
|
|
716
716
|
fallbackFontFamily: t.fontFamily
|
|
717
|
-
}), Ne({}, "agent.state.appearance-cleared")),
|
|
718
|
-
}),
|
|
717
|
+
}), Ne({}, "agent.state.appearance-cleared")), O(r), U(), u && Qe();
|
|
718
|
+
}), O(w.getState()), U(), {
|
|
719
719
|
agent: w,
|
|
720
720
|
updateAppearance: (r) => {
|
|
721
721
|
r.scribbleStyle !== void 0 && (t.scribbleStyle = r.scribbleStyle), Ne(r, "widgetHandle.updateAppearance");
|
|
722
722
|
},
|
|
723
723
|
updateBillingStatus: (r) => {
|
|
724
724
|
const u = r ?? null;
|
|
725
|
-
vt(t.billingStatus, u, re) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null &&
|
|
725
|
+
vt(t.billingStatus, u, re) && (t.billingStatus = u, t.billingStatus?.creditsUsed !== null && !$(t.billingStatus) && (re = null), Be(
|
|
726
726
|
a.querySelector(".pluno-pa-widget__billing-status"),
|
|
727
727
|
t.billingStatus,
|
|
728
728
|
re
|
|
@@ -737,14 +737,14 @@ async function ro(e = {}) {
|
|
|
737
737
|
};
|
|
738
738
|
async function pn(r) {
|
|
739
739
|
if (!we) {
|
|
740
|
-
we = r.id, ue = null,
|
|
740
|
+
we = r.id, ue = null, O(w.getState());
|
|
741
741
|
try {
|
|
742
742
|
if (!t.socialPostDraftHandler)
|
|
743
743
|
throw new Error("Social post drafting is not available here.");
|
|
744
744
|
const u = await t.socialPostDraftHandler(r);
|
|
745
745
|
if (!u.linkedinPost || !u.xPost)
|
|
746
746
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
747
|
-
ae.add(r.id), fe.add(r.id),
|
|
747
|
+
ae.add(r.id), fe.add(r.id), F(), ie?.remove(), ie = na(u, {
|
|
748
748
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
749
749
|
onClose: () => {
|
|
750
750
|
ie?.remove(), ie = null;
|
|
@@ -753,23 +753,23 @@ async function ro(e = {}) {
|
|
|
753
753
|
} catch (u) {
|
|
754
754
|
ue = u instanceof Error ? u.message : "Could not draft social post.";
|
|
755
755
|
} finally {
|
|
756
|
-
we = null,
|
|
756
|
+
we = null, O(w.getState());
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
function Ne(r, u) {
|
|
761
|
-
const
|
|
762
|
-
i = mt(
|
|
763
|
-
accentColor:
|
|
761
|
+
const T = r.accentColor ?? t.accentColor, K = r.colorScheme ?? t.colorScheme, M = r.fontFamily ?? t.fontFamily, Ie = r.scribbleStyle ?? t.scribbleStyle;
|
|
762
|
+
i = mt(T, Ie), ft(a, i, {
|
|
763
|
+
accentColor: T,
|
|
764
764
|
colorScheme: K,
|
|
765
|
-
fontFamily:
|
|
765
|
+
fontFamily: M,
|
|
766
766
|
scribbleStyle: Ie
|
|
767
767
|
}), Y("web-sdk.widget", "Updated widget appearance", {
|
|
768
768
|
source: u,
|
|
769
769
|
inputAppearance: r,
|
|
770
|
-
appliedAccentColor:
|
|
770
|
+
appliedAccentColor: T,
|
|
771
771
|
appliedColorScheme: K,
|
|
772
|
-
appliedFontFamily:
|
|
772
|
+
appliedFontFamily: M,
|
|
773
773
|
appliedScribbleStyle: Ie,
|
|
774
774
|
cssAccent: a.style.getPropertyValue("--pluno-pa-accent")
|
|
775
775
|
});
|
|
@@ -778,15 +778,38 @@ async function ro(e = {}) {
|
|
|
778
778
|
function mt(e, t) {
|
|
779
779
|
return t ? hn(e) : un(e);
|
|
780
780
|
}
|
|
781
|
+
function po(e) {
|
|
782
|
+
const t = so(e);
|
|
783
|
+
return t === null ? "#fafafa" : co(t) > 0.5 ? "#18181b" : "#fafaf9";
|
|
784
|
+
}
|
|
785
|
+
function so(e) {
|
|
786
|
+
const t = e.trim();
|
|
787
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? [
|
|
788
|
+
Number.parseInt(t.slice(1, 3), 16),
|
|
789
|
+
Number.parseInt(t.slice(3, 5), 16),
|
|
790
|
+
Number.parseInt(t.slice(5, 7), 16)
|
|
791
|
+
] : /^#[0-9a-f]{3}$/i.test(t) ? [
|
|
792
|
+
Number.parseInt(t[1] + t[1], 16),
|
|
793
|
+
Number.parseInt(t[2] + t[2], 16),
|
|
794
|
+
Number.parseInt(t[3] + t[3], 16)
|
|
795
|
+
] : null;
|
|
796
|
+
}
|
|
797
|
+
function co([e, t, n]) {
|
|
798
|
+
const o = (a) => {
|
|
799
|
+
const i = a / 255;
|
|
800
|
+
return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
|
|
801
|
+
};
|
|
802
|
+
return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(n);
|
|
803
|
+
}
|
|
781
804
|
function ft(e, t, n) {
|
|
782
805
|
e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
783
806
|
const o = n.scribbleStyle ? Nt(n.accentColor) : n.accentColor;
|
|
784
|
-
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ?
|
|
807
|
+
e.style.setProperty("--pluno-pa-accent", o), n.scribbleStyle ? e.style.setProperty("--pluno-pa-accent-contrast", po(o)) : e.style.removeProperty("--pluno-pa-accent-contrast"), e.style.fontFamily = n.scribbleStyle ? Vn : n.fontFamily, n.scribbleStyle && uo(e.ownerDocument);
|
|
785
808
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
786
809
|
for (const i of a)
|
|
787
810
|
i.src = t;
|
|
788
811
|
}
|
|
789
|
-
function
|
|
812
|
+
function uo(e) {
|
|
790
813
|
if (e.getElementById(gt))
|
|
791
814
|
return;
|
|
792
815
|
const t = e.createElement("style");
|
|
@@ -798,7 +821,7 @@ function lo(e) {
|
|
|
798
821
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
799
822
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
800
823
|
}
|
|
801
|
-
function
|
|
824
|
+
function go({
|
|
802
825
|
root: e,
|
|
803
826
|
launcher: t,
|
|
804
827
|
launcherDragHandle: n,
|
|
@@ -819,7 +842,7 @@ function po({
|
|
|
819
842
|
!d && Math.hypot(g, _) < ht || (d = !0, e.classList.add("pluno-pa-widget--dragging"), a({ x: c.x + g, y: c.y + _ }));
|
|
820
843
|
}, x = (h) => {
|
|
821
844
|
l === h.pointerId && (h.preventDefault(), h.stopPropagation(), d && (s = { x: h.clientX, y: h.clientY }, i()), f());
|
|
822
|
-
},
|
|
845
|
+
}, R = (h) => {
|
|
823
846
|
l === h.pointerId && (h.preventDefault(), f());
|
|
824
847
|
}, v = (h) => {
|
|
825
848
|
if (!s)
|
|
@@ -829,35 +852,35 @@ function po({
|
|
|
829
852
|
}, y = (h) => {
|
|
830
853
|
if (e.classList.contains("pluno-pa-widget--open") || e.classList.contains("pluno-pa-widget--closing"))
|
|
831
854
|
return;
|
|
832
|
-
const g = h.shiftKey ?
|
|
833
|
-
let
|
|
834
|
-
h.key === "ArrowUp" ?
|
|
855
|
+
const g = h.shiftKey ? ao : oo, _ = o();
|
|
856
|
+
let N = null;
|
|
857
|
+
h.key === "ArrowUp" ? N = { x: _.x, y: _.y - g } : h.key === "ArrowDown" ? N = { x: _.x, y: _.y + g } : h.key === "ArrowLeft" ? N = { x: _.x - g, y: _.y } : h.key === "ArrowRight" && (N = { x: _.x + g, y: _.y }), N && (h.preventDefault(), h.stopPropagation(), a(N), i());
|
|
835
858
|
};
|
|
836
|
-
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", S), t.addEventListener("pointerup", x), t.addEventListener("pointercancel",
|
|
837
|
-
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel",
|
|
859
|
+
return t.addEventListener("pointerdown", C), t.addEventListener("pointermove", S), t.addEventListener("pointerup", x), t.addEventListener("pointercancel", R), t.addEventListener("click", v, !0), n.addEventListener("keydown", y), () => {
|
|
860
|
+
t.removeEventListener("pointerdown", C), t.removeEventListener("pointermove", S), t.removeEventListener("pointerup", x), t.removeEventListener("pointercancel", R), t.removeEventListener("click", v, !0), n.removeEventListener("keydown", y);
|
|
838
861
|
};
|
|
839
862
|
}
|
|
840
|
-
function
|
|
863
|
+
function Ge(e, t = !0) {
|
|
841
864
|
const n = se(), o = e.getBoundingClientRect(), a = !e.classList.contains("pluno-pa-widget--open") && !e.classList.contains("pluno-pa-widget--closing");
|
|
842
865
|
return {
|
|
843
|
-
width: t && a && o.width > 0 ? o.width : Math.min(
|
|
844
|
-
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ?
|
|
866
|
+
width: t && a && o.width > 0 ? o.width : Math.min(Bt, n.width - 36),
|
|
867
|
+
height: t && a && o.height > 0 ? o.height : e.classList.contains("pluno-pa-widget--scribble") ? qn : Ft
|
|
845
868
|
};
|
|
846
869
|
}
|
|
847
|
-
function
|
|
870
|
+
function $t() {
|
|
848
871
|
const e = se();
|
|
849
872
|
return {
|
|
850
873
|
width: Math.min(
|
|
851
|
-
pe(e.width *
|
|
852
|
-
e.width -
|
|
874
|
+
pe(e.width * Xn, Kn, Yn),
|
|
875
|
+
e.width - B * 2
|
|
853
876
|
),
|
|
854
877
|
height: Math.min(
|
|
855
|
-
pe(e.height *
|
|
856
|
-
e.height -
|
|
878
|
+
pe(e.height * Qn, Zn, Jn),
|
|
879
|
+
e.height - $e - B
|
|
857
880
|
)
|
|
858
881
|
};
|
|
859
882
|
}
|
|
860
|
-
function
|
|
883
|
+
function ho(e, t, n) {
|
|
861
884
|
const o = Number.parseFloat(e.style.left), a = Number.parseFloat(e.style.top);
|
|
862
885
|
if (Number.isFinite(o) && Number.isFinite(a))
|
|
863
886
|
return { x: o, y: a };
|
|
@@ -871,30 +894,30 @@ function so(e, t, n) {
|
|
|
871
894
|
};
|
|
872
895
|
}
|
|
873
896
|
function bt(e, t, n) {
|
|
874
|
-
const o = se(), a =
|
|
897
|
+
const o = se(), a = B + mo(e);
|
|
875
898
|
return {
|
|
876
|
-
x: pe(t.x,
|
|
877
|
-
y: pe(t.y, a, Math.max(a, o.height - n.height -
|
|
899
|
+
x: pe(t.x, B, Math.max(B, o.width - n.width - B)),
|
|
900
|
+
y: pe(t.y, a, Math.max(a, o.height - n.height - B))
|
|
878
901
|
};
|
|
879
902
|
}
|
|
880
|
-
function
|
|
881
|
-
return e.classList.contains("pluno-pa-widget--scribble") ?
|
|
903
|
+
function mo(e) {
|
|
904
|
+
return e.classList.contains("pluno-pa-widget--scribble") ? no : to;
|
|
882
905
|
}
|
|
883
906
|
function wt(e, t, n) {
|
|
884
|
-
const o =
|
|
907
|
+
const o = Ge(e), a = $t(), i = {
|
|
885
908
|
x: n === "bottom-left" ? t.x : t.x + o.width - a.width,
|
|
886
909
|
y: t.y + o.height - a.height
|
|
887
910
|
};
|
|
888
|
-
return
|
|
911
|
+
return fo(i);
|
|
889
912
|
}
|
|
890
|
-
function
|
|
891
|
-
const t = se(), n =
|
|
913
|
+
function fo(e) {
|
|
914
|
+
const t = se(), n = $t();
|
|
892
915
|
return {
|
|
893
|
-
x: pe(e.x,
|
|
916
|
+
x: pe(e.x, B, Math.max(B, t.width - n.width - B)),
|
|
894
917
|
y: pe(
|
|
895
918
|
e.y,
|
|
896
|
-
|
|
897
|
-
Math.max(
|
|
919
|
+
$e,
|
|
920
|
+
Math.max($e, t.height - n.height - B)
|
|
898
921
|
)
|
|
899
922
|
};
|
|
900
923
|
}
|
|
@@ -905,16 +928,16 @@ function _e(e, t) {
|
|
|
905
928
|
}
|
|
906
929
|
e.style.left = `${t.x}px`, e.style.top = `${t.y}px`, e.style.right = "auto", e.style.bottom = "auto";
|
|
907
930
|
}
|
|
908
|
-
function
|
|
931
|
+
function bo(e, t) {
|
|
909
932
|
e.style.setProperty("--pluno-pa-panel-offset-x", `${t.x}px`), e.style.setProperty("--pluno-pa-panel-offset-y", `${t.y}px`);
|
|
910
933
|
}
|
|
911
|
-
function
|
|
934
|
+
function wo(e) {
|
|
912
935
|
e.style.removeProperty("--pluno-pa-panel-offset-x"), e.style.removeProperty("--pluno-pa-panel-offset-y");
|
|
913
936
|
}
|
|
914
937
|
function se() {
|
|
915
938
|
return {
|
|
916
|
-
width: window.innerWidth || document.documentElement.clientWidth ||
|
|
917
|
-
height: window.innerHeight || document.documentElement.clientHeight || Ft +
|
|
939
|
+
width: window.innerWidth || document.documentElement.clientWidth || Bt + B * 2,
|
|
940
|
+
height: window.innerHeight || document.documentElement.clientHeight || Ft + B * 2
|
|
918
941
|
};
|
|
919
942
|
}
|
|
920
943
|
function Me(e) {
|
|
@@ -938,9 +961,9 @@ function Y(e, t, n) {
|
|
|
938
961
|
message: t,
|
|
939
962
|
details: n
|
|
940
963
|
}, i = o.__plunoProductAgentDiagnostics__ ?? [];
|
|
941
|
-
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(
|
|
964
|
+
i.push(a), i.length > 120 && i.splice(0, i.length - 120), o.__plunoProductAgentDiagnostics__ = i, o.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent(Gn, { detail: a }));
|
|
942
965
|
}
|
|
943
|
-
function
|
|
966
|
+
function _o(e, t) {
|
|
944
967
|
Y("web-sdk.widget.position", e, t);
|
|
945
968
|
}
|
|
946
969
|
function Re(e, t, n) {
|
|
@@ -957,7 +980,7 @@ function he(e, t = () => !0) {
|
|
|
957
980
|
t() && (e.scrollTop = e.scrollHeight);
|
|
958
981
|
});
|
|
959
982
|
}
|
|
960
|
-
function
|
|
983
|
+
function xo(e) {
|
|
961
984
|
const t = e.messages[e.messages.length - 1];
|
|
962
985
|
return [
|
|
963
986
|
e.messages.length,
|
|
@@ -968,13 +991,13 @@ function fo(e) {
|
|
|
968
991
|
e.lastError ?? ""
|
|
969
992
|
].join(":");
|
|
970
993
|
}
|
|
971
|
-
function
|
|
994
|
+
function vo(e) {
|
|
972
995
|
return e.messages.length > 0 || e.assistantDraft.length > 0 || e.isThinking || !!e.lastError;
|
|
973
996
|
}
|
|
974
|
-
function
|
|
975
|
-
e.appendChild(
|
|
997
|
+
function yo(e, t, n, o) {
|
|
998
|
+
e.appendChild(Po()), e.appendChild(Co(t, n, o)), e.appendChild(Wt("pluno-pa-widget__close", "Close", Ao(16), !0)), e.appendChild(Eo(n));
|
|
976
999
|
}
|
|
977
|
-
function
|
|
1000
|
+
function Co(e, t, n) {
|
|
978
1001
|
const o = document.createElement("form");
|
|
979
1002
|
if (o.className = "pluno-pa-widget__launcher", n) {
|
|
980
1003
|
const i = document.createElement("button");
|
|
@@ -984,21 +1007,21 @@ function _o(e, t, n) {
|
|
|
984
1007
|
const a = document.createElement("input");
|
|
985
1008
|
return a.className = "pluno-pa-widget__launcher-input", a.type = "text", a.placeholder = e, a.setAttribute("aria-label", e), o.appendChild(a), o;
|
|
986
1009
|
}
|
|
987
|
-
function
|
|
1010
|
+
function Eo(e) {
|
|
988
1011
|
const t = document.createElement("section");
|
|
989
1012
|
t.className = "pluno-pa-widget__panel", t.hidden = !0;
|
|
990
1013
|
const n = document.createElement("div");
|
|
991
1014
|
n.className = "pluno-pa-widget__timeline-wrap";
|
|
992
1015
|
const o = document.createElement("main");
|
|
993
|
-
o.className = "pluno-pa-widget__timeline", o.appendChild(
|
|
1016
|
+
o.className = "pluno-pa-widget__timeline", o.appendChild(So(e));
|
|
994
1017
|
const a = document.createElement("div");
|
|
995
1018
|
a.className = "pluno-pa-widget__timeline-bottom-sentinel", a.setAttribute("aria-hidden", "true"), o.appendChild(a), n.appendChild(o);
|
|
996
1019
|
const i = document.createElement("div");
|
|
997
1020
|
i.className = "pluno-pa-widget__active-users-counter", i.hidden = !0, n.appendChild(i);
|
|
998
1021
|
const l = document.createElement("button");
|
|
999
|
-
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Wt("pluno-pa-widget__new-chat", "New chat",
|
|
1022
|
+
return l.type = "button", l.className = "pluno-pa-widget__timeline-jump", l.textContent = "New messages ↓", l.hidden = !0, n.appendChild(l), n.appendChild(Wt("pluno-pa-widget__new-chat", "New chat", To(), !0)), t.appendChild(n), t.appendChild(ko()), t;
|
|
1000
1023
|
}
|
|
1001
|
-
function
|
|
1024
|
+
function ko() {
|
|
1002
1025
|
const e = document.createElement("form");
|
|
1003
1026
|
e.className = "pluno-pa-widget__composer";
|
|
1004
1027
|
const t = document.createElement("div");
|
|
@@ -1012,7 +1035,7 @@ function vo() {
|
|
|
1012
1035
|
const i = document.createElement("input");
|
|
1013
1036
|
i.className = "pluno-pa-widget__attachment-input", i.type = "file", i.accept = Wn, i.multiple = !0, i.tabIndex = -1, i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1014
1037
|
const l = document.createElement("button");
|
|
1015
|
-
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(
|
|
1038
|
+
l.type = "button", l.className = "pluno-pa-widget__attach", l.setAttribute("aria-label", "Attach files"), l.title = "Attach files", l.appendChild(No()), l.appendChild(Io()), a.appendChild(l);
|
|
1016
1039
|
const p = document.createElement("textarea");
|
|
1017
1040
|
p.className = "pluno-pa-widget__input", p.rows = 1, p.placeholder = "Ask for anything...", a.appendChild(p);
|
|
1018
1041
|
const c = document.createElement("button");
|
|
@@ -1024,15 +1047,15 @@ function vo() {
|
|
|
1024
1047
|
const f = document.createElement("span");
|
|
1025
1048
|
return f.className = "pluno-pa-widget__ai-disclaimer", f.textContent = "AI can make mistakes. Verify outputs.", d.appendChild(f), e.appendChild(d), e;
|
|
1026
1049
|
}
|
|
1027
|
-
function
|
|
1050
|
+
function So(e) {
|
|
1028
1051
|
const t = document.createElement("div");
|
|
1029
|
-
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild(
|
|
1052
|
+
return t.className = "pluno-pa-widget__empty-state", t.appendChild(Ht("pluno-pa-widget__character--empty", e)), t.appendChild(Gt()), t;
|
|
1030
1053
|
}
|
|
1031
|
-
function
|
|
1054
|
+
function Gt() {
|
|
1032
1055
|
const e = document.createElement("div");
|
|
1033
1056
|
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;
|
|
1034
1057
|
}
|
|
1035
|
-
function
|
|
1058
|
+
function Lo(e, t) {
|
|
1036
1059
|
e.replaceChildren(), e.setAttribute("aria-label", `${t.toLocaleString("en-US")} users currently active`);
|
|
1037
1060
|
const n = document.createElement("span");
|
|
1038
1061
|
n.className = "pluno-pa-widget__active-users-counter-dot", n.setAttribute("aria-hidden", "true"), e.appendChild(n), e.appendChild(document.createTextNode(`${t.toLocaleString("en-US")} users currently active`));
|
|
@@ -1045,7 +1068,7 @@ function Wt(e, t, n, o) {
|
|
|
1045
1068
|
const a = document.createElement("button");
|
|
1046
1069
|
return a.type = "button", a.className = e, a.setAttribute("aria-label", t), a.title = t, a.hidden = o, a.appendChild(n), a;
|
|
1047
1070
|
}
|
|
1048
|
-
function
|
|
1071
|
+
function Po() {
|
|
1049
1072
|
const e = L("svg", {
|
|
1050
1073
|
class: "pluno-pa-widget__scribble-defs",
|
|
1051
1074
|
"aria-hidden": "true",
|
|
@@ -1053,9 +1076,9 @@ function Eo() {
|
|
|
1053
1076
|
width: "0",
|
|
1054
1077
|
height: "0"
|
|
1055
1078
|
}), t = L("defs");
|
|
1056
|
-
return t.appendChild(
|
|
1079
|
+
return t.appendChild(Oe("pluno-pa-scribble-wobble", "2", "12")), t.appendChild(Oe("pluno-pa-scribble-wobble-2", "5", "15")), t.appendChild(Oe("pluno-pa-scribble-wobble-3", "9", "19")), e.appendChild(t), e;
|
|
1057
1080
|
}
|
|
1058
|
-
function
|
|
1081
|
+
function Oe(e, t, n) {
|
|
1059
1082
|
const o = L("filter", { id: e, x: "-8%", y: "-8%", width: "116%", height: "116%" });
|
|
1060
1083
|
return o.appendChild(
|
|
1061
1084
|
L("feTurbulence", {
|
|
@@ -1092,11 +1115,11 @@ function Be(e, t, n) {
|
|
|
1092
1115
|
})
|
|
1093
1116
|
), o;
|
|
1094
1117
|
}
|
|
1095
|
-
function
|
|
1118
|
+
function Ao(e) {
|
|
1096
1119
|
const t = X("0 0 24 24", e, e, "none", "currentColor", "2.25");
|
|
1097
1120
|
return t.appendChild(L("path", { d: "m6 9 6 6 6-6" })), t;
|
|
1098
1121
|
}
|
|
1099
|
-
function
|
|
1122
|
+
function To() {
|
|
1100
1123
|
const e = X("0 0 24 24", 17, 17, "none", "currentColor", "2.25");
|
|
1101
1124
|
return e.appendChild(L("path", { d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" })), e.appendChild(L("path", { d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z" })), e;
|
|
1102
1125
|
}
|
|
@@ -1104,7 +1127,7 @@ function jt() {
|
|
|
1104
1127
|
const e = X("0 0 24 24", 14, 14, "none", "currentColor", "2.75");
|
|
1105
1128
|
return e.appendChild(L("line", { x1: "12", y1: "19", x2: "12", y2: "5" })), e.appendChild(L("polyline", { points: "5 12 12 5 19 12" })), e;
|
|
1106
1129
|
}
|
|
1107
|
-
function
|
|
1130
|
+
function No() {
|
|
1108
1131
|
const e = X("0 0 24 24", 16, 16, "none", "currentColor", "2.4");
|
|
1109
1132
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"), e.appendChild(
|
|
1110
1133
|
L("path", {
|
|
@@ -1112,7 +1135,7 @@ function Lo() {
|
|
|
1112
1135
|
})
|
|
1113
1136
|
), e;
|
|
1114
1137
|
}
|
|
1115
|
-
function
|
|
1138
|
+
function Io() {
|
|
1116
1139
|
const e = X("0 0 24 24", 19, 19, "none", "currentColor");
|
|
1117
1140
|
return e.setAttribute("class", "pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"), e.appendChild(
|
|
1118
1141
|
L("path", {
|
|
@@ -1124,15 +1147,15 @@ function Po() {
|
|
|
1124
1147
|
})
|
|
1125
1148
|
), e;
|
|
1126
1149
|
}
|
|
1127
|
-
function
|
|
1150
|
+
function Do() {
|
|
1128
1151
|
const e = X("0 0 24 24", 18, 18, "currentColor");
|
|
1129
1152
|
return e.appendChild(L("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" })), e;
|
|
1130
1153
|
}
|
|
1131
|
-
function
|
|
1154
|
+
function Mo() {
|
|
1132
1155
|
const e = X("0 0 24 24", 12, 12, "none", "currentColor", "2.4");
|
|
1133
1156
|
return e.appendChild(L("path", { d: "M18 6 6 18" })), e.appendChild(L("path", { d: "m6 6 12 12" })), e;
|
|
1134
1157
|
}
|
|
1135
|
-
function
|
|
1158
|
+
function Ro() {
|
|
1136
1159
|
const e = X("0 0 24 24", 13, 13, "none", "currentColor", "2.25");
|
|
1137
1160
|
return e.appendChild(L("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" })), e.appendChild(L("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })), e;
|
|
1138
1161
|
}
|
|
@@ -1147,7 +1170,7 @@ function X(e, t, n, o, a, i) {
|
|
|
1147
1170
|
return a && (l.stroke = a, l["stroke-linecap"] = "round", l["stroke-linejoin"] = "round"), i && (l["stroke-width"] = i), L("svg", l);
|
|
1148
1171
|
}
|
|
1149
1172
|
function L(e, t = {}) {
|
|
1150
|
-
const n = document.createElementNS(
|
|
1173
|
+
const n = document.createElementNS(eo, e);
|
|
1151
1174
|
for (const [o, a] of Object.entries(t))
|
|
1152
1175
|
n.setAttribute(o, a);
|
|
1153
1176
|
return n;
|
|
@@ -1158,18 +1181,18 @@ function _t(e) {
|
|
|
1158
1181
|
n.stopPropagation();
|
|
1159
1182
|
});
|
|
1160
1183
|
}
|
|
1161
|
-
function
|
|
1184
|
+
function Oo(e, t, n) {
|
|
1162
1185
|
e.replaceChildren(), e.hidden = t.length === 0;
|
|
1163
1186
|
for (const [o, a] of t.entries()) {
|
|
1164
1187
|
const i = document.createElement("div");
|
|
1165
|
-
i.className = "pluno-pa-widget__attachment", i.appendChild(
|
|
1188
|
+
i.className = "pluno-pa-widget__attachment", i.appendChild(Bo(a));
|
|
1166
1189
|
const l = document.createElement("span");
|
|
1167
1190
|
l.textContent = a.name, i.appendChild(l);
|
|
1168
1191
|
const p = document.createElement("button");
|
|
1169
|
-
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(
|
|
1192
|
+
p.type = "button", p.setAttribute("aria-label", `Remove ${a.name}`), p.appendChild(Mo()), p.addEventListener("click", () => n(o)), i.appendChild(p), e.appendChild(i);
|
|
1170
1193
|
}
|
|
1171
1194
|
}
|
|
1172
|
-
function
|
|
1195
|
+
function Bo(e) {
|
|
1173
1196
|
if (Vt(e)) {
|
|
1174
1197
|
const n = document.createElement("img");
|
|
1175
1198
|
return n.src = e.dataUrl, n.alt = "", n.setAttribute("aria-hidden", "true"), n;
|
|
@@ -1177,7 +1200,7 @@ function Do(e) {
|
|
|
1177
1200
|
const t = document.createElement("span");
|
|
1178
1201
|
return t.className = "pluno-pa-widget__attachment-file", t.textContent = "PDF", t;
|
|
1179
1202
|
}
|
|
1180
|
-
function
|
|
1203
|
+
function Fo(e) {
|
|
1181
1204
|
if (Vt(e)) {
|
|
1182
1205
|
const a = document.createElement("img");
|
|
1183
1206
|
return a.src = e.dataUrl, a.alt = e.name, a;
|
|
@@ -1192,10 +1215,10 @@ function Mo(e) {
|
|
|
1192
1215
|
function Vt(e) {
|
|
1193
1216
|
return e.mimeType.startsWith("image/");
|
|
1194
1217
|
}
|
|
1195
|
-
function
|
|
1218
|
+
function Uo(e) {
|
|
1196
1219
|
return e === "application/pdf" ? "document.pdf" : "image";
|
|
1197
1220
|
}
|
|
1198
|
-
async function
|
|
1221
|
+
async function zo(e) {
|
|
1199
1222
|
if (!e)
|
|
1200
1223
|
return [];
|
|
1201
1224
|
const t = Array.from(e);
|
|
@@ -1203,37 +1226,37 @@ async function Bo(e) {
|
|
|
1203
1226
|
throw new Error(`Attach up to ${Ce} files per message.`);
|
|
1204
1227
|
return Promise.all(
|
|
1205
1228
|
t.map(async (n) => {
|
|
1206
|
-
const o =
|
|
1229
|
+
const o = $o(n);
|
|
1207
1230
|
if (!o)
|
|
1208
1231
|
throw new Error("Pluno supports PNG, JPEG, WebP, non-animated GIF, and PDF files.");
|
|
1209
1232
|
if (n.size > Hn)
|
|
1210
1233
|
throw new Error("Each Pluno attachment can be up to 10 MB.");
|
|
1211
1234
|
if (o === "image/gif") {
|
|
1212
|
-
const a = new Uint8Array(await
|
|
1213
|
-
if (
|
|
1235
|
+
const a = new Uint8Array(await Xo(n));
|
|
1236
|
+
if (Ho(a))
|
|
1214
1237
|
throw new Error("Pluno supports non-animated GIF images.");
|
|
1215
1238
|
}
|
|
1216
1239
|
return {
|
|
1217
|
-
name: n.name ||
|
|
1240
|
+
name: n.name || Uo(o),
|
|
1218
1241
|
mimeType: o,
|
|
1219
1242
|
sizeBytes: n.size,
|
|
1220
|
-
dataUrl:
|
|
1243
|
+
dataUrl: Go(await Zo(n), o)
|
|
1221
1244
|
};
|
|
1222
1245
|
})
|
|
1223
1246
|
);
|
|
1224
1247
|
}
|
|
1225
|
-
function
|
|
1226
|
-
if (
|
|
1248
|
+
function $o(e) {
|
|
1249
|
+
if (Ot.has(e.type))
|
|
1227
1250
|
return e.type;
|
|
1228
1251
|
const t = e.name.toLowerCase();
|
|
1229
1252
|
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
1230
1253
|
}
|
|
1231
|
-
function
|
|
1254
|
+
function Go(e, t) {
|
|
1232
1255
|
const n = `data:${t};base64,`;
|
|
1233
1256
|
return e.startsWith(n) ? e : e.replace(/^data:[^;]*;base64,/, n);
|
|
1234
1257
|
}
|
|
1235
|
-
function
|
|
1236
|
-
if (e.length < 14 || !
|
|
1258
|
+
function Ho(e) {
|
|
1259
|
+
if (e.length < 14 || !Wo(e))
|
|
1237
1260
|
return !1;
|
|
1238
1261
|
const t = e[10];
|
|
1239
1262
|
let n = 13;
|
|
@@ -1260,7 +1283,7 @@ function Uo(e) {
|
|
|
1260
1283
|
}
|
|
1261
1284
|
return !1;
|
|
1262
1285
|
}
|
|
1263
|
-
function
|
|
1286
|
+
function Wo(e) {
|
|
1264
1287
|
return e[0] === 71 && e[1] === 73 && e[2] === 70 && e[3] === 56 && (e[4] === 55 || e[4] === 57) && e[5] === 97;
|
|
1265
1288
|
}
|
|
1266
1289
|
function xt(e, t) {
|
|
@@ -1275,14 +1298,14 @@ function xt(e, t) {
|
|
|
1275
1298
|
function xe(e) {
|
|
1276
1299
|
return !!(e && Array.from(e.types).includes("Files"));
|
|
1277
1300
|
}
|
|
1278
|
-
function
|
|
1301
|
+
function Be(e, t, n = null) {
|
|
1279
1302
|
if (!e || !He(t, n)) {
|
|
1280
1303
|
e && (e.hidden = !0, e.replaceChildren());
|
|
1281
1304
|
return;
|
|
1282
1305
|
}
|
|
1283
|
-
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status",
|
|
1306
|
+
e.hidden = !1, e.replaceChildren(), e.className = "pluno-pa-widget__billing-status", $(t) || Ve(n) ? e.appendChild(jo(t, n)) : qt(t) && e.appendChild(Vo(t));
|
|
1284
1307
|
}
|
|
1285
|
-
function
|
|
1308
|
+
function jo(e, t) {
|
|
1286
1309
|
const n = document.createElement("div");
|
|
1287
1310
|
n.className = "pluno-pa-widget__billing-action-card";
|
|
1288
1311
|
const o = e.limitExceeded || t === "limit_exceeded", a = document.createElement("strong");
|
|
@@ -1290,36 +1313,36 @@ function Go(e, t) {
|
|
|
1290
1313
|
const i = document.createElement("span");
|
|
1291
1314
|
return i.textContent = o ? "Earn bonus credits or upgrade to keep using Pluno on this product." : e.paymentIssue ?? "Open billing to keep using Pluno.", n.appendChild(i), n.appendChild(Kt(e, "Upgrade plan", "pluno-pa-widget__billing-action-card-actions")), n;
|
|
1292
1315
|
}
|
|
1293
|
-
function
|
|
1316
|
+
function Vo(e) {
|
|
1294
1317
|
const t = document.createElement("div");
|
|
1295
1318
|
t.className = "pluno-pa-widget__billing-action-card pluno-pa-widget__billing-action-card--low";
|
|
1296
1319
|
const n = document.createElement("strong");
|
|
1297
1320
|
n.textContent = "Credits running low", t.appendChild(n);
|
|
1298
1321
|
const o = document.createElement("span");
|
|
1299
|
-
return o.textContent =
|
|
1322
|
+
return o.textContent = Ko(e) ?? "Credits are running low for this period.", t.appendChild(o), t.appendChild(Kt(e, "Upgrade", "pluno-pa-widget__billing-action-card-actions")), t;
|
|
1300
1323
|
}
|
|
1301
1324
|
function He(e, t) {
|
|
1302
|
-
return e !== null && (
|
|
1325
|
+
return e !== null && ($(e) || qt(e) || Ve(t));
|
|
1303
1326
|
}
|
|
1304
1327
|
function vt(e, t, n) {
|
|
1305
|
-
return He(t, n) ||
|
|
1328
|
+
return He(t, n) || qo(t) ? !0 : !He(e, n);
|
|
1306
1329
|
}
|
|
1307
|
-
function
|
|
1308
|
-
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null ||
|
|
1330
|
+
function qo(e) {
|
|
1331
|
+
return e != null && (e.creditsUsed !== null || e.creditLimit !== null || e.creditsRemaining !== null || $(e));
|
|
1309
1332
|
}
|
|
1310
|
-
function
|
|
1333
|
+
function $(e) {
|
|
1311
1334
|
return e?.limitExceeded === !0 || !!e?.paymentIssue;
|
|
1312
1335
|
}
|
|
1313
1336
|
function Ve(e) {
|
|
1314
1337
|
return e === "limit_exceeded" || e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required";
|
|
1315
1338
|
}
|
|
1316
1339
|
function qt(e) {
|
|
1317
|
-
return
|
|
1340
|
+
return !$(e) && e.creditLimit !== null && e.creditLimit > 0 && e.creditsRemaining !== null && e.creditsRemaining > 0 && e.creditsRemaining / e.creditLimit <= 0.2;
|
|
1318
1341
|
}
|
|
1319
|
-
function
|
|
1320
|
-
return e.creditsRemaining === null ? null : `${
|
|
1342
|
+
function Ko(e) {
|
|
1343
|
+
return e.creditsRemaining === null ? null : `${Yo(e.creditsRemaining)} credits left`;
|
|
1321
1344
|
}
|
|
1322
|
-
function
|
|
1345
|
+
function Yo(e) {
|
|
1323
1346
|
return new Intl.NumberFormat("en-US", {
|
|
1324
1347
|
maximumFractionDigits: 0
|
|
1325
1348
|
}).format(Math.ceil(e));
|
|
@@ -1330,11 +1353,16 @@ function Kt(e, t, n) {
|
|
|
1330
1353
|
}
|
|
1331
1354
|
function yt(e, t) {
|
|
1332
1355
|
const n = document.createElement("button");
|
|
1333
|
-
|
|
1356
|
+
if (n.type = "button", e === "Earn credits") {
|
|
1357
|
+
const o = document.createElement("span");
|
|
1358
|
+
o.className = "pluno-pa-widget__billing-action-card-earn-credits-label", o.textContent = e, n.appendChild(o);
|
|
1359
|
+
} else
|
|
1360
|
+
n.textContent = e;
|
|
1361
|
+
return n.disabled = t.trim().length === 0, n.addEventListener("click", () => {
|
|
1334
1362
|
t.trim().length !== 0 && window.open(t, "_blank", "noopener,noreferrer");
|
|
1335
1363
|
}), n;
|
|
1336
1364
|
}
|
|
1337
|
-
function
|
|
1365
|
+
function Xo(e) {
|
|
1338
1366
|
return new Promise((t, n) => {
|
|
1339
1367
|
const o = new FileReader();
|
|
1340
1368
|
o.addEventListener("load", () => {
|
|
@@ -1348,7 +1376,7 @@ function Vo(e) {
|
|
|
1348
1376
|
}), o.readAsArrayBuffer(e);
|
|
1349
1377
|
});
|
|
1350
1378
|
}
|
|
1351
|
-
function
|
|
1379
|
+
function Zo(e) {
|
|
1352
1380
|
return new Promise((t, n) => {
|
|
1353
1381
|
const o = new FileReader();
|
|
1354
1382
|
o.addEventListener("load", () => {
|
|
@@ -1365,9 +1393,9 @@ function qo(e) {
|
|
|
1365
1393
|
function Ct(e, t) {
|
|
1366
1394
|
return e.messages.filter((o) => !Yt(o)).length === 0 && !e.assistantDraft && !e.lastError && !e.isThinking && !t;
|
|
1367
1395
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const
|
|
1370
|
-
e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null &&
|
|
1396
|
+
function Jo(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
|
|
1397
|
+
const R = [...i.messages], v = R.filter((b) => !Yt(b)), y = e.scrollTop;
|
|
1398
|
+
e.replaceChildren(), Zt(n, i.isThinking), a.hidden = !p, p && l !== null && Lo(a, l);
|
|
1371
1399
|
const h = v.length > 0 || !!i.assistantDraft || i.isThinking;
|
|
1372
1400
|
if (o.hidden = !h, v.length === 0 && !i.assistantDraft && !i.lastError && !i.isThinking) {
|
|
1373
1401
|
const b = document.createElement("div");
|
|
@@ -1375,29 +1403,34 @@ function Ko(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
|
|
|
1375
1403
|
const m = document.createElement("div");
|
|
1376
1404
|
m.className = "pluno-pa-widget__empty-hero";
|
|
1377
1405
|
const k = document.createElement("img");
|
|
1378
|
-
k.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", k.src = C(), k.alt = "", k.setAttribute("aria-hidden", "true"), m.appendChild(k), b.appendChild(m), b.appendChild(
|
|
1406
|
+
k.className = "pluno-pa-widget__character pluno-pa-widget__character--empty", k.src = C(), k.alt = "", k.setAttribute("aria-hidden", "true"), m.appendChild(k), b.appendChild(m), b.appendChild(Gt());
|
|
1379
1407
|
const P = document.createElement("div");
|
|
1380
|
-
P.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && P.setAttribute("aria-hidden", "true")
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1408
|
+
if (P.className = i.starterPrompts.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", i.starterPrompts.length === 0 && P.setAttribute("aria-hidden", "true"), i.starterPrompts.length > 0)
|
|
1409
|
+
for (const I of i.starterPrompts) {
|
|
1410
|
+
const A = document.createElement("button");
|
|
1411
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt", A.textContent = `"${I}"`, A.addEventListener("click", () => {
|
|
1412
|
+
S(I);
|
|
1413
|
+
}), P.appendChild(A);
|
|
1414
|
+
}
|
|
1415
|
+
else
|
|
1416
|
+
for (let I = 0; I < jn; I += 1) {
|
|
1417
|
+
const A = document.createElement("button");
|
|
1418
|
+
A.type = "button", A.className = "pluno-pa-widget__starter-prompt pluno-pa-widget__starter-prompt--placeholder", A.disabled = !0, A.tabIndex = -1, A.innerHTML = " ", P.appendChild(A);
|
|
1419
|
+
}
|
|
1387
1420
|
b.appendChild(P), e.appendChild(b), e.appendChild(t);
|
|
1388
1421
|
return;
|
|
1389
1422
|
}
|
|
1390
|
-
let g = null, _ = null,
|
|
1423
|
+
let g = null, _ = null, N = [];
|
|
1391
1424
|
const Z = () => {
|
|
1392
|
-
if (
|
|
1425
|
+
if (N.length === 0)
|
|
1393
1426
|
return !1;
|
|
1394
|
-
const b =
|
|
1395
|
-
return e.appendChild(b), g = null, _ = b,
|
|
1427
|
+
const b = la(N, s, f, C());
|
|
1428
|
+
return e.appendChild(b), g = null, _ = b, N = [], !0;
|
|
1396
1429
|
};
|
|
1397
1430
|
for (let b = 0; b < v.length; b += 1) {
|
|
1398
1431
|
const m = v[b];
|
|
1399
1432
|
if (m.role === "tool") {
|
|
1400
|
-
|
|
1433
|
+
N.push(m);
|
|
1401
1434
|
continue;
|
|
1402
1435
|
}
|
|
1403
1436
|
if (m.role === "system")
|
|
@@ -1407,10 +1440,10 @@ function Ko(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
|
|
|
1407
1440
|
const w = We(C());
|
|
1408
1441
|
e.appendChild(w), g = null, _ = w;
|
|
1409
1442
|
}
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1443
|
+
const I = document.createElement("div");
|
|
1444
|
+
I.className = `pluno-pa-widget__message pluno-pa-widget__message--${m.role}`, m.role === "assistant" ? St(I, P) : I.textContent = P, m.role === "user" && m.attachments?.length && I.appendChild(ea(m.attachments));
|
|
1445
|
+
const A = document.createElement("div");
|
|
1446
|
+
A.className = "pluno-pa-widget__message-actions", A.appendChild(Et(P)), I.appendChild(A), e.appendChild(I), g = I, _ = null;
|
|
1414
1447
|
}
|
|
1415
1448
|
const de = Z();
|
|
1416
1449
|
if (i.assistantDraft) {
|
|
@@ -1428,16 +1461,16 @@ function Ko(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
|
|
|
1428
1461
|
const b = Xt();
|
|
1429
1462
|
e.appendChild(b), g = null, _ = b;
|
|
1430
1463
|
} else {
|
|
1431
|
-
const b =
|
|
1464
|
+
const b = pa(C());
|
|
1432
1465
|
e.appendChild(b), g = null, _ = b;
|
|
1433
1466
|
}
|
|
1434
1467
|
if (i.lastError) {
|
|
1435
1468
|
const b = document.createElement("div");
|
|
1436
1469
|
b.className = "pluno-pa-widget__error", b.textContent = i.lastError, e.appendChild(b), g = b, _ = null;
|
|
1437
1470
|
}
|
|
1438
|
-
const E = x && !i.isThinking ? xn(
|
|
1471
|
+
const E = x && !i.isThinking ? xn(R) : null;
|
|
1439
1472
|
if (x && E && !x.dismissedCandidateIds.has(E.id)) {
|
|
1440
|
-
const b =
|
|
1473
|
+
const b = ta(E, {
|
|
1441
1474
|
isDrafting: x.draftingCandidateId === E.id,
|
|
1442
1475
|
error: x.error,
|
|
1443
1476
|
onDraft: x.onDraft,
|
|
@@ -1448,7 +1481,7 @@ function Ko(e, t, n, o, a, i, l, p, c, d, s, f, C, S, x) {
|
|
|
1448
1481
|
}
|
|
1449
1482
|
g?.classList.add("pluno-pa-widget__message--bottom-reserve"), _?.classList.add("pluno-pa-widget__bottom-reserve-compact"), e.appendChild(t), c ? he(e, d) : e.scrollTop = y;
|
|
1450
1483
|
}
|
|
1451
|
-
function
|
|
1484
|
+
function Qo(e, t, n, o, a, i) {
|
|
1452
1485
|
e.replaceChildren(), Zt(t, !1), t.disabled = !0, n.hidden = !0;
|
|
1453
1486
|
const l = document.createElement("div");
|
|
1454
1487
|
l.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
@@ -1459,20 +1492,20 @@ function Yo(e, t, n, o, a, i) {
|
|
|
1459
1492
|
const d = document.createElement("button");
|
|
1460
1493
|
d.type = "button", d.className = "pluno-pa-widget__login", d.textContent = a, d.addEventListener("click", () => i?.()), l.appendChild(d), e.appendChild(l);
|
|
1461
1494
|
}
|
|
1462
|
-
function
|
|
1495
|
+
function ea(e) {
|
|
1463
1496
|
const t = document.createElement("div");
|
|
1464
1497
|
t.className = "pluno-pa-widget__message-attachments";
|
|
1465
1498
|
for (const n of e)
|
|
1466
|
-
t.appendChild(
|
|
1499
|
+
t.appendChild(Fo(n));
|
|
1467
1500
|
return t;
|
|
1468
1501
|
}
|
|
1469
1502
|
function Et(e) {
|
|
1470
1503
|
const t = document.createElement("button");
|
|
1471
|
-
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(
|
|
1504
|
+
return t.type = "button", t.className = "pluno-pa-widget__message-copy", t.setAttribute("aria-label", "Copy message"), t.title = "Copy message", t.appendChild(Ro()), t.addEventListener("click", (n) => {
|
|
1472
1505
|
n.preventDefault(), n.stopPropagation(), navigator.clipboard.writeText(e);
|
|
1473
1506
|
}), t;
|
|
1474
1507
|
}
|
|
1475
|
-
function
|
|
1508
|
+
function ta(e, t) {
|
|
1476
1509
|
const n = document.createElement("article");
|
|
1477
1510
|
n.className = "pluno-pa-widget__share-prompt";
|
|
1478
1511
|
const o = document.createElement("div");
|
|
@@ -1508,7 +1541,7 @@ function Zo(e, t) {
|
|
|
1508
1541
|
}
|
|
1509
1542
|
return o.appendChild(p), n.appendChild(o), n;
|
|
1510
1543
|
}
|
|
1511
|
-
function
|
|
1544
|
+
function na(e, t) {
|
|
1512
1545
|
const n = document.createElement("div");
|
|
1513
1546
|
n.className = "pluno-pa-widget__share-dialog-backdrop", n.addEventListener("click", (v) => {
|
|
1514
1547
|
v.target === n && t.onClose();
|
|
@@ -1527,7 +1560,7 @@ function Jo(e, t) {
|
|
|
1527
1560
|
d.className = "pluno-pa-widget__share-dialog-step-header";
|
|
1528
1561
|
const s = document.createElement("strong");
|
|
1529
1562
|
s.textContent = "1) Copy Screenshot", d.appendChild(s);
|
|
1530
|
-
const f =
|
|
1563
|
+
const f = oa("Copy Screenshot", async () => {
|
|
1531
1564
|
try {
|
|
1532
1565
|
return await vn(e.screenshotDataUrl ?? ""), p.textContent = "", p.hidden = !0, !0;
|
|
1533
1566
|
} catch {
|
|
@@ -1547,29 +1580,29 @@ function Jo(e, t) {
|
|
|
1547
1580
|
S.className = "pluno-pa-widget__share-dialog-step-title", S.textContent = "2) Share on", C.appendChild(S);
|
|
1548
1581
|
const x = document.createElement("p");
|
|
1549
1582
|
x.className = "pluno-pa-widget__share-dialog-hint", x.textContent = "Post draft opens prefilled on supported platforms.", C.appendChild(x);
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
for (const v of
|
|
1583
|
+
const R = document.createElement("footer");
|
|
1584
|
+
R.className = "pluno-pa-widget__share-dialog-platforms";
|
|
1585
|
+
for (const v of aa(e)) {
|
|
1553
1586
|
const y = document.createElement("a");
|
|
1554
|
-
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(
|
|
1587
|
+
y.href = v.href, y.target = "_blank", y.rel = "noopener noreferrer", y.title = v.label, y.setAttribute("aria-label", `Open ${v.label}`), y.appendChild(ia(v.id)), R.appendChild(y);
|
|
1555
1588
|
}
|
|
1556
|
-
if (C.appendChild(
|
|
1589
|
+
if (C.appendChild(R), o.appendChild(C), t.socialPostRewardsUrl) {
|
|
1557
1590
|
const v = document.createElement("div");
|
|
1558
1591
|
v.className = "pluno-pa-widget__share-dialog-step";
|
|
1559
1592
|
const y = document.createElement("strong");
|
|
1560
1593
|
y.className = "pluno-pa-widget__share-dialog-step-title", y.textContent = "3) Submit post to get 2000 free credits!", v.appendChild(y);
|
|
1561
1594
|
const h = document.createElement("a");
|
|
1562
|
-
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(
|
|
1595
|
+
h.className = "pluno-pa-widget__share-dialog-reward-link", h.href = t.socialPostRewardsUrl, h.target = "_blank", h.rel = "noopener noreferrer", h.appendChild(document.createTextNode("Submit post URL")), h.appendChild(ra()), v.appendChild(h), o.appendChild(v);
|
|
1563
1596
|
}
|
|
1564
1597
|
return n.appendChild(o), n;
|
|
1565
1598
|
}
|
|
1566
|
-
function
|
|
1599
|
+
function oa(e, t) {
|
|
1567
1600
|
const n = document.createElement("button");
|
|
1568
1601
|
return n.type = "button", n.className = "pluno-pa-widget__share-dialog-copy", n.textContent = e, n.addEventListener("click", async (o) => {
|
|
1569
1602
|
o.preventDefault(), o.stopPropagation(), await t() && (n.textContent = "Copied ✓");
|
|
1570
1603
|
}), n;
|
|
1571
1604
|
}
|
|
1572
|
-
function
|
|
1605
|
+
function aa(e) {
|
|
1573
1606
|
const t = e.linkedinPost.trim(), n = e.xPost.trim();
|
|
1574
1607
|
return [
|
|
1575
1608
|
{
|
|
@@ -1589,17 +1622,17 @@ function ea(e) {
|
|
|
1589
1622
|
}
|
|
1590
1623
|
];
|
|
1591
1624
|
}
|
|
1592
|
-
function
|
|
1625
|
+
function ia(e) {
|
|
1593
1626
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1594
|
-
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" ? (
|
|
1627
|
+
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" ? (D(t, "M6.7 13.2c.4 4.1.2 8.1.1 12.3"), D(t, "M6.4 6.9c.6-.5 1.6-.5 2.1.1.7.7.5 1.8-.2 2.3-.8.5-1.9.2-2.3-.6-.2-.6 0-1.3.4-1.8Z"), D(t, "M14.4 13.3c.1 3.8.1 7.8 0 11.9"), D(t, "M14.8 16.2c1.2-2 3-3.1 5.1-2.9 3.4.3 4.8 2.7 4.8 6.2 0 1.9-.1 3.8-.1 5.8"), D(t, "M20 18c.1 2.2.1 4.7 0 7.2"), t) : e === "x" ? (D(t, "M7.2 7.4c5.6 6.4 10.9 12.2 17.7 17.2"), D(t, "M24.4 7.2c-5.1 6.3-10.6 11.8-17 17.8"), D(t, "M9.1 8.2c5.1 5.6 9.7 10.8 15 15.5", "0.55"), t) : (D(t, "M10.2 6.4c3.8-.3 8-.3 11.6.1 2.5.3 3.8 1.8 4 4 .4 3.3.4 7.4 0 10.9-.3 2.4-1.7 3.8-4 4.1-3.8.4-8.2.4-11.8 0-2.3-.3-3.7-1.8-4-4.1-.4-3.5-.3-7.8.1-11.1.2-2.2 1.8-3.6 4.1-3.9Z"), D(t, "M11 7.3c3.4-.4 7.1-.4 10.2.1 2 .3 3.1 1.4 3.4 3.2.4 3 .4 6.6.1 9.9-.3 2.2-1.3 3.3-3.3 3.7-3.2.5-7.2.5-10.5.1", "0.48"), D(t, "M12.1 16.1c.1-2.4 1.8-4.1 4-4.2 2.4-.1 4.2 1.6 4.3 4 .1 2.3-1.6 4.1-3.9 4.2-2.6.2-4.3-1.5-4.4-4Z"), D(t, "M22 10.7c.3-.1.7 0 .9.3.2.4.1.8-.2 1-.4.2-.8.1-1-.2-.2-.4-.1-.8.3-1.1Z"), t);
|
|
1595
1628
|
}
|
|
1596
|
-
function
|
|
1629
|
+
function D(e, t, n) {
|
|
1597
1630
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1598
1631
|
o.setAttribute("d", t), n && o.setAttribute("opacity", n), e.appendChild(o);
|
|
1599
1632
|
}
|
|
1600
|
-
function
|
|
1633
|
+
function ra() {
|
|
1601
1634
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1602
|
-
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"),
|
|
1635
|
+
return e.setAttribute("class", "pluno-pa-widget__share-dialog-external-icon"), e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("aria-hidden", "true"), D(e, "M14 5h5v5"), D(e, "M19 5l-8 8"), D(e, "M18 13v5a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h5"), e;
|
|
1603
1636
|
}
|
|
1604
1637
|
function Yt(e) {
|
|
1605
1638
|
return e.role === "tool" && e.toolName === Dt;
|
|
@@ -1607,12 +1640,12 @@ function Yt(e) {
|
|
|
1607
1640
|
function kt(e) {
|
|
1608
1641
|
return e.replace(/\uE200[^\uE201]*(?:\uE201|$)/g, "");
|
|
1609
1642
|
}
|
|
1610
|
-
function
|
|
1643
|
+
function la(e, t, n, o) {
|
|
1611
1644
|
const a = document.createElement("article");
|
|
1612
1645
|
a.className = "pluno-pa-widget__tool-group", a.title = new Date(e[e.length - 1].createdAt).toLocaleString();
|
|
1613
1646
|
const i = document.createElement("img");
|
|
1614
1647
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1615
|
-
const l = document.createElement("details"), p =
|
|
1648
|
+
const l = document.createElement("details"), p = sa(e);
|
|
1616
1649
|
l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
|
|
1617
1650
|
a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
|
|
1618
1651
|
});
|
|
@@ -1638,7 +1671,7 @@ function We(e) {
|
|
|
1638
1671
|
const n = document.createElement("img");
|
|
1639
1672
|
return n.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", n.src = e, n.alt = "", n.setAttribute("aria-hidden", "true"), t.appendChild(n), t;
|
|
1640
1673
|
}
|
|
1641
|
-
function
|
|
1674
|
+
function pa(e) {
|
|
1642
1675
|
const t = We(e);
|
|
1643
1676
|
return t.classList.add("pluno-pa-widget__thinking-marker"), t.appendChild(Xt()), t;
|
|
1644
1677
|
}
|
|
@@ -1650,7 +1683,7 @@ function Xt() {
|
|
|
1650
1683
|
const n = document.createElement("span");
|
|
1651
1684
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1652
1685
|
}
|
|
1653
|
-
function
|
|
1686
|
+
function sa(e) {
|
|
1654
1687
|
return `tools:${e[0]?.id ?? ""}`;
|
|
1655
1688
|
}
|
|
1656
1689
|
function je() {
|
|
@@ -1658,7 +1691,7 @@ function je() {
|
|
|
1658
1691
|
return e.className = "pluno-pa-widget__spinner", e.setAttribute("aria-hidden", "true"), e;
|
|
1659
1692
|
}
|
|
1660
1693
|
function Zt(e, t) {
|
|
1661
|
-
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ?
|
|
1694
|
+
e.setAttribute("aria-label", t ? "Stop" : "Send"), e.classList.toggle("pluno-pa-widget__send--stop", t), e.replaceChildren(t ? Do() : jt());
|
|
1662
1695
|
}
|
|
1663
1696
|
function St(e, t) {
|
|
1664
1697
|
const n = t.replace(/\r\n/g, `
|
|
@@ -1732,7 +1765,7 @@ function ve(e, t) {
|
|
|
1732
1765
|
p.textContent = l.slice(1, -1), e.appendChild(p);
|
|
1733
1766
|
} else {
|
|
1734
1767
|
const p = l.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);
|
|
1735
|
-
if (p &&
|
|
1768
|
+
if (p && da(p[2])) {
|
|
1736
1769
|
const c = document.createElement("a");
|
|
1737
1770
|
c.href = p[2], c.target = "_top", c.rel = "noreferrer", c.textContent = p[1], e.appendChild(c);
|
|
1738
1771
|
} else
|
|
@@ -1742,7 +1775,7 @@ function ve(e, t) {
|
|
|
1742
1775
|
}
|
|
1743
1776
|
o < t.length && e.appendChild(document.createTextNode(t.slice(o)));
|
|
1744
1777
|
}
|
|
1745
|
-
function
|
|
1778
|
+
function da(e) {
|
|
1746
1779
|
if (e.startsWith("/") || e.startsWith("#"))
|
|
1747
1780
|
return !0;
|
|
1748
1781
|
try {
|
|
@@ -1753,7 +1786,7 @@ function ra(e) {
|
|
|
1753
1786
|
}
|
|
1754
1787
|
}
|
|
1755
1788
|
function Lt(e, t) {
|
|
1756
|
-
if (
|
|
1789
|
+
if (ca(e))
|
|
1757
1790
|
return;
|
|
1758
1791
|
const n = `
|
|
1759
1792
|
:host {
|
|
@@ -2775,7 +2808,7 @@ function Lt(e, t) {
|
|
|
2775
2808
|
}
|
|
2776
2809
|
.pluno-pa-widget__billing-action-card {
|
|
2777
2810
|
display: grid;
|
|
2778
|
-
gap:
|
|
2811
|
+
gap: 7px;
|
|
2779
2812
|
padding: 10px;
|
|
2780
2813
|
border: 1px solid color-mix(in srgb, var(--pluno-pa-accent) 24%, var(--pluno-pa-divider));
|
|
2781
2814
|
border-radius: 8px;
|
|
@@ -2814,6 +2847,10 @@ function Lt(e, t) {
|
|
|
2814
2847
|
cursor: pointer;
|
|
2815
2848
|
white-space: nowrap;
|
|
2816
2849
|
}
|
|
2850
|
+
.pluno-pa-widget__billing-action-card-earn-credits-label {
|
|
2851
|
+
display: inline-block;
|
|
2852
|
+
transform: translateY(1px);
|
|
2853
|
+
}
|
|
2817
2854
|
.pluno-pa-widget__billing-action-card-actions button:first-child {
|
|
2818
2855
|
border-color: var(--pluno-pa-text);
|
|
2819
2856
|
background: var(--pluno-pa-text);
|
|
@@ -3089,7 +3126,7 @@ function Lt(e, t) {
|
|
|
3089
3126
|
}
|
|
3090
3127
|
.pluno-pa-widget__active-users-counter {
|
|
3091
3128
|
position: absolute;
|
|
3092
|
-
top:
|
|
3129
|
+
top: 22px;
|
|
3093
3130
|
left: 50%;
|
|
3094
3131
|
z-index: 2;
|
|
3095
3132
|
display: inline-flex;
|
|
@@ -3140,7 +3177,6 @@ function Lt(e, t) {
|
|
|
3140
3177
|
width: min(100%, 320px);
|
|
3141
3178
|
}
|
|
3142
3179
|
.pluno-pa-widget__starter-prompts--empty {
|
|
3143
|
-
min-height: 96px;
|
|
3144
3180
|
pointer-events: none;
|
|
3145
3181
|
}
|
|
3146
3182
|
.pluno-pa-widget__starter-prompt {
|
|
@@ -3160,6 +3196,9 @@ function Lt(e, t) {
|
|
|
3160
3196
|
color: var(--pluno-pa-text);
|
|
3161
3197
|
background: transparent;
|
|
3162
3198
|
}
|
|
3199
|
+
.pluno-pa-widget__starter-prompt--placeholder {
|
|
3200
|
+
visibility: hidden;
|
|
3201
|
+
}
|
|
3163
3202
|
.pluno-pa-widget__login {
|
|
3164
3203
|
border: 0;
|
|
3165
3204
|
border-radius: 8px;
|
|
@@ -3407,6 +3446,9 @@ function Lt(e, t) {
|
|
|
3407
3446
|
.pluno-pa-widget--scribble .pluno-pa-widget__send::before {
|
|
3408
3447
|
background: var(--pluno-pa-accent);
|
|
3409
3448
|
}
|
|
3449
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__send:disabled {
|
|
3450
|
+
color: var(--pluno-pa-faint);
|
|
3451
|
+
}
|
|
3410
3452
|
.pluno-pa-widget--scribble .pluno-pa-widget__send:disabled::before {
|
|
3411
3453
|
background: var(--pluno-pa-surface);
|
|
3412
3454
|
}
|
|
@@ -3550,18 +3592,18 @@ function Lt(e, t) {
|
|
|
3550
3592
|
filter: url(#pluno-pa-scribble-wobble-2);
|
|
3551
3593
|
}
|
|
3552
3594
|
`;
|
|
3553
|
-
if (
|
|
3595
|
+
if (ua(e, n))
|
|
3554
3596
|
return;
|
|
3555
3597
|
const o = e.ownerDocument.createElement("style");
|
|
3556
3598
|
o.id = Ut, o.textContent = n, e.appendChild(o), Jt(e);
|
|
3557
3599
|
}
|
|
3558
|
-
function
|
|
3600
|
+
function ca(e) {
|
|
3559
3601
|
return e.getElementById(Ut) !== null || e.host instanceof HTMLElement && e.host.getAttribute(zt) === "true";
|
|
3560
3602
|
}
|
|
3561
3603
|
function Jt(e) {
|
|
3562
3604
|
e.host instanceof HTMLElement && e.host.setAttribute(zt, "true");
|
|
3563
3605
|
}
|
|
3564
|
-
function
|
|
3606
|
+
function ua(e, t) {
|
|
3565
3607
|
if (typeof CSSStyleSheet > "u" || typeof CSSStyleSheet.prototype.replaceSync != "function" || !("adoptedStyleSheets" in e))
|
|
3566
3608
|
return !1;
|
|
3567
3609
|
try {
|
|
@@ -3571,7 +3613,7 @@ function pa(e, t) {
|
|
|
3571
3613
|
return !1;
|
|
3572
3614
|
}
|
|
3573
3615
|
}
|
|
3574
|
-
async function
|
|
3616
|
+
async function ga() {
|
|
3575
3617
|
return document.body ? document.body : await new Promise((e) => {
|
|
3576
3618
|
const t = new MutationObserver(() => {
|
|
3577
3619
|
document.body && (t.disconnect(), e(document.body));
|
|
@@ -3582,7 +3624,7 @@ async function sa() {
|
|
|
3582
3624
|
function Qt(e) {
|
|
3583
3625
|
return `pluno.productAgent.widgetState.${location.origin}.${e.backendUrl ?? ""}.${e.tokenEndpoint ?? ""}.${e.position ?? ""}`;
|
|
3584
3626
|
}
|
|
3585
|
-
function
|
|
3627
|
+
function ha(e) {
|
|
3586
3628
|
try {
|
|
3587
3629
|
const t = window.localStorage.getItem(Qt(e));
|
|
3588
3630
|
if (!t)
|
|
@@ -3592,7 +3634,7 @@ function da(e) {
|
|
|
3592
3634
|
isOpen: n.isOpen === !0,
|
|
3593
3635
|
composerValue: typeof n.composerValue == "string" ? n.composerValue : "",
|
|
3594
3636
|
openToolGroupKeys: Array.isArray(n.openToolGroupKeys) ? n.openToolGroupKeys.filter((o) => typeof o == "string") : [],
|
|
3595
|
-
launcherPosition:
|
|
3637
|
+
launcherPosition: wa(n.launcherPosition) ? n.launcherPosition : null,
|
|
3596
3638
|
seenShareCandidateIds: Array.isArray(n.seenShareCandidateIds) ? n.seenShareCandidateIds.filter((o) => typeof o == "string").slice(-Mt) : [],
|
|
3597
3639
|
sharePromptsDisabled: n.sharePromptsDisabled === !0
|
|
3598
3640
|
};
|
|
@@ -3600,7 +3642,7 @@ function da(e) {
|
|
|
3600
3642
|
return Pt();
|
|
3601
3643
|
}
|
|
3602
3644
|
}
|
|
3603
|
-
async function
|
|
3645
|
+
async function ma(e) {
|
|
3604
3646
|
if (e.loadSharePromptsDisabled)
|
|
3605
3647
|
return e.loadSharePromptsDisabled();
|
|
3606
3648
|
try {
|
|
@@ -3609,7 +3651,7 @@ async function ca(e) {
|
|
|
3609
3651
|
return !1;
|
|
3610
3652
|
}
|
|
3611
3653
|
}
|
|
3612
|
-
function
|
|
3654
|
+
function fa(e, t) {
|
|
3613
3655
|
if (e.persistSharePromptsDisabled) {
|
|
3614
3656
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3615
3657
|
});
|
|
@@ -3631,28 +3673,28 @@ function Pt() {
|
|
|
3631
3673
|
sharePromptsDisabled: !1
|
|
3632
3674
|
};
|
|
3633
3675
|
}
|
|
3634
|
-
function
|
|
3676
|
+
function ba(e, t) {
|
|
3635
3677
|
try {
|
|
3636
3678
|
window.localStorage.setItem(Qt(e), JSON.stringify(t));
|
|
3637
3679
|
} catch {
|
|
3638
3680
|
return;
|
|
3639
3681
|
}
|
|
3640
3682
|
}
|
|
3641
|
-
function
|
|
3683
|
+
function wa(e) {
|
|
3642
3684
|
if (!e || typeof e != "object")
|
|
3643
3685
|
return !1;
|
|
3644
3686
|
const t = e;
|
|
3645
3687
|
return Number.isFinite(t.x) && Number.isFinite(t.y);
|
|
3646
3688
|
}
|
|
3647
3689
|
const At = /* @__PURE__ */ new WeakSet();
|
|
3648
|
-
function
|
|
3690
|
+
function _a(e) {
|
|
3649
3691
|
return Object.keys(e.dataset).some((t) => t.startsWith("pluno"));
|
|
3650
3692
|
}
|
|
3651
3693
|
function Tt(e) {
|
|
3652
3694
|
const t = e.pathname.split("/");
|
|
3653
3695
|
return t[t.length - 1] ?? "";
|
|
3654
3696
|
}
|
|
3655
|
-
function
|
|
3697
|
+
function xa(e, t) {
|
|
3656
3698
|
const n = new URL(e.src, document.baseURI);
|
|
3657
3699
|
return n.href === t.href || n.pathname === t.pathname ? !0 : Tt(n) === Tt(t);
|
|
3658
3700
|
}
|
|
@@ -3665,7 +3707,7 @@ class V extends EventTarget {
|
|
|
3665
3707
|
this.dispatchEvent(new MessageEvent("message", { data: a.detail?.data ?? "" }));
|
|
3666
3708
|
}), this.addPreviewListener(zn, () => {
|
|
3667
3709
|
this.readyState = V.CLOSED, this.dispatchEvent(new Event("error")), this.cleanup();
|
|
3668
|
-
}), this.addPreviewListener(
|
|
3710
|
+
}), this.addPreviewListener($n, (o) => {
|
|
3669
3711
|
const a = o;
|
|
3670
3712
|
this.readyState = V.CLOSED, this.dispatchEvent(
|
|
3671
3713
|
new CloseEvent("close", {
|
|
@@ -3691,20 +3733,20 @@ class V extends EventTarget {
|
|
|
3691
3733
|
binaryType = "blob";
|
|
3692
3734
|
bufferedAmount = 0;
|
|
3693
3735
|
readyState = V.CONNECTING;
|
|
3694
|
-
socketId =
|
|
3736
|
+
socketId = va();
|
|
3695
3737
|
listeners = /* @__PURE__ */ new Map();
|
|
3696
3738
|
send(t) {
|
|
3697
3739
|
if (this.readyState !== V.OPEN)
|
|
3698
3740
|
throw new DOMException("Pluno preview websocket is not open", "InvalidStateError");
|
|
3699
3741
|
window.dispatchEvent(
|
|
3700
|
-
new CustomEvent(ye(
|
|
3742
|
+
new CustomEvent(ye(On, this.channelId), {
|
|
3701
3743
|
detail: { socketId: this.socketId, data: typeof t == "string" ? t : String(t) }
|
|
3702
3744
|
})
|
|
3703
3745
|
);
|
|
3704
3746
|
}
|
|
3705
3747
|
close(t, n) {
|
|
3706
3748
|
this.readyState !== V.CLOSED && (this.readyState = V.CLOSING, window.dispatchEvent(
|
|
3707
|
-
new CustomEvent(ye(
|
|
3749
|
+
new CustomEvent(ye(Bn, this.channelId), {
|
|
3708
3750
|
detail: { socketId: this.socketId, code: t, reason: n }
|
|
3709
3751
|
})
|
|
3710
3752
|
), this.cleanup());
|
|
@@ -3721,7 +3763,7 @@ class V extends EventTarget {
|
|
|
3721
3763
|
this.listeners.clear();
|
|
3722
3764
|
}
|
|
3723
3765
|
}
|
|
3724
|
-
function
|
|
3766
|
+
function va() {
|
|
3725
3767
|
const e = window.sessionStorage.getItem(ct);
|
|
3726
3768
|
if (e)
|
|
3727
3769
|
return e;
|
|
@@ -3731,26 +3773,26 @@ function ba() {
|
|
|
3731
3773
|
function ye(e, t) {
|
|
3732
3774
|
return `${e}:${t}`;
|
|
3733
3775
|
}
|
|
3734
|
-
function
|
|
3776
|
+
function ya(e) {
|
|
3735
3777
|
const t = document.currentScript;
|
|
3736
3778
|
if (t instanceof HTMLScriptElement)
|
|
3737
3779
|
return [t];
|
|
3738
3780
|
const n = new URL(e, document.baseURI).href, o = new URL(n);
|
|
3739
3781
|
return Array.from(document.querySelectorAll("script[type='module'][src]")).filter(
|
|
3740
|
-
(a) => a instanceof HTMLScriptElement &&
|
|
3782
|
+
(a) => a instanceof HTMLScriptElement && _a(a) && xa(a, o)
|
|
3741
3783
|
);
|
|
3742
3784
|
}
|
|
3743
|
-
function
|
|
3744
|
-
for (const t of
|
|
3785
|
+
function Ca(e) {
|
|
3786
|
+
for (const t of ya(e)) {
|
|
3745
3787
|
if (At.has(t) || t.dataset.plunoAutoMount === "false")
|
|
3746
3788
|
continue;
|
|
3747
3789
|
At.add(t);
|
|
3748
3790
|
const n = t.dataset.plunoPreviewChannel;
|
|
3749
|
-
|
|
3791
|
+
lo({
|
|
3750
3792
|
token: t.dataset.plunoToken,
|
|
3751
3793
|
tokenEndpoint: t.dataset.plunoTokenEndpoint,
|
|
3752
3794
|
backendUrl: t.dataset.plunoBackendUrl,
|
|
3753
|
-
webSocketFactory: n ?
|
|
3795
|
+
webSocketFactory: n ? ro(n) : void 0,
|
|
3754
3796
|
launcherLabel: t.dataset.plunoLauncherLabel,
|
|
3755
3797
|
accentColor: t.dataset.plunoAccentColor,
|
|
3756
3798
|
colorScheme: t.dataset.plunoColorScheme === "dark" ? "dark" : "light",
|
|
@@ -3762,8 +3804,8 @@ function _a(e) {
|
|
|
3762
3804
|
});
|
|
3763
3805
|
}
|
|
3764
3806
|
}
|
|
3765
|
-
|
|
3807
|
+
Ca(import.meta.url);
|
|
3766
3808
|
export {
|
|
3767
|
-
|
|
3768
|
-
|
|
3809
|
+
ro as createProductAgentPreviewBridgeWebSocketFactory,
|
|
3810
|
+
lo as mountPlunoProductAgentWidget
|
|
3769
3811
|
};
|