bstp-agent-widget 0.2.53 → 0.2.55

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.
@@ -23759,9 +23759,32 @@ function XO({ opened: e, onClose: t, zIndex: n, withinPortal: r, withOverlay: i
23759
23759
  t.style.setProperty("--agent-widget-drawer-width", "0px");
23760
23760
  return;
23761
23761
  }
23762
- let n = document.querySelector(`.${db.content}`)?.getBoundingClientRect().width, r = Math.round(n ?? j);
23763
- return t.style.setProperty("--agent-widget-drawer-width", `${r}px`), () => {
23764
- t.style.setProperty("--agent-widget-drawer-width", "0px");
23762
+ let n = () => {
23763
+ let e = Array.from(document.querySelectorAll(`.${db.content}`));
23764
+ for (let t of e) {
23765
+ let e = t.getBoundingClientRect();
23766
+ if (e.width > 0 && e.height > 0) return t;
23767
+ }
23768
+ return e[0] ?? null;
23769
+ }, r = () => {
23770
+ let e = n();
23771
+ if (!e) {
23772
+ t.style.setProperty("--agent-widget-drawer-width", `${Math.max(0, Math.floor(j))}px`);
23773
+ return;
23774
+ }
23775
+ let r = e.getBoundingClientRect(), i = Math.max(0, Math.ceil(window.innerWidth - r.left));
23776
+ t.style.setProperty("--agent-widget-drawer-width", `${i}px`);
23777
+ };
23778
+ r();
23779
+ let i = n(), a = typeof ResizeObserver < "u" ? new ResizeObserver(() => {
23780
+ r();
23781
+ }) : null;
23782
+ i && a && a.observe(i);
23783
+ let o = () => {
23784
+ r();
23785
+ };
23786
+ return window.addEventListener("resize", o), () => {
23787
+ a?.disconnect(), window.removeEventListener("resize", o), t.style.setProperty("--agent-widget-drawer-width", "0px");
23765
23788
  };
23766
23789
  }, [e, j]), /* @__PURE__ */ T(w, { children: /* @__PURE__ */ E(ub, {
23767
23790
  opened: e,