@nivaro/react 0.3.128 → 0.3.130

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.
@@ -1,299 +1,304 @@
1
- import { jsx as w, jsxs as L } from "react/jsx-runtime";
2
- import { MoreHorizontal as F } from "lucide-react";
3
- import { useRef as m, useState as M, useEffect as R, useContext as K, createContext as U } from "react";
4
- import { createPortal as P } from "react-dom";
1
+ import { jsx as g, jsxs as O } from "react/jsx-runtime";
2
+ import { MoreHorizontal as K } from "lucide-react";
3
+ import { useRef as v, useCallback as H, useState as L, useEffect as E, useContext as A, createContext as U } from "react";
4
+ import { createPortal as J } from "react-dom";
5
5
  import { cn as W } from "../../lib/utils.js";
6
- function j(i, t) {
7
- const s = i.target;
8
- if (!(s != null && s.closest)) return !0;
9
- if (s.closest("[data-radix-popper-content-wrapper]")) return !1;
10
- const n = s.closest('[role="dialog"]');
11
- return !n || !!(t && n.contains(t));
6
+ function Q(n, t) {
7
+ const d = n.target;
8
+ if (!(d != null && d.closest)) return !0;
9
+ if (d.closest("[data-radix-popper-content-wrapper]")) return !1;
10
+ const r = d.closest('[role="dialog"]');
11
+ return !r || !!(t && r.contains(t));
12
12
  }
13
- const N = U(!0), q = '[role="dialog"],[role="alertdialog"]';
14
- function J(i, t) {
15
- return i instanceof Element ? (i.matches(q) ? [i] : Array.from(i.querySelectorAll(q))).some((n) => !n.closest("[data-radix-popper-content-wrapper]") && !t(n)) : !1;
13
+ const B = U(!0), N = U(null);
14
+ function oe() {
15
+ const n = A(N);
16
+ return H(() => (n == null ? void 0 : n()) ?? null, [n]);
16
17
  }
17
- const Q = 1500;
18
- function G(i, t, s) {
19
- const n = m(t);
20
- n.current = t;
21
- const p = m(s);
22
- p.current = s, R(() => {
23
- if (!i) return;
24
- let f = 0;
25
- const o = [], u = (a) => {
26
- const c = a.target;
27
- if (!(c != null && c.closest) || !p.current(c)) return;
28
- const d = window.location.href, h = !!c.closest("a[href]");
29
- f = Date.now() + Q;
30
- const l = () => {
31
- (h || window.location.href !== d) && n.current();
18
+ const j = '[role="dialog"],[role="alertdialog"]';
19
+ function X(n, t) {
20
+ return n instanceof Element ? (n.matches(j) ? [n] : Array.from(n.querySelectorAll(j))).some((r) => !r.closest("[data-radix-popper-content-wrapper]") && !t(r)) : !1;
21
+ }
22
+ const Y = 1500;
23
+ function V(n, t, d) {
24
+ const r = v(t);
25
+ r.current = t;
26
+ const u = v(d);
27
+ u.current = d, E(() => {
28
+ if (!n) return;
29
+ let l = 0;
30
+ const o = [], a = (i) => {
31
+ const s = i.target;
32
+ if (!(s != null && s.closest) || !u.current(s)) return;
33
+ const c = window.location.href, p = !!s.closest("a[href]");
34
+ l = Date.now() + Y;
35
+ const h = () => {
36
+ (p || window.location.href !== c) && r.current();
32
37
  };
33
- o.push(setTimeout(l, 0), setTimeout(l, 250));
34
- }, r = typeof MutationObserver > "u" ? null : new MutationObserver((a) => {
35
- if (!(Date.now() > f)) {
36
- for (const c of a)
37
- for (const d of Array.from(c.addedNodes))
38
- if (J(d, p.current)) {
39
- f = 0, n.current();
38
+ o.push(setTimeout(h, 0), setTimeout(h, 250));
39
+ }, f = typeof MutationObserver > "u" ? null : new MutationObserver((i) => {
40
+ if (!(Date.now() > l)) {
41
+ for (const s of i)
42
+ for (const c of Array.from(s.addedNodes))
43
+ if (X(c, u.current)) {
44
+ l = 0, r.current();
40
45
  return;
41
46
  }
42
47
  }
43
48
  });
44
- return r == null || r.observe(document.body, { childList: !0, subtree: !0 }), window.addEventListener("click", u, !0), () => {
45
- r == null || r.disconnect(), window.removeEventListener("click", u, !0);
46
- for (const a of o) clearTimeout(a);
49
+ return f == null || f.observe(document.body, { childList: !0, subtree: !0 }), window.addEventListener("click", a, !0), () => {
50
+ f == null || f.disconnect(), window.removeEventListener("click", a, !0);
51
+ for (const i of o) clearTimeout(i);
47
52
  };
48
- }, [i]);
53
+ }, [n]);
49
54
  }
50
- function O(i, t) {
51
- const s = i.querySelector("[data-nvr-header-title]"), n = s == null ? void 0 : s.querySelector("[data-nvr-record-title]"), p = n == null ? void 0 : n.parentElement;
52
- if (!s || !n || !p || !t) return 0;
53
- const f = s.getBoundingClientRect();
54
- if (t.getBoundingClientRect().top >= f.bottom - 1) return 0;
55
- const u = n.getBoundingClientRect().top, r = Array.from(p.children).filter(
56
- (d) => d instanceof HTMLElement && d.offsetWidth > 0
55
+ function S(n, t) {
56
+ const d = n.querySelector("[data-nvr-header-title]"), r = d == null ? void 0 : d.querySelector("[data-nvr-record-title]"), u = r == null ? void 0 : r.parentElement;
57
+ if (!d || !r || !u || !t) return 0;
58
+ const l = d.getBoundingClientRect();
59
+ if (t.getBoundingClientRect().top >= l.bottom - 1) return 0;
60
+ const a = r.getBoundingClientRect().top, f = Array.from(u.children).filter(
61
+ (c) => c instanceof HTMLElement && c.offsetWidth > 0
57
62
  );
58
- if (!r.some((d) => d.getBoundingClientRect().top > u + 2)) return 0;
59
- const a = Number.parseFloat(getComputedStyle(p).columnGap) || 0, c = r.reduce((d, h) => d + h.offsetWidth, 0) + a * (r.length - 1);
60
- return Math.max(0, Math.ceil(c - p.clientWidth));
63
+ if (!f.some((c) => c.getBoundingClientRect().top > a + 2)) return 0;
64
+ const i = Number.parseFloat(getComputedStyle(u).columnGap) || 0, s = f.reduce((c, p) => c + p.offsetWidth, 0) + i * (f.length - 1);
65
+ return Math.max(0, Math.ceil(s - u.clientWidth));
61
66
  }
62
- function te({ children: i }) {
63
- var x, k;
64
- const t = m(null), s = m(null), [n, p] = M(!1), f = m(!1);
65
- f.current = n;
66
- const o = m(0), u = m(0), [r, a] = M(!1), c = m(null), d = m(!1);
67
- if (n ? r && (d.current = !0) : d.current = !1, G(
68
- r,
69
- () => a(!1),
67
+ function ae({ children: n }) {
68
+ var k, y;
69
+ const t = v(null), d = v(null), r = H(() => d.current, []), [u, l] = L(!1), o = v(!1);
70
+ o.current = u;
71
+ const a = v(0), f = v(0), [i, s] = L(!1), c = v(null), p = v(!1);
72
+ if (u ? i && (p.current = !0) : p.current = !1, V(
73
+ i,
74
+ () => s(!1),
70
75
  (e) => {
71
- var b;
72
- return !!((b = c.current) != null && b.contains(e) || e.closest("[data-nvr-header-menu-panel]"));
76
+ var m;
77
+ return !!((m = c.current) != null && m.contains(e) || e.closest("[data-nvr-header-menu-panel]"));
73
78
  }
74
- ), R(() => {
75
- var A, B;
76
- const e = (A = t.current) == null ? void 0 : A.closest("[data-nvr-header-row]");
79
+ ), E(() => {
80
+ var T, I;
81
+ const e = (T = t.current) == null ? void 0 : T.closest("[data-nvr-header-row]");
77
82
  if (!e) return;
78
- const b = () => {
79
- var I, D;
80
- if (!f.current) {
83
+ const m = () => {
84
+ var F, q;
85
+ if (!o.current) {
81
86
  if (e.scrollWidth > e.clientWidth + 2) {
82
- o.current = e.scrollWidth, p(!0), a(!1);
87
+ a.current = e.scrollWidth, l(!0), s(!1);
83
88
  return;
84
89
  }
85
- const H = O(e, ((I = t.current) == null ? void 0 : I.parentElement) ?? null);
86
- H > 0 && (o.current = e.clientWidth + H, p(!0), a(!1));
90
+ const z = S(e, ((F = t.current) == null ? void 0 : F.parentElement) ?? null);
91
+ z > 0 && (a.current = e.clientWidth + z, l(!0), s(!1));
87
92
  return;
88
93
  }
89
- const C = e.hasAttribute("data-nvr-header-wrap"), S = e.scrollWidth > e.clientWidth + 2, T = C || e.querySelector('[data-nvr-header-fold="inline"]') ? 0 : O(e, ((D = t.current) == null ? void 0 : D.parentElement) ?? null);
90
- !C && (S || T > 0) ? (u.current = Math.max(
91
- S ? e.scrollWidth : 0,
92
- e.clientWidth + T
93
- ), e.setAttribute("data-nvr-header-wrap", "")) : C && e.clientWidth > u.current + 32 ? e.removeAttribute("data-nvr-header-wrap") : !C && o.current > 0 && e.clientWidth > o.current + 32 && p(!1);
94
+ const M = e.hasAttribute("data-nvr-header-wrap"), P = e.scrollWidth > e.clientWidth + 2, D = M || e.querySelector('[data-nvr-header-fold="inline"]') ? 0 : S(e, ((q = t.current) == null ? void 0 : q.parentElement) ?? null);
95
+ !M && (P || D > 0) ? (f.current = Math.max(
96
+ P ? e.scrollWidth : 0,
97
+ e.clientWidth + D
98
+ ), e.setAttribute("data-nvr-header-wrap", "")) : M && e.clientWidth > f.current + 32 ? e.removeAttribute("data-nvr-header-wrap") : !M && a.current > 0 && e.clientWidth > a.current + 32 && l(!1);
94
99
  };
95
- b();
96
- const E = new ResizeObserver(b);
97
- E.observe(e);
98
- const v = (B = t.current) == null ? void 0 : B.parentElement;
99
- v && v !== e && E.observe(v);
100
- let y = 0;
101
- const _ = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
102
- y || (y = requestAnimationFrame(() => {
103
- y = 0, b();
100
+ m();
101
+ const _ = new ResizeObserver(m);
102
+ _.observe(e);
103
+ const x = (I = t.current) == null ? void 0 : I.parentElement;
104
+ x && x !== e && _.observe(x);
105
+ let R = 0;
106
+ const C = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
107
+ R || (R = requestAnimationFrame(() => {
108
+ R = 0, m();
104
109
  }));
105
110
  });
106
- return _ == null || _.observe(e, { childList: !0, subtree: !0 }), () => {
107
- E.disconnect(), _ == null || _.disconnect(), y && cancelAnimationFrame(y);
111
+ return C == null || C.observe(e, { childList: !0, subtree: !0 }), () => {
112
+ _.disconnect(), C == null || C.disconnect(), R && cancelAnimationFrame(R);
108
113
  };
109
- }), R(() => {
110
- if (!r) return;
111
- const e = (b) => {
112
- b.key !== "Escape" || !j(b, t.current) || (b.stopPropagation(), a(!1));
114
+ }), E(() => {
115
+ if (!i) return;
116
+ const e = (m) => {
117
+ m.key !== "Escape" || !Q(m, t.current) || (m.stopPropagation(), s(!1));
113
118
  };
114
119
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
115
- }, [r]), R(() => {
116
- if (!r) return;
117
- const e = (E) => {
118
- const v = E.target;
119
- if (v.closest("[data-nvr-header-tools-panel]") || v.closest("[data-nvr-header-tools-btn]") || v.closest("[data-nvr-header-menu-panel]") || v.closest("[data-radix-popper-content-wrapper]"))
120
+ }, [i]), E(() => {
121
+ if (!i) return;
122
+ const e = (_) => {
123
+ const x = _.target;
124
+ if (x.closest("[data-nvr-header-tools-panel]") || x.closest("[data-nvr-header-tools-btn]") || x.closest("[data-nvr-header-menu-panel]") || x.closest("[data-radix-popper-content-wrapper]"))
120
125
  return;
121
- const y = v.closest('[role="dialog"]');
122
- y && !y.contains(t.current) || a(!1);
123
- }, b = (E) => {
124
- E.target.closest("[data-nvr-header-menu-panel] [data-nvr-menu-close]") && a(!1);
126
+ const R = x.closest('[role="dialog"]');
127
+ R && !R.contains(t.current) || s(!1);
128
+ }, m = (_) => {
129
+ _.target.closest("[data-nvr-header-menu-panel] [data-nvr-menu-close]") && s(!1);
125
130
  };
126
- return window.addEventListener("mousedown", e, !0), window.addEventListener("click", b), () => {
127
- window.removeEventListener("mousedown", e, !0), window.removeEventListener("click", b);
131
+ return window.addEventListener("mousedown", e, !0), window.addEventListener("click", m), () => {
132
+ window.removeEventListener("mousedown", e, !0), window.removeEventListener("click", m);
128
133
  };
129
- }, [r]), !n)
130
- return /* @__PURE__ */ w("div", { ref: t, className: "contents", "data-nvr-header-tools": "inline", children: /* @__PURE__ */ w(N.Provider, { value: !0, children: i }) });
131
- const h = r ? (x = s.current) == null ? void 0 : x.getBoundingClientRect() : void 0, l = ((k = s.current) == null ? void 0 : k.closest('[role="dialog"]')) ?? document.body, g = h ? h.right - (l === document.body ? 0 : l.getBoundingClientRect().left) - 16 : 440;
132
- return /* @__PURE__ */ L("div", { ref: t, className: "flex shrink-0 items-center", "data-nvr-header-tools": "folded", children: [
133
- /* @__PURE__ */ w(
134
+ }, [i]), !u)
135
+ return /* @__PURE__ */ g("div", { ref: t, className: "contents", "data-nvr-header-tools": "inline", children: /* @__PURE__ */ g(B.Provider, { value: !0, children: n }) });
136
+ const h = i ? (k = d.current) == null ? void 0 : k.getBoundingClientRect() : void 0, b = ((y = d.current) == null ? void 0 : y.closest('[role="dialog"]')) ?? document.body, w = h ? h.right - (b === document.body ? 0 : b.getBoundingClientRect().left) - 16 : 440;
137
+ return /* @__PURE__ */ O("div", { ref: t, className: "flex shrink-0 items-center", "data-nvr-header-tools": "folded", children: [
138
+ /* @__PURE__ */ g(
134
139
  "button",
135
140
  {
136
- ref: s,
141
+ ref: d,
137
142
  type: "button",
138
143
  "data-nvr-header-tools-btn": !0,
139
- "aria-expanded": r,
144
+ "aria-expanded": i,
140
145
  "aria-label": "More tools",
141
146
  "data-tip": "More tools",
142
- onClick: () => a((e) => !e),
147
+ onClick: () => s((e) => !e),
143
148
  className: W(
144
149
  "inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent",
145
- r && "bg-accent text-accent-foreground dark:bg-accent"
150
+ i && "bg-accent text-accent-foreground dark:bg-accent"
146
151
  ),
147
- children: /* @__PURE__ */ w(F, { className: "h-4 w-4" })
152
+ children: /* @__PURE__ */ g(K, { className: "h-4 w-4" })
148
153
  }
149
154
  ),
150
- d.current && P(
151
- /* @__PURE__ */ w(
155
+ p.current && J(
156
+ /* @__PURE__ */ g(
152
157
  "div",
153
158
  {
154
159
  ref: c,
155
160
  "data-nvr-header-tools-panel": !0,
156
- style: r && h ? l === document.body ? {
161
+ style: i && h ? b === document.body ? {
157
162
  position: "fixed",
158
163
  top: h.bottom + 6,
159
164
  right: Math.max(8, window.innerWidth - h.right),
160
- maxWidth: Math.min(440, g),
165
+ maxWidth: Math.min(440, w),
161
166
  zIndex: 110
162
167
  } : {
163
168
  position: "absolute",
164
- top: h.bottom - l.getBoundingClientRect().top + 6,
165
- right: Math.max(8, l.getBoundingClientRect().right - h.right),
166
- maxWidth: Math.min(440, g),
169
+ top: h.bottom - b.getBoundingClientRect().top + 6,
170
+ right: Math.max(8, b.getBoundingClientRect().right - h.right),
171
+ maxWidth: Math.min(440, w),
167
172
  zIndex: 110
168
173
  } : { display: "none" },
169
174
  className: "flex flex-wrap items-center justify-end gap-1.5 rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card [&_[data-nvr-header-tool-group]]:h-auto [&_[data-nvr-header-tool-group]]:min-h-9 [&_[data-nvr-header-tool-group]]:max-w-full [&_[data-nvr-header-tool-group]]:shrink [&_[data-nvr-header-tool-group]]:flex-wrap",
170
- children: /* @__PURE__ */ w(N.Provider, { value: r, children: i })
175
+ children: /* @__PURE__ */ g(N.Provider, { value: r, children: /* @__PURE__ */ g(B.Provider, { value: i, children: n }) })
171
176
  }
172
177
  ),
173
- l
178
+ b
174
179
  )
175
180
  ] });
176
181
  }
177
- function ne(i, t) {
178
- const [s, n] = M(!1), p = m(!1);
179
- p.current = s;
180
- const f = m(0);
181
- return R(() => {
182
- const o = i.current, u = o == null ? void 0 : o.closest("[data-nvr-header-row]");
183
- if (!t || !o || !u) {
184
- !t && p.current && n(!1);
182
+ function ie(n, t) {
183
+ const [d, r] = L(!1), u = v(!1);
184
+ u.current = d;
185
+ const l = v(0);
186
+ return E(() => {
187
+ const o = n.current, a = o == null ? void 0 : o.closest("[data-nvr-header-row]");
188
+ if (!t || !o || !a) {
189
+ !t && u.current && r(!1);
185
190
  return;
186
191
  }
187
- o.setAttribute("data-nvr-header-fold", p.current ? "folded" : "inline");
188
- const r = () => {
189
- if (p.current)
190
- f.current > 0 && u.clientWidth > f.current + 32 && n(!1);
192
+ o.setAttribute("data-nvr-header-fold", u.current ? "folded" : "inline");
193
+ const f = () => {
194
+ if (u.current)
195
+ l.current > 0 && a.clientWidth > l.current + 32 && r(!1);
191
196
  else {
192
- const h = u.scrollWidth > u.clientWidth + 2, l = u.querySelector("[data-nvr-header-tools]");
193
- if ((l == null ? void 0 : l.getAttribute("data-nvr-header-tools")) === "inline" && l.childElementCount > 0)
197
+ const p = a.scrollWidth > a.clientWidth + 2, h = a.querySelector("[data-nvr-header-tools]");
198
+ if ((h == null ? void 0 : h.getAttribute("data-nvr-header-tools")) === "inline" && h.childElementCount > 0)
194
199
  return;
195
- const g = h ? 0 : O(u, o.parentElement);
196
- if (!h && g <= 0) return;
197
- f.current = h ? u.scrollWidth : u.clientWidth + g, n(!0);
200
+ const b = p ? 0 : S(a, o.parentElement);
201
+ if (!p && b <= 0) return;
202
+ l.current = p ? a.scrollWidth : a.clientWidth + b, r(!0);
198
203
  }
199
204
  };
200
- r();
201
- const a = new ResizeObserver(r);
202
- a.observe(u), o.parentElement && o.parentElement !== u && a.observe(o.parentElement);
203
- let c = 0;
204
- const d = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
205
- c || (c = requestAnimationFrame(() => {
206
- c = 0, r();
205
+ f();
206
+ const i = new ResizeObserver(f);
207
+ i.observe(a), o.parentElement && o.parentElement !== a && i.observe(o.parentElement);
208
+ let s = 0;
209
+ const c = typeof MutationObserver > "u" ? null : new MutationObserver(() => {
210
+ s || (s = requestAnimationFrame(() => {
211
+ s = 0, f();
207
212
  }));
208
213
  });
209
- return d == null || d.observe(u, { childList: !0, subtree: !0 }), () => {
210
- a.disconnect(), d == null || d.disconnect(), c && cancelAnimationFrame(c);
214
+ return c == null || c.observe(a, { childList: !0, subtree: !0 }), () => {
215
+ i.disconnect(), c == null || c.disconnect(), s && cancelAnimationFrame(s);
211
216
  };
212
- }), R(() => {
217
+ }), E(() => {
213
218
  var o;
214
- t || (o = i.current) == null || o.removeAttribute("data-nvr-header-fold");
215
- }, [t, i]), s;
219
+ t || (o = n.current) == null || o.removeAttribute("data-nvr-header-fold");
220
+ }, [t, n]), d;
216
221
  }
217
- const V = 240;
218
- function z(i, t) {
219
- return Math.max(8, Math.min(i, t - V - 8));
222
+ const Z = 240;
223
+ function G(n, t) {
224
+ return Math.max(8, Math.min(n, t - Z - 8));
220
225
  }
221
- function re({
222
- children: i,
226
+ function se({
227
+ children: n,
223
228
  label: t = "More",
224
- className: s
229
+ className: d
225
230
  }) {
226
- var d, h;
227
- const n = m(null), p = m(null), [f, o] = M(!1), u = m(!1);
228
- f && (u.current = !0), G(
229
- f,
231
+ var h, b;
232
+ const r = v(null), u = v(null), [l, o] = L(!1), a = A(N), f = H(() => (a == null ? void 0 : a()) ?? r.current, [a]), i = v(!1);
233
+ l && (i.current = !0), V(
234
+ l,
230
235
  () => o(!1),
231
- (l) => {
232
- var g;
233
- return !!((g = p.current) != null && g.contains(l));
236
+ (w) => {
237
+ var k;
238
+ return !!((k = u.current) != null && k.contains(w));
234
239
  }
235
240
  );
236
- const r = K(N);
237
- R(() => {
238
- r || o(!1);
239
- }, [r]), R(() => {
240
- if (!f) return;
241
- const l = (x) => {
242
- var e;
243
- const k = x.target;
244
- k.closest("[data-nvr-header-menu-panel]") || k.closest("[data-nvr-header-menu-btn]") || k.closest("[data-radix-popper-content-wrapper]") || // A dialog opened from a menu row, not one hosting the form.
245
- k.closest('[role="dialog"]') && !((e = k.closest('[role="dialog"]')) != null && e.contains(n.current)) || o(!1);
246
- }, g = (x) => {
247
- x.key !== "Escape" || !j(x, n.current) || (x.stopPropagation(), o(!1));
241
+ const s = A(B);
242
+ E(() => {
243
+ s || o(!1);
244
+ }, [s]), E(() => {
245
+ if (!l) return;
246
+ const w = (y) => {
247
+ var m;
248
+ const e = y.target;
249
+ e.closest("[data-nvr-header-menu-panel]") || e.closest("[data-nvr-header-menu-btn]") || e.closest("[data-radix-popper-content-wrapper]") || // A dialog opened from a menu row, not one hosting the form.
250
+ e.closest('[role="dialog"]') && !((m = e.closest('[role="dialog"]')) != null && m.contains(r.current)) || o(!1);
251
+ }, k = (y) => {
252
+ y.key !== "Escape" || !Q(y, r.current) || (y.stopPropagation(), o(!1));
248
253
  };
249
- return window.addEventListener("mousedown", l, !0), window.addEventListener("keydown", g, !0), () => {
250
- window.removeEventListener("mousedown", l, !0), window.removeEventListener("keydown", g, !0);
254
+ return window.addEventListener("mousedown", w, !0), window.addEventListener("keydown", k, !0), () => {
255
+ window.removeEventListener("mousedown", w, !0), window.removeEventListener("keydown", k, !0);
251
256
  };
252
- }, [f]);
253
- const a = f ? (d = n.current) == null ? void 0 : d.getBoundingClientRect() : void 0, c = ((h = n.current) == null ? void 0 : h.closest('[role="dialog"]')) ?? document.body;
254
- return /* @__PURE__ */ L("div", { className: W("relative shrink-0", s), children: [
255
- /* @__PURE__ */ L(
257
+ }, [l]);
258
+ const c = l ? (h = r.current) == null ? void 0 : h.getBoundingClientRect() : void 0, p = ((b = r.current) == null ? void 0 : b.closest('[role="dialog"]')) ?? document.body;
259
+ return /* @__PURE__ */ O("div", { className: W("relative shrink-0", d), children: [
260
+ /* @__PURE__ */ O(
256
261
  "button",
257
262
  {
258
- ref: n,
263
+ ref: r,
259
264
  type: "button",
260
265
  "data-nvr-header-menu-btn": !0,
261
266
  "aria-haspopup": "menu",
262
- "aria-expanded": f,
267
+ "aria-expanded": l,
263
268
  "aria-label": t,
264
269
  "data-tip": "More actions",
265
- onClick: () => o((l) => !l),
270
+ onClick: () => o((w) => !w),
266
271
  className: W(
267
272
  "inline-flex h-9 items-center gap-1 rounded-md border border-input bg-background px-2.5 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent",
268
- f && "bg-accent text-accent-foreground dark:bg-accent"
273
+ l && "bg-accent text-accent-foreground dark:bg-accent"
269
274
  ),
270
275
  children: [
271
- /* @__PURE__ */ w(F, { className: "h-4 w-4" }),
272
- /* @__PURE__ */ w("span", { className: "hidden lg:inline", children: t })
276
+ /* @__PURE__ */ g(K, { className: "h-4 w-4" }),
277
+ /* @__PURE__ */ g("span", { className: "hidden lg:inline", children: t })
273
278
  ]
274
279
  }
275
280
  ),
276
- u.current && P(
277
- /* @__PURE__ */ w(
281
+ i.current && J(
282
+ /* @__PURE__ */ g(
278
283
  "div",
279
284
  {
280
- ref: p,
285
+ ref: u,
281
286
  "data-nvr-header-menu-panel": !0,
282
287
  role: "menu",
283
- onClick: (l) => {
284
- l.target.closest("[data-nvr-menu-close]") && o(!1);
288
+ onClick: (w) => {
289
+ w.target.closest("[data-nvr-menu-close]") && o(!1);
285
290
  },
286
- style: f && a ? c === document.body ? {
291
+ style: l && c ? p === document.body ? {
287
292
  position: "fixed",
288
- top: a.bottom + 6,
289
- right: z(window.innerWidth - a.right, window.innerWidth),
293
+ top: c.bottom + 6,
294
+ right: G(window.innerWidth - c.right, window.innerWidth),
290
295
  zIndex: 110
291
296
  } : {
292
297
  position: "absolute",
293
- top: a.bottom - c.getBoundingClientRect().top + 6,
294
- right: z(
295
- c.getBoundingClientRect().right - a.right,
296
- c.getBoundingClientRect().width
298
+ top: c.bottom - p.getBoundingClientRect().top + 6,
299
+ right: G(
300
+ p.getBoundingClientRect().right - c.right,
301
+ p.getBoundingClientRect().width
297
302
  ),
298
303
  zIndex: 110
299
304
  } : { display: "none" },
@@ -303,18 +308,18 @@ function re({
303
308
  "[&_button:hover]:bg-accent [&_button:hover]:text-accent-foreground [&_button_svg]:h-3.5 [&_button_svg]:w-3.5 [&_button_svg]:shrink-0 [&_button_svg]:text-slate-500",
304
309
  "[&>[data-nvr-menu-divider]]:my-1 [&>[data-nvr-menu-divider]]:h-px [&>[data-nvr-menu-divider]]:bg-slate-100 dark:[&>[data-nvr-menu-divider]]:bg-border"
305
310
  ),
306
- children: i
311
+ children: /* @__PURE__ */ g(N.Provider, { value: f, children: n })
307
312
  }
308
313
  ),
309
- c
314
+ p
310
315
  )
311
316
  ] });
312
317
  }
313
- function oe({
314
- children: i,
318
+ function ce({
319
+ children: n,
315
320
  className: t
316
321
  }) {
317
- return /* @__PURE__ */ w(
322
+ return /* @__PURE__ */ g(
318
323
  "div",
319
324
  {
320
325
  "data-nvr-header-tool-group": !0,
@@ -322,17 +327,18 @@ function oe({
322
327
  "inline-flex h-9 shrink-0 items-center rounded-md border border-input bg-background px-0.5 shadow-sm [&>*+*]:border-l [&>*+*]:border-input/70",
323
328
  t
324
329
  ),
325
- children: i
330
+ children: n
326
331
  }
327
332
  );
328
333
  }
329
334
  export {
330
- re as HeaderMenu,
331
- oe as HeaderToolGroup,
332
- te as HeaderTools,
333
- z as menuRight,
334
- J as openedLayerIn,
335
- O as titleChipDeficit,
336
- G as useCloseWhenRowOpensLayer,
337
- ne as useHeaderFold
335
+ se as HeaderMenu,
336
+ ce as HeaderToolGroup,
337
+ ae as HeaderTools,
338
+ G as menuRight,
339
+ X as openedLayerIn,
340
+ S as titleChipDeficit,
341
+ V as useCloseWhenRowOpensLayer,
342
+ oe as useHeaderAnchor,
343
+ ie as useHeaderFold
338
344
  };
@@ -34,7 +34,12 @@ async function d(e, t, a, o) {
34
34
  if (!n.ok) throw await s(n);
35
35
  return { blob: await n.blob(), filename: c(n, o) };
36
36
  }
37
- const m = (e, t) => r(e, `/collection-layouts/${t}/spreadsheet-template`, "template.xlsx"), b = (e, t, a = 5e3) => d(e, `/collection-layouts/${t}/spreadsheet-export`, { limit: a }, "records.xlsx"), x = (e, t) => r(e, `/collection-layouts/${t}/blank-form`, "blank-form.pdf"), S = (e, t, a) => d(e, "/collection-layouts/help-sheet/xlsx", { rows: t, name: a }, "help-text.xlsx");
37
+ const m = (e, t) => r(e, `/collection-layouts/${t}/spreadsheet-template`, "template.xlsx"), b = (e, t, a) => d(
38
+ e,
39
+ `/collection-layouts/${t}/spreadsheet-export`,
40
+ {},
41
+ "records.xlsx"
42
+ ), x = (e, t) => r(e, `/collection-layouts/${t}/blank-form`, "blank-form.pdf"), S = (e, t, a) => d(e, "/collection-layouts/help-sheet/xlsx", { rows: t, name: a }, "help-text.xlsx");
38
43
  async function h(e) {
39
44
  const t = new Uint8Array(await e.arrayBuffer());
40
45
  let a = "";