@lec-space/liquidglass 0.0.0-stage → 1.0.0

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.
Files changed (90) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +58 -2
  3. package/dist/button-BCSOcrTI.cjs +1 -0
  4. package/dist/button-SXD_7EGY.js +970 -0
  5. package/dist/index.cjs +2 -0
  6. package/dist/index.js +4440 -0
  7. package/dist/styles.css +3804 -0
  8. package/dist/types/activity-calendar.d.ts +18 -0
  9. package/dist/types/alert.d.ts +18 -0
  10. package/dist/types/avatar.d.ts +12 -0
  11. package/dist/types/badge.d.ts +13 -0
  12. package/dist/types/button.d.ts +16 -0
  13. package/dist/types/card.d.ts +10 -0
  14. package/dist/types/checkbox.d.ts +9 -0
  15. package/dist/types/command-palette.d.ts +22 -0
  16. package/dist/types/config-provider.d.ts +62 -0
  17. package/dist/types/context-menu.d.ts +17 -0
  18. package/dist/types/data-table.d.ts +32 -0
  19. package/dist/types/date-range-picker.d.ts +23 -0
  20. package/dist/types/descriptions.d.ts +13 -0
  21. package/dist/types/dialog.d.ts +19 -0
  22. package/dist/types/drawer.d.ts +7 -0
  23. package/dist/types/empty.d.ts +8 -0
  24. package/dist/types/filter-bar.d.ts +9 -0
  25. package/dist/types/form-field.d.ts +19 -0
  26. package/dist/types/glass-group.d.ts +10 -0
  27. package/dist/types/glass.d.ts +3 -0
  28. package/dist/types/import-wizard.d.ts +11 -0
  29. package/dist/types/index.d.ts +53 -0
  30. package/dist/types/input.d.ts +11 -0
  31. package/dist/types/internal/bend.d.ts +15 -0
  32. package/dist/types/internal/calendar-day.d.ts +13 -0
  33. package/dist/types/internal/chevron.d.ts +6 -0
  34. package/dist/types/internal/contour.d.ts +10 -0
  35. package/dist/types/internal/controllable.d.ts +1 -0
  36. package/dist/types/internal/cx.d.ts +1 -0
  37. package/dist/types/internal/date-only.d.ts +4 -0
  38. package/dist/types/internal/field-error.d.ts +6 -0
  39. package/dist/types/internal/floating.d.ts +15 -0
  40. package/dist/types/internal/form-reset.d.ts +3 -0
  41. package/dist/types/internal/hold.d.ts +8 -0
  42. package/dist/types/internal/href.d.ts +7 -0
  43. package/dist/types/internal/jelly.d.ts +22 -0
  44. package/dist/types/internal/modal.d.ts +11 -0
  45. package/dist/types/internal/placement.d.ts +33 -0
  46. package/dist/types/internal/press.d.ts +2 -0
  47. package/dist/types/internal/range-calendar-navigation.d.ts +6 -0
  48. package/dist/types/internal/range-calendar.d.ts +11 -0
  49. package/dist/types/internal/refraction.d.ts +20 -0
  50. package/dist/types/internal/scroller.d.ts +2 -0
  51. package/dist/types/internal/sheet-drag.d.ts +17 -0
  52. package/dist/types/internal/spring.d.ts +13 -0
  53. package/dist/types/internal/styles.d.ts +5 -0
  54. package/dist/types/internal/tab-motion.d.ts +2 -0
  55. package/dist/types/internal/tree-branch.d.ts +13 -0
  56. package/dist/types/member-picker.d.ts +15 -0
  57. package/dist/types/menu.d.ts +61 -0
  58. package/dist/types/message.d.ts +12 -0
  59. package/dist/types/multi-select.d.ts +25 -0
  60. package/dist/types/navigation-bar.d.ts +25 -0
  61. package/dist/types/page-control.d.ts +13 -0
  62. package/dist/types/pagination.d.ts +12 -0
  63. package/dist/types/popover.d.ts +20 -0
  64. package/dist/types/progress.d.ts +10 -0
  65. package/dist/types/radio.d.ts +8 -0
  66. package/dist/types/search-field.d.ts +5 -0
  67. package/dist/types/segmented-control.d.ts +14 -0
  68. package/dist/types/select.d.ts +20 -0
  69. package/dist/types/sheet.d.ts +14 -0
  70. package/dist/types/skeleton.d.ts +9 -0
  71. package/dist/types/slider.d.ts +10 -0
  72. package/dist/types/statistic.d.ts +11 -0
  73. package/dist/types/stepper.d.ts +12 -0
  74. package/dist/types/style-entry.d.ts +1 -0
  75. package/dist/types/switch.d.ts +7 -0
  76. package/dist/types/tab-bar.d.ts +23 -0
  77. package/dist/types/table.d.ts +22 -0
  78. package/dist/types/tabs.d.ts +19 -0
  79. package/dist/types/tag.d.ts +10 -0
  80. package/dist/types/text-area.d.ts +13 -0
  81. package/dist/types/toast.d.ts +35 -0
  82. package/dist/types/toolbar.d.ts +13 -0
  83. package/dist/types/tooltip.d.ts +16 -0
  84. package/dist/types/tree.d.ts +18 -0
  85. package/dist/types/typography.d.ts +11 -0
  86. package/dist/types/upload.d.ts +15 -0
  87. package/dist/types/workspace.d.ts +22 -0
  88. package/dist/workspace.cjs +1 -0
  89. package/dist/workspace.js +42 -0
  90. package/package.json +65 -3
