1import { j as m } from "./jsx-runtime-u17CrQMm.js"; 2import { r as t } from "./chunk-EPOLDU6W-DDKLhvzC.js"; 3const T = { title: null, showContextTitle: false, hideContextShortcut: false, showTitle: true, overBleed: null, headerHeight: 0, registerHeader: () => { 4}, setTitle: () => { 5}, setContextInView: () => { 6}, setContextInFocus: () => { 7}, setArticleInView: () => { 8}, setOverBleed: () => { 9} }, i = t.createContext(void 0); 10function p({ children: n }) { 11 const [e, s] = t.useState(null), [u, c] = t.useState(false), [l, x] = t.useState(false), [a, d] = t.useState(true), [r, f] = t.useState(null), [o, h] = t.useState(0), w = t.useRef(null), C = t.useCallback((v) => { 12 var _a; 13 if ((_a = w.current) == null ? void 0 : _a.disconnect(), w.current = null, !v) { 14 h(0); 15 return; 16 } 17 const S = () => { 18 const H = Math.ceil(v.getBoundingClientRect().height); 19 h((E) => E === H ? E : H); 20 }; 21 S(); 22 const I = new ResizeObserver(S); 23 I.observe(v), w.current = I; 24 }, []); 25 t.useEffect(() => () => { 26 var _a; 27 (_a = w.current) == null ? void 0 : _a.disconnect(); 28 }, []); 29 const b = t.useMemo(() => ({ title: e, showContextTitle: l, hideContextShortcut: u, showTitle: !!e && a, overBleed: r, headerHeight: o, registerHeader: C, setTitle: s, setContextInView: c, setArticleInView: d, setContextInFocus: x, setOverBleed: f }), [e, u, a, l, r, o, C]); 30 return m.jsx(i, { value: b, children: n }); 31} 32function g() { 33 return t.useContext(i) ?? T; 34} 35function O(n) { 36 const e = t.useContext(i); 37 t.useEffect(() => { 38 if (e) return e.setTitle(n), () => e.setTitle(null); 39 }, [e, n]); 40} 41function R(n, e) { 42 const s = t.useContext(i); 43 t.useEffect(() => { 44 if (s) return s.setContextInView(n), s.setContextInFocus(e), () => { 45 s.setContextInView(false), s.setContextInFocus(false); 46 }; 47 }, [s, n, e]); 48} 49function A(n) { 50 const e = t.useContext(i); 51 t.useEffect(() => { 52 if (e) return e.setArticleInView(n), () => e.setArticleInView(true); 53 }, [e, n]); 54} 55function z(n) { 56 const e = t.useContext(i); 57 t.useEffect(() => { 58 if (e) return e.setOverBleed(n), () => e.setOverBleed(null); 59 }, [e, n]); 60} 61function F() { 62 const n = t.useRef(null), [e, s] = t.useState(false), { headerHeight: u } = g(); 63 return t.useEffect(() => { 64 const c = n.current; 65 if (!c) return; 66 const l = c.parentElement ?? c; 67 let x = Number.POSITIVE_INFINITY, a = null; 68 const d = () => { 69 const o = window.scrollY + u >= x; 70 o !== a && (a = o, s(o)); 71 }, r = () => { 72 x = window.scrollY + l.getBoundingClientRect().bottom, d(); 73 }, f = typeof ResizeObserver > "u" ? null : new ResizeObserver(r); 74 return f == null ? void 0 : f.observe(l), document.body && (f == null ? void 0 : f.observe(document.body)), r(), window.addEventListener("scroll", d, { passive: true }), window.addEventListener("resize", r), () => { 75 window.removeEventListener("scroll", d), window.removeEventListener("resize", r), f == null ? void 0 : f.disconnect(); 76 }; 77 }, [u]), [e, n]; 78} 79export { 80 p as S, 81 O as a, 82 A as b, 83 g as c, 84 R as d, 85 z as e, 86 F as u 87};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.