UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

58 lines (57 loc) • 2.14 kB
(function() { try { var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}; e.SENTRY_RELEASE = { id: "3.39.1" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "44feeb02-c84e-4fb1-b2f8-984c7d50f58d", e._sentryDebugIdIdentifier = "sentry-dbid-44feeb02-c84e-4fb1-b2f8-984c7d50f58d"); } catch {} })(); import { r as e } from "./rolldown-runtime-BOCG9HEF.js"; import { t } from "./react-CM7l092i.js"; import { l as n } from "./store-CARxK2Ft.js"; //#region ../ui/src/shared/activeElement.ts var r = (e) => !!e && "activeElement" in e; function i(e) { var t; let n = e == null ? void 0 : e.getRootNode(), i = r(n) ? n.activeElement : document.activeElement; for (; !(i == null || (t = i.shadowRoot) == null) && t.activeElement;) i = i.shadowRoot.activeElement; return i; } //#endregion //#region src/utils/getRenderTargetFromRoot.ts var a = /* @__PURE__ */ e(t(), 1); function o(e) { var t; if (!e) return console.error("[getRenderTargetFromRoot] rootElement is null"), null; let n = e.firstElementChild; if (n && n.shadowRoot) { let e = n.shadowRoot.querySelector("#efp-layout"); if (e) return e; } return ((t = e.querySelector) == null ? void 0 : t.call(e, "#efp-layout")) || (console.error("[getRenderTargetFromRoot] rootElement is null"), null); } //#endregion //#region src/utils/useRenderTarget.ts var s = () => { let [e, t] = (0, a.useState)(() => o(n.rootElement)); return (0, a.useEffect)(() => { var e, r; if (typeof window > "u" || !n.rootElement) return; let i = !1, a = null, s = () => { let e = o(n.rootElement); return e && !i ? (t((t) => t === e ? t : e), !0) : !1; }; if (s()) return; let c = (e = (r = n.rootElement.firstElementChild) == null ? void 0 : r.shadowRoot) == null ? n.rootElement : e; return a = new MutationObserver(() => { s() && a && a.disconnect(); }), a.observe(c, { childList: !0, subtree: !0 }), () => { i = !0, a && a.disconnect(); }; }, [n.rootElement]), e; }; //#endregion export { i as n, s as t };