@tenancy.nz/chat-ui 0.1.33 → 0.1.34

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/esm/index.js CHANGED
@@ -5465,24 +5465,68 @@ function WS() {
5465
5465
  }
5466
5466
  }, []), [o, a] = fe(!1);
5467
5467
  return si(() => {
5468
+ var b, w;
5468
5469
  if (!n) {
5469
5470
  a(!1);
5470
5471
  return;
5471
5472
  }
5472
- let l = 0, u = 0;
5473
- return l = requestAnimationFrame(() => {
5474
- u = requestAnimationFrame(() => a(!0));
5475
- }), () => {
5473
+ const l = ((w = (b = i.current) == null ? void 0 : b.getRootNode) == null ? void 0 : w.call(b)) || document, u = (E) => {
5474
+ var T;
5476
5475
  try {
5477
- cancelAnimationFrame(l);
5476
+ return ((T = l.querySelector) == null ? void 0 : T.call(l, E)) ?? null;
5477
+ } catch {
5478
+ return null;
5479
+ }
5480
+ }, h = e.map((E) => typeof E.target == "string" ? E.target : "").filter(Boolean), d = () => h.some((E) => !!u(E));
5481
+ let f = 0, p = 0, g = null, m = null;
5482
+ const v = () => {
5483
+ f = requestAnimationFrame(() => {
5484
+ p = requestAnimationFrame(() => a(!0));
5485
+ });
5486
+ };
5487
+ if (d())
5488
+ v();
5489
+ else {
5490
+ const E = l instanceof Document ? l.documentElement : l;
5491
+ try {
5492
+ g = new MutationObserver(() => {
5493
+ if (d()) {
5494
+ try {
5495
+ g && g.disconnect();
5496
+ } catch {
5497
+ }
5498
+ v();
5499
+ }
5500
+ }), g.observe(E, { childList: !0, subtree: !0 });
5501
+ } catch {
5502
+ }
5503
+ m = setTimeout(() => {
5504
+ try {
5505
+ g && g.disconnect();
5506
+ } catch {
5507
+ }
5508
+ v();
5509
+ }, 2e3);
5510
+ }
5511
+ return () => {
5512
+ try {
5513
+ cancelAnimationFrame(f);
5514
+ } catch {
5515
+ }
5516
+ try {
5517
+ cancelAnimationFrame(p);
5518
+ } catch {
5519
+ }
5520
+ try {
5521
+ g && g.disconnect();
5478
5522
  } catch {
5479
5523
  }
5480
5524
  try {
5481
- cancelAnimationFrame(u);
5525
+ clearTimeout(m);
5482
5526
  } catch {
5483
5527
  }
5484
5528
  };
5485
- }, [n]), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
5529
+ }, [n, e]), /* @__PURE__ */ I.jsxs(I.Fragment, { children: [
5486
5530
  /* @__PURE__ */ I.jsx("span", { ref: i, style: { position: "absolute", inset: 0, pointerEvents: "none" }, "aria-hidden": !0 }),
5487
5531
  n && o && /* @__PURE__ */ I.jsx(
5488
5532
  $S,