package/dist/index.js ADDED
@@ -0,0 +1,4440 @@
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./button-SXD_7EGY.js";
2
+ import { cloneElement as h, createContext as g, forwardRef as _, useCallback as v, useContext as y, useEffect as b, useId as x, useImperativeHandle as S, useLayoutEffect as C, useMemo as w, useRef as T, useState as E } from "react";
3
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
4
+ import { DayPicker as A, getDefaultClassNames as j } from "@daypicker/react";
5
+ import { enUS as M, zhCN as N } from "@daypicker/react/locale";
6
+ // src/internal/controllable.ts
7
+ function P(e, t, n) {
8
+ let [r, i] = E(t), a = e !== void 0, o = T(n);
9
+ b(() => {
10
+ o.current = n;
11
+ });
12
+ let s = v((e) => {
13
+ a || i(e), o.current?.(e);
14
+ }, [a]);
15
+ return [a ? e : r, s];
16
+ }
17
+ // src/internal/modal.ts
18
+ var F = typeof window > "u" ? b : C;
19
+ function I(e, t, n, r) {
20
+ let [i, a] = E(t ? "open" : "closed"), o = T(n), s = T(null);
21
+ return b(() => {
22
+ o.current = n;
23
+ }), F(() => {
24
+ a((e) => t ? "open" : e === "closed" ? "closed" : "leaving");
25
+ }, [t]), F(() => {
26
+ let t = e.current;
27
+ t && i === "open" && !t.open && (s.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, typeof t.showModal == "function" ? t.showModal() : t.setAttribute("open", ""), t.tabIndex = -1, t.focus({ preventScroll: !0 }));
28
+ }, [i, e]), b(() => {
29
+ let t = e.current;
30
+ if (!t) return;
31
+ let n = (e) => {
32
+ e.preventDefault(), o.current();
33
+ };
34
+ return t.addEventListener("cancel", n), () => t.removeEventListener("cancel", n);
35
+ }, [e, i]), {
36
+ phase: i,
37
+ finished: () => {
38
+ let t = e.current, n = r?.current ?? s.current, i = t?.contains(document.activeElement) || document.activeElement === document.body;
39
+ typeof t?.close == "function" && t.open ? t.close() : t?.removeAttribute("open"), i && n?.isConnected && !n.matches(":disabled, [aria-disabled=\"true\"]") && n.focus({ preventScroll: !0 }), a("closed");
40
+ }
41
+ };
42
+ }
43
+ var L = () => typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, R = 120;
44
+ function z({ open: e, defaultOpen: t = !1, onOpenChange: n, title: a, message: o, actions: s, className: c }) {
45
+ let l = x(), u = l + "-title", d = l + "-message", [f, p] = P(e, t, n), m = T(null), h = T(null), g = s.find((e) => e.role === "cancel"), { phase: _, finished: v } = I(m, f, () => {
46
+ g?.onSelect?.(), p(!1);
47
+ }), y = T(v);
48
+ b(() => {
49
+ y.current = v;
50
+ }), b(() => {
51
+ if (_ !== "closed") return r(h.current);
52
+ }, [_ === "closed"]), b(() => {
53
+ if (_ !== "leaving") return;
54
+ let e = setTimeout(() => y.current(), L() ? 0 : R);
55
+ return () => clearTimeout(e);
56
+ }, [_]);
57
+ let S = o == null ? void 0 : d;
58
+ return /* @__PURE__ */ O("dialog", {
59
+ ref: m,
60
+ className: i("lg-modal lg-alert", c),
61
+ "data-phase": _,
62
+ "aria-labelledby": u,
63
+ "aria-describedby": S,
64
+ children: _ === "closed" ? null : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("span", {
65
+ className: "lg-modal-scrim",
66
+ "aria-hidden": !0
67
+ }), /* @__PURE__ */ k("div", {
68
+ ref: h,
69
+ className: "lg-glass lg-alert-card",
70
+ children: [/* @__PURE__ */ k("div", {
71
+ className: "lg-alert-text",
72
+ children: [/* @__PURE__ */ O("h2", {
73
+ id: u,
74
+ className: "lg-alert-title",
75
+ children: a
76
+ }), o == null ? null : /* @__PURE__ */ O("p", {
77
+ id: S,
78
+ className: "lg-alert-message",
79
+ children: o
80
+ })]
81
+ }), /* @__PURE__ */ O("div", {
82
+ className: "lg-alert-actions",
83
+ "data-stacked": s.length > 2 ? "" : void 0,
84
+ children: s.map((e, t) => /* @__PURE__ */ O("button", {
85
+ type: "button",
86
+ className: "lg-alert-action",
87
+ "data-destructive": e.role === "destructive" ? "" : void 0,
88
+ onClick: () => {
89
+ e.onSelect?.(), p(!1);
90
+ },
91
+ children: e.label
92
+ }, t))
93
+ })]
94
+ })] })
95
+ });
96
+ }
97
+ // src/glass.tsx
98
+ var B = /* @__PURE__ */ _(function({ className: e, ...t }, n) {
99
+ let r = T(null);
100
+ return S(n, () => r.current), s(r), /* @__PURE__ */ O("div", {
101
+ ref: r,
102
+ className: i("lg-glass", e),
103
+ ...t
104
+ });
105
+ });
106
+ function ee(e, t, n, r) {
107
+ let i = n === "end" ? e.left + e.width - t.width : n === "center" ? e.left + (e.width - t.width) / 2 : e.left, a = Math.max(8, Math.min(i, r.width - 8 - t.width)), o = r.height - 8 - Math.max(e.top, 8), s = Math.min(e.top + e.height, r.height - 8) - 8, c = t.height <= o || o >= s ? "bottom" : "top", l = Math.max(0, c === "bottom" ? o : s), u = Math.min(t.height, l);
108
+ return {
109
+ left: a,
110
+ top: c === "bottom" ? Math.max(e.top, 8) : Math.min(e.top + e.height, r.height - 8) - u,
111
+ side: c,
112
+ height: u,
113
+ scrolls: t.height > l
114
+ };
115
+ }
116
+ // src/context-menu.tsx
117
+ var V = 500, H = 10, U = 8;
118
+ function W({ items: e, open: t, defaultOpen: n = !1, onOpenChange: a, children: s, className: c, "aria-label": l }) {
119
+ let [u, d] = P(t, n, a), f = T(null), p = T(null), m = T(null), h = T(null), [g, _] = E(null), { phase: v, finished: y } = I(p, u, () => d(!1)), x = T(y);
120
+ b(() => {
121
+ x.current = y;
122
+ });
123
+ let S = () => {
124
+ _(f.current.getBoundingClientRect()), d(!0);
125
+ }, C = T(null), w = () => {
126
+ C.current && clearTimeout(C.current.timer), C.current = null;
127
+ };
128
+ b(() => w, []);
129
+ let A = (e) => {
130
+ e.button === 0 && e.pointerType !== "mouse" && (C.current = {
131
+ timer: setTimeout(S, V),
132
+ x: e.clientX,
133
+ y: e.clientY
134
+ });
135
+ }, j = (e) => {
136
+ C.current && Math.hypot(e.clientX - C.current.x, e.clientY - C.current.y) > U && w();
137
+ }, M = (e) => {
138
+ e.preventDefault(), w(), S();
139
+ };
140
+ b(() => {
141
+ if (v === "closed") return;
142
+ let e = m.current, t = h.current, n = g ?? f.current.getBoundingClientRect(), i = r(e), a = {
143
+ width: innerWidth,
144
+ height: innerHeight
145
+ }, s = {
146
+ width: e.offsetWidth,
147
+ height: e.offsetHeight
148
+ }, c = n.bottom + H + s.height <= a.height - 8, l = ee({
149
+ left: n.left,
150
+ top: c ? n.bottom + H : n.top - H - s.height,
151
+ width: n.width,
152
+ height: 0
153
+ }, s, "center", a);
154
+ e.style.left = `${l.left}px`, e.style.top = `${c ? n.bottom + H : n.top - H - s.height}px`, e.style.transformOrigin = c ? "50% 0" : "50% 100%", t.style.left = `${n.left}px`, t.style.top = `${n.top}px`, t.style.width = `${n.width}px`, t.style.height = `${n.height}px`;
155
+ let u = o(0, 443, 24.8, (n) => {
156
+ let r = Math.min(1, Math.max(0, n));
157
+ e.style.transform = `scale(${.3 + .7 * Math.max(0, n)})`, e.style.opacity = String(Math.min(1, r * 3)), t.style.transform = `scale(${1 + .03 * Math.sin(Math.min(1, r) * Math.PI)})`, n === 0 && N.current === "leaving" && x.current();
158
+ });
159
+ return F.current = u, u.paint(), u.set(1, L()), e.querySelector(".lg-menu-item:not(:disabled)")?.focus({ preventScroll: !0 }), () => {
160
+ u.stop(), F.current = null, i();
161
+ };
162
+ }, [v === "closed"]);
163
+ let N = T(v), F = T(null);
164
+ return b(() => {
165
+ N.current = v, v === "leaving" && (F.current?.tune(900, 60), F.current?.set(0, L()));
166
+ }, [v]), /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("div", {
167
+ ref: f,
168
+ className: i("lg-context-target", c),
169
+ onPointerDown: A,
170
+ onPointerMove: j,
171
+ onPointerUp: w,
172
+ onPointerCancel: w,
173
+ onContextMenu: M,
174
+ children: s
175
+ }), /* @__PURE__ */ O("dialog", {
176
+ ref: p,
177
+ className: "lg-modal lg-context",
178
+ "data-phase": v,
179
+ "aria-label": l,
180
+ children: v === "closed" ? null : /* @__PURE__ */ k(D, { children: [
181
+ /* @__PURE__ */ O("span", {
182
+ className: "lg-modal-scrim",
183
+ "aria-hidden": !0,
184
+ onClick: () => d(!1)
185
+ }),
186
+ /* @__PURE__ */ O("div", {
187
+ ref: h,
188
+ className: "lg-context-lift",
189
+ "aria-hidden": !0,
190
+ children: s
191
+ }),
192
+ /* @__PURE__ */ O("div", {
193
+ ref: m,
194
+ role: "menu",
195
+ className: "lg-glass lg-context-card",
196
+ children: /* @__PURE__ */ O("div", {
197
+ className: "lg-menu-content",
198
+ children: e.map((e, t) => e === "separator" ? /* @__PURE__ */ O("div", {
199
+ role: "separator",
200
+ className: "lg-menu-separator"
201
+ }, t) : "heading" in e ? /* @__PURE__ */ O("div", {
202
+ className: "lg-menu-heading",
203
+ children: e.heading
204
+ }, t) : /* @__PURE__ */ k("button", {
205
+ type: "button",
206
+ role: "menuitem",
207
+ className: "lg-menu-item",
208
+ disabled: e.disabled,
209
+ "data-destructive": e.destructive ? "" : void 0,
210
+ onClick: () => {
211
+ d(!1), e.onSelect?.();
212
+ },
213
+ children: [e.icon, e.label]
214
+ }, t))
215
+ })
216
+ })
217
+ ] })
218
+ })] });
219
+ }
220
+ // src/internal/contour.ts
221
+ function G(e, t, n) {
222
+ let r = Math.abs(t - e.x - e.width / 2) - e.width / 2 + e.radius, i = Math.abs(n - e.y - e.height / 2) - e.height / 2 + e.radius;
223
+ return Math.hypot(Math.max(r, 0), Math.max(i, 0)) + Math.min(Math.max(r, i), 0) - e.radius;
224
+ }
225
+ function K(e, t, n, r) {
226
+ let i = Infinity;
227
+ for (let a of e) {
228
+ let e = G(a, n, r), o = Math.max(t - Math.abs(i - e), 0) / (t || 1);
229
+ i = Math.min(i, e) - o * o * t / 4;
230
+ }
231
+ return i;
232
+ }
233
+ function te(e, t, n, r, i = 2) {
234
+ let a = Math.ceil(n / i) + 1, o = Math.ceil(r / i) + 1, s = new Float32Array(a * o);
235
+ for (let n = 0; n < o; n++) for (let r = 0; r < a; r++) s[n * a + r] = K(e, t, r * i, n * i);
236
+ let c = (e, t) => s[t * a + e], l = (e, t, n, r, a) => {
237
+ let o = e / (e - t);
238
+ return a ? [(n + o) * i, r * i] : [n * i, (r + o) * i];
239
+ }, u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = (e, t, n) => {
240
+ let r = `${e},${t},${+!!n}`;
241
+ if (!d.has(r)) {
242
+ let i = c(e, t), a = n ? c(e + 1, t) : c(e, t + 1);
243
+ d.set(r, l(i, a, e, t, n));
244
+ }
245
+ return r;
246
+ };
247
+ for (let e = 0; e < o - 1; e++) for (let t = 0; t < a - 1; t++) {
248
+ let n = c(t, e) < 0, r = c(t + 1, e) < 0, i = c(t + 1, e + 1) < 0, a = c(t, e + 1) < 0;
249
+ if (n === r && r === i && i === a) continue;
250
+ let o = () => f(t, e, !0), s = () => f(t + 1, e, !1), l = () => f(t, e + 1, !0), d = () => f(t, e, !1), p = (e, t) => u.set(e, t);
251
+ switch ((n ? 8 : 0) | (r ? 4 : 0) | (i ? 2 : 0) | !!a) {
252
+ case 1:
253
+ p(l(), d());
254
+ break;
255
+ case 2:
256
+ p(s(), l());
257
+ break;
258
+ case 3:
259
+ p(s(), d());
260
+ break;
261
+ case 4:
262
+ p(o(), s());
263
+ break;
264
+ case 5:
265
+ p(o(), d()), p(l(), s());
266
+ break;
267
+ case 6:
268
+ p(o(), l());
269
+ break;
270
+ case 7:
271
+ p(o(), d());
272
+ break;
273
+ case 8:
274
+ p(d(), o());
275
+ break;
276
+ case 9:
277
+ p(l(), o());
278
+ break;
279
+ case 10:
280
+ p(d(), l()), p(s(), o());
281
+ break;
282
+ case 11:
283
+ p(s(), o());
284
+ break;
285
+ case 12:
286
+ p(d(), s());
287
+ break;
288
+ case 13:
289
+ p(l(), s());
290
+ break;
291
+ case 14: p(d(), l());
292
+ }
293
+ }
294
+ let p = "", m = /* @__PURE__ */ new Set();
295
+ for (let e of u.keys()) {
296
+ if (m.has(e)) continue;
297
+ let t = e, n = !0;
298
+ for (; t && !m.has(t);) {
299
+ m.add(t);
300
+ let [e, r] = d.get(t);
301
+ p += `${n ? "M" : "L"}${e.toFixed(1)} ${r.toFixed(1)}`, n = !1, t = u.get(t);
302
+ }
303
+ p += "Z";
304
+ }
305
+ return p;
306
+ }
307
+ // src/glass-group.tsx
308
+ var ne = 24, re = /* @__PURE__ */ _(function({ spacing: e = 20, className: t, children: n, ...r }, a) {
309
+ let o = T(null), s = T(null), c = T(null), l = T(null), u = x().replace(/:/g, "");
310
+ return S(a, () => o.current), b(() => {
311
+ let t = o.current, n = l.current, r = [...s.current.querySelectorAll("mask")], i = [...s.current.querySelectorAll(":scope > path"), ...c.current.querySelectorAll("path")], a = 0, u = 0, d = "", f = () => [...t.querySelectorAll(":scope > .lg-glass:not(.lg-glass-group-shape):not([data-variant='filled'])")], p = () => {
312
+ u = 0;
313
+ let o = t.getBoundingClientRect(), s = f().map((e) => {
314
+ let t = e.getBoundingClientRect(), n = e.offsetWidth ? t.width / e.offsetWidth : 1, r = parseFloat(getComputedStyle(e).borderTopLeftRadius) * n || 0;
315
+ return {
316
+ x: t.left - o.left + ne,
317
+ y: t.top - o.top + ne,
318
+ width: t.width,
319
+ height: t.height,
320
+ radius: Math.min(r, t.width / 2, t.height / 2)
321
+ };
322
+ }), c = s.map((e) => Object.values(e).map((e) => e.toFixed(1)).join()).join("|") + o.width + o.height;
323
+ if (c === d) return;
324
+ d = c;
325
+ let l = te(s, e, o.width + 48, o.height + 48);
326
+ a = 1 - a;
327
+ let p = r[a];
328
+ p.setAttribute("width", String(o.width + 48)), p.setAttribute("height", String(o.height + 48)), p.firstElementChild.setAttribute("d", l), n.style.setProperty("-webkit-mask", `url(#${p.id})`), n.style.setProperty("mask", `url(#${p.id})`);
329
+ for (let e of i) e.setAttribute("d", l);
330
+ }, m = () => {
331
+ u ||= requestAnimationFrame(p);
332
+ }, h = 0, g = () => {
333
+ p(), h = t.getAnimations({ subtree: !0 }).length ? requestAnimationFrame(g) : 0;
334
+ }, _ = () => {
335
+ h ||= requestAnimationFrame(g);
336
+ }, v = new ResizeObserver(m);
337
+ v.observe(t);
338
+ let y = new MutationObserver(() => {
339
+ for (let e of f()) v.observe(e);
340
+ m();
341
+ });
342
+ y.observe(t, {
343
+ attributes: !0,
344
+ attributeFilter: ["style", "class"],
345
+ childList: !0,
346
+ subtree: !0
347
+ });
348
+ for (let e of f()) v.observe(e);
349
+ return t.addEventListener("transitionrun", _), t.addEventListener("animationstart", _), p(), () => {
350
+ cancelAnimationFrame(u), cancelAnimationFrame(h), v.disconnect(), y.disconnect(), t.removeEventListener("transitionrun", _), t.removeEventListener("animationstart", _);
351
+ };
352
+ }, [e]), /* @__PURE__ */ k("div", {
353
+ ref: o,
354
+ className: i("lg-glass-group", t),
355
+ ...r,
356
+ children: [
357
+ /* @__PURE__ */ O("svg", {
358
+ ref: c,
359
+ className: "lg-glass-group-layer lg-glass-group-shadow",
360
+ "aria-hidden": !0,
361
+ children: /* @__PURE__ */ O("path", {})
362
+ }),
363
+ /* @__PURE__ */ O("span", {
364
+ ref: l,
365
+ className: "lg-glass lg-glass-group-shape",
366
+ style: {
367
+ WebkitMask: `url(#${u}-shape-0)`,
368
+ mask: `url(#${u}-shape-0)`
369
+ },
370
+ "aria-hidden": !0
371
+ }),
372
+ /* @__PURE__ */ k("svg", {
373
+ ref: s,
374
+ className: "lg-glass-group-layer lg-glass-group-rim",
375
+ "aria-hidden": !0,
376
+ children: [
377
+ /* @__PURE__ */ k("defs", { children: [[0, 1].map((e) => /* @__PURE__ */ O("mask", {
378
+ id: `${u}-shape-${e}`,
379
+ maskUnits: "userSpaceOnUse",
380
+ x: "0",
381
+ y: "0",
382
+ children: /* @__PURE__ */ O("path", { fill: "#fff" })
383
+ }, e)), /* @__PURE__ */ k("linearGradient", {
384
+ id: `${u}-light`,
385
+ x1: "0",
386
+ y1: "0",
387
+ x2: "0",
388
+ y2: "1",
389
+ children: [
390
+ /* @__PURE__ */ O("stop", {
391
+ offset: "0",
392
+ stopColor: "#fff",
393
+ stopOpacity: "0.34"
394
+ }),
395
+ /* @__PURE__ */ O("stop", {
396
+ offset: "0.3",
397
+ stopColor: "#fff",
398
+ stopOpacity: "0"
399
+ }),
400
+ /* @__PURE__ */ O("stop", {
401
+ offset: "0.7",
402
+ stopColor: "#fff",
403
+ stopOpacity: "0"
404
+ }),
405
+ /* @__PURE__ */ O("stop", {
406
+ offset: "1",
407
+ stopColor: "#fff",
408
+ stopOpacity: "0.34"
409
+ })
410
+ ]
411
+ })] }),
412
+ /* @__PURE__ */ O("path", { className: "lg-glass-group-hairline" }),
413
+ /* @__PURE__ */ O("path", {
414
+ className: "lg-glass-group-line",
415
+ stroke: `url(#${u}-light)`
416
+ })
417
+ ]
418
+ }),
419
+ n
420
+ ]
421
+ });
422
+ }), ie = /* @__PURE__ */ _(function({ value: e, defaultValue: t = "", onValueChange: n, icon: r, variant: a = "glass", className: o, style: c, ...u }, d) {
423
+ let { locale: f } = l(), p = T(null), m = T(null), [h, g] = P(e, t, n);
424
+ return S(d, () => m.current), s(p), /* @__PURE__ */ k("div", {
425
+ ref: p,
426
+ className: i("lg-glass lg-input", o),
427
+ "data-variant": a === "glass" ? void 0 : a,
428
+ style: c,
429
+ onPointerDown: (e) => {
430
+ e.target !== m.current && m.current?.focus();
431
+ },
432
+ children: [
433
+ r == null ? null : /* @__PURE__ */ O("span", {
434
+ className: "lg-input-icon",
435
+ children: r
436
+ }),
437
+ /* @__PURE__ */ O("input", {
438
+ ref: m,
439
+ value: h,
440
+ onChange: (e) => g(e.currentTarget.value),
441
+ ...u
442
+ }),
443
+ u.type === "search" && h && !u.disabled ? /* @__PURE__ */ O("button", {
444
+ type: "button",
445
+ className: "lg-input-clear",
446
+ "aria-label": f.clear,
447
+ onPointerDown: (e) => e.preventDefault(),
448
+ onClick: () => {
449
+ g(""), m.current?.focus();
450
+ },
451
+ children: /* @__PURE__ */ O("svg", {
452
+ viewBox: "0 0 16 16",
453
+ fill: "none",
454
+ stroke: "currentColor",
455
+ strokeWidth: 1.5,
456
+ strokeLinecap: "round",
457
+ "aria-hidden": !0,
458
+ children: /* @__PURE__ */ O("path", { d: "m4.5 4.5 7 7m0-7-7 7" })
459
+ })
460
+ }) : null
461
+ ]
462
+ });
463
+ });
464
+ // src/internal/href.ts
465
+ function ae(e) {
466
+ if (e === void 0) return;
467
+ let t = e.replace(/[\u0000- ]/g, ""), n = /^([a-z][a-z0-9+.-]*):/i.exec(t);
468
+ return n ? /^(https?|mailto|tel|sms)$/i.test(n[1]) ? e : void 0 : e;
469
+ }
470
+ // src/menu.tsx
471
+ var oe = typeof window > "u" ? b : C, se = ({ metaKey: e, ctrlKey: t, shiftKey: n }) => ({
472
+ metaKey: e,
473
+ ctrlKey: t,
474
+ shiftKey: n
475
+ }), q = (e) => Math.min(1, Math.max(0, e)), ce = (e) => Math.sign(e) * 7 * (1 - Math.exp(-Math.abs(e) * .12 / 7)), le = (e) => e != null && e !== "separator" && !("heading" in e), ue = [
476
+ [
477
+ 0,
478
+ 0,
479
+ 0,
480
+ .7,
481
+ 1
482
+ ],
483
+ [
484
+ -.43,
485
+ 0,
486
+ .01,
487
+ .7,
488
+ 1
489
+ ],
490
+ [
491
+ -1.28,
492
+ .04,
493
+ .15,
494
+ .7,
495
+ 1
496
+ ],
497
+ [
498
+ -1.48,
499
+ .435,
500
+ .73,
501
+ .75,
502
+ 1
503
+ ],
504
+ [
505
+ -1.22,
506
+ .53,
507
+ .88,
508
+ .85,
509
+ 1
510
+ ],
511
+ [
512
+ -.97,
513
+ .6,
514
+ 1,
515
+ .95,
516
+ 1
517
+ ],
518
+ [
519
+ -.52,
520
+ .73,
521
+ 1.2,
522
+ 1.08,
523
+ 1
524
+ ],
525
+ [
526
+ -.14,
527
+ .81,
528
+ 1.33,
529
+ 1.19,
530
+ 1
531
+ ],
532
+ [
533
+ .21,
534
+ .88,
535
+ 1.4,
536
+ 1.25,
537
+ .92
538
+ ],
539
+ [
540
+ .45,
541
+ .91,
542
+ 1.4,
543
+ 1.27,
544
+ .83
545
+ ],
546
+ [
547
+ .66,
548
+ .95,
549
+ 1.365,
550
+ 1.28,
551
+ .75
552
+ ],
553
+ [
554
+ .8,
555
+ .97,
556
+ 1.31,
557
+ 1.25,
558
+ .66
559
+ ],
560
+ [
561
+ .93,
562
+ .99,
563
+ 1.25,
564
+ 1.2,
565
+ .58
566
+ ],
567
+ [
568
+ 1.03,
569
+ 1.01,
570
+ 1.2,
571
+ 1.16,
572
+ .49
573
+ ],
574
+ [
575
+ 1.07,
576
+ 1.02,
577
+ 1.14,
578
+ 1.12,
579
+ .41
580
+ ],
581
+ [
582
+ 1.1,
583
+ 1.02,
584
+ 1.087,
585
+ 1.09,
586
+ .32
587
+ ],
588
+ [
589
+ 1.1,
590
+ 1.02,
591
+ 1.052,
592
+ 1.06,
593
+ .24
594
+ ],
595
+ [
596
+ 1.1,
597
+ 1.02,
598
+ 1.035,
599
+ 1.04,
600
+ .15
601
+ ],
602
+ [
603
+ 1.07,
604
+ 1.02,
605
+ 1.017,
606
+ 1.03,
607
+ .1
608
+ ],
609
+ [
610
+ 1.07,
611
+ 1.02,
612
+ 1,
613
+ 1.02,
614
+ .05
615
+ ],
616
+ [
617
+ 1.07,
618
+ 1.01,
619
+ .99,
620
+ 1.01,
621
+ .02
622
+ ],
623
+ [
624
+ 1.03,
625
+ 1.01,
626
+ .99,
627
+ 1,
628
+ 0
629
+ ],
630
+ [
631
+ 1.02,
632
+ 1.01,
633
+ .99,
634
+ 1,
635
+ 0
636
+ ],
637
+ [
638
+ 1.01,
639
+ 1,
640
+ .99,
641
+ 1,
642
+ 0
643
+ ],
644
+ [
645
+ 1,
646
+ 1,
647
+ 1,
648
+ 1,
649
+ 0
650
+ ]
651
+ ], de = [
652
+ [
653
+ 1,
654
+ 1,
655
+ 1,
656
+ 1,
657
+ 0
658
+ ],
659
+ [
660
+ .86,
661
+ .98,
662
+ 1.226,
663
+ 1,
664
+ .2
665
+ ],
666
+ [
667
+ .64,
668
+ .94,
669
+ 1.41,
670
+ .98,
671
+ .5
672
+ ],
673
+ [
674
+ .33,
675
+ .9,
676
+ 1.44,
677
+ .95,
678
+ .75
679
+ ],
680
+ [
681
+ -.02,
682
+ .86,
683
+ 1.365,
684
+ .92,
685
+ 1
686
+ ],
687
+ [
688
+ -.38,
689
+ .81,
690
+ 1.21,
691
+ .9,
692
+ 1
693
+ ],
694
+ [
695
+ -.72,
696
+ .74,
697
+ 1.02,
698
+ .88,
699
+ 1
700
+ ],
701
+ [
702
+ -1.05,
703
+ .66,
704
+ .82,
705
+ .86,
706
+ 1
707
+ ],
708
+ [
709
+ -1.34,
710
+ .57,
711
+ .63,
712
+ .84,
713
+ 1
714
+ ],
715
+ [
716
+ -1.59,
717
+ .49,
718
+ .47,
719
+ .82,
720
+ 1
721
+ ]
722
+ ], fe = [
723
+ [
724
+ .41,
725
+ .35,
726
+ .61,
727
+ -3
728
+ ],
729
+ [
730
+ .35,
731
+ .25,
732
+ .69,
733
+ -5
734
+ ],
735
+ [
736
+ .31,
737
+ .165,
738
+ .76,
739
+ -6
740
+ ],
741
+ [
742
+ .28,
743
+ .096,
744
+ .81,
745
+ -7
746
+ ],
747
+ [
748
+ .23,
749
+ .035,
750
+ .865,
751
+ -7
752
+ ],
753
+ [
754
+ .18,
755
+ 0,
756
+ .9,
757
+ -6
758
+ ],
759
+ [
760
+ 0,
761
+ 0,
762
+ .93,
763
+ -6
764
+ ],
765
+ [
766
+ 0,
767
+ 0,
768
+ .96,
769
+ -5
770
+ ],
771
+ [
772
+ 0,
773
+ 0,
774
+ .98,
775
+ -5
776
+ ],
777
+ [
778
+ 0,
779
+ 0,
780
+ .99,
781
+ -4
782
+ ],
783
+ [
784
+ 0,
785
+ 0,
786
+ 1,
787
+ -4
788
+ ],
789
+ [
790
+ 0,
791
+ 0,
792
+ 1.01,
793
+ -3
794
+ ],
795
+ [
796
+ 0,
797
+ 0,
798
+ 1.016,
799
+ -2
800
+ ],
801
+ [
802
+ 0,
803
+ 0,
804
+ 1.02,
805
+ -2
806
+ ],
807
+ [
808
+ 0,
809
+ 0,
810
+ 1.02,
811
+ -1
812
+ ],
813
+ [
814
+ 0,
815
+ 0,
816
+ 1.016,
817
+ -1
818
+ ],
819
+ [
820
+ 0,
821
+ 0,
822
+ 1.016,
823
+ -1
824
+ ],
825
+ [
826
+ 0,
827
+ 0,
828
+ 1.01,
829
+ 0
830
+ ],
831
+ [
832
+ 0,
833
+ 0,
834
+ 1.008,
835
+ 0
836
+ ],
837
+ [
838
+ 0,
839
+ 0,
840
+ 1.004,
841
+ 0
842
+ ],
843
+ [
844
+ 0,
845
+ 0,
846
+ 1,
847
+ 0
848
+ ]
849
+ ];
850
+ function pe(e, t) {
851
+ let n = e[Math.min(Math.floor(t), e.length - 1)], r = e[Math.min(Math.floor(t) + 1, e.length - 1)], i = t - Math.floor(t);
852
+ return n.map((e, t) => e + (r[t] - e) * i);
853
+ }
854
+ function me(e, t) {
855
+ let n = 0;
856
+ return e.forEach((r, i) => {
857
+ Math.abs(r[1] - t) < Math.abs(e[n][1] - t) && (n = i);
858
+ }), n;
859
+ }
860
+ var J = /* @__PURE__ */ O("svg", {
861
+ className: "lg-menu-chevron",
862
+ viewBox: "0 0 12 12",
863
+ fill: "none",
864
+ stroke: "currentColor",
865
+ "aria-hidden": !0,
866
+ children: /* @__PURE__ */ O("path", {
867
+ d: "M2.5 4.5 6 8l3.5-3.5",
868
+ strokeWidth: "1.6",
869
+ strokeLinecap: "round",
870
+ strokeLinejoin: "round"
871
+ })
872
+ }), he = /* @__PURE__ */ k("svg", {
873
+ viewBox: "0 0 16 16",
874
+ fill: "currentColor",
875
+ "aria-hidden": !0,
876
+ children: [
877
+ /* @__PURE__ */ O("circle", {
878
+ cx: "3",
879
+ cy: "8",
880
+ r: "1.4"
881
+ }),
882
+ /* @__PURE__ */ O("circle", {
883
+ cx: "8",
884
+ cy: "8",
885
+ r: "1.4"
886
+ }),
887
+ /* @__PURE__ */ O("circle", {
888
+ cx: "13",
889
+ cy: "8",
890
+ r: "1.4"
891
+ })
892
+ ]
893
+ }), ge = /* @__PURE__ */ O("svg", {
894
+ viewBox: "0 0 14 14",
895
+ fill: "none",
896
+ stroke: "currentColor",
897
+ "aria-hidden": !0,
898
+ children: /* @__PURE__ */ O("path", {
899
+ d: "m2.75 7.25 2.75 2.75 5.75-6",
900
+ strokeWidth: "1.8",
901
+ strokeLinecap: "round",
902
+ strokeLinejoin: "round"
903
+ })
904
+ });
905
+ function _e(e) {
906
+ let t = e.getBoundingClientRect(), n = e.offsetWidth, r = e.offsetHeight;
907
+ return {
908
+ left: t.left + t.width / 2 - n / 2,
909
+ top: t.top + t.height / 2 - r / 2,
910
+ width: n,
911
+ height: r
912
+ };
913
+ }
914
+ var ve = () => ({
915
+ width: document.documentElement.clientWidth || window.innerWidth,
916
+ height: window.innerHeight
917
+ });
918
+ function ye(e) {
919
+ if ("showPopover" in e && !e.matches(":popover-open")) {
920
+ e.setAttribute("popover", "manual");
921
+ try {
922
+ e.showPopover();
923
+ } catch {}
924
+ }
925
+ }
926
+ function be(e) {
927
+ if ("hidePopover" in e && e.matches(":popover-open")) try {
928
+ e.hidePopover();
929
+ } catch {}
930
+ }
931
+ function xe({ items: e = [], renderContent: t, "aria-label": r, icon: a, label: s, trigger: c, align: l = "center", chevron: d = !1, open: f, defaultOpen: h = !1, onOpenChange: g, className: _, style: v }) {
932
+ let y = x(), S = t !== void 0, [C, w] = P(f, h, g), A = a ?? (s == null ? he : void 0), j = s == null ? A : /* @__PURE__ */ k(D, { children: [
933
+ A,
934
+ s,
935
+ d ? J : null
936
+ ] }), [M, N] = E(C ? "open" : "closed"), F = T(null), I = T(null), L = T(null), R = T(null), z = T(null), B = T(null), V = T(null), H = T({
937
+ items: e,
938
+ open: C,
939
+ setOpen: w
940
+ }), U = T(!0), W = T(0), G = M !== "closed";
941
+ b(() => {
942
+ H.current = {
943
+ items: e,
944
+ open: C,
945
+ setOpen: w
946
+ };
947
+ }), b(() => {
948
+ if (C) return N("open");
949
+ N((e) => e === "closed" ? e : "leaving"), U.current && I.current?.contains(document.activeElement) && F.current?.focus({ preventScroll: !0 }), U.current = !0;
950
+ }, [C]);
951
+ let K = (e = !0) => {
952
+ H.current.open && (U.current = e, S && e && f === void 0 && F.current?.focus({ preventScroll: !0 }), H.current.setOpen(!1));
953
+ };
954
+ return b(() => {
955
+ S && I.current && (I.current.inert = M === "leaving"), M === "open" && V.current?.set(1), M === "leaving" && V.current?.set(0);
956
+ }, [M, S]), oe(() => {
957
+ if (!G) return;
958
+ let e = F.current, t = I.current, r = L.current, i = R.current, a = z.current, s = B.current;
959
+ ye(t), t.style.left = "0px", t.style.top = "0px", t.style.setProperty("--lg-menu-min-width", `${e.offsetWidth}px`);
960
+ let c = () => {
961
+ let n = _e(e);
962
+ a.style.maxHeight = "";
963
+ let r = ee(n, {
964
+ width: t.offsetWidth,
965
+ height: t.offsetHeight
966
+ }, t.dataset.align, ve());
967
+ t.dataset.side = r.side, t.toggleAttribute("data-scrolls", r.scrolls), r.scrolls && (a.style.maxHeight = `${r.height}px`), t.style.left = `${r.left}px`, t.style.top = `${r.top}px`;
968
+ let o = {
969
+ x: n.left - r.left,
970
+ y: n.top - r.top,
971
+ width: n.width,
972
+ height: n.height
973
+ }, s = {
974
+ width: t.offsetWidth,
975
+ height: t.offsetHeight
976
+ }, c = Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius) || 0, s.width / 2, s.height / 2), l = Math.min(1, c / (Math.min(s.width, s.height) / 2)), u = {
977
+ x: s.width / 2,
978
+ y: s.height / 2
979
+ }, d = {
980
+ x: o.x + o.width / 2,
981
+ y: o.y + o.height / 2
982
+ };
983
+ return a.style.transformOrigin = `${u.x}px ${u.y}px`, t.style.transformOrigin = `${d.x}px ${d.y}px`, i.style.left = `${o.x}px`, i.style.top = `${o.y}px`, i.style.width = `${o.width}px`, i.style.height = `${o.height}px`, {
984
+ place: r,
985
+ from: o,
986
+ to: s,
987
+ radius: c,
988
+ roundest: l,
989
+ centre: u,
990
+ home: d
991
+ };
992
+ }, { place: l, from: d, to: f, radius: p, roundest: h, centre: g, home: _ } = c(), v = getComputedStyle(e);
993
+ i.style.color = v.color, i.style.padding = `0 ${v.paddingRight} 0 ${v.paddingLeft}`, i.style.gap = v.columnGap, i.style.fontSize = v.fontSize;
994
+ let y, b = u(r, f.width, f.height, p), x = (e) => Math.max(d.height * .8, e < 0 ? d.width * (1 + .302 * e) : e > 1 ? f.width * (1 + .232 * (e - 1)) : d.width + (f.width - d.width) * e), C = (e) => e > 1 ? f.height * (1 + .69 * (e - 1)) : d.height + (f.height - d.height) * e, w = ([e, t, n, o, s], c, l, u) => {
995
+ let d = x(e), p = C(t), m = _.x + (g.x - _.x) * q(e) - d / 2, v = _.y + (g.y - _.y) * n, y = v - p / 2, b = (h + (1 - h) * s) * Math.min(d, p) / 2;
996
+ r.style.left = `${m}px`, r.style.top = `${y}px`, r.style.width = `${d}px`, r.style.height = `${p}px`, r.style.borderRadius = `${b}px`, r.style.opacity = "1", i.style.opacity = String(u), i.style.filter = `blur(${4 * (1 - u)}px)`;
997
+ let S = (v - g.y) * .45, w = (e, t, n = 0) => t + (e - t - n) / o;
998
+ a.style.opacity = String(c), a.style.transform = `translateY(${S}px) scale(${o})`, a.style.filter = l ? `blur(${l}px)` : "", a.style.clipPath = `inset(${w(y, g.y, S)}px ${f.width - w(m + d, g.x)}px ${f.height - w(y + p, g.y, S)}px ${w(m, g.x)}px round ${b / o}px)`;
999
+ }, T = ([t, n, o, s]) => {
1000
+ a.style.opacity = "0", i.style.opacity = "0", e.style.opacity = "", e.style.transform = `translateY(${s}px) scaleX(${o})`;
1001
+ let c = d.y + d.height + s, l = n * (f.height - d.height), u = t * d.width;
1002
+ r.style.opacity = t && l > 0 ? "1" : "0", r.style.left = `${_.x - u / 2}px`, r.style.top = `${c}px`, r.style.width = `${u}px`, r.style.height = `${Math.max(0, l)}px`, r.style.borderRadius = `0 0 ${u / 2}px ${u / 2}px`;
1003
+ }, E = () => {
1004
+ for (let e of [
1005
+ "left",
1006
+ "top",
1007
+ "width",
1008
+ "height",
1009
+ "borderRadius",
1010
+ "opacity"
1011
+ ]) r.style[e] = "";
1012
+ for (let e of [
1013
+ "opacity",
1014
+ "transform",
1015
+ "filter",
1016
+ "clipPath"
1017
+ ]) a.style[e] = "";
1018
+ i.style.opacity = "0", delete t.dataset.morphing;
1019
+ }, D = -1, O = 0, k = 0, A = 0, j = ue[0], M = () => {
1020
+ if (D === 1) return O >= ue.length - 1 ? (E(), y ??= n(r), !0) : (j = pe(ue, O), e.style.opacity = "0", w(j, q((O - 1) / 6), 5 * q(1 - (O - 2) / 14), q(1 - O / 2.5)), !1);
1021
+ if (O < de.length) return j = pe(de, O), e.style.opacity = "0", w(j, q(1 - O / 4), 4 * q(O / 4), q((O - 5) / 3)), !1;
1022
+ let t = O - de.length;
1023
+ if (t >= fe.length - 1) return e.style.opacity = "", e.style.transform = "", N("closed"), !0;
1024
+ let i = fe[Math.floor(t)], a = fe[Math.floor(t) + 1], o = t - Math.floor(t);
1025
+ return T(i.map((e, t) => e + (a[t] - e) * o)), !1;
1026
+ }, P = 3, U = (e) => {
1027
+ k = 0, P > 0 ? (P--, A = e, k = requestAnimationFrame(U)) : (O += Math.min(34, Math.max(0, e - A)) * 60 / 1e3, A = e, M() || (k = requestAnimationFrame(U)));
1028
+ }, te = { set(e) {
1029
+ if (e === D) return;
1030
+ let n = D !== -1;
1031
+ D = e, y?.(), y = void 0, t.dataset.morphing = "";
1032
+ let r = e === 1 ? ue : de;
1033
+ O = n && (e === 0 || O < de.length) ? me(r, j[1]) : 0, cancelAnimationFrame(k), document.hidden || m() ? (O = r === ue ? ue.length : de.length + fe.length, M()) : (A = Number(document.timeline?.currentTime ?? performance.now()), M(), k = requestAnimationFrame(U));
1034
+ } };
1035
+ V.current = te, te.set(1);
1036
+ let ne = () => [...t.querySelectorAll(".lg-menu-item:not(:disabled)")].filter((e) => getComputedStyle(e).display !== "none");
1037
+ W.current ? t.focus({ preventScroll: !0 }) : S ? (a.querySelector("[data-lg-menu-initial-focus]") ?? a.querySelector("button:not(:disabled), a[href], input:not(:disabled)") ?? t).focus({ preventScroll: !0 }) : ne()[0]?.focus({ preventScroll: !0 });
1038
+ let re = () => {
1039
+ if (D !== 1 || !H.current.open) return;
1040
+ let e = f;
1041
+ ({place: l, from: d, to: f, radius: p, roundest: h, centre: g, home: _} = c()), (e.width !== f.width || e.height !== f.height) && (b(), b = u(r, f.width, f.height, p), k || (y?.(), y = n(r)));
1042
+ }, ie = S && typeof ResizeObserver < "u" ? new ResizeObserver(re) : null;
1043
+ ie?.observe(a);
1044
+ let oe = (n) => {
1045
+ if (n.target instanceof Node && t.contains(n.target)) return;
1046
+ if (S) return re();
1047
+ let r = _e(e), i = ee(r, {
1048
+ width: t.offsetWidth,
1049
+ height: t.offsetHeight
1050
+ }, t.dataset.align, ve());
1051
+ t.style.left = `${i.left}px`, t.style.top = `${l.side === "bottom" ? r.top : r.top + r.height - t.offsetHeight}px`;
1052
+ }, J = {
1053
+ scale: 1,
1054
+ x: 0,
1055
+ y: 0
1056
+ }, he = () => {
1057
+ t.style.scale = String(J.scale), t.style.translate = `${J.x}px ${J.y}px`;
1058
+ }, ge = o(1, 650, 36, (e) => {
1059
+ J.scale = e, he();
1060
+ }), xe = o(0, 600, 30, (e) => {
1061
+ J.x = e, he();
1062
+ }), Y = o(0, 600, 30, (e) => {
1063
+ J.y = e, he();
1064
+ }), X = null, Se = null, Ce = 0, Z = (e) => {
1065
+ if (Se === e) return;
1066
+ let n = !Se;
1067
+ Se = e, e ? (t.dataset.scrubbing = "", s.style.width = `${e.offsetWidth}px`, s.style.height = `${e.offsetHeight}px`, n && (s.style.transition = "none"), s.style.transform = `translate(${e.offsetLeft}px, ${e.offsetTop}px)`, s.style.opacity = "1", n && (s.offsetWidth, s.style.transition = "")) : (delete t.dataset.scrubbing, s.style.opacity = "0");
1068
+ }, we = (e, n) => {
1069
+ let r = document.elementFromPoint(e, n)?.closest(".lg-menu-item");
1070
+ return r && !r.matches(":disabled") && t.contains(r) ? r : null;
1071
+ }, Te = (e) => {
1072
+ e.isPrimary && e.button === 0 && (X = {
1073
+ id: e.pointerId,
1074
+ x: e.clientX,
1075
+ y: e.clientY
1076
+ }, e.pointerType === "touch" && l.scrolls || t.setPointerCapture(e.pointerId), t.dataset.pressed = "", ge.set(1 + 5 / Math.max(t.offsetWidth, t.offsetHeight, 200)), Z(we(e.clientX, e.clientY)));
1077
+ }, Ee = (e) => {
1078
+ if (X) e.pointerId === X.id && (Z(we(e.clientX, e.clientY)), xe.set(ce(e.clientX - X.x), !0), Y.set(ce(e.clientY - X.y), !0));
1079
+ else {
1080
+ let t = e.pointerType === "mouse" ? we(e.clientX, e.clientY) : null;
1081
+ t && Z(t);
1082
+ }
1083
+ }, De = (e) => {
1084
+ if (e.pointerId !== X?.id) return;
1085
+ let n = e.type === "pointerup" ? we(e.clientX, e.clientY) : null;
1086
+ Z(null), X = null, delete t.dataset.pressed, ge.set(1), xe.set(0), Y.set(0), Ce = performance.now() + 500, n?.dispatchEvent(new MouseEvent("click", {
1087
+ bubbles: !0,
1088
+ cancelable: !0,
1089
+ ...se(e)
1090
+ }));
1091
+ }, Oe = (e) => {
1092
+ !X && e.pointerType === "mouse" && Z(null);
1093
+ }, ke = (e) => {
1094
+ let t = e.target.closest(".lg-menu-item");
1095
+ if (!t || (t instanceof HTMLAnchorElement && e.preventDefault(), e.detail !== 0 && performance.now() < Ce)) return;
1096
+ let n = H.current.items[Number(t.dataset.index)];
1097
+ if (!le(n)) return;
1098
+ let r = Object.values(se(e)).some(Boolean), i = ae(n.href);
1099
+ (!n.keepOpen || i && r) && K(), i && r ? window.open(i, "_blank", "noopener") : n.onSelect ? n.onSelect() : i && window.location.assign(i);
1100
+ }, Ae = (e) => {
1101
+ if (e.key === "Escape") e.preventDefault(), e.stopPropagation(), K();
1102
+ else if (S) return;
1103
+ else if (e.key === "Tab") K(!1);
1104
+ else if ([
1105
+ "ArrowDown",
1106
+ "ArrowUp",
1107
+ "Home",
1108
+ "End"
1109
+ ].includes(e.key)) {
1110
+ e.preventDefault(), X || Z(null);
1111
+ let t = ne(), n = t.indexOf(document.activeElement);
1112
+ t[e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus();
1113
+ }
1114
+ }, je = (e) => {
1115
+ let n = e.target;
1116
+ !t.contains(n) && !F.current?.contains(n) && K(!1);
1117
+ };
1118
+ return S || (t.addEventListener("pointerdown", Te), t.addEventListener("pointermove", Ee), t.addEventListener("pointerleave", Oe), t.addEventListener("pointerup", De), t.addEventListener("pointercancel", De), t.addEventListener("lostpointercapture", De), t.addEventListener("click", ke)), S && document.addEventListener("focusin", je), t.addEventListener("keydown", Ae), document.addEventListener("pointerdown", je, !0), window.addEventListener("scroll", oe, !0), window.addEventListener("resize", oe), () => {
1119
+ cancelAnimationFrame(k), ie?.disconnect(), document.removeEventListener("focusin", je), e.style.transform = "", [
1120
+ ge,
1121
+ xe,
1122
+ Y
1123
+ ].forEach((e) => e.stop()), y?.(), b(), V.current = null, e.style.opacity = "", t.removeEventListener("pointerdown", Te), t.removeEventListener("pointermove", Ee), t.removeEventListener("pointerleave", Oe), t.removeEventListener("pointerup", De), t.removeEventListener("pointercancel", De), t.removeEventListener("lostpointercapture", De), t.removeEventListener("click", ke), t.removeEventListener("keydown", Ae), document.removeEventListener("pointerdown", je, !0), window.removeEventListener("scroll", oe, !0), window.removeEventListener("resize", oe), be(t);
1124
+ };
1125
+ }, [G, S]), /* @__PURE__ */ k("div", {
1126
+ className: i("lg-menu", _),
1127
+ style: v,
1128
+ children: [/* @__PURE__ */ O(p, {
1129
+ ...c,
1130
+ ref: F,
1131
+ icon: A,
1132
+ "aria-label": c?.["aria-label"] ?? (s == null ? r : void 0),
1133
+ "aria-haspopup": S ? void 0 : "menu",
1134
+ "aria-expanded": C,
1135
+ "aria-controls": G ? y : void 0,
1136
+ onPointerUp: (e) => {
1137
+ if (c?.onPointerUp?.(e), e.pointerType !== "touch" || c?.disabled) return;
1138
+ let t = e.currentTarget.getBoundingClientRect();
1139
+ e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom && (W.current = e.timeStamp, w(!C));
1140
+ },
1141
+ onClick: (e) => {
1142
+ let t = W.current && e.timeStamp - W.current < 700;
1143
+ W.current = 0, t || w(!C);
1144
+ },
1145
+ children: s == null ? null : /* @__PURE__ */ k(D, { children: [s, d ? J : null] })
1146
+ }), G ? /* @__PURE__ */ k("div", {
1147
+ ref: I,
1148
+ id: y,
1149
+ role: S ? "group" : "menu",
1150
+ tabIndex: -1,
1151
+ "aria-label": r,
1152
+ className: "lg-menu-card",
1153
+ "data-phase": M,
1154
+ "data-align": l,
1155
+ "data-label": s == null ? void 0 : "",
1156
+ children: [
1157
+ /* @__PURE__ */ O("span", {
1158
+ ref: L,
1159
+ className: "lg-glass lg-menu-surface",
1160
+ "data-size-fixed": !0,
1161
+ "aria-hidden": !0
1162
+ }),
1163
+ /* @__PURE__ */ O("span", {
1164
+ ref: R,
1165
+ className: "lg-menu-glyph",
1166
+ "aria-hidden": !0,
1167
+ children: j
1168
+ }),
1169
+ /* @__PURE__ */ k("div", {
1170
+ ref: z,
1171
+ role: "none",
1172
+ className: "lg-menu-content",
1173
+ children: [/* @__PURE__ */ O("span", {
1174
+ ref: B,
1175
+ className: "lg-menu-plate",
1176
+ "aria-hidden": !0
1177
+ }), t ? t({ close: K }) : e.map((e, t) => {
1178
+ if (e === "separator") return /* @__PURE__ */ O("div", {
1179
+ role: "separator",
1180
+ className: "lg-menu-separator"
1181
+ }, t);
1182
+ if ("heading" in e) return /* @__PURE__ */ O("div", {
1183
+ role: "presentation",
1184
+ className: "lg-menu-heading",
1185
+ children: e.heading
1186
+ }, t);
1187
+ let n = e.checked !== void 0, r = {
1188
+ role: n ? "menuitemradio" : "menuitem",
1189
+ "aria-checked": n ? e.checked : void 0,
1190
+ className: i("lg-menu-item", e.className),
1191
+ "data-index": t,
1192
+ "data-destructive": e.destructive ? "" : void 0
1193
+ }, a = /* @__PURE__ */ k(D, { children: [
1194
+ n ? /* @__PURE__ */ O("span", {
1195
+ className: "lg-menu-check",
1196
+ "aria-hidden": !0,
1197
+ children: e.checked ? ge : null
1198
+ }) : null,
1199
+ e.icon,
1200
+ e.label
1201
+ ] }), o = ae(e.href);
1202
+ return o && !e.disabled ? /* @__PURE__ */ O("a", {
1203
+ href: o,
1204
+ ...r,
1205
+ children: a
1206
+ }, t) : /* @__PURE__ */ O("button", {
1207
+ type: "button",
1208
+ disabled: e.disabled,
1209
+ ...r,
1210
+ children: a
1211
+ }, t);
1212
+ })]
1213
+ })
1214
+ ]
1215
+ }) : null]
1216
+ });
1217
+ }
1218
+ // src/message.tsx
1219
+ function Y({ children: e, tone: t = "info", action: n, className: r }) {
1220
+ return /* @__PURE__ */ k(B, {
1221
+ className: i("lg-message", r),
1222
+ "data-tone": t,
1223
+ children: [/* @__PURE__ */ k("div", {
1224
+ className: "lg-message-body",
1225
+ role: t === "error" ? "alert" : "status",
1226
+ children: [/* @__PURE__ */ k("svg", {
1227
+ width: "16",
1228
+ height: "16",
1229
+ viewBox: "0 0 24 24",
1230
+ fill: "none",
1231
+ stroke: "currentColor",
1232
+ strokeWidth: "2",
1233
+ strokeLinecap: "round",
1234
+ "aria-hidden": "true",
1235
+ children: [/* @__PURE__ */ O("circle", {
1236
+ cx: "12",
1237
+ cy: "12",
1238
+ r: "9"
1239
+ }), /* @__PURE__ */ O("path", { d: t === "error" ? "M12 8v4m0 4h.01" : "M12 8h.01M12 12v4" })]
1240
+ }), /* @__PURE__ */ O("span", { children: e })]
1241
+ }), n && /* @__PURE__ */ O(p, {
1242
+ size: "small",
1243
+ onClick: n.onClick,
1244
+ children: n.label
1245
+ })]
1246
+ });
1247
+ }
1248
+ // src/internal/scroller.ts
1249
+ function X(e) {
1250
+ for (let t = e.parentElement; t; t = t.parentElement) if (/auto|scroll/.test(getComputedStyle(t).overflowY)) return t;
1251
+ return null;
1252
+ }
1253
+ // src/toolbar.tsx
1254
+ var Se = "button:not(:disabled), a[href], [tabindex]:not([tabindex='-1'])", Ce = {
1255
+ ArrowLeft: (e, t) => (e - 1 + t) % t,
1256
+ ArrowRight: (e, t) => (e + 1) % t,
1257
+ Home: () => 0,
1258
+ End: (e, t) => t - 1
1259
+ }, Z = /* @__PURE__ */ _(function({ edge: e = "uniform", className: t, onKeyDown: n, ...r }, a) {
1260
+ let o = T(null);
1261
+ return S(a, () => o.current), b(() => {
1262
+ let t = o.current;
1263
+ if (!t || e === "none") return;
1264
+ let n = X(t), r = n ?? window, i = () => t.toggleAttribute("data-scrolled", (n ? n.scrollTop : window.scrollY) > 0);
1265
+ return i(), r.addEventListener("scroll", i, { passive: !0 }), () => {
1266
+ r.removeEventListener("scroll", i), t.removeAttribute("data-scrolled");
1267
+ };
1268
+ }, [e]), /* @__PURE__ */ O("div", {
1269
+ ref: o,
1270
+ role: "toolbar",
1271
+ className: i("lg-toolbar", t),
1272
+ "data-edge": e === "none" ? void 0 : e,
1273
+ onKeyDown: (e) => {
1274
+ n?.(e);
1275
+ let t = Ce[e.key], r = e.target;
1276
+ if (e.defaultPrevented || !t || r.matches("input, textarea, select, [contenteditable]")) return;
1277
+ let i = [...e.currentTarget.querySelectorAll(Se)], a = i.indexOf(r);
1278
+ a < 0 || (e.preventDefault(), i[t(a, i.length)]?.focus());
1279
+ },
1280
+ ...r
1281
+ });
1282
+ }), we = /* @__PURE__ */ _(function({ className: e, ...t }, n) {
1283
+ let r = T(null);
1284
+ return S(n, () => r.current), s(r), /* @__PURE__ */ O("div", {
1285
+ ref: r,
1286
+ role: "group",
1287
+ className: i("lg-glass lg-toolbar-group", e),
1288
+ ...t
1289
+ });
1290
+ }), Te = 12, Ee = /* @__PURE__ */ O("svg", {
1291
+ viewBox: "0 0 26 26",
1292
+ fill: "none",
1293
+ stroke: "currentColor",
1294
+ strokeWidth: 2.8,
1295
+ strokeLinecap: "round",
1296
+ strokeLinejoin: "round",
1297
+ "aria-hidden": !0,
1298
+ children: /* @__PURE__ */ O("path", { d: "M15.75 5.5 8.25 13l7.5 7.5" })
1299
+ }), De = /* @__PURE__ */ _(function({ title: e, large: t = !0, onBack: n, backLabel: r = "Back", leading: a, trailing: o, level: s = 1, className: c, "aria-label": l = "Navigation bar", ...u }, d) {
1300
+ let f = T(null), m = T(null);
1301
+ return S(d, () => f.current), b(() => {
1302
+ let e = f.current, t = m.current;
1303
+ if (!e || !t) return;
1304
+ let n = X(e) ?? window, r = () => e.toggleAttribute("data-collapsed", t.getBoundingClientRect().bottom - Te <= e.getBoundingClientRect().bottom);
1305
+ return r(), n.addEventListener("scroll", r, { passive: !0 }), window.addEventListener("resize", r), () => {
1306
+ n.removeEventListener("scroll", r), window.removeEventListener("resize", r), e.removeAttribute("data-collapsed");
1307
+ };
1308
+ }, [t]), /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ k(Z, {
1309
+ ref: f,
1310
+ "aria-label": l,
1311
+ className: i("lg-nav", c),
1312
+ "data-large": t ? "" : void 0,
1313
+ ...u,
1314
+ children: [
1315
+ /* @__PURE__ */ k("div", {
1316
+ className: "lg-nav-side",
1317
+ children: [n && /* @__PURE__ */ O(we, {
1318
+ role: "presentation",
1319
+ children: /* @__PURE__ */ O(p, {
1320
+ "aria-label": r,
1321
+ icon: Ee,
1322
+ onClick: n
1323
+ })
1324
+ }), a]
1325
+ }),
1326
+ /* @__PURE__ */ O("span", {
1327
+ className: "lg-nav-title",
1328
+ role: t ? void 0 : "heading",
1329
+ "aria-level": t ? void 0 : s,
1330
+ "aria-hidden": t ? !0 : void 0,
1331
+ children: e
1332
+ }),
1333
+ /* @__PURE__ */ O("div", {
1334
+ className: "lg-nav-side",
1335
+ "data-side": "trailing",
1336
+ children: o
1337
+ })
1338
+ ]
1339
+ }), t && /* @__PURE__ */ O("div", {
1340
+ ref: m,
1341
+ className: "lg-nav-large",
1342
+ role: "heading",
1343
+ "aria-level": s,
1344
+ children: e
1345
+ })] });
1346
+ }), Oe = /* @__PURE__ */ _(function({ count: e, value: t, defaultValue: n = 0, onValueChange: r, glass: a = !0, className: o, ...s }, c) {
1347
+ let [l, u] = P(t, n, r), d = Math.max(0, Math.floor(e)), f = Math.min(Math.max(l, 0), Math.max(d - 1, 0)), p = (e) => {
1348
+ e >= 0 && e < d && e !== f && u(e);
1349
+ }, m = Array.from({ length: d }, (e, t) => /* @__PURE__ */ O("button", {
1350
+ type: "button",
1351
+ className: "lg-page-dot",
1352
+ "aria-label": `Page ${t + 1} of ${d}`,
1353
+ "aria-current": t === f ? "page" : void 0,
1354
+ tabIndex: t === f ? 0 : -1,
1355
+ onClick: () => p(t)
1356
+ }, t)), h = /* @__PURE__ */ O("div", {
1357
+ className: "lg-page-dots",
1358
+ onKeyDown: (e) => {
1359
+ let t = {
1360
+ ArrowLeft: f - 1,
1361
+ ArrowUp: f - 1,
1362
+ ArrowRight: f + 1,
1363
+ ArrowDown: f + 1,
1364
+ Home: 0,
1365
+ End: d - 1
1366
+ }[e.key];
1367
+ t !== void 0 && (e.preventDefault(), p(t), e.currentTarget.children[Math.min(Math.max(t, 0), d - 1)]?.focus());
1368
+ },
1369
+ children: m
1370
+ });
1371
+ return O(a ? B : "div", {
1372
+ ref: c,
1373
+ role: "group",
1374
+ className: i("lg-page-control", o),
1375
+ ...s,
1376
+ children: h
1377
+ });
1378
+ }), ke = /* @__PURE__ */ k("svg", {
1379
+ viewBox: "0 0 16 16",
1380
+ fill: "none",
1381
+ stroke: "currentColor",
1382
+ strokeWidth: 1.5,
1383
+ strokeLinecap: "round",
1384
+ "aria-hidden": !0,
1385
+ children: [/* @__PURE__ */ O("circle", {
1386
+ cx: "7",
1387
+ cy: "7",
1388
+ r: "4.75"
1389
+ }), /* @__PURE__ */ O("path", { d: "m10.5 10.5 3.25 3.25" })]
1390
+ }), Ae = /* @__PURE__ */ _(function({ icon: e = ke, placeholder: t = "Search", ...n }, r) {
1391
+ return /* @__PURE__ */ O(ie, {
1392
+ ref: r,
1393
+ type: "search",
1394
+ icon: e,
1395
+ placeholder: t,
1396
+ ...n
1397
+ });
1398
+ }), je = 650, Me = 24, Ne = .3, Pe = 1.2, Fe = .55, Ie = {
1399
+ x: 1,
1400
+ y: 1,
1401
+ shift: 0
1402
+ };
1403
+ function Le(e, t, n = 0) {
1404
+ if (!e || t <= 0) return Ie;
1405
+ let r = Ne * Math.tanh(Math.abs(e) / (t * Pe));
1406
+ return r < 1e-4 ? Ie : {
1407
+ x: 1 + r,
1408
+ y: 1 - Fe * r,
1409
+ shift: -e * n
1410
+ };
1411
+ }
1412
+ function Re(e, t, n = 0) {
1413
+ let r = 0, i = !1, a = Ie, s = o(0, je, Me, (i) => {
1414
+ let o = Le(r - i, e(), n);
1415
+ (o.x !== a.x || o.y !== a.y || o.shift !== a.shift) && (a = o, t(o));
1416
+ });
1417
+ return {
1418
+ follow(e, t = !1) {
1419
+ r = e;
1420
+ let n = t || !i;
1421
+ i = !0, s.set(e, n);
1422
+ },
1423
+ stop: () => s.stop()
1424
+ };
1425
+ }
1426
+ // src/segmented-control.tsx
1427
+ var ze = 25, Be = 28, Ve = 44, He = 4, Ue = 240, We = 300, Ge = /* @__PURE__ */ _(function({ items: e, value: t, defaultValue: n, onValueChange: r, className: a, style: c, ...l }, u) {
1428
+ let [d, f] = P(t, n ?? e[0]?.value, r), p = T(null), m = T(null), h = T(null), g = T(null), _ = T(!1), v = T(() => {}), y = Math.max(0, e.findIndex((e) => e.value === d)), x = T({
1429
+ items: e,
1430
+ index: y,
1431
+ setValue: f
1432
+ });
1433
+ S(u, () => p.current), s(h, !0), b(() => {
1434
+ x.current = {
1435
+ items: e,
1436
+ index: y,
1437
+ setValue: f
1438
+ };
1439
+ }), b(() => {
1440
+ let e = p.current, t = m.current, n = h.current, r = y, i = 0, a = {
1441
+ x: 1,
1442
+ y: 1
1443
+ }, s = 0, c = Ie, l = () => e.getBoundingClientRect().width / Math.max(x.current.items.length, 1), u = () => {
1444
+ let e = l();
1445
+ s = e;
1446
+ let o = e - 4, c = o + ze, u = Math.min(1, Math.max(0, i));
1447
+ a = {
1448
+ x: o / c + (1 - o / c) * i,
1449
+ y: Be / Ve + (1 - Be / Ve) * i
1450
+ }, t.style.transform = `translateX(${r * e}px)`, t.style.opacity = String(1 - u), n.style.opacity = String(Math.min(1, u * 4)), n.style.visibility = u > .001 ? "visible" : "hidden", n.style.setProperty("--lg-lift", String(u)), f.follow(r * e, u < .01), d();
1451
+ }, d = () => {
1452
+ n.style.transform = `translate(${r * s + c.shift}px, -50%) scale(${a.x * c.x}, ${a.y * c.y})`;
1453
+ }, f = Re(() => n.offsetWidth, (e) => {
1454
+ c = e, d();
1455
+ }, .35), b = o(y, 443, 34, (e) => {
1456
+ r = e, u();
1457
+ }), S = o(0, 2e3, 80, (e) => {
1458
+ i = e, u();
1459
+ });
1460
+ b.paint(), g.current = b;
1461
+ let C = 0, w = 0, T = () => {
1462
+ clearTimeout(C), w = performance.now(), S.tune(2e3, 80), S.set(1);
1463
+ }, E = () => {
1464
+ clearTimeout(C), C = window.setTimeout(() => {
1465
+ S.tune(600, 49), S.set(0);
1466
+ }, Math.max(0, Ue - (performance.now() - w)));
1467
+ };
1468
+ v.current = () => {
1469
+ clearTimeout(C), S.tune(2e3, 80), S.set(1), C = window.setTimeout(() => {
1470
+ S.tune(600, 49), S.set(0);
1471
+ }, We);
1472
+ };
1473
+ let D = null, O = !1, k = (e) => {
1474
+ let { items: t, index: n } = x.current, r = n, i = Infinity;
1475
+ return t.forEach((t, n) => {
1476
+ !t.disabled && Math.abs(n - e) < i && (r = n, i = Math.abs(n - e));
1477
+ }), r;
1478
+ }, A = (t) => {
1479
+ if (!t.isPrimary || t.button) return;
1480
+ let n = t.target.closest(".lg-segment");
1481
+ n && !n.disabled && (_.current = !1, Number(n.dataset.index) === x.current.index && (O = !0, T(), D = {
1482
+ id: t.pointerId,
1483
+ x: t.clientX,
1484
+ from: x.current.index
1485
+ }, e.setPointerCapture?.(t.pointerId)));
1486
+ }, j = (e) => {
1487
+ if (e.pointerId !== D?.id) return;
1488
+ let t = e.clientX - D.x;
1489
+ if (!_.current && Math.abs(t) < He) return;
1490
+ _.current = !0;
1491
+ let n = x.current.items.length - 1;
1492
+ b.set(Math.min(n, Math.max(0, D.from + t / Math.max(l(), 1))), !0);
1493
+ }, M = (e) => {
1494
+ if (O && E(), O = !1, e.pointerId !== D?.id) return;
1495
+ D = null;
1496
+ let { items: t, index: n, setValue: i } = x.current;
1497
+ if (_.current && e.type === "pointerup") {
1498
+ let e = t[k(r)];
1499
+ e && t.indexOf(e) !== n && i(e.value);
1500
+ }
1501
+ queueMicrotask(() => b.set(x.current.index));
1502
+ };
1503
+ return e.addEventListener("pointerdown", A), e.addEventListener("pointermove", j), window.addEventListener("pointerup", M), window.addEventListener("pointercancel", M), () => {
1504
+ clearTimeout(C), e.removeEventListener("pointerdown", A), e.removeEventListener("pointermove", j), window.removeEventListener("pointerup", M), window.removeEventListener("pointercancel", M), b.stop(), S.stop(), f.stop();
1505
+ };
1506
+ }, []), b(() => {
1507
+ g.current?.set(y);
1508
+ }, [y]);
1509
+ let C = (t) => {
1510
+ let n = {
1511
+ ArrowLeft: -1,
1512
+ ArrowUp: -1,
1513
+ ArrowRight: 1,
1514
+ ArrowDown: 1
1515
+ }[t.key];
1516
+ if (!n) return;
1517
+ t.preventDefault();
1518
+ let r = e.filter((e) => !e.disabled), i = r[(r.findIndex((e) => e.value === d) + n + r.length) % r.length];
1519
+ i && (f(i.value), t.currentTarget.querySelector(`[data-index="${e.indexOf(i)}"]`)?.focus());
1520
+ };
1521
+ return /* @__PURE__ */ k("div", {
1522
+ ref: p,
1523
+ role: "radiogroup",
1524
+ className: i("lg-segmented", a),
1525
+ style: {
1526
+ ...c,
1527
+ "--lg-segments": e.length
1528
+ },
1529
+ onKeyDown: C,
1530
+ ...l,
1531
+ children: [
1532
+ /* @__PURE__ */ O("span", {
1533
+ ref: m,
1534
+ className: "lg-segmented-thumb",
1535
+ "aria-hidden": !0
1536
+ }),
1537
+ /* @__PURE__ */ O("span", {
1538
+ ref: h,
1539
+ className: "lg-glass lg-segmented-lens",
1540
+ "aria-hidden": !0
1541
+ }),
1542
+ e.map((e, t) => /* @__PURE__ */ O("button", {
1543
+ type: "button",
1544
+ role: "radio",
1545
+ className: "lg-segment",
1546
+ "aria-checked": t === y,
1547
+ tabIndex: t === y ? 0 : -1,
1548
+ disabled: e.disabled,
1549
+ "data-index": t,
1550
+ onClick: () => {
1551
+ !_.current && t !== y && (v.current(), f(e.value)), _.current = !1;
1552
+ },
1553
+ children: e.label
1554
+ }, e.value))
1555
+ ]
1556
+ });
1557
+ }), Ke = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"], [draggable=\"true\"], [data-lg-no-sheet-drag]";
1558
+ function qe(e) {
1559
+ return e.closest(Ke) !== null;
1560
+ }
1561
+ function Je(e, t) {
1562
+ let n = [];
1563
+ for (let r = e; r; r = r === t ? null : r.parentElement) r instanceof HTMLElement && /auto|scroll|overlay/.test(getComputedStyle(r).overflowY) && r.scrollHeight > r.clientHeight + 1 && n.push(r);
1564
+ return n;
1565
+ }
1566
+ function Ye(e, t, n, r) {
1567
+ return e < 0 ? t < n - .5 ? "sheet" : "content" : r ? "content" : "sheet";
1568
+ }
1569
+ function Xe(e, t, n) {
1570
+ if (e <= t) return {
1571
+ height: e,
1572
+ scroll: 0
1573
+ };
1574
+ let r = e - t, i = Math.min(r, Math.max(n, 0));
1575
+ return {
1576
+ height: t + (r - i) / 3,
1577
+ scroll: i
1578
+ };
1579
+ }
1580
+ // src/sheet.tsx
1581
+ var Ze = .516, Qe = 67, $e = 8, et = 8, tt = 38, nt = [700, 65];
1582
+ function rt({ open: e, defaultOpen: a = !1, onOpenChange: s, detents: c = ["medium", "large"], children: l, className: u, "aria-label": d }) {
1583
+ let [f, p] = P(e, a, s), m = T(null), h = T(null), g = T(null), _ = T(null), { phase: v, finished: y } = I(m, f, () => p(!1)), x = T({
1584
+ finished: y,
1585
+ detents: c,
1586
+ phase: v
1587
+ });
1588
+ b(() => {
1589
+ x.current = {
1590
+ finished: y,
1591
+ detents: c,
1592
+ phase: v
1593
+ };
1594
+ }), b(() => {
1595
+ if (v === "closed") return;
1596
+ let e = h.current, i = g.current, a = () => {
1597
+ let e = m.current?.clientHeight || innerHeight;
1598
+ return x.current.detents.map((t) => t === "medium" ? e * Ze : e - Qe);
1599
+ }, s, c = 0, l = (t) => {
1600
+ c = t;
1601
+ let n = m.current?.clientHeight || innerHeight, r = n * Ze, o = n - Qe, s = Math.min(1, Math.max(0, (t - r) / (o - r))), l = x.current.detents.length ? Math.min(...a()) : r, u = $e * (1 - s);
1602
+ e.style.left = e.style.right = `${u}px`, e.style.bottom = `${et * (1 - s)}px`, e.style.height = `${Math.max(l, t)}px`, e.style.transform = t < l ? `translateY(${l - t}px)` : "", e.style.setProperty("--lg-sheet-full", String(s)), e.style.borderRadius = `${tt + 0 * s}px ${tt + 0 * s}px ${tt * (1 - s)}px ${tt * (1 - s)}px`, i.style.opacity = String(Math.min(1, Math.max(0, t / l))), t === 0 && x.current.phase === "leaving" && x.current.finished();
1603
+ }, u = o(0, nt[0], nt[1], (e) => {
1604
+ s?.(), s = void 0, l(e);
1605
+ });
1606
+ _.current = {
1607
+ spring: u,
1608
+ heights: a
1609
+ }, u.paint();
1610
+ let d = r(e), f = a()[0] ?? 0, p = t(() => u.set(f, L())), y = setInterval(() => {
1611
+ !s && Math.abs(c - f) < .01 && x.current.phase === "open" && (s = n(e));
1612
+ }, 300);
1613
+ return () => {
1614
+ p(), clearInterval(y), u.stop(), s?.(), d(), _.current = null;
1615
+ };
1616
+ }, [v === "closed"]), b(() => {
1617
+ v === "leaving" && _.current?.spring.set(0, L()), v === "open" && _.current?.spring.set(_.current.heights()[0] ?? 0, L());
1618
+ }, [v]);
1619
+ let S = T(null), C = T(0), w = () => h.current.getBoundingClientRect().height - (new DOMMatrix(getComputedStyle(h.current).transform).m42 || 0), E = () => Math.max(..._.current?.heights() ?? [0]), A = (e, t, n) => {
1620
+ let r = h.current;
1621
+ e.claimed = !0, e.startY = e.lastY = t, e.lastAt = n, e.speed = 0, e.startHeight = w(), e.scroller = e.scrolling.find((e) => e.scrollTop < e.scrollHeight - e.clientHeight - 1) ?? null, e.scrollStart = e.scroller?.scrollTop ?? 0, r.setAttribute("data-dragging", "");
1622
+ try {
1623
+ r.setPointerCapture(e.id);
1624
+ } catch {}
1625
+ getSelection()?.removeAllRanges();
1626
+ }, j = (e, t, n, r) => {
1627
+ if (e.claimed) return !0;
1628
+ let i = t - e.startX, a = n - e.startY;
1629
+ if (Math.max(Math.abs(i), Math.abs(a)) < 8) return !1;
1630
+ let o = e.scrolling.some((e) => e.scrollTop > 0);
1631
+ return Math.abs(i) > Math.abs(a) || Ye(a, w(), E(), o) === "content" ? (S.current = null, !1) : (A(e, n, r), !0);
1632
+ };
1633
+ b(() => {
1634
+ let e = h.current;
1635
+ if (!e) return;
1636
+ let t = (e) => {
1637
+ let t = S.current, n = e.touches[0];
1638
+ t && n && j(t, n.clientX, n.clientY, e.timeStamp) && e.cancelable && e.preventDefault();
1639
+ };
1640
+ return e.addEventListener("touchmove", t, { passive: !1 }), () => e.removeEventListener("touchmove", t);
1641
+ }, [v === "closed"]);
1642
+ let M = (e) => {
1643
+ if (e.pointerType === "mouse" && e.button !== 0) return;
1644
+ let t = e.target, n = t.closest(".lg-sheet-handle") !== null;
1645
+ if (!n && qe(t)) return;
1646
+ let r = {
1647
+ id: e.pointerId,
1648
+ startX: e.clientX,
1649
+ startY: e.clientY,
1650
+ startHeight: 0,
1651
+ lastY: e.clientY,
1652
+ lastAt: e.timeStamp,
1653
+ speed: 0,
1654
+ claimed: !1,
1655
+ scrolling: n ? [] : Je(t, h.current),
1656
+ scroller: null,
1657
+ scrollStart: 0
1658
+ };
1659
+ S.current = r, n && A(r, e.clientY, e.timeStamp);
1660
+ }, N = (e) => {
1661
+ let t = S.current;
1662
+ if (!t || e.pointerId !== t.id) return;
1663
+ if (e.pointerType === "mouse" && e.buttons === 0) return F(e);
1664
+ if (!j(t, e.clientX, e.clientY, e.timeStamp)) return;
1665
+ let n = e.timeStamp - t.lastAt;
1666
+ n > 0 && (t.speed = (t.lastY - e.clientY) / n * 1e3), t.lastY = e.clientY, t.lastAt = e.timeStamp;
1667
+ let { scroller: r } = t, i = r ? r.scrollHeight - r.clientHeight - t.scrollStart : 0, { height: a, scroll: o } = Xe(t.startHeight + t.startY - e.clientY, E(), i);
1668
+ r && (r.scrollTop = t.scrollStart + o), _.current?.spring.set(a, !0);
1669
+ }, F = (e) => {
1670
+ let t = S.current;
1671
+ if (!t || e.pointerId !== t.id || (S.current = null, !t.claimed)) return;
1672
+ h.current?.removeAttribute("data-dragging"), e.type === "pointerup" && (window.clearTimeout(C.current), C.current = window.setTimeout(() => C.current = 0, 100));
1673
+ let n = _.current?.heights() ?? [], r = Math.min(...n), i = w();
1674
+ if (i < r * .7 || t.speed < -500 && i <= r) {
1675
+ p(!1);
1676
+ return;
1677
+ }
1678
+ let a = i + t.speed * .15, o = n.reduce((e, t) => Math.abs(t - a) < Math.abs(e - a) ? t : e, n[0] ?? 0);
1679
+ _.current?.spring.set(o);
1680
+ };
1681
+ return /* @__PURE__ */ O("dialog", {
1682
+ ref: m,
1683
+ className: i("lg-modal lg-sheet-dialog", u),
1684
+ "data-phase": v,
1685
+ "aria-label": d,
1686
+ children: v === "closed" ? null : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("span", {
1687
+ ref: g,
1688
+ className: "lg-modal-scrim",
1689
+ "aria-hidden": !0,
1690
+ onClick: () => p(!1)
1691
+ }), /* @__PURE__ */ k("div", {
1692
+ ref: h,
1693
+ className: "lg-glass lg-sheet",
1694
+ onPointerDown: M,
1695
+ onPointerMove: N,
1696
+ onPointerUp: F,
1697
+ onPointerCancel: F,
1698
+ onClickCapture: (e) => {
1699
+ C.current && (e.preventDefault(), e.stopPropagation());
1700
+ },
1701
+ children: [/* @__PURE__ */ O("div", {
1702
+ className: "lg-sheet-handle",
1703
+ children: /* @__PURE__ */ O("span", {
1704
+ className: "lg-sheet-grabber",
1705
+ "aria-hidden": !0
1706
+ })
1707
+ }), /* @__PURE__ */ O("div", {
1708
+ className: "lg-sheet-content",
1709
+ children: l
1710
+ })]
1711
+ })] })
1712
+ });
1713
+ }
1714
+ // src/slider.tsx
1715
+ var it = 37, at = /* @__PURE__ */ _(function({ value: e, defaultValue: t, onValueChange: n, min: r = 0, max: a = 100, step: c = 1, className: l, style: u, ...d }, f) {
1716
+ let p = T(null), m = T(null), h = T(null), g = T(null), [_, v] = P(e, t ?? r, n), y = a > r ? Math.min(1, Math.max(0, (_ - r) / (a - r))) : 0;
1717
+ S(f, () => p.current), s(m, !0);
1718
+ let x = T({
1719
+ value: _,
1720
+ setValue: v,
1721
+ min: r,
1722
+ max: a,
1723
+ step: c
1724
+ });
1725
+ return b(() => {
1726
+ x.current = {
1727
+ value: _,
1728
+ setValue: v,
1729
+ min: r,
1730
+ max: a,
1731
+ step: c
1732
+ };
1733
+ }), b(() => {
1734
+ let e = g.current;
1735
+ e && e.jelly.follow(e.place(), !e.held);
1736
+ }, [y]), b(() => {
1737
+ let e = p.current, t = m.current, n = h.current, r = o(0, 2e3, 80, (e) => {
1738
+ let r = Math.min(1, Math.max(0, e));
1739
+ t.style.scale = String(.627 + .373 * e), n.style.opacity = String(1 - r), t.style.setProperty("--lg-lift", String(r));
1740
+ }), i = e.parentElement, a = {
1741
+ held: !1,
1742
+ place: () => {
1743
+ let { value: e, min: t, max: n } = x.current;
1744
+ return (i.offsetWidth - it) * (e - t) / Math.max(n - t, 1e-6);
1745
+ },
1746
+ jelly: Re(() => t.offsetWidth, (e) => {
1747
+ t.style.transform = e.x === 1 && e.y === 1 && !e.shift ? "" : `translateX(${e.shift}px) scale(${e.x}, ${e.y})`;
1748
+ }, .35)
1749
+ };
1750
+ g.current = a;
1751
+ let s = 0, c = 0, l = () => {
1752
+ e.disabled || (clearTimeout(s), c = performance.now(), r.tune(2e3, 80), r.set(1), a.held = !0, a.jelly.follow(a.place(), !0));
1753
+ }, u = () => {
1754
+ clearTimeout(s), s = window.setTimeout(() => {
1755
+ r.tune(600, 49), r.set(0), a.held = !1;
1756
+ }, Math.max(0, 240 - (performance.now() - c)));
1757
+ }, d = [
1758
+ "pointerup",
1759
+ "pointercancel",
1760
+ "lostpointercapture",
1761
+ "blur"
1762
+ ], f = null, _ = (t) => {
1763
+ if (t.pointerType !== "touch" || !t.isPrimary || e.disabled || !matchMedia("(pointer: coarse)").matches) return;
1764
+ let { value: n, min: r, max: a } = x.current, o = i.getBoundingClientRect(), s = o.width - it, c = o.left + it / 2 + s * (n - r) / Math.max(a - r, 1e-6);
1765
+ Math.abs(t.clientX - c) > 30.5 || (f = {
1766
+ id: t.pointerId,
1767
+ x: t.clientX,
1768
+ from: n,
1769
+ span: s
1770
+ }, i.setPointerCapture?.(t.pointerId), l());
1771
+ }, v = (e) => {
1772
+ if (e.pointerId !== f?.id) return;
1773
+ let { setValue: t, value: n, min: r, max: i, step: a } = x.current, o = f.from + (e.clientX - f.x) / Math.max(f.span, 1) * (i - r), s = r + Math.round((o - r) / a) * a, c = Math.min(i, Math.max(r, Number(s.toFixed(6))));
1774
+ c !== n && t(c);
1775
+ }, y = (e) => {
1776
+ e.pointerId === f?.id && (f = null, u());
1777
+ };
1778
+ return i.addEventListener("pointerdown", _), i.addEventListener("pointermove", v), i.addEventListener("pointerup", y), i.addEventListener("pointercancel", y), e.addEventListener("pointerdown", l), d.forEach((t) => e.addEventListener(t, u)), window.addEventListener("pointerup", u), () => {
1779
+ clearTimeout(s), i.removeEventListener("pointerdown", _), i.removeEventListener("pointermove", v), i.removeEventListener("pointerup", y), i.removeEventListener("pointercancel", y), r.stop(), a.jelly.stop(), g.current = null, t.style.transform = "", e.removeEventListener("pointerdown", l), d.forEach((t) => e.removeEventListener(t, u)), window.removeEventListener("pointerup", u);
1780
+ };
1781
+ }, []), /* @__PURE__ */ k("div", {
1782
+ className: i("lg-slider", l),
1783
+ style: {
1784
+ ...u,
1785
+ "--lg-progress": y
1786
+ },
1787
+ children: [
1788
+ /* @__PURE__ */ O("span", {
1789
+ className: "lg-slider-track",
1790
+ "aria-hidden": !0,
1791
+ children: /* @__PURE__ */ O("span", { className: "lg-slider-fill" })
1792
+ }),
1793
+ /* @__PURE__ */ O("span", {
1794
+ ref: m,
1795
+ className: "lg-glass lg-slider-thumb",
1796
+ "aria-hidden": !0,
1797
+ children: /* @__PURE__ */ O("span", {
1798
+ ref: h,
1799
+ className: "lg-thumb-face"
1800
+ })
1801
+ }),
1802
+ /* @__PURE__ */ O("input", {
1803
+ ref: p,
1804
+ type: "range",
1805
+ min: r,
1806
+ max: a,
1807
+ step: c,
1808
+ value: _,
1809
+ onChange: (e) => v(e.currentTarget.valueAsNumber),
1810
+ ...d
1811
+ })
1812
+ ]
1813
+ });
1814
+ }), ot = (e) => /* @__PURE__ */ O("svg", {
1815
+ viewBox: "0 0 16 16",
1816
+ fill: "none",
1817
+ stroke: "currentColor",
1818
+ strokeWidth: 2,
1819
+ strokeLinecap: "round",
1820
+ "aria-hidden": !0,
1821
+ children: /* @__PURE__ */ O("path", { d: e })
1822
+ }), st = /* @__PURE__ */ _(function({ value: e, defaultValue: t = 0, onValueChange: n, min: r = -Infinity, max: a = Infinity, step: o = 1, disabled: s, className: c, ...u }, d) {
1823
+ let { locale: f } = l(), [p, m] = P(e, t, n), h = (e) => m(Math.min(a, Math.max(r, p + e * o)));
1824
+ return /* @__PURE__ */ k("div", {
1825
+ ref: d,
1826
+ role: "group",
1827
+ className: i("lg-stepper", c),
1828
+ ...u,
1829
+ children: [
1830
+ /* @__PURE__ */ O("button", {
1831
+ type: "button",
1832
+ className: "lg-stepper-button",
1833
+ "aria-label": f.decrease,
1834
+ disabled: s || p <= r,
1835
+ onClick: () => h(-1),
1836
+ children: ot("M1.5 8h13")
1837
+ }),
1838
+ /* @__PURE__ */ O("span", {
1839
+ className: "lg-stepper-divider",
1840
+ "aria-hidden": !0
1841
+ }),
1842
+ /* @__PURE__ */ O("button", {
1843
+ type: "button",
1844
+ className: "lg-stepper-button",
1845
+ "aria-label": f.increase,
1846
+ disabled: s || p >= a,
1847
+ onClick: () => h(1),
1848
+ children: ot("M1.5 8h13M8 1.5v13")
1849
+ })
1850
+ ]
1851
+ });
1852
+ }), ct = (e, t) => t || performance.now() - e >= 150, lt = 22, ut = 300, dt = (e) => Math.min(1, Math.max(0, e)), ft = /* @__PURE__ */ _(function({ checked: e, defaultChecked: t = !1, onCheckedChange: n, className: r, ...a }, c) {
1853
+ let l = T(null), u = T(null), d = T(null), f = T(null);
1854
+ s(d, !0);
1855
+ let [p, m] = P(e, t, n), h = T({
1856
+ checked: p,
1857
+ setChecked: m
1858
+ }), g = T(null);
1859
+ return S(c, () => l.current), b(() => {
1860
+ h.current = {
1861
+ checked: p,
1862
+ setChecked: m
1863
+ }, g.current?.position.set(+!!p), g.current?.color.set(+!!p);
1864
+ }, [p, m]), b(() => {
1865
+ let e = l.current, t = u.current, n = d.current, r = f.current, i = 0, a = .627, s = Ie, c = () => {
1866
+ n.style.transform = `translate(${i}px, -50%) scale(${a * s.x}, ${a * s.y})`;
1867
+ }, p = Re(() => n.offsetWidth, (e) => {
1868
+ s = e, c();
1869
+ }), m = +!!h.current.checked, _ = o(m, 1e3, 80, (e) => {
1870
+ i = e * lt, p.follow(i), c();
1871
+ }), v = o(m, 300, 35, (e) => {
1872
+ t.style.opacity = String(dt(e));
1873
+ }), y = o(0, 2e3, 80, (e) => {
1874
+ a = .627 + .373 * e, r.style.opacity = String(1 - dt(e)), n.style.setProperty("--lg-lift", String(dt(e))), c();
1875
+ });
1876
+ g.current = {
1877
+ position: _,
1878
+ color: v
1879
+ }, _.paint(), v.paint(), y.paint();
1880
+ let b = null, x = !1, S = () => {
1881
+ _.set(+!!h.current.checked), v.set(+!!h.current.checked);
1882
+ }, C = 0, w = (e) => {
1883
+ clearTimeout(C), C = window.setTimeout(() => {
1884
+ y.tune(600, 49), y.set(0);
1885
+ }, Math.max(0, ut - (performance.now() - e)));
1886
+ }, T = (t) => {
1887
+ let n = b;
1888
+ if (b = null, w(n?.at ?? 0), n && e.hasPointerCapture(n.id) && e.releasePointerCapture(n.id), t === void 0 || t === h.current.checked) return S();
1889
+ h.current.setChecked(t), requestAnimationFrame(S);
1890
+ }, E = (t) => {
1891
+ t.isPrimary && t.button === 0 && !e.disabled && (t.preventDefault(), x = !1, b = {
1892
+ id: t.pointerId,
1893
+ x: t.clientX,
1894
+ y: t.clientY,
1895
+ from: +!!h.current.checked,
1896
+ moved: !1,
1897
+ at: performance.now(),
1898
+ box: e.getBoundingClientRect()
1899
+ }, e.setPointerCapture(t.pointerId), clearTimeout(C), y.tune(2e3, 80), y.set(1));
1900
+ }, D = (e) => {
1901
+ if (e.pointerId !== b?.id) return;
1902
+ let t = e.clientX - b.x, n = Math.abs(e.clientY - b.y);
1903
+ if (!ct(b.at, b.moved) && n > 10 && n > Math.abs(t) + 4) return x = !0, T();
1904
+ if (!b.moved && Math.abs(t) < 4) return;
1905
+ b.moved = !0;
1906
+ let r = b.from + t / lt, i = r < 0 ? r : r > 1 ? r - 1 : 0;
1907
+ _.set(dt(r) + i / 22), v.set(+(r > .5));
1908
+ }, O = (e) => {
1909
+ if (e.pointerId !== b?.id) return;
1910
+ x = !0;
1911
+ let { from: t, x: n, moved: r, box: i } = b, a = t + (e.clientX - n) / lt, o = e.clientY >= i.top - 24 && e.clientY <= i.bottom + 24;
1912
+ T(r ? a > .5 : o ? !h.current.checked : void 0);
1913
+ }, k = (e) => {
1914
+ b && e.cancelable && ct(b.at, b.moved) && e.preventDefault();
1915
+ }, A = () => {
1916
+ b && (x = !0, T());
1917
+ }, j = () => {
1918
+ x ? x = !1 : e.disabled || h.current.setChecked(!h.current.checked);
1919
+ };
1920
+ return e.addEventListener("pointerdown", E), e.addEventListener("pointermove", D), e.addEventListener("pointerup", O), e.addEventListener("pointercancel", A), e.addEventListener("lostpointercapture", A), e.addEventListener("touchmove", k, { passive: !1 }), e.addEventListener("click", j), () => {
1921
+ g.current = null, clearTimeout(C), [
1922
+ _,
1923
+ v,
1924
+ y,
1925
+ p
1926
+ ].forEach((e) => e.stop()), e.removeEventListener("pointerdown", E), e.removeEventListener("pointermove", D), e.removeEventListener("pointerup", O), e.removeEventListener("pointercancel", A), e.removeEventListener("lostpointercapture", A), e.removeEventListener("touchmove", k), e.removeEventListener("click", j);
1927
+ };
1928
+ }, []), /* @__PURE__ */ k("button", {
1929
+ ref: l,
1930
+ type: "button",
1931
+ role: "switch",
1932
+ "aria-checked": p,
1933
+ className: i("lg-switch", r),
1934
+ ...a,
1935
+ children: [/* @__PURE__ */ O("span", {
1936
+ ref: u,
1937
+ className: "lg-switch-fill",
1938
+ "aria-hidden": !0
1939
+ }), /* @__PURE__ */ O("span", {
1940
+ ref: d,
1941
+ className: "lg-glass lg-switch-thumb",
1942
+ "aria-hidden": !0,
1943
+ children: /* @__PURE__ */ O("span", {
1944
+ ref: f,
1945
+ className: "lg-thumb-face"
1946
+ })
1947
+ })]
1948
+ });
1949
+ }), pt = "http://www.w3.org/2000/svg", mt = .9, ht = /* @__PURE__ */ new Map(), gt;
1950
+ function Q(e, t) {
1951
+ let n = document.createElementNS(pt, e);
1952
+ for (let [e, r] of Object.entries(t)) n.setAttribute(e, String(r));
1953
+ return n;
1954
+ }
1955
+ function _t() {
1956
+ if (gt?.isConnected) return gt;
1957
+ let e = Q("svg", {
1958
+ width: 0,
1959
+ height: 0,
1960
+ "aria-hidden": "true"
1961
+ });
1962
+ return e.style.cssText = "position:absolute;width:0;height:0;pointer-events:none", gt = Q("defs", {}), e.append(gt), document.body.append(e), gt;
1963
+ }
1964
+ function vt(e, t) {
1965
+ let n = Math.min(devicePixelRatio || 1, 2), r = document.createElement("canvas");
1966
+ r.width = Math.max(1, Math.ceil(e * n)), r.height = Math.max(1, Math.ceil(t * n));
1967
+ let i = r.getContext("2d");
1968
+ if (!i) return null;
1969
+ let a = i.createImageData(r.width, r.height), o = i.createImageData(r.width, r.height), s = i.createImageData(r.width, r.height), c = Math.min(e, t) / 2;
1970
+ for (let n = 0; n < r.height; n++) for (let i = 0; i < r.width; i++) {
1971
+ let l = (i + .5) * e / r.width - e / 2, u = (n + .5) * t / r.height - t / 2, d = Math.abs(l) - (e / 2 - c), f = Math.abs(u) - (t / 2 - c), p = Math.max(d, 0), m = Math.max(f, 0), h = Math.hypot(p, m), g = c - (h + Math.min(Math.max(d, f), 0)), _ = h > 0 ? p / h * Math.sign(l) : d > f ? Math.sign(l) : 0, v = h > 0 ? m / h * Math.sign(u) : d > f ? 0 : Math.sign(u), y = yt(1 - Math.max(g, 0) / 15), b = y * y, x = (n * r.width + i) * 4, S = Math.round(127.5 - _ * b * 127.5), C = Math.round(127.5 - v * b * 127.5);
1972
+ a.data.fill(S, x, x + 3), a.data[x + 3] = 255, o.data.fill(C, x, x + 3), o.data[x + 3] = 255, s.data[x + 3] = Math.round(y * 255);
1973
+ }
1974
+ i.putImageData(a, 0, 0);
1975
+ let l = r.toDataURL();
1976
+ i.putImageData(o, 0, 0);
1977
+ let u = r.toDataURL();
1978
+ return i.putImageData(s, 0, 0), [
1979
+ l,
1980
+ u,
1981
+ r.toDataURL()
1982
+ ];
1983
+ }
1984
+ var yt = (e) => Math.min(1, Math.max(0, e)), bt = () => /AppleWebKit\//.test(navigator.userAgent) && !/Chrom(?:e|ium)\//.test(navigator.userAgent);
1985
+ function xt(e, t, n) {
1986
+ let r = Math.round(e * 2) / 2, i = Math.round(t * 2) / 2, a = `${r}x${i}${n ? "-dark" : ""}`, o = ht.get(a);
1987
+ if (o) return o;
1988
+ let s = vt(r, i);
1989
+ if (!s) return [];
1990
+ let [c, l, u] = s, d = [], f = `liquidglass-bend-${ht.size}`, p = n ? [
1991
+ [
1992
+ "r",
1993
+ 1.1400000000000001,
1994
+ "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"
1995
+ ],
1996
+ [
1997
+ "g",
1998
+ 1,
1999
+ "0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0"
2000
+ ],
2001
+ [
2002
+ "b",
2003
+ .86,
2004
+ "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0"
2005
+ ]
2006
+ ] : [[
2007
+ "all",
2008
+ 1,
2009
+ ""
2010
+ ]], m = bt(), h = m ? "objectBoundingBox" : "userSpaceOnUse", g = m ? {
2011
+ x: 0,
2012
+ y: 0,
2013
+ width: 1,
2014
+ height: 1
2015
+ } : {
2016
+ x: 0,
2017
+ y: 0,
2018
+ width: r,
2019
+ height: i
2020
+ };
2021
+ for (let e = 1; e <= 8; e++) {
2022
+ let t = `${f}-${e}`, a = Q("filter", {
2023
+ id: t,
2024
+ ...g,
2025
+ filterUnits: h,
2026
+ primitiveUnits: h,
2027
+ "color-interpolation-filters": "sRGB"
2028
+ });
2029
+ a.append(Q("feImage", {
2030
+ href: c,
2031
+ ...g,
2032
+ preserveAspectRatio: "none",
2033
+ result: "across-map"
2034
+ }), Q("feImage", {
2035
+ href: l,
2036
+ ...g,
2037
+ preserveAspectRatio: "none",
2038
+ result: "down-map"
2039
+ }), Q("feImage", {
2040
+ href: u,
2041
+ ...g,
2042
+ preserveAspectRatio: "none",
2043
+ result: "band"
2044
+ }));
2045
+ for (let e of ["across", "down"]) {
2046
+ let t = Q("feComponentTransfer", {
2047
+ in: `${e}-map`,
2048
+ result: e
2049
+ });
2050
+ t.append(Q("feFuncA", {
2051
+ type: "linear",
2052
+ slope: 0,
2053
+ intercept: .5
2054
+ })), a.append(t);
2055
+ }
2056
+ let o = 14 * e / 8;
2057
+ for (let [e, t, n] of p) a.append(Q("feDisplacementMap", {
2058
+ in: "SourceGraphic",
2059
+ in2: "across",
2060
+ scale: m ? o * t / r : o * t,
2061
+ xChannelSelector: "R",
2062
+ yChannelSelector: "A",
2063
+ result: `${e}-x`
2064
+ }), Q("feDisplacementMap", {
2065
+ in: `${e}-x`,
2066
+ in2: "down",
2067
+ scale: m ? o * t / i : o * t,
2068
+ xChannelSelector: "A",
2069
+ yChannelSelector: "R",
2070
+ result: n ? `${e}-ray` : "bent"
2071
+ })), n && a.append(Q("feColorMatrix", {
2072
+ in: `${e}-ray`,
2073
+ type: "matrix",
2074
+ values: n,
2075
+ result: e
2076
+ }));
2077
+ n && a.append(Q("feComposite", {
2078
+ in: "r",
2079
+ in2: "g",
2080
+ operator: "arithmetic",
2081
+ k2: 1,
2082
+ k3: 1,
2083
+ result: "rg"
2084
+ }), Q("feComposite", {
2085
+ in: "rg",
2086
+ in2: "b",
2087
+ operator: "arithmetic",
2088
+ k2: 1,
2089
+ k3: 1,
2090
+ result: "bent"
2091
+ }));
2092
+ let s = e / 8 * mt;
2093
+ a.append(Q("feGaussianBlur", {
2094
+ in: "bent",
2095
+ stdDeviation: m ? `${s / r} ${s / i}` : s,
2096
+ result: "soft"
2097
+ }), Q("feComposite", {
2098
+ in: "soft",
2099
+ in2: "band",
2100
+ operator: "in",
2101
+ result: "soft-rim"
2102
+ }), Q("feComposite", {
2103
+ in: "bent",
2104
+ in2: "band",
2105
+ operator: "out",
2106
+ result: "sharp-middle"
2107
+ }), Q("feComposite", {
2108
+ in: "soft-rim",
2109
+ in2: "sharp-middle",
2110
+ operator: "arithmetic",
2111
+ k2: 1,
2112
+ k3: 1
2113
+ })), _t().append(a), d.push(`url("#${t}")`);
2114
+ }
2115
+ return ht.set(a, d), d;
2116
+ }
2117
+ // src/internal/tab-motion.ts
2118
+ var St = [
2119
+ 225,
2120
+ 21,
2121
+ 676,
2122
+ 47.8
2123
+ ], Ct = [
2124
+ 2500,
2125
+ 94,
2126
+ 576,
2127
+ 44.2
2128
+ ], wt = (e, t, n) => Math.min(n, Math.max(t, e)), Tt = [
2129
+ "ArrowLeft",
2130
+ "ArrowRight",
2131
+ "Home",
2132
+ "End"
2133
+ ], Et = 230, Dt = .049, Ot = .19, kt = .07;
2134
+ function At({ bar: e, glass: t, lens: n, tint: r, bend: i, row: a }, s) {
2135
+ let c = [...e.querySelectorAll(".lg-tab")], l = [...e.querySelectorAll(".lg-tab-face")], u = [...a.children], d = 0, f = 0, p = 16, h = 12, g = 0, _ = 0, v = 0, y = [], b = -1, x = !1, S = 0, C = 0, w = null, T = {
2136
+ x: 0,
2137
+ lift: 0
2138
+ }, E = Ie, D = () => {
2139
+ let t = getComputedStyle(e);
2140
+ d = (e.clientWidth - parseFloat(t.paddingLeft) - parseFloat(t.paddingRight)) / c.length, f = n.offsetHeight, g = parseFloat(t.paddingLeft) || 0, _ = parseFloat(t.paddingTop) || 0, v = n.offsetWidth, p = parseFloat(t.getPropertyValue("--lg-lens-grow-x")) || 0, h = parseFloat(t.getPropertyValue("--lg-lens-grow-y")) || 0;
2141
+ let i = t.getPropertyValue("--lg-dark").trim() !== "" && t.getPropertyValue("--lg-dark").trim() !== "initial";
2142
+ r.offsetWidth && r.offsetHeight && (y = xt(r.offsetWidth, r.offsetHeight, i));
2143
+ }, O = (t, n, r) => {
2144
+ let i = v * n, a = f * r, o = g + t + d / 2 - i / 2, s = _ + f / 2 - a / 2, c = Math.min(f / 2 * n, i / 2), u = a / 2;
2145
+ l.forEach((t, n) => {
2146
+ let r = g + n * d;
2147
+ if ("hidden" in e.dataset || o + i <= r || o >= r + d) {
2148
+ t.style.clipPath = "";
2149
+ return;
2150
+ }
2151
+ let [l, p] = [o - r, o - r + i], [m, h] = [s - _, s - _ + a], v = (e) => e.toFixed(2), y = `M${v(l + c)} ${v(m)}H${v(p - c)}A${v(c)} ${v(u)} 0 0 1 ${v(p)} ${v((m + h) / 2)}A${v(c)} ${v(u)} 0 0 1 ${v(p - c)} ${v(h)}H${v(l + c)}A${v(c)} ${v(u)} 0 0 1 ${v(l)} ${v((m + h) / 2)}A${v(c)} ${v(u)} 0 0 1 ${v(l + c)} ${v(m)}Z`;
2152
+ t.style.clipPath = `path(evenodd, "M-200 -200H${v(d + 200)}V${v(f + 200)}H-200Z${y}")`;
2153
+ });
2154
+ }, k = () => {
2155
+ let { x: t, lift: o } = T, s = (1 + p / d * o) * E.x, c = (1 + h / f * o) * E.y;
2156
+ n.style.transform = r.style.transform = `translateX(${t}px) scale(${s}, ${c})`;
2157
+ let l = 1 - kt * o, m = (1 + Ot * o) / l, g = `${d / 2}px, ${f / 2}px`;
2158
+ a.style.transform = `translate(${g}) scale(${l}) translate(-${d / 2}px, -${f / 2}px) scale(${1 / s}, ${1 / c}) translate(${-t + (s - 1) * d / 2}px, ${(c - 1) * f / 2}px)`;
2159
+ for (let e of u) e.style.scale = String(m);
2160
+ let _ = Math.round(o * 8);
2161
+ i.style.filter = _ > 0 ? y[Math.min(_, y.length) - 1] ?? "" : "", e.style.scale = o > .001 ? String(1 + Dt * o) : "", O(t, s, c), !w && o < .01 && delete e.dataset.refracting;
2162
+ }, A = Re(() => v || n.offsetWidth, (e) => {
2163
+ E = e, k();
2164
+ }), j = o(0, St[0], St[1], (e) => {
2165
+ T.x = e, A.follow(e), k();
2166
+ }), M = o(0, St[2], St[3], (e) => {
2167
+ T.lift = e, k();
2168
+ }), N = (e, t, n = !1) => {
2169
+ let [r, i] = w?.moved ? Ct : St, [, , a, o] = w ? Ct : St;
2170
+ j.tune(r, i), M.tune(a, o), n && A.follow(e, !0), j.set(e, n), M.set(+!!t, n);
2171
+ }, P = (t = !1) => {
2172
+ if (w) return;
2173
+ let n = b >= 0;
2174
+ n ? delete e.dataset.hidden : e.dataset.hidden = "", n ? N(b * d, C !== 0, t || !x) : k(), x = n;
2175
+ }, F = (e) => wt(w.anchor + e.clientX - w.x, 0, d * (c.length - 1)), I = (e, r) => {
2176
+ t.style.setProperty("--lg-x", `${wt((e.clientX - r.left) / r.width * 100, 0, 100)}%`), n.style.setProperty("--lg-x", `${wt((e.clientX - r.left - 4 - T.x) / d * 100, 0, 100)}%`);
2177
+ }, L = () => {
2178
+ clearTimeout(C), C = 0, delete e.dataset.lifted, delete n.dataset.pressed;
2179
+ }, R = (t = !1) => {
2180
+ let r = w;
2181
+ w = null, L();
2182
+ let i = t && r && !m() ? Et - (performance.now() - r.at) : 0;
2183
+ return i > 0 && (e.dataset.lifted = "", n.dataset.pressed = "", C = window.setTimeout(() => {
2184
+ L(), P();
2185
+ }, i)), r && e.hasPointerCapture(r.id) && e.releasePointerCapture(r.id), r;
2186
+ }, z = !1, B = (t) => {
2187
+ let r = t.target.closest(".lg-tab");
2188
+ if (!t.isPrimary || t.button !== 0 || w || !r || t.metaKey || t.ctrlKey || t.shiftKey || t.altKey) return;
2189
+ cancelAnimationFrame(S), S = 0, L(), D();
2190
+ let i = e.getBoundingClientRect();
2191
+ w = {
2192
+ id: t.pointerId,
2193
+ x: t.clientX,
2194
+ anchor: c.indexOf(r) * d,
2195
+ moved: !1,
2196
+ box: i,
2197
+ at: performance.now()
2198
+ }, z = !1, e.dataset.lifted = "", e.dataset.refracting = "", delete e.dataset.hidden, n.dataset.pressed = "", I(t, i), N(w.anchor, !0, !x), x = !0;
2199
+ }, ee = (t) => {
2200
+ t.pointerId === w?.id && (!w.moved && Math.abs(t.clientX - w.x) > 6 && (w.moved = !0, e.setPointerCapture(t.pointerId)), w.moved && N(F(t), !0), I(t, w.box));
2201
+ }, V = (t) => {
2202
+ if (t.pointerId !== w?.id || t.type === "lostpointercapture" && t.target !== e) return;
2203
+ let n = Math.round(F(t) / d), { moved: r, box: i } = w, a = t.clientY >= i.top - 24 && t.clientY <= i.bottom + 24;
2204
+ R(t.type === "pointerup" && !r && a), t.type === "pointerup" && (r || a) ? (z = !0, S = requestAnimationFrame(() => {
2205
+ S = 0, P();
2206
+ }), c[n]?.click()) : (z = r, P());
2207
+ }, H = (e) => {
2208
+ w && e.cancelable && ct(w.at, w.moved) && e.preventDefault();
2209
+ }, U = (e) => {
2210
+ if (e.isTrusted && z && e.detail !== 0) {
2211
+ z = !1, e.preventDefault();
2212
+ return;
2213
+ }
2214
+ let t = e.target.closest(".lg-tab");
2215
+ if (!t || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
2216
+ let n = c.indexOf(t);
2217
+ t instanceof HTMLAnchorElement && (b = n, P()), s(n);
2218
+ }, W = (e) => {
2219
+ let t = e.target.closest(".lg-tab");
2220
+ if (!t || t instanceof HTMLAnchorElement || !Tt.includes(e.key)) return;
2221
+ e.preventDefault();
2222
+ let n = c.indexOf(t), r = e.key === "Home" ? 0 : e.key === "End" ? c.length - 1 : (n + (e.key === "ArrowRight" ? 1 : c.length - 1)) % c.length;
2223
+ s(r), c[r]?.focus();
2224
+ }, G = () => {
2225
+ cancelAnimationFrame(S), S = 0, R(), P(!0);
2226
+ }, K = () => {
2227
+ document.hidden && G();
2228
+ }, te = new ResizeObserver(() => {
2229
+ D(), w || P(!0);
2230
+ });
2231
+ return D(), e.dataset.ready = "", e.addEventListener("pointerdown", B), window.addEventListener("pointermove", ee), window.addEventListener("pointerup", V), window.addEventListener("pointercancel", V), e.addEventListener("lostpointercapture", V), e.addEventListener("touchmove", H, { passive: !1 }), e.addEventListener("click", U, !0), e.addEventListener("keydown", W), document.addEventListener("visibilitychange", K), window.addEventListener("blur", G), te.observe(e), {
2232
+ setActive(e) {
2233
+ cancelAnimationFrame(S), S = 0, b = e, P();
2234
+ },
2235
+ destroy() {
2236
+ clearTimeout(C), e.style.scale = "", cancelAnimationFrame(S), j.stop(), M.stop(), A.stop(), te.disconnect();
2237
+ for (let t of [
2238
+ "ready",
2239
+ "hidden",
2240
+ "lifted",
2241
+ "refracting"
2242
+ ]) delete e.dataset[t];
2243
+ e.removeEventListener("pointerdown", B), window.removeEventListener("pointermove", ee), window.removeEventListener("pointerup", V), window.removeEventListener("pointercancel", V), e.removeEventListener("lostpointercapture", V), e.removeEventListener("touchmove", H), e.removeEventListener("click", U, !0), e.removeEventListener("keydown", W), document.removeEventListener("visibilitychange", K), window.removeEventListener("blur", G);
2244
+ }
2245
+ };
2246
+ }
2247
+ function jt({ items: e, value: t, defaultValue: n = null, onValueChange: r, minimized: a = !1, onExpand: o, link: c = "a", className: u, style: d, ...f }) {
2248
+ let { locale: p } = l(), m = T(null), h = T(null), g = T(null), _ = T(null), v = T(null), y = T(null), x = T(null), [S, w] = P(t, n, r), E = e.findIndex((e) => e.value === S), A = T({
2249
+ items: e,
2250
+ selected: E,
2251
+ setValue: w
2252
+ }), j = e.map((e) => e.value).join("\n"), M = e.every((e) => ae(e.href) !== void 0), N = (e) => e.icon == null ? /* @__PURE__ */ O("span", {
2253
+ className: "lg-tab-label",
2254
+ children: e.label
2255
+ }) : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("span", {
2256
+ className: "lg-tab-icon",
2257
+ children: e.icon
2258
+ }), /* @__PURE__ */ O("span", {
2259
+ className: "lg-tab-label",
2260
+ children: e.label
2261
+ })] });
2262
+ return s(h), s(g, !0), b(() => {
2263
+ A.current = {
2264
+ items: e,
2265
+ selected: E,
2266
+ setValue: w
2267
+ };
2268
+ }), b(() => {
2269
+ let e = At({
2270
+ bar: m.current,
2271
+ glass: h.current,
2272
+ lens: g.current,
2273
+ tint: _.current,
2274
+ bend: y.current,
2275
+ row: v.current
2276
+ }, (e) => {
2277
+ let t = A.current.items[e];
2278
+ t && A.current.setValue(t.value);
2279
+ });
2280
+ return e.setActive(A.current.selected), x.current = e, () => {
2281
+ e.destroy(), x.current = null;
2282
+ };
2283
+ }, [j]), C(() => {
2284
+ x.current?.setActive(E);
2285
+ }, [E]), /* @__PURE__ */ k("div", {
2286
+ ref: m,
2287
+ role: M ? "navigation" : "tablist",
2288
+ className: i("lg-tab-bar", u),
2289
+ "data-icons": e.some((e) => e.icon != null) ? "" : void 0,
2290
+ "data-minimized": a ? "" : void 0,
2291
+ style: {
2292
+ ...d,
2293
+ "--lg-index": Math.max(E, 0),
2294
+ "--lg-tabs": e.length
2295
+ },
2296
+ ...f,
2297
+ children: [
2298
+ /* @__PURE__ */ O("span", {
2299
+ ref: h,
2300
+ className: "lg-glass lg-tab-bar-glass",
2301
+ "aria-hidden": !0
2302
+ }),
2303
+ e.map((e, t) => ae(e.href) === void 0 ? /* @__PURE__ */ O("button", {
2304
+ type: "button",
2305
+ role: "tab",
2306
+ className: "lg-tab",
2307
+ "data-selected": t === E ? "" : void 0,
2308
+ "aria-selected": t === E,
2309
+ tabIndex: t === E || E < 0 && t === 0 ? 0 : -1,
2310
+ children: /* @__PURE__ */ O("span", {
2311
+ className: "lg-tab-face",
2312
+ children: N(e)
2313
+ })
2314
+ }, e.value) : /* @__PURE__ */ O(c, {
2315
+ href: ae(e.href),
2316
+ className: "lg-tab",
2317
+ "data-selected": t === E ? "" : void 0,
2318
+ "aria-current": t === E ? "page" : void 0,
2319
+ draggable: !1,
2320
+ children: /* @__PURE__ */ O("span", {
2321
+ className: "lg-tab-face",
2322
+ children: N(e)
2323
+ })
2324
+ }, e.value)),
2325
+ /* @__PURE__ */ O("span", {
2326
+ ref: _,
2327
+ className: "lg-tab-tint",
2328
+ "aria-hidden": !0,
2329
+ children: /* @__PURE__ */ O("span", {
2330
+ ref: y,
2331
+ className: "lg-tab-bend",
2332
+ children: /* @__PURE__ */ O("span", {
2333
+ className: "lg-tab-clip",
2334
+ children: /* @__PURE__ */ O("span", {
2335
+ ref: v,
2336
+ className: "lg-tab-row",
2337
+ children: e.map((e) => /* @__PURE__ */ O("span", {
2338
+ className: "lg-tab-copy",
2339
+ children: N(e)
2340
+ }, e.value))
2341
+ })
2342
+ })
2343
+ })
2344
+ }),
2345
+ /* @__PURE__ */ O("span", {
2346
+ ref: g,
2347
+ className: "lg-glass lg-tab-lens",
2348
+ "aria-hidden": !0
2349
+ }),
2350
+ e[E]?.icon == null ? null : /* @__PURE__ */ O("button", {
2351
+ type: "button",
2352
+ className: "lg-tab-mini",
2353
+ "aria-label": p.showTabs,
2354
+ tabIndex: a ? 0 : -1,
2355
+ "aria-hidden": !a,
2356
+ onClick: o,
2357
+ children: /* @__PURE__ */ O("span", {
2358
+ className: "lg-tab-icon",
2359
+ children: e[E].icon
2360
+ })
2361
+ })
2362
+ ]
2363
+ });
2364
+ }
2365
+ // src/checkbox.tsx
2366
+ var Mt = _(function({ children: e, description: t, indeterminate: n = !1, onCheckedChange: r, onChange: a, className: o, style: c, ...l }, u) {
2367
+ let d = T(null), f = T(null), p = x();
2368
+ return S(u, () => d.current), s(f), b(() => {
2369
+ d.current && (d.current.indeterminate = n);
2370
+ }, [n, l.checked]), /* @__PURE__ */ k("label", {
2371
+ className: i("lg-choice", o),
2372
+ style: c,
2373
+ "data-disabled": l.disabled || void 0,
2374
+ children: [
2375
+ /* @__PURE__ */ O("input", {
2376
+ ...l,
2377
+ ref: d,
2378
+ type: "checkbox",
2379
+ className: "lg-choice-input",
2380
+ "aria-describedby": [l["aria-describedby"], t ? p : null].filter(Boolean).join(" ") || void 0,
2381
+ onChange: (e) => {
2382
+ a?.(e), r?.(e.currentTarget.checked);
2383
+ }
2384
+ }),
2385
+ /* @__PURE__ */ O("span", {
2386
+ ref: f,
2387
+ className: "lg-glass lg-choice-control",
2388
+ "aria-hidden": "true",
2389
+ children: /* @__PURE__ */ k("svg", {
2390
+ viewBox: "0 0 20 20",
2391
+ fill: "none",
2392
+ stroke: "currentColor",
2393
+ strokeWidth: "2.2",
2394
+ strokeLinecap: "round",
2395
+ strokeLinejoin: "round",
2396
+ children: [/* @__PURE__ */ O("path", {
2397
+ className: "lg-choice-check",
2398
+ d: "m5 10 3.2 3.2L15 6.5"
2399
+ }), /* @__PURE__ */ O("path", {
2400
+ className: "lg-choice-mixed",
2401
+ d: "M5 10h10"
2402
+ })]
2403
+ })
2404
+ }),
2405
+ (e != null || t != null) && /* @__PURE__ */ k("span", {
2406
+ className: "lg-choice-text",
2407
+ children: [/* @__PURE__ */ O("span", { children: e }), t != null && /* @__PURE__ */ O("span", {
2408
+ id: p,
2409
+ className: "lg-choice-description",
2410
+ children: t
2411
+ })]
2412
+ })
2413
+ ]
2414
+ });
2415
+ }), Nt = _(function({ children: e, description: t, onCheckedChange: n, onChange: r, className: a, style: o, ...c }, l) {
2416
+ let u = T(null), d = x();
2417
+ return s(u), /* @__PURE__ */ k("label", {
2418
+ className: i("lg-choice", a),
2419
+ style: o,
2420
+ "data-disabled": c.disabled || void 0,
2421
+ children: [
2422
+ /* @__PURE__ */ O("input", {
2423
+ ...c,
2424
+ ref: l,
2425
+ type: "radio",
2426
+ className: "lg-choice-input",
2427
+ "aria-describedby": [c["aria-describedby"], t ? d : null].filter(Boolean).join(" ") || void 0,
2428
+ onChange: (e) => {
2429
+ r?.(e), n?.(e.currentTarget.checked);
2430
+ }
2431
+ }),
2432
+ /* @__PURE__ */ O("span", {
2433
+ ref: u,
2434
+ className: "lg-glass lg-choice-control lg-radio-control",
2435
+ "aria-hidden": "true",
2436
+ children: /* @__PURE__ */ O("span", {})
2437
+ }),
2438
+ (e != null || t != null) && /* @__PURE__ */ k("span", {
2439
+ className: "lg-choice-text",
2440
+ children: [/* @__PURE__ */ O("span", { children: e }), t != null && /* @__PURE__ */ O("span", {
2441
+ id: d,
2442
+ className: "lg-choice-description",
2443
+ children: t
2444
+ })]
2445
+ })
2446
+ ]
2447
+ });
2448
+ });
2449
+ // src/internal/field-error.tsx
2450
+ function Pt({ id: e, children: t }) {
2451
+ return /* @__PURE__ */ k("span", {
2452
+ id: e,
2453
+ role: "alert",
2454
+ className: "lg-field-error",
2455
+ children: [/* @__PURE__ */ k("svg", {
2456
+ viewBox: "0 0 16 16",
2457
+ fill: "none",
2458
+ stroke: "currentColor",
2459
+ strokeWidth: "1.3",
2460
+ "aria-hidden": "true",
2461
+ children: [/* @__PURE__ */ O("circle", {
2462
+ cx: "8",
2463
+ cy: "8",
2464
+ r: "6"
2465
+ }), /* @__PURE__ */ O("path", { d: "M8 4.5v4M8 11h.01" })]
2466
+ }), /* @__PURE__ */ O("span", { children: t })]
2467
+ });
2468
+ }
2469
+ // src/internal/floating.tsx
2470
+ var Ft = typeof window > "u" ? b : C, It = [], Lt = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex=\"0\"]";
2471
+ function Rt({ anchor: e, side: t = "bottom", align: n = "center", onDismiss: r, focusOnOpen: a = !1, dismissOnBlur: o = !0, allowAnchorOverlap: c = !1, className: l, children: u, ...d }) {
2472
+ let f = T(null), p = T(r);
2473
+ return Ft(() => {
2474
+ p.current = r;
2475
+ }), s(f), Ft(() => {
2476
+ let r = f.current, i = e.current;
2477
+ if (!r || !i) return;
2478
+ if (typeof r.showPopover == "function") {
2479
+ r.setAttribute("popover", "manual");
2480
+ try {
2481
+ r.showPopover();
2482
+ } catch {
2483
+ r.removeAttribute("popover");
2484
+ }
2485
+ }
2486
+ It.push(r);
2487
+ let s = () => {
2488
+ let e = window.visualViewport, a = e?.offsetLeft ?? 0, o = e?.offsetTop ?? 0, s = e?.width ?? document.documentElement.clientWidth, l = e?.height ?? window.innerHeight;
2489
+ r.style.maxWidth = `${Math.max(0, s - 16)}px`, r.style.maxHeight = `${Math.max(0, l - 16)}px`;
2490
+ let u = i.getBoundingClientRect(), d = r.getBoundingClientRect(), f = {
2491
+ top: u.top - o - 8 - 8,
2492
+ bottom: o + l - u.bottom - 8 - 8,
2493
+ left: u.left - a - 8 - 8,
2494
+ right: a + s - u.right - 8 - 8
2495
+ }, p = {
2496
+ top: "bottom",
2497
+ bottom: "top",
2498
+ left: "right",
2499
+ right: "left"
2500
+ }, m = t === "left" || t === "right", h = m ? d.width : d.height, g = f[t] < h && f[p[t]] > f[t] ? p[t] : t;
2501
+ !m && !c && (r.style.maxHeight = `${Math.max(0, f[g])}px`);
2502
+ let _ = r.offsetWidth, v = r.offsetHeight, y = n === "start" ? u.left : n === "end" ? u.right - _ : u.left + (u.width - _) / 2, b = n === "start" ? u.top : n === "end" ? u.bottom - v : u.top + (u.height - v) / 2;
2503
+ g === "top" && (b = u.top - v - 8), g === "bottom" && (b = u.bottom + 8), g === "left" && (y = u.left - _ - 8), g === "right" && (y = u.right + 8), r.style.left = `${Math.max(a + 8, Math.min(y, a + s - 8 - _))}px`, r.style.top = `${Math.max(o + 8, Math.min(b, o + l - 8 - v))}px`, r.dataset.side = g;
2504
+ };
2505
+ s(), a && (r.querySelector(Lt) ?? r).focus({ preventScroll: !0 });
2506
+ let l = new ResizeObserver(s);
2507
+ l.observe(r), l.observe(i);
2508
+ let u = (e) => {
2509
+ if (It.at(-1) !== r) return;
2510
+ let t = e.target;
2511
+ !r.contains(t) && !i.contains(t) && p.current(e.type === "focusin" ? "focus" : "outside");
2512
+ }, d = (e) => {
2513
+ e.key === "Escape" && It.at(-1) === r && (e.preventDefault(), e.stopPropagation(), p.current("escape"));
2514
+ };
2515
+ return document.addEventListener("pointerdown", u, !0), o && document.addEventListener("focusin", u), document.addEventListener("keydown", d, !0), window.addEventListener("resize", s), window.addEventListener("scroll", s, !0), window.visualViewport?.addEventListener("resize", s), window.visualViewport?.addEventListener("scroll", s), () => {
2516
+ let e = It.indexOf(r);
2517
+ e !== -1 && It.splice(e, 1), l.disconnect(), document.removeEventListener("pointerdown", u, !0), document.removeEventListener("focusin", u), document.removeEventListener("keydown", d, !0), window.removeEventListener("resize", s), window.removeEventListener("scroll", s, !0), window.visualViewport?.removeEventListener("resize", s), window.visualViewport?.removeEventListener("scroll", s), r.hasAttribute("popover") && r.matches(":popover-open") && r.hidePopover();
2518
+ };
2519
+ }, [
2520
+ e,
2521
+ t,
2522
+ n,
2523
+ a,
2524
+ o,
2525
+ c
2526
+ ]), /* @__PURE__ */ O("div", {
2527
+ ...d,
2528
+ ref: f,
2529
+ tabIndex: -1,
2530
+ className: i("lg-glass lg-floating", l),
2531
+ children: u
2532
+ });
2533
+ }
2534
+ // src/internal/form-reset.ts
2535
+ function zt(e, t) {
2536
+ let n = T(t);
2537
+ b(() => {
2538
+ n.current = t;
2539
+ }), b(() => {
2540
+ let t = (t) => {
2541
+ t.target === e.current?.form && queueMicrotask(() => {
2542
+ !t.defaultPrevented && e.current && n.current();
2543
+ });
2544
+ };
2545
+ return document.addEventListener("reset", t), () => document.removeEventListener("reset", t);
2546
+ }, [e]);
2547
+ }
2548
+ // src/select.tsx
2549
+ var Bt = _(function({ options: e, value: t, defaultValue: n = "", onValueChange: r, placeholder: a, className: o, style: c, id: u, disabled: d, required: f, name: p, form: m, onInvalid: h, onClick: g, onKeyDown: _, autoComplete: v, error: y, ...S }, C) {
2550
+ let { locale: w } = l(), D = a ?? w.choose, A = T(null), j = T(null), [M, N] = P(t, n, r), [F, I] = E(!1), [L, R] = E(-1), z = x(), B = `${z}-error`, [ee, V] = E(), H = y ?? ee, U = T({
2551
+ text: "",
2552
+ at: 0
2553
+ });
2554
+ s(A), zt(j, () => {
2555
+ I(!1), V(void 0), t === void 0 && N(n);
2556
+ }), b(() => {
2557
+ d && I(!1);
2558
+ }, [d]), b(() => {
2559
+ j.current?.validity.valid && V(void 0);
2560
+ }, [
2561
+ M,
2562
+ d,
2563
+ f
2564
+ ]), b(() => {
2565
+ F && L >= 0 && document.getElementById(`${z}-${L}`)?.scrollIntoView({ block: "nearest" });
2566
+ }, [
2567
+ F,
2568
+ L,
2569
+ z
2570
+ ]);
2571
+ let W = e.findIndex((e) => e.value === M), G = e.map((e, t) => e.disabled ? -1 : t).filter((e) => e >= 0), K = (e = !1) => {
2572
+ R(G.includes(W) ? W : (e ? G.at(-1) : G[0]) ?? -1), I(!0);
2573
+ }, te = (t) => {
2574
+ let n = e[t];
2575
+ n && !n.disabled && (N(n.value), I(!1));
2576
+ }, ne = (t) => {
2577
+ let n = t.key;
2578
+ if (n === "Tab") I(!1);
2579
+ else if ([
2580
+ "ArrowDown",
2581
+ "ArrowUp",
2582
+ "Home",
2583
+ "End"
2584
+ ].includes(n)) {
2585
+ if (t.preventDefault(), !F) {
2586
+ K(n === "ArrowUp" || n === "End");
2587
+ return;
2588
+ }
2589
+ let e = G.indexOf(L), r = n === "Home" ? 0 : n === "End" ? G.length - 1 : (e + (n === "ArrowDown" ? 1 : -1) + G.length) % G.length;
2590
+ R(G[r] ?? -1);
2591
+ } else if (n === "Enter" || n === " ") t.preventDefault(), F ? te(L) : K();
2592
+ else if (n.length === 1 && !t.altKey && !t.ctrlKey && !t.metaKey) {
2593
+ t.preventDefault();
2594
+ let r = Date.now(), i = (r - U.current.at > 600 ? "" : U.current.text) + n.toLocaleLowerCase();
2595
+ U.current = {
2596
+ text: i,
2597
+ at: r
2598
+ };
2599
+ let a = G.find((t) => e[t].label.toLocaleLowerCase().startsWith(i));
2600
+ a !== void 0 && (I(!0), R(a));
2601
+ }
2602
+ };
2603
+ return /* @__PURE__ */ k("span", {
2604
+ className: i("lg-select", o),
2605
+ style: c,
2606
+ children: [
2607
+ /* @__PURE__ */ k("select", {
2608
+ ref: j,
2609
+ className: "lg-visually-hidden",
2610
+ tabIndex: -1,
2611
+ "aria-hidden": "true",
2612
+ name: p,
2613
+ form: m,
2614
+ autoComplete: v,
2615
+ disabled: d,
2616
+ required: f,
2617
+ value: M,
2618
+ onChange: (e) => N(e.currentTarget.value),
2619
+ onInvalid: (e) => {
2620
+ h?.(e), e.defaultPrevented || (e.preventDefault(), V(e.currentTarget.validity.valueMissing ? "请选择一个选项。" : e.currentTarget.validationMessage), A.current?.focus());
2621
+ },
2622
+ children: [/* @__PURE__ */ O("option", {
2623
+ value: "",
2624
+ children: D
2625
+ }), e.map((e) => /* @__PURE__ */ O("option", {
2626
+ value: e.value,
2627
+ disabled: e.disabled,
2628
+ children: e.label
2629
+ }, e.value))]
2630
+ }),
2631
+ /* @__PURE__ */ k("button", {
2632
+ ...S,
2633
+ ref: (e) => {
2634
+ A.current = e, typeof C == "function" ? C(e) : C && (C.current = e);
2635
+ },
2636
+ id: u,
2637
+ type: "button",
2638
+ role: "combobox",
2639
+ "aria-haspopup": "listbox",
2640
+ "aria-expanded": F,
2641
+ "aria-controls": F ? z : void 0,
2642
+ "aria-activedescendant": F && L >= 0 ? `${z}-${L}` : void 0,
2643
+ "aria-required": f,
2644
+ "aria-label": S["aria-label"],
2645
+ "aria-labelledby": S["aria-labelledby"],
2646
+ "aria-describedby": [S["aria-describedby"], H ? B : null].filter(Boolean).join(" ") || void 0,
2647
+ "aria-invalid": H ? !0 : S["aria-invalid"],
2648
+ disabled: d,
2649
+ className: "lg-glass lg-select-trigger",
2650
+ "data-placeholder": W < 0 || void 0,
2651
+ onClick: (e) => {
2652
+ g?.(e), e.defaultPrevented || (A.current?.focus({ preventScroll: !0 }), F ? I(!1) : K());
2653
+ },
2654
+ onKeyDown: (e) => {
2655
+ _?.(e), e.defaultPrevented || ne(e);
2656
+ },
2657
+ children: [/* @__PURE__ */ O("span", { children: W < 0 ? D : e[W].label }), /* @__PURE__ */ O("svg", {
2658
+ viewBox: "0 0 16 16",
2659
+ fill: "none",
2660
+ stroke: "currentColor",
2661
+ strokeWidth: "1.5",
2662
+ "aria-hidden": "true",
2663
+ children: /* @__PURE__ */ O("path", { d: "m4 6 4 4 4-4" })
2664
+ })]
2665
+ }),
2666
+ H && /* @__PURE__ */ O(Pt, {
2667
+ id: B,
2668
+ children: H
2669
+ }),
2670
+ F && /* @__PURE__ */ k(Rt, {
2671
+ id: z,
2672
+ anchor: A,
2673
+ role: "listbox",
2674
+ "aria-label": S["aria-label"],
2675
+ "aria-labelledby": S["aria-labelledby"],
2676
+ align: "start",
2677
+ className: "lg-select-list",
2678
+ style: { width: A.current?.offsetWidth },
2679
+ onDismiss: () => I(!1),
2680
+ children: [e.length === 0 && /* @__PURE__ */ O("div", {
2681
+ className: "lg-select-empty",
2682
+ role: "presentation",
2683
+ children: w.empty
2684
+ }), e.map((e, t) => /* @__PURE__ */ k("div", {
2685
+ id: `${z}-${t}`,
2686
+ role: "option",
2687
+ "aria-selected": e.value === M,
2688
+ "aria-disabled": e.disabled || void 0,
2689
+ className: "lg-select-option",
2690
+ "data-active": L === t || void 0,
2691
+ onPointerMove: () => {
2692
+ e.disabled || R(t);
2693
+ },
2694
+ onPointerDown: (e) => e.preventDefault(),
2695
+ onClick: () => te(t),
2696
+ children: [/* @__PURE__ */ O("span", { children: e.label }), /* @__PURE__ */ O("span", {
2697
+ "aria-hidden": "true",
2698
+ children: e.value === M ? "✓" : ""
2699
+ })]
2700
+ }, e.value))]
2701
+ })
2702
+ ]
2703
+ });
2704
+ }), Vt = _(function({ value: e, defaultValue: t = "", onValueChange: n, onChange: r, onInvalid: a, error: o, variant: c = "glass", showCount: l = !1, resize: u = "none", className: d, style: f, rows: p = 4, ...m }, h) {
2705
+ let g = T(null), _ = T(null), v = x(), y = `${v}-error`, [C, w] = E(), D = o ?? C, [A, j] = P(e, t, n);
2706
+ return S(h, () => _.current), s(g), zt(_, () => {
2707
+ w(void 0), e === void 0 && j(t);
2708
+ }), b(() => {
2709
+ _.current?.validity.valid && w(void 0);
2710
+ }, [
2711
+ A,
2712
+ m.disabled,
2713
+ m.required
2714
+ ]), /* @__PURE__ */ k("div", {
2715
+ className: i("lg-textarea-field", d),
2716
+ style: f,
2717
+ children: [/* @__PURE__ */ k("div", {
2718
+ ref: g,
2719
+ className: "lg-glass lg-textarea",
2720
+ "data-variant": c,
2721
+ "data-disabled": m.disabled || void 0,
2722
+ "data-invalid": !!D || m["aria-invalid"] === !0 || m["aria-invalid"] === "true" || void 0,
2723
+ children: [/* @__PURE__ */ O("textarea", {
2724
+ ...m,
2725
+ ref: _,
2726
+ rows: p,
2727
+ value: A,
2728
+ style: { resize: u },
2729
+ "aria-describedby": [
2730
+ m["aria-describedby"],
2731
+ l ? v : null,
2732
+ D ? y : null
2733
+ ].filter(Boolean).join(" ") || void 0,
2734
+ "aria-invalid": D ? !0 : m["aria-invalid"],
2735
+ onInvalid: (e) => {
2736
+ a?.(e), e.defaultPrevented || (e.preventDefault(), w(e.currentTarget.validity.valueMissing ? "请填写内容后再提交。" : e.currentTarget.validationMessage), _.current?.focus());
2737
+ },
2738
+ onChange: (e) => {
2739
+ j(e.currentTarget.value), r?.(e);
2740
+ }
2741
+ }), l && /* @__PURE__ */ k("span", {
2742
+ id: v,
2743
+ className: "lg-textarea-count",
2744
+ children: [A.length, m.maxLength == null ? "" : ` / ${m.maxLength}`]
2745
+ })]
2746
+ }), D && /* @__PURE__ */ O(Pt, {
2747
+ id: y,
2748
+ children: D
2749
+ })]
2750
+ });
2751
+ }), Ht = _(function({ title: e, description: t, extra: n, cover: r, footer: a, padding: o = "regular", children: s, className: c, ...l }, u) {
2752
+ return /* @__PURE__ */ k(B, {
2753
+ ...l,
2754
+ ref: u,
2755
+ className: i("lg-card", c),
2756
+ "data-padding": o,
2757
+ children: [
2758
+ r != null && /* @__PURE__ */ O("div", {
2759
+ className: "lg-card-cover",
2760
+ children: r
2761
+ }),
2762
+ (e != null || t != null || n != null) && /* @__PURE__ */ k("div", {
2763
+ className: "lg-card-header",
2764
+ children: [/* @__PURE__ */ k("div", {
2765
+ className: "lg-card-heading",
2766
+ children: [e != null && /* @__PURE__ */ O("div", {
2767
+ className: "lg-card-title",
2768
+ children: e
2769
+ }), t != null && /* @__PURE__ */ O("div", {
2770
+ className: "lg-card-description",
2771
+ children: t
2772
+ })]
2773
+ }), n != null && /* @__PURE__ */ O("div", {
2774
+ className: "lg-card-extra",
2775
+ children: n
2776
+ })]
2777
+ }),
2778
+ /* @__PURE__ */ O("div", {
2779
+ className: "lg-card-body",
2780
+ children: s
2781
+ }),
2782
+ a != null && /* @__PURE__ */ O("div", {
2783
+ className: "lg-card-footer",
2784
+ children: a
2785
+ })
2786
+ ]
2787
+ });
2788
+ });
2789
+ // src/tooltip.tsx
2790
+ function Ut({ children: e, content: t, side: n = "top", delay: r = 350, disabled: i = !1, open: a, defaultOpen: o = !1, onOpenChange: s }) {
2791
+ let c = T(null), l = T(void 0), u = T(!1), d = T(!1), f = x(), [p, m] = P(a, o, s), g = () => clearTimeout(l.current), _ = () => {
2792
+ g(), m(!1);
2793
+ }, v = () => {
2794
+ d.current = !1, g(), l.current = setTimeout(() => {
2795
+ !u.current && !d.current && m(!1);
2796
+ }, 100);
2797
+ };
2798
+ return b(() => () => clearTimeout(l.current), []), b(() => {
2799
+ i && clearTimeout(l.current);
2800
+ }, [i]), /* @__PURE__ */ k("span", {
2801
+ ref: c,
2802
+ className: "lg-floating-anchor",
2803
+ onPointerEnter: (e) => {
2804
+ i || e.pointerType === "touch" || (d.current = !0, g(), l.current = setTimeout(() => m(!0), r));
2805
+ },
2806
+ onPointerLeave: v,
2807
+ onFocus: () => {
2808
+ u.current = !0, i || (g(), m(!0));
2809
+ },
2810
+ onBlur: (e) => {
2811
+ e.currentTarget.contains(e.relatedTarget) || (u.current = !1, _());
2812
+ },
2813
+ children: [h(e, { "aria-describedby": [e.props["aria-describedby"], !i && p ? f : null].filter(Boolean).join(" ") || void 0 }), !i && p && /* @__PURE__ */ O(Rt, {
2814
+ id: f,
2815
+ anchor: c,
2816
+ side: n,
2817
+ role: "tooltip",
2818
+ className: "lg-tooltip",
2819
+ onDismiss: _,
2820
+ onPointerEnter: () => {
2821
+ d.current = !0, g();
2822
+ },
2823
+ onPointerLeave: v,
2824
+ children: t
2825
+ })]
2826
+ });
2827
+ }
2828
+ // src/popover.tsx
2829
+ function Wt({ label: e, "aria-label": t, title: n, children: r, trigger: i, side: a = "bottom", align: o = "center", width: s = 300, open: c, defaultOpen: l = !1, onOpenChange: u, className: d }) {
2830
+ let f = T(null), m = x(), [h, g] = P(c, l, u), _ = () => {
2831
+ g(!1), f.current?.focus({ preventScroll: !0 });
2832
+ };
2833
+ return /* @__PURE__ */ k("span", {
2834
+ className: "lg-floating-anchor",
2835
+ children: [/* @__PURE__ */ O(p, {
2836
+ ...i,
2837
+ ref: f,
2838
+ "aria-haspopup": "dialog",
2839
+ "aria-expanded": h,
2840
+ "aria-controls": h ? m : void 0,
2841
+ onClick: () => g(!h),
2842
+ children: e
2843
+ }), h && /* @__PURE__ */ k(Rt, {
2844
+ id: m,
2845
+ anchor: f,
2846
+ side: a,
2847
+ align: o,
2848
+ role: "dialog",
2849
+ "aria-label": t,
2850
+ className: `lg-popover ${d ?? ""}`,
2851
+ style: { width: s },
2852
+ focusOnOpen: !0,
2853
+ onDismiss: (e) => {
2854
+ e === "escape" ? _() : g(!1);
2855
+ },
2856
+ children: [n != null && /* @__PURE__ */ O("div", {
2857
+ className: "lg-popover-title",
2858
+ children: n
2859
+ }), typeof r == "function" ? r({ close: _ }) : r]
2860
+ })]
2861
+ });
2862
+ }
2863
+ // src/toast.tsx
2864
+ function Gt({ title: e, description: t, tone: n = "info", duration: r = 0, action: a, onDismiss: o, closeLabel: s = "关闭提示", className: c }) {
2865
+ let [l, u] = E(!1), [d, f] = E(!1), [m, h] = E(!1), g = T(r), _ = T(o);
2866
+ return b(() => {
2867
+ _.current = o;
2868
+ }), b(() => {
2869
+ let e = () => h(document.hidden);
2870
+ return e(), document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
2871
+ }, []), b(() => {
2872
+ g.current = r;
2873
+ }, [r]), b(() => {
2874
+ if (r <= 0 || l || d || m) return;
2875
+ let e = Date.now(), t = setTimeout(() => _.current?.(), Math.max(0, g.current));
2876
+ return () => {
2877
+ clearTimeout(t), g.current = Math.max(0, g.current - (Date.now() - e));
2878
+ };
2879
+ }, [
2880
+ r,
2881
+ l,
2882
+ d,
2883
+ m
2884
+ ]), /* @__PURE__ */ k(B, {
2885
+ className: i("lg-toast", c),
2886
+ "data-tone": n,
2887
+ onPointerEnter: () => u(!0),
2888
+ onPointerLeave: () => u(!1),
2889
+ onFocusCapture: () => f(!0),
2890
+ onBlurCapture: (e) => {
2891
+ e.currentTarget.contains(e.relatedTarget) || f(!1);
2892
+ },
2893
+ onKeyDown: (e) => {
2894
+ e.key === "Escape" && o && (e.preventDefault(), e.stopPropagation(), o());
2895
+ },
2896
+ children: [
2897
+ /* @__PURE__ */ O("span", {
2898
+ className: "lg-toast-icon",
2899
+ "aria-hidden": "true",
2900
+ children: n === "success" ? "✓" : n === "error" ? "×" : n === "warning" ? "!" : "i"
2901
+ }),
2902
+ /* @__PURE__ */ k("div", {
2903
+ className: "lg-toast-content",
2904
+ children: [/* @__PURE__ */ k("div", {
2905
+ role: n === "error" ? "alert" : "status",
2906
+ "aria-atomic": "true",
2907
+ children: [/* @__PURE__ */ O("div", {
2908
+ className: "lg-toast-title",
2909
+ children: e
2910
+ }), t && /* @__PURE__ */ O("div", {
2911
+ className: "lg-toast-description",
2912
+ children: t
2913
+ })]
2914
+ }), a && /* @__PURE__ */ O(p, {
2915
+ size: "small",
2916
+ onClick: () => {
2917
+ a.onClick(), o?.();
2918
+ },
2919
+ children: a.label
2920
+ })]
2921
+ }),
2922
+ o && /* @__PURE__ */ O("button", {
2923
+ type: "button",
2924
+ className: "lg-dismiss",
2925
+ "aria-label": s,
2926
+ onClick: o,
2927
+ children: /* @__PURE__ */ O("span", {
2928
+ "aria-hidden": "true",
2929
+ children: "×"
2930
+ })
2931
+ })
2932
+ ]
2933
+ });
2934
+ }
2935
+ var Kt = g(null);
2936
+ function qt({ children: e, duration: t = 4500, maxVisible: n = 3, position: r = "bottom-right", label: i = "通知", closeLabel: a }) {
2937
+ let o = x(), s = T(0), [c, l] = E([]), u = T([]), d = T(null), f = Number.isFinite(n) ? Math.max(1, Math.floor(n)) : 3, p = v((e) => {
2938
+ let t = {
2939
+ id: `${o}-${++s.current}`,
2940
+ options: e,
2941
+ returnFocus: document.activeElement instanceof HTMLElement ? document.activeElement : null
2942
+ };
2943
+ return u.current = [...u.current, t], l(u.current), t.id;
2944
+ }, [o]), m = v((e) => {
2945
+ let t = u.current.find((t) => t.id === e);
2946
+ t && (document.getElementById(e)?.contains(document.activeElement) && t.returnFocus?.isConnected && t.returnFocus.focus({ preventScroll: !0 }), u.current = u.current.filter((t) => t.id !== e), l(u.current), t.options.onDismiss?.());
2947
+ }, []), h = v(() => {
2948
+ for (let e of [...u.current]) m(e.id);
2949
+ }, [m]), g = w(() => ({
2950
+ toast: p,
2951
+ dismiss: m,
2952
+ dismissAll: h
2953
+ }), [
2954
+ p,
2955
+ m,
2956
+ h
2957
+ ]), _ = c.length > 0;
2958
+ return b(() => {
2959
+ let e = d.current;
2960
+ if (e && typeof e.showPopover == "function") {
2961
+ e.setAttribute("popover", "manual");
2962
+ try {
2963
+ _ && !e.matches(":popover-open") && e.showPopover(), !_ && e.matches(":popover-open") && e.hidePopover();
2964
+ } catch {
2965
+ e.removeAttribute("popover");
2966
+ }
2967
+ }
2968
+ }, [_]), /* @__PURE__ */ k(Kt.Provider, {
2969
+ value: g,
2970
+ children: [e, /* @__PURE__ */ O("div", {
2971
+ ref: d,
2972
+ className: "lg-toast-viewport",
2973
+ "data-position": r,
2974
+ role: "region",
2975
+ "aria-label": i,
2976
+ tabIndex: -1,
2977
+ children: c.slice(0, f).map((e) => /* @__PURE__ */ O("div", {
2978
+ id: e.id,
2979
+ children: /* @__PURE__ */ O(Gt, {
2980
+ ...e.options,
2981
+ duration: e.options.duration ?? t,
2982
+ closeLabel: a,
2983
+ onDismiss: () => m(e.id)
2984
+ })
2985
+ }, e.id))
2986
+ })]
2987
+ });
2988
+ }
2989
+ function Jt() {
2990
+ let e = y(Kt);
2991
+ if (!e) throw Error("useToast 必须在 ToastProvider 内使用。");
2992
+ return e;
2993
+ }
2994
+ // src/tag.tsx
2995
+ function Yt({ tone: e = "neutral", icon: t, onClose: n, closeLabel: r = "移除标签", children: a, className: o, ...c }) {
2996
+ let l = T(null);
2997
+ return s(l), /* @__PURE__ */ k("span", {
2998
+ ...c,
2999
+ ref: l,
3000
+ className: i("lg-glass lg-tag", o),
3001
+ "data-tone": e,
3002
+ children: [
3003
+ t,
3004
+ /* @__PURE__ */ O("span", { children: a }),
3005
+ n && /* @__PURE__ */ O("button", {
3006
+ type: "button",
3007
+ className: "lg-dismiss",
3008
+ "aria-label": r,
3009
+ onClick: n,
3010
+ children: /* @__PURE__ */ O("span", {
3011
+ "aria-hidden": "true",
3012
+ children: "×"
3013
+ })
3014
+ })
3015
+ ]
3016
+ });
3017
+ }
3018
+ // src/badge.tsx
3019
+ function Xt({ count: e = 0, max: t = 99, dot: n = !1, showZero: r = !1, tone: a = "danger", label: o, children: s, className: c, ...l }) {
3020
+ let u = Math.max(0, Math.trunc(e)), d = Math.max(0, Math.trunc(t)), f = n || u > 0 || r;
3021
+ return /* @__PURE__ */ k("span", {
3022
+ ...l,
3023
+ className: i("lg-badge", c),
3024
+ "data-attached": s != null || void 0,
3025
+ children: [s, f && /* @__PURE__ */ O("span", {
3026
+ role: "img",
3027
+ className: "lg-badge-mark",
3028
+ "data-tone": a,
3029
+ "data-dot": n || void 0,
3030
+ "aria-label": o ?? (n ? "有新消息" : String(u)),
3031
+ children: /* @__PURE__ */ O("span", {
3032
+ "aria-hidden": "true",
3033
+ children: n ? null : u > d ? `${d}+` : u
3034
+ })
3035
+ })]
3036
+ });
3037
+ }
3038
+ // src/avatar.tsx
3039
+ function Zt({ src: e, alt: t, name: n, children: r, size: a = "regular", shape: o = "circle", onImageError: c, className: l, style: u, ...d }) {
3040
+ let [f, p] = E();
3041
+ b(() => {
3042
+ p(void 0);
3043
+ }, [e]);
3044
+ let m = T(null);
3045
+ s(m);
3046
+ let h = d["aria-label"] ?? t ?? n ?? "头像", g = typeof a == "number" ? Math.max(16, a) : {
3047
+ small: 28,
3048
+ regular: 40,
3049
+ large: 64
3050
+ }[a];
3051
+ return /* @__PURE__ */ O("span", {
3052
+ ...d,
3053
+ ref: m,
3054
+ role: "img",
3055
+ "aria-label": h,
3056
+ className: i("lg-glass lg-avatar", l),
3057
+ "data-shape": o,
3058
+ style: {
3059
+ ...u,
3060
+ "--lg-avatar-size": `${g}px`
3061
+ },
3062
+ children: e && f !== e ? /* @__PURE__ */ O("img", {
3063
+ src: e,
3064
+ alt: "",
3065
+ onError: () => {
3066
+ p(e), c?.();
3067
+ }
3068
+ }, e) : /* @__PURE__ */ O("span", {
3069
+ "aria-hidden": "true",
3070
+ children: r ?? (Array.from(n?.trim() || "")[0]?.toLocaleUpperCase() || /* @__PURE__ */ k("svg", {
3071
+ viewBox: "0 0 24 24",
3072
+ fill: "none",
3073
+ stroke: "currentColor",
3074
+ strokeWidth: "1.5",
3075
+ children: [/* @__PURE__ */ O("circle", {
3076
+ cx: "12",
3077
+ cy: "8",
3078
+ r: "3.5"
3079
+ }), /* @__PURE__ */ O("path", { d: "M5 21v-2a7 7 0 0 1 14 0v2" })]
3080
+ }))
3081
+ })
3082
+ });
3083
+ }
3084
+ // src/empty.tsx
3085
+ function Qt({ title: e = "暂无内容", description: t, icon: n, children: r, className: a, ...o }) {
3086
+ return /* @__PURE__ */ k("div", {
3087
+ ...o,
3088
+ className: i("lg-empty", a),
3089
+ children: [
3090
+ /* @__PURE__ */ O("div", {
3091
+ className: "lg-empty-icon",
3092
+ "aria-hidden": "true",
3093
+ children: n ?? /* @__PURE__ */ k("svg", {
3094
+ viewBox: "0 0 64 64",
3095
+ fill: "none",
3096
+ stroke: "currentColor",
3097
+ strokeWidth: "1.5",
3098
+ strokeLinejoin: "round",
3099
+ children: [/* @__PURE__ */ O("path", { d: "m12 29 9-14h22l9 14v20H12Z" }), /* @__PURE__ */ O("path", { d: "M12 29h13l3 6h8l3-6h13M24 22h16" })]
3100
+ })
3101
+ }),
3102
+ /* @__PURE__ */ O("div", {
3103
+ className: "lg-empty-title",
3104
+ children: e
3105
+ }),
3106
+ t != null && /* @__PURE__ */ O("div", {
3107
+ className: "lg-empty-description",
3108
+ children: t
3109
+ }),
3110
+ r != null && /* @__PURE__ */ O("div", {
3111
+ className: "lg-empty-actions",
3112
+ children: r
3113
+ })
3114
+ ]
3115
+ });
3116
+ }
3117
+ // src/skeleton.tsx
3118
+ function $t({ width: e, height: t, shape: n = "text", animated: r = !0, className: a, style: o, ...s }) {
3119
+ return /* @__PURE__ */ O("span", {
3120
+ ...s,
3121
+ "aria-hidden": "true",
3122
+ className: i("lg-skeleton", a),
3123
+ "data-shape": n,
3124
+ "data-animated": r || void 0,
3125
+ style: {
3126
+ ...o,
3127
+ width: e,
3128
+ height: t
3129
+ }
3130
+ });
3131
+ }
3132
+ // src/typography.tsx
3133
+ function en({ as: e = "p", tone: t = "default", size: n = "regular", weight: r = "regular", truncate: a, className: o, ...s }) {
3134
+ return /* @__PURE__ */ O(e, {
3135
+ ...s,
3136
+ className: i("lg-typography", o),
3137
+ "data-tone": t,
3138
+ "data-size": n,
3139
+ "data-weight": r,
3140
+ "data-truncate": a || void 0
3141
+ });
3142
+ }
3143
+ // src/form-field.tsx
3144
+ function tn({ id: e, label: t, description: n, error: r, required: a, disabled: o, children: s, className: c, ...l }) {
3145
+ let u = x(), d = e ?? u, f = n ? d + "-description" : void 0, p = r ? d + "-error" : void 0, m = [f, p].filter(Boolean).join(" ") || void 0;
3146
+ return /* @__PURE__ */ k("div", {
3147
+ ...l,
3148
+ className: i("lg-field", c),
3149
+ "data-disabled": o || void 0,
3150
+ children: [
3151
+ /* @__PURE__ */ k("label", {
3152
+ htmlFor: d,
3153
+ className: "lg-field-label",
3154
+ children: [t, a && /* @__PURE__ */ O("span", {
3155
+ "aria-hidden": "true",
3156
+ children: " *"
3157
+ })]
3158
+ }),
3159
+ n && /* @__PURE__ */ O("div", {
3160
+ id: f,
3161
+ className: "lg-field-description",
3162
+ children: n
3163
+ }),
3164
+ s({
3165
+ id: d,
3166
+ required: a,
3167
+ disabled: o,
3168
+ "aria-describedby": m,
3169
+ "aria-invalid": r ? !0 : void 0
3170
+ }),
3171
+ r && /* @__PURE__ */ O("div", {
3172
+ id: p,
3173
+ className: "lg-field-error",
3174
+ role: "alert",
3175
+ children: r
3176
+ })
3177
+ ]
3178
+ });
3179
+ }
3180
+ // src/dialog.tsx
3181
+ function nn({ open: e, onOpenChange: t, title: n, description: r, children: a, footer: o, size: s = "regular", dismissible: c = !0, initialFocusRef: u, returnFocusRef: d, className: f }) {
3182
+ let m = T(null), h = T(!1), g = x(), { locale: _ } = l(), v = () => {
3183
+ c && t(!1);
3184
+ }, { phase: y, finished: S } = I(m, e, v, d);
3185
+ b(() => {
3186
+ y === "open" && u?.current?.focus({ preventScroll: !0 });
3187
+ }, [y, u]);
3188
+ let C = T(S);
3189
+ return b(() => {
3190
+ C.current = S;
3191
+ }), b(() => {
3192
+ if (y !== "leaving") return;
3193
+ let e = setTimeout(() => C.current(), L() ? 0 : 150);
3194
+ return () => clearTimeout(e);
3195
+ }, [y]), /* @__PURE__ */ O("dialog", {
3196
+ ref: m,
3197
+ className: i("lg-dialog", f),
3198
+ "data-phase": y,
3199
+ "data-size": s,
3200
+ "aria-labelledby": g + "-title",
3201
+ "aria-describedby": r ? g + "-description" : void 0,
3202
+ onPointerDown: (e) => {
3203
+ h.current = e.target === e.currentTarget;
3204
+ },
3205
+ onClick: (e) => {
3206
+ e.target === e.currentTarget && h.current && v();
3207
+ },
3208
+ children: y !== "closed" && /* @__PURE__ */ k("div", {
3209
+ className: "lg-dialog-panel",
3210
+ children: [
3211
+ /* @__PURE__ */ k("header", {
3212
+ className: "lg-dialog-header",
3213
+ children: [/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("h2", {
3214
+ id: g + "-title",
3215
+ children: n
3216
+ }), r && /* @__PURE__ */ O("p", {
3217
+ id: g + "-description",
3218
+ children: r
3219
+ })] }), c && /* @__PURE__ */ O(p, {
3220
+ "aria-label": _.close,
3221
+ size: "small",
3222
+ onClick: v,
3223
+ children: "×"
3224
+ })]
3225
+ }),
3226
+ /* @__PURE__ */ O("div", {
3227
+ className: "lg-dialog-content",
3228
+ children: a
3229
+ }),
3230
+ o && /* @__PURE__ */ O("footer", {
3231
+ className: "lg-dialog-footer",
3232
+ children: o
3233
+ })
3234
+ ]
3235
+ })
3236
+ });
3237
+ }
3238
+ // src/tabs.tsx
3239
+ function rn({ items: e, value: t, defaultValue: n, onValueChange: r, "aria-label": a, keepMounted: o = !0, className: c }) {
3240
+ let u = x(), d = T(null);
3241
+ s(d);
3242
+ let { direction: f } = l(), [p, m] = P(t, n ?? e.find((e) => !e.disabled)?.value ?? "", r), h = e.find((e) => e.value === p && !e.disabled) ?? e.find((e) => !e.disabled);
3243
+ function g(t) {
3244
+ let n = e.filter((e) => !e.disabled), r = n.findIndex((e) => e.value === h?.value), i = f === "rtl" ? "ArrowLeft" : "ArrowRight", a = f === "rtl" ? "ArrowRight" : "ArrowLeft", o;
3245
+ if (t.key === i && (o = n[(r + 1) % n.length]), t.key === a && (o = n[(r - 1 + n.length) % n.length]), t.key === "Home" && (o = n[0]), t.key === "End" && (o = n.at(-1)), !o) return;
3246
+ t.preventDefault(), m(o.value);
3247
+ let s = e.findIndex((e) => e.value === o.value);
3248
+ d.current?.querySelectorAll("[role=\"tab\"]")[s]?.focus();
3249
+ }
3250
+ return /* @__PURE__ */ k("div", {
3251
+ className: i("lg-tabs", c),
3252
+ children: [/* @__PURE__ */ O("div", {
3253
+ ref: d,
3254
+ className: "lg-glass lg-tabs-list",
3255
+ role: "tablist",
3256
+ "aria-label": a,
3257
+ onKeyDown: g,
3258
+ children: e.map((e, t) => /* @__PURE__ */ O("button", {
3259
+ type: "button",
3260
+ id: `${u}-tab-${t}`,
3261
+ role: "tab",
3262
+ disabled: e.disabled,
3263
+ tabIndex: h?.value === e.value ? 0 : -1,
3264
+ "aria-selected": h?.value === e.value,
3265
+ "aria-controls": `${u}-panel-${t}`,
3266
+ onClick: () => m(e.value),
3267
+ children: e.label
3268
+ }, e.value))
3269
+ }), e.map((e, t) => (o || h?.value === e.value) && /* @__PURE__ */ O("div", {
3270
+ id: `${u}-panel-${t}`,
3271
+ role: "tabpanel",
3272
+ "aria-labelledby": `${u}-tab-${t}`,
3273
+ hidden: h?.value !== e.value,
3274
+ tabIndex: 0,
3275
+ className: "lg-tabs-panel",
3276
+ children: e.content
3277
+ }, e.value))]
3278
+ });
3279
+ }
3280
+ // src/table.tsx
3281
+ function an({ columns: e, data: t, rowKey: n, caption: r, empty: a, rowClassName: o, className: s }) {
3282
+ let { locale: c } = l();
3283
+ return /* @__PURE__ */ O("div", {
3284
+ className: i("lg-table-scroll", s),
3285
+ tabIndex: 0,
3286
+ role: "region",
3287
+ "aria-label": r,
3288
+ children: /* @__PURE__ */ k("table", {
3289
+ className: "lg-table",
3290
+ children: [
3291
+ /* @__PURE__ */ O("caption", {
3292
+ className: "lg-sr-only",
3293
+ children: r
3294
+ }),
3295
+ /* @__PURE__ */ O("thead", { children: /* @__PURE__ */ O("tr", { children: e.map((e) => /* @__PURE__ */ O("th", {
3296
+ scope: "col",
3297
+ "aria-sort": e.ariaSort,
3298
+ style: {
3299
+ width: e.width,
3300
+ textAlign: e.align,
3301
+ whiteSpace: e.wrap ? "normal" : "nowrap"
3302
+ },
3303
+ children: e.title
3304
+ }, e.key)) }) }),
3305
+ /* @__PURE__ */ O("tbody", { children: t.length ? t.map((t) => /* @__PURE__ */ O("tr", {
3306
+ className: o?.(t),
3307
+ children: e.map((e) => /* @__PURE__ */ O("td", {
3308
+ style: {
3309
+ textAlign: e.align,
3310
+ whiteSpace: e.wrap ? "normal" : "nowrap"
3311
+ },
3312
+ children: e.render(t)
3313
+ }, e.key))
3314
+ }, n(t))) : /* @__PURE__ */ O("tr", { children: /* @__PURE__ */ O("td", {
3315
+ colSpan: Math.max(1, e.length),
3316
+ className: "lg-table-empty",
3317
+ children: a ?? c.empty
3318
+ }) }) })
3319
+ ]
3320
+ })
3321
+ });
3322
+ }
3323
+ // src/internal/chevron.tsx
3324
+ function on({ direction: e }) {
3325
+ return /* @__PURE__ */ O("svg", {
3326
+ className: "lg-chevron",
3327
+ "data-direction": e,
3328
+ viewBox: "0 0 24 24",
3329
+ fill: "none",
3330
+ stroke: "currentColor",
3331
+ strokeWidth: "1.8",
3332
+ strokeLinecap: "round",
3333
+ strokeLinejoin: "round",
3334
+ "aria-hidden": "true",
3335
+ children: /* @__PURE__ */ O("path", { d: "m9 5 7 7-7 7" })
3336
+ });
3337
+ }
3338
+ // src/pagination.tsx
3339
+ function sn({ total: e, page: t, pageSize: n = 10, onPageChange: r, pageSizeOptions: i = [
3340
+ 10,
3341
+ 20,
3342
+ 50
3343
+ ], onPageSizeChange: a, disabled: o, "aria-label": s }) {
3344
+ let { locale: c } = l(), u = Number.isFinite(n) && n > 0 ? Math.max(1, Math.floor(n)) : 10, d = Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0, f = Math.max(1, Math.ceil(d / u)), m = Math.max(1, Math.min(f, Number.isFinite(t) ? Math.floor(t) : 1)), h = [
3345
+ 1,
3346
+ m - 1,
3347
+ m,
3348
+ m + 1,
3349
+ f
3350
+ ], g = [...new Set(h.filter((e) => e >= 1 && e <= f))].sort((e, t) => e - t), _ = [.../* @__PURE__ */ new Set([u, ...i.filter((e) => Number.isInteger(e) && e > 0)])].sort((e, t) => e - t).map((e) => ({
3351
+ value: String(e),
3352
+ label: c.pageSizeOption(e)
3353
+ }));
3354
+ return /* @__PURE__ */ k("nav", {
3355
+ className: "lg-pagination",
3356
+ "aria-label": s ?? c.pagination,
3357
+ children: [
3358
+ /* @__PURE__ */ O("span", {
3359
+ className: "lg-muted",
3360
+ children: c.total(d)
3361
+ }),
3362
+ /* @__PURE__ */ O(p, {
3363
+ icon: /* @__PURE__ */ O(on, { direction: "previous" }),
3364
+ size: "small",
3365
+ "aria-label": c.previous,
3366
+ disabled: o || m === 1,
3367
+ onClick: () => r(m - 1)
3368
+ }),
3369
+ g.map((e, t) => /* @__PURE__ */ k("span", {
3370
+ className: "lg-pagination-page",
3371
+ children: [t > 0 && e - g[t - 1] > 1 && /* @__PURE__ */ O("span", {
3372
+ "aria-hidden": "true",
3373
+ children: "…"
3374
+ }), /* @__PURE__ */ O(p, {
3375
+ size: "small",
3376
+ "aria-label": c.page(e),
3377
+ "aria-current": e === m ? "page" : void 0,
3378
+ variant: e === m ? "filled" : "glass",
3379
+ disabled: o,
3380
+ onClick: () => r(e),
3381
+ children: e
3382
+ })]
3383
+ }, e)),
3384
+ /* @__PURE__ */ O(p, {
3385
+ icon: /* @__PURE__ */ O(on, { direction: "next" }),
3386
+ size: "small",
3387
+ "aria-label": c.next,
3388
+ disabled: o || m === f,
3389
+ onClick: () => r(m + 1)
3390
+ }),
3391
+ a && /* @__PURE__ */ O(Bt, {
3392
+ className: "lg-pagination-size",
3393
+ "aria-label": c.pageSize,
3394
+ value: String(u),
3395
+ disabled: o,
3396
+ options: _,
3397
+ onValueChange: (e) => a(Number(e))
3398
+ })
3399
+ ]
3400
+ });
3401
+ }
3402
+ // src/internal/date-only.ts
3403
+ function $(e) {
3404
+ if (!e || !/^[1-9]\d{3}-(0[1-9]|1[0-2])-\d{2}$/.test(e)) return;
3405
+ let [t, n, r] = e.split("-").map(Number), i = new Date(t, n - 1, r, 12);
3406
+ if (i.getFullYear() === t && i.getMonth() === n - 1 && i.getDate() === r) return i;
3407
+ }
3408
+ function cn(e) {
3409
+ return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
3410
+ }
3411
+ // src/internal/range-calendar-navigation.tsx
3412
+ function ln({ previousMonth: e, nextMonth: t, onPreviousClick: n, onNextClick: r, ...i }) {
3413
+ let { locale: a } = l();
3414
+ return /* @__PURE__ */ k("nav", {
3415
+ ...i,
3416
+ "aria-label": a.dateRange,
3417
+ children: [/* @__PURE__ */ O(p, {
3418
+ size: "small",
3419
+ icon: /* @__PURE__ */ O(on, { direction: "previous" }),
3420
+ "aria-label": a.previousMonth,
3421
+ disabled: !e,
3422
+ onClick: n
3423
+ }), /* @__PURE__ */ O(p, {
3424
+ size: "small",
3425
+ icon: /* @__PURE__ */ O(on, { direction: "next" }),
3426
+ "aria-label": a.nextMonth,
3427
+ disabled: !t,
3428
+ onClick: r
3429
+ })]
3430
+ });
3431
+ }
3432
+ // src/internal/range-calendar.tsx
3433
+ var un = Object.fromEntries(Object.keys(j()).map((e) => [e, "lg-range-" + e]));
3434
+ function dn({ value: e, onValueChange: t, min: n, max: r, today: i }) {
3435
+ let { locale: a, direction: o } = l(), [s, c] = E(2);
3436
+ b(() => {
3437
+ let e = matchMedia("(max-width: 640px)"), t = () => c(e.matches ? 1 : 2);
3438
+ return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
3439
+ }, []);
3440
+ let u = $(n), d = $(r), f = [];
3441
+ return u && f.push({ before: u }), d && f.push({ after: d }), /* @__PURE__ */ O(A, {
3442
+ mode: "range",
3443
+ resetOnSelect: !0,
3444
+ selected: e,
3445
+ onSelect: t,
3446
+ defaultMonth: e?.from ?? u ?? $(i),
3447
+ today: $(i),
3448
+ startMonth: u ?? $("1000-01-01"),
3449
+ endMonth: d ?? $("9999-12-31"),
3450
+ numberOfMonths: s,
3451
+ weekStartsOn: 1,
3452
+ fixedWeeks: !0,
3453
+ showOutsideDays: !1,
3454
+ autoFocus: !0,
3455
+ locale: a.languageTag.startsWith("zh") ? N : M,
3456
+ dir: o,
3457
+ disabled: f,
3458
+ classNames: un,
3459
+ components: { Nav: ln },
3460
+ formatters: { formatCaption: (e) => a.calendarMonth(cn(e).slice(0, 7)) },
3461
+ labels: { labelDayButton: (e) => cn(e) }
3462
+ });
3463
+ }
3464
+ // src/date-range-picker.tsx
3465
+ function fn({ value: e, defaultValue: t = {
3466
+ start: "",
3467
+ end: ""
3468
+ }, onValueChange: n, names: r, min: i, max: a, today: o, required: s, disabled: c, "aria-label": u }) {
3469
+ let d = x(), f = T(null), m = T(null), h = T(null), { locale: g } = l(), [_, v] = P(e, t, n), [y, S] = E(!1), [C, w] = E(), [D, A] = E(""), j = !!(_.start || _.end), M = _.start ? _.start.replaceAll("-", "/") : g.startDate, N = _.end ? _.end.replaceAll("-", "/") : g.endDate, F = !!(_.start && !$(_.start) || _.end && !$(_.end) || _.start && _.end && _.start > _.end || i && (_.start && _.start < i || _.end && _.end < i) || a && (_.start && _.start > a || _.end && _.end > a));
3470
+ b(() => {
3471
+ let e = F ? g.invalidDateRange : "";
3472
+ f.current?.setCustomValidity(e), m.current?.setCustomValidity(e), !F && (!s || _.start && _.end) && A("");
3473
+ }, [
3474
+ F,
3475
+ g.invalidDateRange,
3476
+ _.start,
3477
+ _.end,
3478
+ s
3479
+ ]), b(() => {
3480
+ c && S(!1);
3481
+ }, [c]), zt(f, () => {
3482
+ S(!1), A(""), e === void 0 && v(t);
3483
+ });
3484
+ function I() {
3485
+ w({
3486
+ from: $(_.start),
3487
+ to: $(_.end)
3488
+ }), S(!0), h.current?.focus({ preventScroll: !0 });
3489
+ }
3490
+ function L() {
3491
+ S(!1), h.current?.focus({ preventScroll: !0 });
3492
+ }
3493
+ function R() {
3494
+ v({
3495
+ start: "",
3496
+ end: ""
3497
+ }), A(""), L();
3498
+ }
3499
+ function z() {
3500
+ C?.from && C.to && (v({
3501
+ start: cn(C.from),
3502
+ end: cn(C.to)
3503
+ }), A(""), L());
3504
+ }
3505
+ function B(e) {
3506
+ e.preventDefault(), A(F ? g.invalidDateRange : g.requiredDateRange), h.current?.focus({ preventScroll: !0 });
3507
+ }
3508
+ let ee = C?.from ? cn(C.from).replaceAll("-", "/") : "—", V = C?.to ? cn(C.to).replaceAll("-", "/") : "—";
3509
+ return /* @__PURE__ */ k("div", {
3510
+ className: "lg-date-range",
3511
+ role: "group",
3512
+ "aria-label": u ?? g.dateRange,
3513
+ children: [
3514
+ /* @__PURE__ */ k("div", {
3515
+ className: "lg-date-range-control",
3516
+ children: [/* @__PURE__ */ k(p, {
3517
+ ref: h,
3518
+ className: "lg-date-range-trigger",
3519
+ "aria-label": u ?? g.dateRange,
3520
+ "aria-haspopup": "dialog",
3521
+ "aria-expanded": y,
3522
+ "aria-controls": y ? d : void 0,
3523
+ "aria-invalid": D ? !0 : void 0,
3524
+ "aria-describedby": d + "-value" + (D ? " " + d + "-error" : ""),
3525
+ "data-empty": !j || void 0,
3526
+ "data-clearable": j || void 0,
3527
+ disabled: c,
3528
+ onClick: () => y ? L() : I(),
3529
+ children: [/* @__PURE__ */ k("svg", {
3530
+ viewBox: "0 0 24 24",
3531
+ fill: "none",
3532
+ stroke: "currentColor",
3533
+ strokeWidth: "1.7",
3534
+ strokeLinecap: "round",
3535
+ "aria-hidden": "true",
3536
+ children: [/* @__PURE__ */ O("rect", {
3537
+ x: "3",
3538
+ y: "5",
3539
+ width: "18",
3540
+ height: "16",
3541
+ rx: "3"
3542
+ }), /* @__PURE__ */ O("path", { d: "M7 3v4m10-4v4M3 11h18" })]
3543
+ }), /* @__PURE__ */ k("span", { children: [
3544
+ M,
3545
+ /* @__PURE__ */ O("span", {
3546
+ className: "lg-date-range-separator",
3547
+ "aria-hidden": "true",
3548
+ children: "–"
3549
+ }),
3550
+ N
3551
+ ] })]
3552
+ }), j && /* @__PURE__ */ O("button", {
3553
+ type: "button",
3554
+ className: "lg-dismiss lg-date-range-clear",
3555
+ "aria-label": g.clear,
3556
+ disabled: c,
3557
+ onClick: R,
3558
+ children: "×"
3559
+ })]
3560
+ }),
3561
+ /* @__PURE__ */ k("span", {
3562
+ id: d + "-value",
3563
+ className: "lg-visually-hidden",
3564
+ children: [
3565
+ M,
3566
+ " – ",
3567
+ N
3568
+ ]
3569
+ }),
3570
+ /* @__PURE__ */ O("input", {
3571
+ ref: f,
3572
+ className: "lg-visually-hidden",
3573
+ tabIndex: -1,
3574
+ "aria-hidden": "true",
3575
+ name: r?.start,
3576
+ value: _.start,
3577
+ required: s,
3578
+ disabled: c,
3579
+ onChange: () => {},
3580
+ onInvalid: B
3581
+ }),
3582
+ /* @__PURE__ */ O("input", {
3583
+ ref: m,
3584
+ className: "lg-visually-hidden",
3585
+ tabIndex: -1,
3586
+ "aria-hidden": "true",
3587
+ name: r?.end,
3588
+ value: _.end,
3589
+ required: s,
3590
+ disabled: c,
3591
+ onChange: () => {},
3592
+ onInvalid: B
3593
+ }),
3594
+ D && /* @__PURE__ */ O(Pt, {
3595
+ id: d + "-error",
3596
+ children: D
3597
+ }),
3598
+ y && /* @__PURE__ */ k(Rt, {
3599
+ id: d,
3600
+ anchor: h,
3601
+ role: "dialog",
3602
+ "aria-label": u ?? g.dateRange,
3603
+ className: "lg-range-popover",
3604
+ align: "start",
3605
+ focusOnOpen: !0,
3606
+ allowAnchorOverlap: !0,
3607
+ onDismiss: (e) => e === "escape" ? L() : S(!1),
3608
+ children: [
3609
+ /* @__PURE__ */ k("div", {
3610
+ className: "lg-range-summary",
3611
+ children: [
3612
+ /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("span", { children: g.startDate }), /* @__PURE__ */ O("strong", { children: ee })] }),
3613
+ /* @__PURE__ */ O("span", {
3614
+ className: "lg-range-summary-arrow",
3615
+ "aria-hidden": "true",
3616
+ children: "→"
3617
+ }),
3618
+ /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("span", { children: g.endDate }), /* @__PURE__ */ O("strong", { children: V })] })
3619
+ ]
3620
+ }),
3621
+ /* @__PURE__ */ O(dn, {
3622
+ value: C,
3623
+ onValueChange: w,
3624
+ min: i,
3625
+ max: a,
3626
+ today: o
3627
+ }),
3628
+ /* @__PURE__ */ k("footer", {
3629
+ className: "lg-range-footer",
3630
+ children: [/* @__PURE__ */ O(p, {
3631
+ size: "small",
3632
+ onClick: R,
3633
+ children: g.clear
3634
+ }), /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O(p, {
3635
+ size: "small",
3636
+ onClick: L,
3637
+ children: g.cancel
3638
+ }), /* @__PURE__ */ O(p, {
3639
+ size: "small",
3640
+ variant: "filled",
3641
+ disabled: !C?.from || !C.to,
3642
+ onClick: z,
3643
+ children: g.applyRange
3644
+ })] })]
3645
+ })
3646
+ ]
3647
+ })
3648
+ ]
3649
+ });
3650
+ }
3651
+ // src/data-table.tsx
3652
+ function pn({ columns: e, data: t, rowKey: n, sort: r, defaultSort: i = null, onSortChange: a, manualSorting: o = !1, selection: s, pagination: c, loading: u, error: f, onRetry: p, toolbar: m, bulkActions: h, ...g }) {
3653
+ let { locale: _ } = l(), [v, y] = P(r, i, a), [b, x] = E([]), S = e.filter((e) => !b.includes(e.key)), C = w(() => {
3654
+ let n = e.find((e) => e.key === v?.key);
3655
+ return o || !n?.compare || !v ? t : [...t].sort((e, t) => n.compare(e, t) * (v.direction === "asc" ? 1 : -1));
3656
+ }, [
3657
+ e,
3658
+ v,
3659
+ t,
3660
+ o
3661
+ ]), T = S.map((e) => {
3662
+ if (!e.sortable && !e.compare) return e;
3663
+ let t = v?.key === e.key ? v.direction : null;
3664
+ return {
3665
+ ...e,
3666
+ ariaSort: t === "asc" ? "ascending" : t === "desc" ? "descending" : "none",
3667
+ title: /* @__PURE__ */ k("button", {
3668
+ type: "button",
3669
+ className: "lg-table-sort",
3670
+ disabled: u,
3671
+ onClick: () => {
3672
+ y(t === "desc" ? null : {
3673
+ key: e.key,
3674
+ direction: t === "asc" ? "desc" : "asc"
3675
+ });
3676
+ },
3677
+ children: [e.title, /* @__PURE__ */ O("span", {
3678
+ "aria-hidden": "true",
3679
+ children: t === "asc" ? " ↑" : t === "desc" ? " ↓" : " ↕"
3680
+ })]
3681
+ })
3682
+ };
3683
+ });
3684
+ if (s) {
3685
+ let e = new Set(s.keys), r = t.map(n), i = r.filter((t) => e.has(t)).length;
3686
+ T.unshift({
3687
+ key: "__selection",
3688
+ width: 58,
3689
+ title: /* @__PURE__ */ O(Mt, {
3690
+ "aria-label": _.selectAll,
3691
+ checked: r.length > 0 && i === r.length,
3692
+ disabled: u || !r.length,
3693
+ indeterminate: i > 0 && i < r.length,
3694
+ onCheckedChange: (t) => {
3695
+ for (let n of r) t ? e.add(n) : e.delete(n);
3696
+ s.onChange([...e]);
3697
+ }
3698
+ }),
3699
+ render: (t) => /* @__PURE__ */ O(Mt, {
3700
+ "aria-label": _.selectRow(n(t)),
3701
+ checked: e.has(n(t)),
3702
+ disabled: u,
3703
+ onCheckedChange: (r) => {
3704
+ r ? e.add(n(t)) : e.delete(n(t)), s.onChange([...e]);
3705
+ }
3706
+ })
3707
+ });
3708
+ }
3709
+ return /* @__PURE__ */ k("div", {
3710
+ className: "lg-data-table",
3711
+ "aria-busy": u || void 0,
3712
+ children: [
3713
+ /* @__PURE__ */ k("div", {
3714
+ className: "lg-data-toolbar",
3715
+ children: [/* @__PURE__ */ O("div", { children: s?.keys.length && h ? h(s.keys) : m }), /* @__PURE__ */ O(Wt, {
3716
+ label: _.columns,
3717
+ "aria-label": _.columns,
3718
+ align: "end",
3719
+ width: 220,
3720
+ children: /* @__PURE__ */ O("div", {
3721
+ className: "lg-check-list",
3722
+ children: e.map((e) => /* @__PURE__ */ O(Mt, {
3723
+ checked: !b.includes(e.key),
3724
+ disabled: S.length === 1 && !b.includes(e.key),
3725
+ onCheckedChange: (t) => {
3726
+ x(t ? b.filter((t) => t !== e.key) : [...b, e.key]);
3727
+ },
3728
+ children: e.title
3729
+ }, e.key))
3730
+ })
3731
+ })]
3732
+ }),
3733
+ f ? /* @__PURE__ */ O(Y, {
3734
+ tone: "error",
3735
+ action: p ? {
3736
+ label: _.retry,
3737
+ onClick: p
3738
+ } : void 0,
3739
+ children: f
3740
+ }) : /* @__PURE__ */ O(an, {
3741
+ ...g,
3742
+ rowKey: n,
3743
+ columns: T,
3744
+ data: C,
3745
+ empty: u ? /* @__PURE__ */ O(d, { "aria-label": _.loading }) : g.empty
3746
+ }),
3747
+ u && C.length > 0 && /* @__PURE__ */ O("span", {
3748
+ role: "status",
3749
+ className: "lg-muted",
3750
+ children: _.loading
3751
+ }),
3752
+ c && /* @__PURE__ */ O(sn, {
3753
+ ...c,
3754
+ disabled: u || c.disabled
3755
+ })
3756
+ ]
3757
+ });
3758
+ }
3759
+ // src/filter-bar.tsx
3760
+ function mn({ children: e, onClear: t, clearLabel: n, actions: r, className: a, ...o }) {
3761
+ let { locale: s } = l();
3762
+ return /* @__PURE__ */ k("form", {
3763
+ ...o,
3764
+ className: i("lg-filter-bar", a),
3765
+ onSubmit: (e) => {
3766
+ o.onSubmit ? o.onSubmit(e) : e.preventDefault();
3767
+ },
3768
+ children: [/* @__PURE__ */ O("div", {
3769
+ className: "lg-filter-fields",
3770
+ children: e
3771
+ }), /* @__PURE__ */ k("div", {
3772
+ className: "lg-filter-actions",
3773
+ children: [t && /* @__PURE__ */ O(p, {
3774
+ type: "button",
3775
+ size: "small",
3776
+ onClick: t,
3777
+ children: n ?? s.resetFilters
3778
+ }), r]
3779
+ })]
3780
+ });
3781
+ }
3782
+ // src/multi-select.tsx
3783
+ function hn({ options: e, value: t, defaultValue: n = [], onValueChange: r, onSearchChange: i, placeholder: a, name: o, required: s, disabled: c, loading: u, maxSelected: f, "aria-label": p }) {
3784
+ let m = T(null), [h, g] = P(t, n, r), [_, v] = E(""), [y, b] = E(!1), { locale: x } = l();
3785
+ zt(m, () => {
3786
+ b(!1), t === void 0 && g([...n]);
3787
+ });
3788
+ let S = i ? e : e.filter((e) => (e.label + " " + (e.description ?? "")).toLocaleLowerCase().includes(_.toLocaleLowerCase())), C = h.map((t) => e.find((e) => e.value === t)?.label ?? t), w = [...new Set(S.map((e) => e.group ?? ""))];
3789
+ return /* @__PURE__ */ k("div", {
3790
+ className: "lg-multi-select",
3791
+ children: [
3792
+ /* @__PURE__ */ O("select", {
3793
+ ref: m,
3794
+ name: o,
3795
+ multiple: !0,
3796
+ value: [...h],
3797
+ required: s,
3798
+ disabled: c,
3799
+ className: "lg-sr-only",
3800
+ tabIndex: -1,
3801
+ "aria-hidden": "true",
3802
+ onChange: () => {},
3803
+ onInvalid: (e) => {
3804
+ e.preventDefault(), b(!0), m.current?.parentElement?.querySelector("button")?.focus();
3805
+ },
3806
+ children: [.../* @__PURE__ */ new Set([...e.map((e) => e.value), ...h])].map((e) => /* @__PURE__ */ O("option", {
3807
+ value: e,
3808
+ children: e
3809
+ }, e))
3810
+ }),
3811
+ /* @__PURE__ */ O(Wt, {
3812
+ label: h.length ? C.join("、") : a ?? x.choose,
3813
+ "aria-label": p,
3814
+ align: "start",
3815
+ width: 320,
3816
+ trigger: {
3817
+ disabled: c,
3818
+ "aria-label": p,
3819
+ "aria-invalid": y || void 0
3820
+ },
3821
+ children: /* @__PURE__ */ k("div", {
3822
+ className: "lg-check-list",
3823
+ children: [
3824
+ /* @__PURE__ */ O(ie, {
3825
+ type: "search",
3826
+ autoFocus: !0,
3827
+ "aria-label": x.search,
3828
+ placeholder: x.search,
3829
+ value: _,
3830
+ onValueChange: (e) => {
3831
+ v(e), i?.(e);
3832
+ }
3833
+ }),
3834
+ u && /* @__PURE__ */ O(d, { "aria-label": x.loading }),
3835
+ !u && !S.length && /* @__PURE__ */ O("p", {
3836
+ className: "lg-muted",
3837
+ children: x.empty
3838
+ }),
3839
+ w.map((e) => /* @__PURE__ */ k("div", {
3840
+ role: "group",
3841
+ "aria-label": e || p,
3842
+ className: "lg-check-list",
3843
+ children: [e && /* @__PURE__ */ O("div", {
3844
+ className: "lg-field-label",
3845
+ children: e
3846
+ }), S.filter((t) => (t.group ?? "") === e).map((e) => /* @__PURE__ */ O(Mt, {
3847
+ checked: h.includes(e.value),
3848
+ disabled: e.disabled || !h.includes(e.value) && f !== void 0 && h.length >= f,
3849
+ description: e.description,
3850
+ onCheckedChange: (t) => {
3851
+ b(!1), g(t ? [...h, e.value] : h.filter((t) => t !== e.value));
3852
+ },
3853
+ children: /* @__PURE__ */ k("span", {
3854
+ className: "lg-member-option",
3855
+ children: [e.icon, e.label]
3856
+ })
3857
+ }, e.value))]
3858
+ }, e))
3859
+ ]
3860
+ })
3861
+ }),
3862
+ y && /* @__PURE__ */ O("p", {
3863
+ role: "alert",
3864
+ className: "lg-field-error",
3865
+ children: x.chooseAtLeastOne
3866
+ })
3867
+ ]
3868
+ });
3869
+ }
3870
+ // src/upload.tsx
3871
+ function gn(e, t) {
3872
+ return !t || t.split(",").some((t) => {
3873
+ let n = t.trim().toLowerCase();
3874
+ return n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n;
3875
+ });
3876
+ }
3877
+ function _n({ value: e, defaultValue: t = [], onValueChange: n, accept: r, multiple: i = !1, maxFiles: a = i ? 10 : 1, maxBytes: o = 8388608, disabled: s, progress: u, "aria-label": d }) {
3878
+ let f = T(null), [m, h] = P(e, t, n), [g, _] = E(""), [v, y] = E(!1), { locale: b } = l();
3879
+ zt(f, () => {
3880
+ _(""), e === void 0 && h([...t]);
3881
+ });
3882
+ function x(e) {
3883
+ if (s) return;
3884
+ let t = i ? [...m, ...e] : [...e];
3885
+ if (t.length > a) {
3886
+ _(b.tooManyFiles(a));
3887
+ return;
3888
+ }
3889
+ let n = t.find((e) => e.size > o || !gn(e, r));
3890
+ n ? _(b.invalidFile(n.name)) : (_(""), h(t));
3891
+ }
3892
+ return /* @__PURE__ */ k("div", {
3893
+ className: "lg-upload",
3894
+ "data-dragging": v || void 0,
3895
+ "aria-label": d,
3896
+ onDragOver: (e) => {
3897
+ e.preventDefault(), s || y(!0);
3898
+ },
3899
+ onDragLeave: () => y(!1),
3900
+ onDrop: (e) => {
3901
+ e.preventDefault(), y(!1), x([...e.dataTransfer.files]);
3902
+ },
3903
+ children: [
3904
+ /* @__PURE__ */ O("input", {
3905
+ ref: f,
3906
+ type: "file",
3907
+ accept: r,
3908
+ multiple: i,
3909
+ disabled: s,
3910
+ className: "lg-sr-only",
3911
+ tabIndex: -1,
3912
+ "aria-label": d,
3913
+ onChange: (e) => {
3914
+ x([...e.target.files ?? []]), e.target.value = "";
3915
+ }
3916
+ }),
3917
+ /* @__PURE__ */ O(p, {
3918
+ disabled: s,
3919
+ onClick: () => f.current?.click(),
3920
+ children: d
3921
+ }),
3922
+ /* @__PURE__ */ O("p", {
3923
+ className: "lg-muted",
3924
+ children: b.dropFiles
3925
+ }),
3926
+ g && /* @__PURE__ */ O(Y, {
3927
+ tone: "error",
3928
+ children: g
3929
+ }),
3930
+ /* @__PURE__ */ O("ul", {
3931
+ className: "lg-upload-files",
3932
+ children: m.map((e, t) => /* @__PURE__ */ k("li", { children: [/* @__PURE__ */ k("span", { children: [
3933
+ e.name,
3934
+ " ",
3935
+ /* @__PURE__ */ k("small", {
3936
+ className: "lg-muted",
3937
+ children: [Math.ceil(e.size / 1024), " KiB"]
3938
+ })
3939
+ ] }), /* @__PURE__ */ O(p, {
3940
+ size: "small",
3941
+ disabled: s,
3942
+ "aria-label": b.clear + " " + e.name,
3943
+ onClick: () => h(m.filter((e, n) => n !== t)),
3944
+ children: "×"
3945
+ })] }, e.name + e.lastModified + t))
3946
+ }),
3947
+ u !== void 0 && /* @__PURE__ */ O(c, {
3948
+ value: u,
3949
+ "aria-label": d + "进度"
3950
+ })
3951
+ ]
3952
+ });
3953
+ }
3954
+ // src/drawer.tsx
3955
+ function vn({ side: e = "end", className: t, ...n }) {
3956
+ return /* @__PURE__ */ O(nn, {
3957
+ ...n,
3958
+ className: i("lg-drawer lg-drawer-" + e, t)
3959
+ });
3960
+ }
3961
+ // src/internal/tree-branch.tsx
3962
+ function yn({ node: e, selected: t, active: n, expanded: r, onToggle: i, onSelect: a, onFocus: o }) {
3963
+ let s = x(), c = !!e.children?.length, l = r.has(e.key);
3964
+ return /* @__PURE__ */ k("li", {
3965
+ role: "treeitem",
3966
+ "data-key": e.key,
3967
+ "aria-labelledby": s,
3968
+ "aria-selected": t === e.key,
3969
+ "aria-expanded": c ? l : void 0,
3970
+ "aria-disabled": e.disabled || void 0,
3971
+ tabIndex: n === e.key ? 0 : -1,
3972
+ onFocus: (t) => {
3973
+ t.target === t.currentTarget && o(e.key);
3974
+ },
3975
+ onClick: (t) => {
3976
+ t.stopPropagation(), t.currentTarget.focus(), e.disabled || a(e.key);
3977
+ },
3978
+ children: [/* @__PURE__ */ k("div", {
3979
+ className: "lg-tree-row",
3980
+ children: [/* @__PURE__ */ O("span", {
3981
+ className: "lg-tree-expander",
3982
+ "aria-hidden": "true",
3983
+ onClick: (t) => {
3984
+ t.stopPropagation(), c && !e.disabled && i(e.key);
3985
+ },
3986
+ children: c ? l ? "▾" : "▸" : "·"
3987
+ }), /* @__PURE__ */ O("span", {
3988
+ id: s,
3989
+ children: e.label
3990
+ })]
3991
+ }), c && l && /* @__PURE__ */ O("ul", {
3992
+ role: "group",
3993
+ children: e.children.map((e) => /* @__PURE__ */ O(yn, {
3994
+ node: e,
3995
+ selected: t,
3996
+ active: n,
3997
+ expanded: r,
3998
+ onToggle: i,
3999
+ onSelect: a,
4000
+ onFocus: o
4001
+ }, e.key))
4002
+ })]
4003
+ });
4004
+ }
4005
+ // src/tree.tsx
4006
+ function bn(e, t, n) {
4007
+ return e.flatMap((e) => [{
4008
+ node: e,
4009
+ parent: n
4010
+ }, ...e.children && t.has(e.key) ? bn(e.children, t, e.key) : []]);
4011
+ }
4012
+ function xn({ nodes: e, selectedKey: t, onSelect: n, expandedKeys: r, defaultExpandedKeys: i = [], onExpandedChange: a, "aria-label": o }) {
4013
+ let { direction: s } = l(), [c, u] = P(r, i, a), [d, f] = P(t, "", n), [p, m] = E(""), h = w(() => new Set(c), [c]), g = bn(e, h), _ = g.some(({ node: e }) => e.key === p) ? p : g.find(({ node: e }) => e.key === d)?.node.key ?? g[0]?.node.key;
4014
+ function v(e) {
4015
+ u(h.has(e) ? c.filter((t) => t !== e) : [...c, e]);
4016
+ }
4017
+ function y(e) {
4018
+ let t = e.target.closest("[role=\"treeitem\"]"), n = g.findIndex(({ node: e }) => e.key === t?.dataset.key), r = g[n];
4019
+ if (!r) return;
4020
+ let i;
4021
+ e.key === "ArrowDown" && (i = g[n + 1]?.node.key), e.key === "ArrowUp" && (i = g[n - 1]?.node.key), e.key === "Home" && (i = g[0]?.node.key), e.key === "End" && (i = g.at(-1)?.node.key);
4022
+ let a = s === "rtl" ? "ArrowLeft" : "ArrowRight", o = s === "rtl" ? "ArrowRight" : "ArrowLeft";
4023
+ e.key === a && r.node.children?.length && !r.node.disabled && (h.has(r.node.key) ? i = r.node.children[0]?.key : v(r.node.key)), e.key === o && !r.node.disabled && (h.has(r.node.key) ? v(r.node.key) : i = r.parent), e.key !== "Enter" && e.key !== " " || r.node.disabled || f(r.node.key), [
4024
+ "ArrowDown",
4025
+ "ArrowUp",
4026
+ "Home",
4027
+ "End",
4028
+ "ArrowRight",
4029
+ "ArrowLeft",
4030
+ "Enter",
4031
+ " "
4032
+ ].includes(e.key) && e.preventDefault(), i && (m(i), [...e.currentTarget.querySelectorAll("[role=\"treeitem\"]")].find((e) => e.dataset.key === i)?.focus());
4033
+ }
4034
+ return /* @__PURE__ */ O("ul", {
4035
+ className: "lg-tree",
4036
+ role: "tree",
4037
+ "aria-label": o,
4038
+ onKeyDown: y,
4039
+ children: e.map((e) => /* @__PURE__ */ O(yn, {
4040
+ node: e,
4041
+ selected: d,
4042
+ active: _,
4043
+ expanded: h,
4044
+ onToggle: v,
4045
+ onSelect: f,
4046
+ onFocus: m
4047
+ }, e.key))
4048
+ });
4049
+ }
4050
+ // src/descriptions.tsx
4051
+ function Sn({ items: e, columns: t = 2, className: n }) {
4052
+ let r = x();
4053
+ return /* @__PURE__ */ O("dl", {
4054
+ className: i("lg-descriptions", n),
4055
+ style: { "--lg-description-columns": t },
4056
+ children: e.map((e, t) => /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("dt", {
4057
+ id: r + "-" + t,
4058
+ children: e.label
4059
+ }), /* @__PURE__ */ O("dd", {
4060
+ "aria-labelledby": r + "-" + t,
4061
+ children: e.value
4062
+ })] }, e.key))
4063
+ });
4064
+ }
4065
+ // src/statistic.tsx
4066
+ function Cn({ title: e, value: t, formatter: n, prefix: r, suffix: i, description: a }) {
4067
+ return /* @__PURE__ */ k("div", {
4068
+ className: "lg-statistic",
4069
+ children: [
4070
+ /* @__PURE__ */ O("div", {
4071
+ className: "lg-muted",
4072
+ children: e
4073
+ }),
4074
+ /* @__PURE__ */ k("div", {
4075
+ className: "lg-statistic-value",
4076
+ children: [
4077
+ r,
4078
+ n ? n(t) : t,
4079
+ i && /* @__PURE__ */ O("small", { children: i })
4080
+ ]
4081
+ }),
4082
+ a && /* @__PURE__ */ O("div", {
4083
+ className: "lg-muted",
4084
+ children: a
4085
+ })
4086
+ ]
4087
+ });
4088
+ }
4089
+ // src/member-picker.tsx
4090
+ function wn({ members: e, ...t }) {
4091
+ let n = e.map((e) => ({
4092
+ value: e.id,
4093
+ label: e.name,
4094
+ description: e.description,
4095
+ group: e.group,
4096
+ disabled: e.disabled,
4097
+ icon: /* @__PURE__ */ O(Zt, {
4098
+ src: e.avatar,
4099
+ name: e.name,
4100
+ size: "small",
4101
+ "aria-hidden": "true"
4102
+ })
4103
+ }));
4104
+ return /* @__PURE__ */ O(hn, {
4105
+ ...t,
4106
+ options: n
4107
+ });
4108
+ }
4109
+ // src/import-wizard.tsx
4110
+ function Tn({ inspect: e, publish: t, renderPreview: n, accept: r = ".zip", maxBytes: i, title: a = "导入文件" }) {
4111
+ let [o, s] = E([]), [c, l] = E({ phase: "choose" }), [u, d] = E(""), f = T(null);
4112
+ b(() => () => f.current?.abort(), []);
4113
+ async function m() {
4114
+ let t = new AbortController();
4115
+ f.current?.abort(), f.current = t, d(""), l({ phase: "inspecting" });
4116
+ try {
4117
+ let n = await e(o, t.signal);
4118
+ t.signal.aborted || l({
4119
+ phase: "ready",
4120
+ preview: n
4121
+ });
4122
+ } catch (e) {
4123
+ t.signal.aborted || (d(e instanceof Error ? e.message : "预检失败,请重试"), l({ phase: "choose" }));
4124
+ }
4125
+ }
4126
+ async function h() {
4127
+ if (c.phase !== "ready") return;
4128
+ let e = c.preview, n = new AbortController();
4129
+ f.current = n, d(""), l({
4130
+ phase: "publishing",
4131
+ preview: e
4132
+ });
4133
+ try {
4134
+ await t(e, n.signal), n.signal.aborted || l({ phase: "finished" });
4135
+ } catch (t) {
4136
+ n.signal.aborted || (d(t instanceof Error ? t.message : "发布失败,请重试"), l({
4137
+ phase: "ready",
4138
+ preview: e
4139
+ }));
4140
+ }
4141
+ }
4142
+ function g() {
4143
+ f.current?.abort(), s([]), d(""), l({ phase: "choose" });
4144
+ }
4145
+ let _ = c.phase === "inspecting" || c.phase === "publishing", v = c.phase === "ready" || c.phase === "publishing" ? n(c.preview) : null;
4146
+ return /* @__PURE__ */ k("section", {
4147
+ className: "lg-import-wizard",
4148
+ "aria-busy": _ || void 0,
4149
+ children: [
4150
+ /* @__PURE__ */ O("h3", { children: a }),
4151
+ /* @__PURE__ */ k("ol", {
4152
+ className: "lg-import-steps",
4153
+ "aria-label": "导入进度",
4154
+ children: [
4155
+ /* @__PURE__ */ O("li", {
4156
+ "aria-current": c.phase === "choose" ? "step" : void 0,
4157
+ children: "1 选择文件"
4158
+ }),
4159
+ /* @__PURE__ */ O("li", {
4160
+ "aria-current": c.phase === "inspecting" || c.phase === "ready" ? "step" : void 0,
4161
+ children: "2 预检"
4162
+ }),
4163
+ /* @__PURE__ */ O("li", {
4164
+ "aria-current": c.phase === "publishing" || c.phase === "finished" ? "step" : void 0,
4165
+ children: "3 发布"
4166
+ })
4167
+ ]
4168
+ }),
4169
+ u && /* @__PURE__ */ O(Y, {
4170
+ tone: "error",
4171
+ children: u
4172
+ }),
4173
+ (c.phase === "choose" || c.phase === "inspecting") && /* @__PURE__ */ O(_n, {
4174
+ "aria-label": "选择导入文件",
4175
+ accept: r,
4176
+ maxBytes: i,
4177
+ disabled: _,
4178
+ value: o,
4179
+ onValueChange: s
4180
+ }),
4181
+ v,
4182
+ c.phase === "finished" && /* @__PURE__ */ O("p", {
4183
+ role: "status",
4184
+ children: "导入完成"
4185
+ }),
4186
+ /* @__PURE__ */ k("div", {
4187
+ className: "lg-filter-actions",
4188
+ children: [
4189
+ (c.phase === "choose" || c.phase === "inspecting") && /* @__PURE__ */ O(p, {
4190
+ variant: "filled",
4191
+ disabled: !o.length,
4192
+ loading: _,
4193
+ onClick: () => void m(),
4194
+ children: "开始预检"
4195
+ }),
4196
+ (c.phase === "ready" || c.phase === "publishing") && /* @__PURE__ */ O(p, {
4197
+ variant: "filled",
4198
+ loading: _,
4199
+ onClick: () => void h(),
4200
+ children: "确认发布"
4201
+ }),
4202
+ c.phase !== "publishing" && /* @__PURE__ */ O(p, {
4203
+ onClick: g,
4204
+ children: c.phase === "finished" ? "继续导入" : "重新选择"
4205
+ })
4206
+ ]
4207
+ })
4208
+ ]
4209
+ });
4210
+ }
4211
+ // src/internal/calendar-day.tsx
4212
+ function En({ date: e, label: t, level: n, selected: r, today: i, focusable: a, onFocus: o, onSelect: s }) {
4213
+ return /* @__PURE__ */ O("div", {
4214
+ role: "gridcell",
4215
+ "aria-selected": e ? r : void 0,
4216
+ className: "lg-calendar-cell",
4217
+ children: e && /* @__PURE__ */ k("button", {
4218
+ type: "button",
4219
+ "data-date": e,
4220
+ "data-level": n,
4221
+ "data-today": i || void 0,
4222
+ tabIndex: a ? 0 : -1,
4223
+ disabled: !s,
4224
+ "aria-label": t,
4225
+ "aria-current": i ? "date" : void 0,
4226
+ onFocus: () => o(e),
4227
+ onClick: () => s?.(e),
4228
+ children: [/* @__PURE__ */ O("span", { children: Number(e.slice(-2)) }), n > 0 && /* @__PURE__ */ O("span", {
4229
+ className: "lg-calendar-activity-dot",
4230
+ "aria-hidden": "true"
4231
+ })]
4232
+ })
4233
+ });
4234
+ }
4235
+ // src/activity-calendar.tsx
4236
+ var Dn = [
4237
+ 0,
4238
+ 1,
4239
+ 2,
4240
+ 3,
4241
+ 4
4242
+ ];
4243
+ function On(e) {
4244
+ if (!/^[1-9]\d{3}-(0[1-9]|1[0-2])$/.test(e)) return [];
4245
+ let [t, n] = e.split("-").map(Number), r = new Date(Date.UTC(t, n, 0)).getUTCDate();
4246
+ return Array.from({ length: r }, (t, n) => e + "-" + String(n + 1).padStart(2, "0"));
4247
+ }
4248
+ function kn({ month: e, days: t, selectedDate: n, today: r, onDateSelect: i, onMonthChange: a, "aria-label": o }) {
4249
+ let { direction: s, locale: c } = l(), u = x(), [d, f] = E(""), m = On(e);
4250
+ if (!m.length) return /* @__PURE__ */ O("p", {
4251
+ role: "alert",
4252
+ children: "月份格式应为 YYYY-MM"
4253
+ });
4254
+ let h = ((/* @__PURE__ */ new Date(m[0] + "T12:00:00Z")).getUTCDay() + 6) % 7, g = [...Array.from({ length: h }, () => ""), ...m];
4255
+ for (; g.length % 7;) g.push("");
4256
+ let _ = Array.from({ length: g.length / 7 }, (e, t) => g.slice(t * 7, t * 7 + 7)), v = new Map(t.map((e) => [e.date, e])), y = Math.max(1, ...m.map((e) => {
4257
+ let t = v.get(e)?.value ?? 0;
4258
+ return Number.isFinite(t) ? Math.max(0, t) : 0;
4259
+ })), b = m.includes(d) ? d : n && m.includes(n) ? n : r && m.includes(r) ? r : m[0], S = _.map((e) => e.map((e) => {
4260
+ let t = v.get(e), i = Number.isFinite(t?.value) ? Math.max(0, t.value) : 0;
4261
+ return {
4262
+ date: e,
4263
+ level: i ? Math.max(1, Math.ceil(i / y * 4)) : 0,
4264
+ label: e + " · " + (t?.label ?? i + " 次活动"),
4265
+ selected: n === e,
4266
+ today: r === e,
4267
+ focusable: b === e
4268
+ };
4269
+ })), C = S.flat().filter((e) => e.date && e.level > 0).length, w = c.calendarMonth(e);
4270
+ function T(t) {
4271
+ let n = /* @__PURE__ */ new Date(e + "-01T12:00:00Z");
4272
+ n.setUTCMonth(n.getUTCMonth() + t);
4273
+ let r = n.toISOString().slice(0, 7);
4274
+ a?.(r);
4275
+ }
4276
+ function D(e) {
4277
+ let t = m.indexOf(e.target.dataset.date ?? "");
4278
+ if (t === -1) return;
4279
+ let n = s === "rtl" ? -1 : 1, r = {
4280
+ ArrowRight: n,
4281
+ ArrowLeft: -n,
4282
+ ArrowDown: 7,
4283
+ ArrowUp: -7,
4284
+ Home: -t,
4285
+ End: m.length - t - 1
4286
+ }[e.key];
4287
+ if (r === void 0) return;
4288
+ e.preventDefault();
4289
+ let i = m[Math.max(0, Math.min(m.length - 1, t + r))];
4290
+ f(i), e.currentTarget.querySelector("[data-date=\"" + i + "\"]")?.focus();
4291
+ }
4292
+ return /* @__PURE__ */ k(B, {
4293
+ className: "lg-activity-calendar",
4294
+ children: [
4295
+ /* @__PURE__ */ k("header", {
4296
+ className: "lg-calendar-header",
4297
+ children: [/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("p", {
4298
+ className: "lg-calendar-caption",
4299
+ children: o
4300
+ }), /* @__PURE__ */ O("h3", {
4301
+ id: u,
4302
+ children: w
4303
+ })] }), /* @__PURE__ */ k("div", {
4304
+ className: "lg-calendar-navigation",
4305
+ children: [/* @__PURE__ */ O(p, {
4306
+ size: "small",
4307
+ icon: /* @__PURE__ */ O(on, { direction: "previous" }),
4308
+ "aria-label": c.previousMonth,
4309
+ disabled: !a || e === "1000-01",
4310
+ onClick: () => T(-1)
4311
+ }), /* @__PURE__ */ O(p, {
4312
+ size: "small",
4313
+ icon: /* @__PURE__ */ O(on, { direction: "next" }),
4314
+ "aria-label": c.nextMonth,
4315
+ disabled: !a || e === "9999-12",
4316
+ onClick: () => T(1)
4317
+ })]
4318
+ })]
4319
+ }),
4320
+ /* @__PURE__ */ k("div", {
4321
+ role: "grid",
4322
+ "aria-label": o + " " + e,
4323
+ onKeyDown: D,
4324
+ children: [/* @__PURE__ */ O("div", {
4325
+ className: "lg-calendar-row lg-calendar-weekdays",
4326
+ role: "row",
4327
+ children: c.weekdays.map((e) => /* @__PURE__ */ O("span", {
4328
+ role: "columnheader",
4329
+ children: e
4330
+ }, e))
4331
+ }), S.map((e, t) => /* @__PURE__ */ O("div", {
4332
+ className: "lg-calendar-row",
4333
+ role: "row",
4334
+ children: e.map((e, t) => /* @__PURE__ */ O(En, {
4335
+ ...e,
4336
+ onFocus: f,
4337
+ onSelect: i
4338
+ }, e.date || "empty-" + t))
4339
+ }, t))]
4340
+ }),
4341
+ /* @__PURE__ */ k("footer", {
4342
+ className: "lg-calendar-footer",
4343
+ children: [/* @__PURE__ */ O("span", { children: c.activeDays(C) }), /* @__PURE__ */ k("span", {
4344
+ className: "lg-calendar-legend",
4345
+ "aria-hidden": "true",
4346
+ children: [
4347
+ /* @__PURE__ */ O("span", { children: c.lessActivity }),
4348
+ Dn.map((e) => /* @__PURE__ */ O("i", { "data-level": e }, e)),
4349
+ /* @__PURE__ */ O("span", { children: c.moreActivity })
4350
+ ]
4351
+ })]
4352
+ })
4353
+ ]
4354
+ });
4355
+ }
4356
+ // src/command-palette.tsx
4357
+ function An({ open: e, onOpenChange: t, commands: n, title: r = "快捷命令", shortcut: i = !1, returnFocusRef: a }) {
4358
+ let [o, s] = E(""), [c, u] = E(""), d = T(null), f = x(), { locale: p } = l(), m = o.trim().toLocaleLowerCase(), h = n.filter((e) => [
4359
+ e.title,
4360
+ e.description,
4361
+ e.group,
4362
+ ...e.keywords ?? []
4363
+ ].join(" ").toLocaleLowerCase().includes(m)), g = h.filter((e) => !e.disabled), _ = g.find((e) => e.id === c) ?? g[0];
4364
+ b(() => {
4365
+ e && (s(""), d.current?.focus());
4366
+ }, [e]), b(() => {
4367
+ if (!i) return;
4368
+ let n = (n) => {
4369
+ (n.metaKey || n.ctrlKey) && n.key.toLowerCase() === "k" && !n.isComposing && !n.repeat && (n.preventDefault(), t(!e));
4370
+ };
4371
+ return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
4372
+ }, [
4373
+ i,
4374
+ e,
4375
+ t
4376
+ ]);
4377
+ function v(e) {
4378
+ e.disabled || (t(!1), e.onSelect());
4379
+ }
4380
+ function y(e) {
4381
+ e.key === "Enter" && _ && (e.preventDefault(), v(_));
4382
+ let t = g.findIndex((e) => e.id === _?.id), n = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
4383
+ if (!n || !g.length) return;
4384
+ e.preventDefault();
4385
+ let r = g[(t + n + g.length) % g.length];
4386
+ u(r.id), document.getElementById(f + "-" + r.id)?.scrollIntoView({ block: "nearest" });
4387
+ }
4388
+ return /* @__PURE__ */ O(nn, {
4389
+ returnFocusRef: a,
4390
+ open: e,
4391
+ onOpenChange: t,
4392
+ title: r,
4393
+ initialFocusRef: d,
4394
+ children: /* @__PURE__ */ k("div", {
4395
+ className: "lg-command-palette",
4396
+ onKeyDown: y,
4397
+ children: [
4398
+ /* @__PURE__ */ O(ie, {
4399
+ ref: d,
4400
+ type: "search",
4401
+ role: "combobox",
4402
+ "aria-label": p.search,
4403
+ "aria-expanded": "true",
4404
+ "aria-controls": f,
4405
+ "aria-autocomplete": "list",
4406
+ "aria-activedescendant": _ ? f + "-" + _.id : void 0,
4407
+ value: o,
4408
+ onValueChange: (e) => {
4409
+ s(e), u("");
4410
+ },
4411
+ placeholder: p.search
4412
+ }),
4413
+ /* @__PURE__ */ O("ul", {
4414
+ id: f,
4415
+ role: "listbox",
4416
+ "aria-label": r,
4417
+ children: h.map((e) => /* @__PURE__ */ O("li", {
4418
+ role: "option",
4419
+ id: f + "-" + e.id,
4420
+ "aria-disabled": e.disabled || void 0,
4421
+ "aria-selected": _?.id === e.id,
4422
+ children: /* @__PURE__ */ k("button", {
4423
+ type: "button",
4424
+ tabIndex: -1,
4425
+ disabled: e.disabled,
4426
+ onPointerMove: () => u(e.id),
4427
+ onClick: () => v(e),
4428
+ children: [/* @__PURE__ */ k("span", { children: [e.title, e.description && /* @__PURE__ */ O("small", { children: e.description })] }), e.group && /* @__PURE__ */ O("small", { children: e.group })]
4429
+ })
4430
+ }, e.id))
4431
+ }),
4432
+ !h.length && /* @__PURE__ */ O("p", {
4433
+ className: "lg-muted",
4434
+ children: p.empty
4435
+ })
4436
+ ]
4437
+ })
4438
+ });
4439
+ }
4440
+ export { kn as ActivityCalendar, z as Alert, Zt as Avatar, Xt as Badge, p as Button, Ht as Card, Mt as Checkbox, An as CommandPalette, a as ConfigProvider, W as ContextMenu, pn as DataTable, fn as DateRangePicker, Sn as Descriptions, nn as Dialog, vn as Drawer, Qt as Empty, mn as FilterBar, tn as FormField, B as Glass, re as GlassGroup, Tn as ImportWizard, ie as Input, wn as MemberPicker, xe as Menu, Y as Message, hn as MultiSelect, De as NavigationBar, Oe as PageControl, sn as Pagination, Wt as Popover, c as Progress, Nt as Radio, Ae as SearchField, Ge as SegmentedControl, Bt as Select, rt as Sheet, $t as Skeleton, at as Slider, d as Spinner, Cn as Statistic, st as Stepper, ft as Switch, jt as TabBar, an as Table, rn as Tabs, Yt as Tag, Vt as TextArea, Gt as Toast, qt as ToastProvider, Z as Toolbar, we as ToolbarGroup, Ut as Tooltip, xn as Tree, en as Typography, _n as Upload, e as enUS, l as useConfig, Jt as useToast, f as zhCN };