@luxfi/ui 7.4.0 → 7.4.3

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 (131) hide show
  1. package/dist/avatar.cjs +7 -6
  2. package/dist/avatar.js +7 -5
  3. package/dist/badge.cjs +33 -35
  4. package/dist/badge.js +33 -35
  5. package/dist/bank.d.cts +3 -3
  6. package/dist/bank.d.ts +3 -3
  7. package/dist/checkbox.cjs +4 -4
  8. package/dist/checkbox.d.cts +3 -2
  9. package/dist/checkbox.d.ts +3 -2
  10. package/dist/checkbox.js +5 -4
  11. package/dist/chrome.cjs +960 -0
  12. package/dist/chrome.d.cts +93 -0
  13. package/dist/chrome.d.ts +93 -0
  14. package/dist/chrome.js +931 -0
  15. package/dist/drawer.cjs +86 -20
  16. package/dist/drawer.js +85 -19
  17. package/dist/expiration-selector.cjs +3 -2
  18. package/dist/expiration-selector.js +3 -2
  19. package/dist/greeks-display.cjs +6 -6
  20. package/dist/greeks-display.js +6 -6
  21. package/dist/gui.cjs +13 -0
  22. package/dist/gui.d.cts +2 -0
  23. package/dist/gui.d.ts +2 -0
  24. package/dist/gui.js +2 -0
  25. package/dist/heading.cjs +4 -2
  26. package/dist/heading.js +4 -2
  27. package/dist/iam.cjs +216 -0
  28. package/dist/iam.d.cts +65 -0
  29. package/dist/iam.d.ts +65 -0
  30. package/dist/iam.js +211 -0
  31. package/dist/icons.cjs +13 -0
  32. package/dist/icons.d.cts +1 -0
  33. package/dist/icons.d.ts +1 -0
  34. package/dist/icons.js +2 -0
  35. package/dist/identity.cjs +430 -0
  36. package/dist/identity.d.cts +64 -0
  37. package/dist/identity.d.ts +64 -0
  38. package/dist/identity.js +408 -0
  39. package/dist/index.cjs +1610 -836
  40. package/dist/index.d.cts +7 -3
  41. package/dist/index.d.ts +7 -3
  42. package/dist/index.js +1587 -831
  43. package/dist/input.cjs +3 -1
  44. package/dist/input.d.cts +3 -5
  45. package/dist/input.d.ts +3 -5
  46. package/dist/input.js +3 -1
  47. package/dist/lux.config.cjs +23 -2
  48. package/dist/lux.config.d.cts +28 -10
  49. package/dist/lux.config.d.ts +28 -10
  50. package/dist/lux.config.js +23 -2
  51. package/dist/menu.cjs +4 -4
  52. package/dist/menu.js +4 -4
  53. package/dist/next.cjs +132 -0
  54. package/dist/next.d.cts +32 -0
  55. package/dist/next.d.ts +32 -0
  56. package/dist/next.js +129 -0
  57. package/dist/option-chain.cjs +1 -1
  58. package/dist/option-chain.js +1 -1
  59. package/dist/option-position.cjs +2 -1
  60. package/dist/option-position.js +2 -1
  61. package/dist/pnl-diagram.cjs +8 -6
  62. package/dist/pnl-diagram.js +8 -6
  63. package/dist/progress.cjs +7 -6
  64. package/dist/progress.js +7 -5
  65. package/dist/provider.cjs +146 -4
  66. package/dist/provider.d.cts +15 -3
  67. package/dist/provider.d.ts +15 -3
  68. package/dist/provider.js +146 -5
  69. package/dist/radio.cjs +9 -7
  70. package/dist/radio.js +10 -7
  71. package/dist/separator.cjs +3 -1
  72. package/dist/separator.js +3 -1
  73. package/dist/slider.cjs +28 -16
  74. package/dist/slider.js +28 -15
  75. package/dist/strategy-builder.cjs +2 -1
  76. package/dist/strategy-builder.js +2 -1
  77. package/dist/switch.cjs +11 -12
  78. package/dist/switch.js +12 -12
  79. package/dist/tag.cjs +34 -36
  80. package/dist/tag.js +33 -35
  81. package/dist/textarea.cjs +3 -1
  82. package/dist/textarea.js +3 -1
  83. package/dist/tooltip.cjs +28 -30
  84. package/dist/tooltip.js +27 -29
  85. package/dist/use-narrow.cjs +46 -0
  86. package/dist/use-narrow.d.cts +12 -0
  87. package/dist/use-narrow.d.ts +12 -0
  88. package/dist/use-narrow.js +20 -0
  89. package/dist/vite.cjs +109 -0
  90. package/dist/vite.d.cts +29 -0
  91. package/dist/vite.d.ts +29 -0
  92. package/dist/vite.js +107 -0
  93. package/dist/white-label.cjs +142 -0
  94. package/dist/white-label.d.cts +59 -0
  95. package/dist/white-label.d.ts +59 -0
  96. package/dist/white-label.js +134 -0
  97. package/package.json +85 -19
  98. package/src/avatar.tsx +22 -16
  99. package/src/checkbox.tsx +15 -10
  100. package/src/chrome.tsx +459 -0
  101. package/src/drawer.tsx +83 -10
  102. package/src/engine.ts +130 -0
  103. package/src/expiration-selector.tsx +3 -2
  104. package/src/greeks-display.tsx +9 -6
  105. package/src/gui.ts +17 -0
  106. package/src/heading.tsx +12 -8
  107. package/src/iam.ts +170 -0
  108. package/src/icons.ts +18 -0
  109. package/src/identity.tsx +318 -0
  110. package/src/index.ts +44 -1
  111. package/src/input.tsx +13 -9
  112. package/src/lux.config.ts +16 -15
  113. package/src/menu.tsx +4 -4
  114. package/src/next.ts +89 -0
  115. package/src/option-chain.tsx +1 -1
  116. package/src/option-position.tsx +2 -1
  117. package/src/pnl-diagram.tsx +11 -6
  118. package/src/progress.tsx +15 -8
  119. package/src/provider.tsx +48 -7
  120. package/src/radio.tsx +15 -11
  121. package/src/separator.tsx +8 -3
  122. package/src/slider.tsx +35 -19
  123. package/src/strategy-builder.tsx +3 -2
  124. package/src/switch.tsx +17 -16
  125. package/src/textarea.tsx +8 -4
  126. package/src/tooltip.tsx +15 -24
  127. package/src/use-narrow.ts +40 -0
  128. package/src/vite.ts +80 -0
  129. package/src/white-label.ts +254 -0
  130. package/tokens.css +613 -319
  131. package/src/tokens.css +0 -438
package/dist/chrome.js ADDED
@@ -0,0 +1,931 @@
1
+ "use client";
2
+ import * as React6 from 'react';
3
+ import React6__default from 'react';
4
+ import { Check, ChevronRight, ChevronsUpDown, Folder, LogOut, User, Settings, Menu, Building2 } from 'lucide-react';
5
+ import { styled, View, Sheet } from '@hanzo/gui';
6
+ import * as RadixDialog from '@radix-ui/react-dialog';
7
+ import { clsx } from 'clsx';
8
+ import { twMerge } from 'tailwind-merge';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
+ import { QueryClient } from '@tanstack/react-query';
11
+ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
12
+
13
+ var NARROW_PX = 640;
14
+ function useBelow(px) {
15
+ const [below, setBelow] = React6.useState(false);
16
+ React6.useEffect(() => {
17
+ const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
18
+ const apply = () => setBelow(mql.matches);
19
+ apply();
20
+ mql.addEventListener("change", apply);
21
+ return () => mql.removeEventListener("change", apply);
22
+ }, [px]);
23
+ return below;
24
+ }
25
+ var useIsNarrow = () => useBelow(NARROW_PX);
26
+ function cn(...inputs) {
27
+ return twMerge(clsx(inputs));
28
+ }
29
+ var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
30
+ var CloseButtonFrame = styled(View, {
31
+ name: "LuxCloseButton",
32
+ render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
33
+ role: "button",
34
+ cursor: "pointer",
35
+ display: "inline-flex",
36
+ alignItems: "center",
37
+ justifyContent: "center",
38
+ width: 20,
39
+ height: 20,
40
+ minWidth: 0,
41
+ flexShrink: 1,
42
+ padding: 0,
43
+ borderRadius: 4,
44
+ borderWidth: 0,
45
+ overflow: "hidden",
46
+ backgroundColor: "transparent",
47
+ hoverStyle: {
48
+ backgroundColor: "transparent"
49
+ },
50
+ variants: {
51
+ disabled: {
52
+ true: {
53
+ opacity: 0.4,
54
+ pointerEvents: "none"
55
+ }
56
+ }
57
+ }
58
+ });
59
+ var CLOSE_BUTTON_CLASSES = [
60
+ "text-[var(--closeButton-fg,currentColor)]",
61
+ "hover:text-[var(--hover-color,currentColor)]",
62
+ "disabled:opacity-40"
63
+ ].join(" ");
64
+ var CloseButton = React6.forwardRef(function CloseButton2(props, ref) {
65
+ const { variant: _variant, size: _size, className, children, ...rest } = props;
66
+ return /* @__PURE__ */ jsx(
67
+ CloseButtonFrame,
68
+ {
69
+ ref,
70
+ className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
71
+ ...rest,
72
+ children: children ?? /* @__PURE__ */ jsx(
73
+ "svg",
74
+ {
75
+ className: "size-5",
76
+ viewBox: "0 0 20 20",
77
+ fill: "none",
78
+ "aria-hidden": "true",
79
+ children: /* @__PURE__ */ jsx(
80
+ "path",
81
+ {
82
+ d: CLOSE_ICON_PATH,
83
+ fill: "currentColor"
84
+ }
85
+ )
86
+ }
87
+ )
88
+ }
89
+ );
90
+ });
91
+ var DrawerPlacementContext = React6.createContext("right");
92
+ var DrawerSizeContext = React6.createContext("md");
93
+ var DrawerStateContext = React6.createContext({
94
+ open: false,
95
+ setOpen: () => {
96
+ },
97
+ modal: true
98
+ });
99
+ var DrawerRoot = (props) => {
100
+ const {
101
+ children,
102
+ open,
103
+ defaultOpen,
104
+ onOpenChange,
105
+ placement = "right",
106
+ modal = true,
107
+ size = "md"
108
+ } = props;
109
+ const [uncontrolled, setUncontrolled] = React6.useState(defaultOpen ?? false);
110
+ const isControlled = open !== void 0;
111
+ const isOpen = isControlled ? open : uncontrolled;
112
+ const setOpen = React6.useCallback((nextOpen) => {
113
+ if (!isControlled) setUncontrolled(nextOpen);
114
+ onOpenChange?.({ open: nextOpen });
115
+ }, [isControlled, onOpenChange]);
116
+ const state = React6.useMemo(
117
+ () => ({ open: isOpen, setOpen, modal }),
118
+ [isOpen, setOpen, modal]
119
+ );
120
+ return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(DrawerStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(
121
+ RadixDialog.Root,
122
+ {
123
+ open: isOpen,
124
+ onOpenChange: setOpen,
125
+ modal,
126
+ children
127
+ }
128
+ ) }) }) });
129
+ };
130
+ var PLACEMENT_CLASSES = {
131
+ right: [
132
+ "inset-y-0 right-0",
133
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-right",
134
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right"
135
+ ].join(" "),
136
+ left: [
137
+ "inset-y-0 left-0",
138
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-left",
139
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left"
140
+ ].join(" "),
141
+ top: [
142
+ "inset-x-0 top-0",
143
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-top",
144
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top"
145
+ ].join(" "),
146
+ bottom: [
147
+ "inset-x-0 bottom-0",
148
+ "data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom",
149
+ "data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom"
150
+ ].join(" ")
151
+ };
152
+ var SIZE_CLASSES = {
153
+ right: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
154
+ left: { xs: "w-60", sm: "w-80", md: "w-96", lg: "w-[480px]", xl: "w-[640px]", full: "w-screen" },
155
+ top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
156
+ bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
157
+ };
158
+ var DrawerContent = React6.forwardRef(
159
+ function DrawerContent2(props, ref) {
160
+ const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
161
+ const placement = React6.useContext(DrawerPlacementContext);
162
+ const size = React6.useContext(DrawerSizeContext);
163
+ const { open, setOpen, modal } = React6.useContext(DrawerStateContext);
164
+ const isNarrow = useIsNarrow();
165
+ if (isNarrow) {
166
+ return /* @__PURE__ */ jsxs(
167
+ Sheet,
168
+ {
169
+ open,
170
+ onOpenChange: setOpen,
171
+ modal,
172
+ dismissOnSnapToBottom: true,
173
+ snapPointsMode: "percent",
174
+ snapPoints: [88],
175
+ transition: "medium",
176
+ children: [
177
+ backdrop && /* @__PURE__ */ jsx(
178
+ Sheet.Overlay,
179
+ {
180
+ transition: "lazy",
181
+ enterStyle: { opacity: 0 },
182
+ exitStyle: { opacity: 0 },
183
+ className: "bg-black/50"
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsx(Sheet.Handle, {}),
187
+ /* @__PURE__ */ jsx(
188
+ Sheet.Frame,
189
+ {
190
+ unstyled: true,
191
+ className: cn(
192
+ "flex flex-col rounded-t-2xl bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)]",
193
+ className
194
+ ),
195
+ ...rest,
196
+ children
197
+ }
198
+ )
199
+ ]
200
+ }
201
+ );
202
+ }
203
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
204
+ backdrop && /* @__PURE__ */ jsx(
205
+ RadixDialog.Overlay,
206
+ {
207
+ className: cn(
208
+ "fixed inset-0 z-50 bg-black/50",
209
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0",
210
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0"
211
+ )
212
+ }
213
+ ),
214
+ /* @__PURE__ */ jsx(
215
+ RadixDialog.Content,
216
+ {
217
+ ref,
218
+ className: cn(
219
+ "fixed z-50 flex flex-col bg-[var(--color-drawer-bg)] shadow-[var(--shadow-drawer)] duration-300",
220
+ PLACEMENT_CLASSES[placement] ?? PLACEMENT_CLASSES.right,
221
+ SIZE_CLASSES[placement]?.[size] ?? SIZE_CLASSES.right?.md,
222
+ className
223
+ ),
224
+ ...rest,
225
+ children
226
+ }
227
+ )
228
+ ] });
229
+ if (portalled) {
230
+ return /* @__PURE__ */ jsx(RadixDialog.Portal, { container: portalRef?.current ?? void 0, children: content });
231
+ }
232
+ return content;
233
+ }
234
+ );
235
+ React6.forwardRef(function DrawerCloseTrigger2(props, ref) {
236
+ return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
237
+ CloseButton,
238
+ {
239
+ ref,
240
+ className: cn("absolute top-7 right-5", props.className),
241
+ ...props
242
+ }
243
+ ) });
244
+ });
245
+ var DrawerHeader = React6.forwardRef(
246
+ function DrawerHeader2({ className, ...props }, ref) {
247
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
248
+ }
249
+ );
250
+ var DrawerBody = React6.forwardRef(
251
+ function DrawerBody2({ className, ...props }, ref) {
252
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
253
+ }
254
+ );
255
+ React6.forwardRef(
256
+ function DrawerFooter2({ className, ...props }, ref) {
257
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
258
+ }
259
+ );
260
+ var DrawerTitle = RadixDialog.Title;
261
+
262
+ // src/white-label.ts
263
+ var LUX_BRAND = {
264
+ lux: "#7000FF",
265
+ zoo: "#6C5EFB",
266
+ hanzo: "#EA580C",
267
+ pars: "#1C3879"};
268
+ var PARS_GOLD = "#C8A45C";
269
+ var ORGS = {
270
+ lux: {
271
+ org: "lux",
272
+ name: "Lux",
273
+ domain: "lux.network",
274
+ iamDomain: "lux.id",
275
+ accent: LUX_BRAND.lux,
276
+ accentForeground: "#FFFFFF"
277
+ },
278
+ zoo: {
279
+ org: "zoo",
280
+ name: "Zoo",
281
+ domain: "zoo.ngo",
282
+ // Zoo's issuer is `zoolabs.id` — the one row where it is not `<org>.id`,
283
+ // and the one every hand-rolled branding map gets wrong. `id.zoo.network`
284
+ // ANSWERS, which is why it keeps being copied around, but it is an alias:
285
+ // its own discovery document advertises
286
+ // issuer https://zoolabs.id
287
+ // authorization_endpoint https://zoolabs.id/v1/iam/oauth/authorize
288
+ // jwks_uri https://zoolabs.id/v1/iam/.well-known/jwks
289
+ // so a client configured on the alias validates `iss` against a string the
290
+ // IdP never emits and rejects every token it is given — the exact shape of
291
+ // the lux.id outage. `zoo.id` is not an IdP at all (no discovery document).
292
+ iamDomain: "zoolabs.id",
293
+ accent: LUX_BRAND.zoo,
294
+ accentForeground: "#FFFFFF"
295
+ },
296
+ bootnode: {
297
+ org: "bootnode",
298
+ name: "Bootnode",
299
+ domain: "bootno.de",
300
+ iamDomain: "id.bootno.de",
301
+ accent: LUX_BRAND.lux,
302
+ accentForeground: "#FFFFFF"
303
+ },
304
+ hanzo: {
305
+ org: "hanzo",
306
+ name: "Hanzo",
307
+ domain: "hanzo.ai",
308
+ iamDomain: "hanzo.id",
309
+ accent: LUX_BRAND.hanzo,
310
+ accentForeground: "#FFFFFF"
311
+ },
312
+ pars: {
313
+ org: "pars",
314
+ name: "Pars",
315
+ domain: "pars.id",
316
+ iamDomain: "pars.id",
317
+ accent: LUX_BRAND.pars,
318
+ accentForeground: PARS_GOLD
319
+ }
320
+ };
321
+ var DOMAIN_ORG = [
322
+ ["lux.network", "lux"],
323
+ ["lux.cloud", "lux"],
324
+ ["lux.id", "lux"],
325
+ ["lux.finance", "lux"],
326
+ ["lux.market", "lux"],
327
+ ["lux.exchange", "lux"],
328
+ ["zoo.ngo", "zoo"],
329
+ ["zoo.network", "zoo"],
330
+ ["zoo.cloud", "zoo"],
331
+ ["zoolabs.id", "zoo"],
332
+ ["hanzo.ai", "hanzo"],
333
+ ["hanzo.cloud", "hanzo"],
334
+ ["hanzo.id", "hanzo"],
335
+ ["pars.id", "pars", "app"],
336
+ ["pars.network", "pars", "app"],
337
+ ["parsdao.org", "pars", "app"],
338
+ ["bootno.de", "bootnode", "platform"]
339
+ ];
340
+ var DEFAULT_ORG = "lux";
341
+ function normalizeHost(host) {
342
+ const noPort = host.trim().toLowerCase().split(":")[0] ?? "";
343
+ return noPort.replace(/\.$/, "");
344
+ }
345
+ function isUnder(host, domain) {
346
+ return host === domain || host.endsWith(`.${domain}`);
347
+ }
348
+ function matchDomain(host) {
349
+ let best;
350
+ for (const entry of DOMAIN_ORG) {
351
+ if (isUnder(host, entry[0]) && (!best || entry[0].length > best[0].length)) {
352
+ best = entry;
353
+ }
354
+ }
355
+ return best;
356
+ }
357
+ function appSlug(host, domain, pinned) {
358
+ if (pinned) return pinned;
359
+ const sub = host === domain ? "" : host.slice(0, -(domain.length + 1));
360
+ const leftmost = sub.split(".")[0] ?? "";
361
+ if (leftmost && leftmost !== "www") return leftmost;
362
+ const label = domain.split(".")[0] ?? "";
363
+ const tld = domain.split(".").slice(1).join(".");
364
+ return tld.split(".")[0] || label;
365
+ }
366
+ function isLocal(host) {
367
+ return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "0.0.0.0" || host === "[::1]" || host.endsWith(".local");
368
+ }
369
+ function resolveWhiteLabel(host) {
370
+ const h = normalizeHost(host);
371
+ const match = h ? matchDomain(h) : void 0;
372
+ const org = match ? match[1] : DEFAULT_ORG;
373
+ const identity = ORGS[org];
374
+ const app = match ? appSlug(h, match[0], match[2]) : h && isLocal(h) ? "local" : "app";
375
+ return {
376
+ ...identity,
377
+ host: h,
378
+ app,
379
+ theme: `dark_${org}`,
380
+ issuer: `https://${identity.iamDomain}`,
381
+ clientId: `${org}-${app}`
382
+ };
383
+ }
384
+ new QueryClient({
385
+ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
386
+ });
387
+ var WhiteLabelContext = React6__default.createContext(resolveWhiteLabel(""));
388
+ var useWhiteLabel = () => React6__default.useContext(WhiteLabelContext);
389
+ var IdentityContext = React6.createContext(null);
390
+ function useIdentity() {
391
+ const ctx = React6.useContext(IdentityContext);
392
+ const whiteLabel = useWhiteLabel();
393
+ const fallback = React6.useMemo(() => ({
394
+ status: "anonymous",
395
+ account: null,
396
+ orgs: [],
397
+ org: null,
398
+ projects: [],
399
+ project: null,
400
+ error: null,
401
+ whiteLabel,
402
+ setOrg: () => void 0,
403
+ setProject: () => void 0,
404
+ signIn: () => {
405
+ if (typeof window !== "undefined") window.location.assign("/login");
406
+ },
407
+ signOut: () => void 0,
408
+ reload: () => void 0
409
+ }), [whiteLabel]);
410
+ return ctx ?? fallback;
411
+ }
412
+ function parsePlacement(placement) {
413
+ if (!placement) {
414
+ return { side: "bottom", align: "start" };
415
+ }
416
+ const parts = placement.split("-");
417
+ const side = parts[0] ?? "bottom";
418
+ const alignPart = parts[1];
419
+ let align = "center";
420
+ if (alignPart === "start") {
421
+ align = "start";
422
+ } else if (alignPart === "end") {
423
+ align = "end";
424
+ }
425
+ return { side, align };
426
+ }
427
+ var PositioningContext = React6.createContext({
428
+ side: "bottom",
429
+ align: "start",
430
+ sideOffset: 4,
431
+ alignOffset: 0
432
+ });
433
+ var MenuRoot = (props) => {
434
+ const {
435
+ children,
436
+ open,
437
+ defaultOpen,
438
+ onOpenChange,
439
+ positioning,
440
+ modal = true,
441
+ // lazyMount / unmountOnExit have no direct Radix equivalent; Radix handles
442
+ // mount/unmount automatically.
443
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
444
+ lazyMount: _lazyMount,
445
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
446
+ unmountOnExit: _unmountOnExit
447
+ } = props;
448
+ const mergedPositioning = {
449
+ placement: "bottom-start",
450
+ ...positioning,
451
+ offset: {
452
+ mainAxis: 4,
453
+ ...positioning?.offset
454
+ }
455
+ };
456
+ const { side, align } = parsePlacement(mergedPositioning.placement);
457
+ const positioningValue = React6.useMemo(() => ({
458
+ side,
459
+ align,
460
+ sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
461
+ alignOffset: mergedPositioning.offset?.crossAxis ?? 0
462
+ }), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
463
+ const handleOpenChange = React6.useCallback((isOpen) => {
464
+ onOpenChange?.({ open: isOpen });
465
+ }, [onOpenChange]);
466
+ return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
467
+ DropdownMenu.Root,
468
+ {
469
+ open,
470
+ defaultOpen,
471
+ onOpenChange: handleOpenChange,
472
+ modal,
473
+ children
474
+ }
475
+ ) });
476
+ };
477
+ var MenuTrigger = React6.forwardRef(function MenuTrigger2(props, ref) {
478
+ const { asChild = false, ...rest } = props;
479
+ return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild, ref, ...rest });
480
+ });
481
+ var MenuContent = React6.forwardRef(function MenuContent2(props, ref) {
482
+ const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
483
+ const positioning = React6.useContext(PositioningContext);
484
+ const mergedStyle = {
485
+ ...style,
486
+ ...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
487
+ ...minW !== void 0 ? { minWidth: minW } : {}
488
+ };
489
+ const content = /* @__PURE__ */ jsx(
490
+ DropdownMenu.Content,
491
+ {
492
+ ref,
493
+ side: positioning.side,
494
+ align: positioning.align,
495
+ sideOffset: positioning.sideOffset,
496
+ alignOffset: positioning.alignOffset,
497
+ className: cn(
498
+ "z-50 min-w-[8rem] overflow-hidden rounded-lg p-1",
499
+ "border border-[var(--color-popover-border,var(--color-border-divider))]",
500
+ "bg-[var(--color-popover-bg,var(--color-dialog-bg))]",
501
+ "shadow-[0_4px_12px_var(--color-popover-shadow)]",
502
+ "outline-none",
503
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
504
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
505
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
506
+ "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
507
+ className
508
+ ),
509
+ style: Object.keys(mergedStyle).length > 0 ? mergedStyle : void 0,
510
+ ...rest
511
+ }
512
+ );
513
+ if (!portalled) {
514
+ return content;
515
+ }
516
+ return /* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalRef?.current ?? void 0, children: content });
517
+ });
518
+ var MenuItem = React6.forwardRef(function MenuItem2(props, ref) {
519
+ const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
520
+ return /* @__PURE__ */ jsx(
521
+ DropdownMenu.Item,
522
+ {
523
+ ref,
524
+ asChild,
525
+ disabled,
526
+ onClick,
527
+ className: cn(
528
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
529
+ "outline-none transition-colors",
530
+ "text-[var(--color-text-primary,inherit)]",
531
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
532
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
533
+ className
534
+ ),
535
+ ...rest,
536
+ children
537
+ }
538
+ );
539
+ });
540
+ React6.forwardRef(function MenuItemText2(props, ref) {
541
+ const { className, ...rest } = props;
542
+ return /* @__PURE__ */ jsx("span", { ref, className: cn("flex-1", className), ...rest });
543
+ });
544
+ React6.forwardRef(function MenuItemCommand2(props, ref) {
545
+ const { className, ...rest } = props;
546
+ return /* @__PURE__ */ jsx(
547
+ "span",
548
+ {
549
+ ref,
550
+ className: cn("ml-auto text-xs tracking-widest opacity-60", className),
551
+ ...rest
552
+ }
553
+ );
554
+ });
555
+ var MenuSeparator = React6.forwardRef(function MenuSeparator2(props, ref) {
556
+ const { className, ...rest } = props;
557
+ return /* @__PURE__ */ jsx(
558
+ DropdownMenu.Separator,
559
+ {
560
+ ref,
561
+ className: cn("-mx-1 my-1 h-px bg-[var(--color-border-divider)]", className),
562
+ ...rest
563
+ }
564
+ );
565
+ });
566
+ React6.forwardRef(function MenuItemGroup2(props, ref) {
567
+ const { title, children, className, ...rest } = props;
568
+ return /* @__PURE__ */ jsxs(DropdownMenu.Group, { ref, className, ...rest, children: [
569
+ title && /* @__PURE__ */ jsx(DropdownMenu.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
570
+ children
571
+ ] });
572
+ });
573
+ React6.forwardRef(function MenuArrow2(props, ref) {
574
+ const { className, ...rest } = props;
575
+ return /* @__PURE__ */ jsx(
576
+ DropdownMenu.Arrow,
577
+ {
578
+ ref,
579
+ className: cn("fill-[var(--color-popover-bg,var(--color-dialog-bg))]", className),
580
+ ...rest
581
+ }
582
+ );
583
+ });
584
+ React6.forwardRef(function MenuCheckboxItem2(props, ref) {
585
+ const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
586
+ return /* @__PURE__ */ jsxs(
587
+ DropdownMenu.CheckboxItem,
588
+ {
589
+ ref,
590
+ checked,
591
+ onCheckedChange,
592
+ onClick,
593
+ className: cn(
594
+ "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
595
+ "outline-none transition-colors",
596
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
597
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
598
+ className
599
+ ),
600
+ ...rest,
601
+ children: [
602
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
603
+ children
604
+ ]
605
+ }
606
+ );
607
+ });
608
+ React6.forwardRef(function MenuRadioItemGroup2(props, ref) {
609
+ const { value, onValueChange, ...rest } = props;
610
+ return /* @__PURE__ */ jsx(
611
+ DropdownMenu.RadioGroup,
612
+ {
613
+ ref,
614
+ value,
615
+ onValueChange,
616
+ ...rest
617
+ }
618
+ );
619
+ });
620
+ React6.forwardRef(function MenuRadioItem2(props, ref) {
621
+ const { className, children, value, onClick, ...rest } = props;
622
+ const { value: _v, ...radixRest } = rest;
623
+ return /* @__PURE__ */ jsxs(
624
+ DropdownMenu.RadioItem,
625
+ {
626
+ ref,
627
+ value,
628
+ onClick,
629
+ className: cn(
630
+ "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm",
631
+ "outline-none transition-colors",
632
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
633
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
634
+ className
635
+ ),
636
+ children: [
637
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
638
+ /* @__PURE__ */ jsx("span", { children })
639
+ ]
640
+ }
641
+ );
642
+ });
643
+ React6.forwardRef(function MenuContextTrigger2(props, ref) {
644
+ const { asChild: _asChild, ...rest } = props;
645
+ return /* @__PURE__ */ jsx("span", { ref, ...rest });
646
+ });
647
+ React6.forwardRef(function MenuTriggerItem2(props, ref) {
648
+ const { startIcon, children, className, ...rest } = props;
649
+ return /* @__PURE__ */ jsx(DropdownMenu.Sub, { children: /* @__PURE__ */ jsxs(
650
+ DropdownMenu.SubTrigger,
651
+ {
652
+ ref,
653
+ className: cn(
654
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm",
655
+ "outline-none transition-colors",
656
+ "data-[highlighted]:bg-[var(--color-popover-item-hover,rgba(0,0,0,0.04))]",
657
+ className
658
+ ),
659
+ ...rest,
660
+ children: [
661
+ startIcon,
662
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children }),
663
+ /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
664
+ ]
665
+ }
666
+ ) });
667
+ });
668
+ function initials(label) {
669
+ return label.split(/[\s._-]+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2).toUpperCase();
670
+ }
671
+ var Monogram = ({ label, logo }) => logo ? /* @__PURE__ */ jsx("img", { src: logo, alt: "", className: "h-5 w-5 shrink-0 rounded object-contain" }) : /* @__PURE__ */ jsx(
672
+ "span",
673
+ {
674
+ "aria-hidden": "true",
675
+ className: "flex h-5 w-5 shrink-0 items-center justify-center rounded bg-[rgba(127,127,127,0.22)] text-[10px] font-bold",
676
+ children: initials(label)
677
+ }
678
+ );
679
+ var Row = ({ item, onDone, menu }) => {
680
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
681
+ item.icon,
682
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: item.label }),
683
+ item.hint ? /* @__PURE__ */ jsx("span", { className: "text-xs opacity-60", children: item.hint }) : null,
684
+ item.selected ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }) : null
685
+ ] });
686
+ const className = cn(
687
+ "flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",
688
+ "hover:bg-[rgba(127,127,127,0.14)]",
689
+ item.danger && "text-[var(--color-text-error,#e5484d)]"
690
+ );
691
+ const activate = () => {
692
+ onDone();
693
+ item.onSelect?.();
694
+ };
695
+ const shared = {
696
+ "data-testid": `chrome-item-${item.id}`,
697
+ "aria-current": item.selected ? "true" : void 0,
698
+ className
699
+ };
700
+ const control = item.href ? /* @__PURE__ */ jsx("a", { href: item.href, ...shared, onClick: onDone, children: body }) : /* @__PURE__ */ jsx("button", { type: "button", ...shared, onClick: activate, children: body });
701
+ return menu ? /* @__PURE__ */ jsx(MenuItem, { value: item.id, asChild: true, children: control }) : control;
702
+ };
703
+ var Switcher = ({
704
+ title,
705
+ label,
706
+ icon,
707
+ items,
708
+ footer = [],
709
+ status = "ready",
710
+ empty = "Nothing here yet.",
711
+ onSignIn,
712
+ signInLabel = "Sign in",
713
+ error,
714
+ align = "start",
715
+ testId
716
+ }) => {
717
+ const [open, setOpen] = React6.useState(false);
718
+ const narrow = useIsNarrow();
719
+ const close = React6.useCallback(() => setOpen(false), []);
720
+ const message = status === "loading" ? "Loading\u2026" : status === "error" ? error ?? "Could not reach IAM." : status === "anonymous" ? null : items.length === 0 ? empty : null;
721
+ const rows = status === "anonymous" && onSignIn ? [{ id: "sign-in", label: signInLabel, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: onSignIn }] : status === "ready" ? items : [];
722
+ const panel = (menu) => /* @__PURE__ */ jsxs(Fragment, { children: [
723
+ /* @__PURE__ */ jsx("div", { className: "px-2 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-wide opacity-55", children: title }),
724
+ message ? /* @__PURE__ */ jsx("div", { "data-testid": "chrome-message", className: "px-2 py-2 text-sm opacity-70", children: message }) : null,
725
+ rows.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id)),
726
+ footer.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
727
+ menu ? /* @__PURE__ */ jsx(MenuSeparator, { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }) : /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-[var(--color-border-divider,rgba(127,127,127,0.25))]" }),
728
+ footer.map((item) => /* @__PURE__ */ jsx(Row, { item, onDone: close, menu }, item.id))
729
+ ] }) : null
730
+ ] });
731
+ const trigger = /* @__PURE__ */ jsxs(
732
+ "button",
733
+ {
734
+ type: "button",
735
+ "data-testid": testId,
736
+ "aria-label": title,
737
+ "aria-haspopup": "menu",
738
+ "aria-expanded": open,
739
+ className: cn(
740
+ "flex max-w-[14rem] items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium",
741
+ "hover:bg-[rgba(127,127,127,0.14)]"
742
+ ),
743
+ children: [
744
+ icon,
745
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: label }),
746
+ /* @__PURE__ */ jsx(ChevronsUpDown, { "aria-hidden": "true", className: "h-3.5 w-3.5 shrink-0 opacity-60" })
747
+ ]
748
+ }
749
+ );
750
+ if (narrow) {
751
+ return /* @__PURE__ */ jsxs(DrawerRoot, { open, onOpenChange: (d) => setOpen(d.open), placement: "bottom", size: "md", children: [
752
+ React6.cloneElement(trigger, { onClick: () => setOpen(true) }),
753
+ /* @__PURE__ */ jsxs(DrawerContent, { "data-testid": testId ? `${testId}-panel` : void 0, children: [
754
+ /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: title }) }),
755
+ /* @__PURE__ */ jsx(DrawerBody, { children: panel(false) })
756
+ ] })
757
+ ] });
758
+ }
759
+ return /* @__PURE__ */ jsxs(
760
+ MenuRoot,
761
+ {
762
+ open,
763
+ onOpenChange: (d) => setOpen(d.open),
764
+ positioning: { placement: align === "end" ? "bottom-end" : "bottom-start" },
765
+ children: [
766
+ /* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: trigger }),
767
+ /* @__PURE__ */ jsx(MenuContent, { minW: "16rem", "data-testid": testId ? `${testId}-panel` : void 0, children: panel(true) })
768
+ ]
769
+ }
770
+ );
771
+ };
772
+ var OrgSwitcher = () => {
773
+ const id = useIdentity();
774
+ return /* @__PURE__ */ jsx(
775
+ Switcher,
776
+ {
777
+ testId: "org-switcher",
778
+ title: "Organization",
779
+ label: id.org?.displayName || id.org?.name || id.whiteLabel.name,
780
+ icon: /* @__PURE__ */ jsx(Monogram, { label: id.org?.displayName || id.org?.name || id.whiteLabel.name, logo: id.org?.logo }),
781
+ status: id.status,
782
+ error: id.error,
783
+ empty: "No organizations for this account.",
784
+ onSignIn: id.signIn,
785
+ signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
786
+ items: id.orgs.map((o) => ({
787
+ id: o.name,
788
+ label: o.displayName || o.name,
789
+ icon: /* @__PURE__ */ jsx(Monogram, { label: o.displayName || o.name, logo: o.logo }),
790
+ selected: o.name === id.org?.name,
791
+ onSelect: () => id.setOrg(o.name)
792
+ }))
793
+ }
794
+ );
795
+ };
796
+ var ProjectSwitcher = () => {
797
+ const id = useIdentity();
798
+ if (id.status === "ready" && id.projects.length === 0) return null;
799
+ return /* @__PURE__ */ jsx(
800
+ Switcher,
801
+ {
802
+ testId: "project-switcher",
803
+ title: "Project",
804
+ label: id.project?.displayName || id.project?.name || "Project",
805
+ icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
806
+ status: id.status,
807
+ error: id.error,
808
+ empty: "No projects in this organization.",
809
+ onSignIn: id.signIn,
810
+ items: id.projects.map((p) => ({
811
+ id: p.name,
812
+ label: p.displayName || p.name,
813
+ icon: /* @__PURE__ */ jsx(Folder, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
814
+ selected: p.name === id.project?.name,
815
+ onSelect: () => id.setProject(p.name)
816
+ }))
817
+ }
818
+ );
819
+ };
820
+ var UserMenu = ({ items = [] }) => {
821
+ const id = useIdentity();
822
+ const who = id.account?.displayName || id.account?.email || id.account?.name || "Account";
823
+ return /* @__PURE__ */ jsx(
824
+ Switcher,
825
+ {
826
+ testId: "user-menu",
827
+ align: "end",
828
+ title: id.status === "ready" ? who : "Account",
829
+ label: id.status === "ready" ? who : "Sign in",
830
+ icon: id.status === "ready" ? /* @__PURE__ */ jsx(Monogram, { label: who, logo: id.account?.avatar }) : /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
831
+ status: id.status,
832
+ error: id.error,
833
+ onSignIn: id.signIn,
834
+ signInLabel: `Sign in with ${id.whiteLabel.iamDomain}`,
835
+ items: [
836
+ { id: "account", label: id.account?.email || who, icon: /* @__PURE__ */ jsx(User, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) },
837
+ ...items
838
+ ],
839
+ footer: id.status === "ready" ? [{ id: "sign-out", label: "Sign out", danger: true, icon: /* @__PURE__ */ jsx(LogOut, { "aria-hidden": "true", className: "h-4 w-4" }), onSelect: id.signOut }] : []
840
+ }
841
+ );
842
+ };
843
+ var SettingsMenu = ({ items = [], href = "/settings" }) => /* @__PURE__ */ jsx(
844
+ Switcher,
845
+ {
846
+ testId: "settings-menu",
847
+ align: "end",
848
+ title: "Settings",
849
+ label: "Settings",
850
+ icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
851
+ items,
852
+ empty: "No settings on this surface.",
853
+ footer: [{ id: "all-settings", label: "All settings", href, icon: /* @__PURE__ */ jsx(Settings, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }) }]
854
+ }
855
+ );
856
+ var AppNav = ({
857
+ brand,
858
+ home = "/",
859
+ links = [],
860
+ org = true,
861
+ project = false,
862
+ settings,
863
+ userItems,
864
+ children
865
+ }) => {
866
+ const id = useIdentity();
867
+ const narrow = useIsNarrow();
868
+ const [menu, setMenu] = React6.useState(false);
869
+ return /* @__PURE__ */ jsx(
870
+ "header",
871
+ {
872
+ "data-testid": "app-nav",
873
+ className: "sticky top-0 z-50 border-b border-[var(--color-border-divider,rgba(127,127,127,0.25))] bg-[var(--color-bg-body,inherit)]",
874
+ children: /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-14 max-w-7xl items-center gap-2 px-4", children: [
875
+ narrow && links.length > 0 ? /* @__PURE__ */ jsxs(DrawerRoot, { open: menu, onOpenChange: (d) => setMenu(d.open), placement: "bottom", size: "md", children: [
876
+ /* @__PURE__ */ jsx(
877
+ "button",
878
+ {
879
+ type: "button",
880
+ "aria-label": "Menu",
881
+ "data-testid": "nav-menu",
882
+ className: "rounded-md p-2 hover:bg-[rgba(127,127,127,0.14)]",
883
+ onClick: () => setMenu(true),
884
+ children: /* @__PURE__ */ jsx(Menu, { "aria-hidden": "true", className: "h-5 w-5" })
885
+ }
886
+ ),
887
+ /* @__PURE__ */ jsxs(DrawerContent, { "data-testid": "nav-menu-panel", children: [
888
+ /* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: "Menu" }) }),
889
+ /* @__PURE__ */ jsx(DrawerBody, { children: links.map((l) => /* @__PURE__ */ jsx(
890
+ "a",
891
+ {
892
+ href: l.href,
893
+ onClick: () => setMenu(false),
894
+ "aria-current": l.active ? "page" : void 0,
895
+ className: "block rounded-md px-2 py-2.5 text-sm hover:bg-[rgba(127,127,127,0.14)]",
896
+ children: l.label
897
+ },
898
+ l.href
899
+ )) })
900
+ ] })
901
+ ] }) : null,
902
+ /* @__PURE__ */ jsx("a", { href: home, className: "flex items-center gap-2 font-semibold tracking-tight", children: brand ?? /* @__PURE__ */ jsxs(Fragment, { children: [
903
+ /* @__PURE__ */ jsx(Building2, { "aria-hidden": "true", className: "h-4 w-4 opacity-70" }),
904
+ id.whiteLabel.name
905
+ ] }) }),
906
+ org ? /* @__PURE__ */ jsx(OrgSwitcher, {}) : null,
907
+ project ? /* @__PURE__ */ jsx(ProjectSwitcher, {}) : null,
908
+ !narrow && links.length > 0 ? /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1", children: links.map((l) => /* @__PURE__ */ jsx(
909
+ "a",
910
+ {
911
+ href: l.href,
912
+ "aria-current": l.active ? "page" : void 0,
913
+ className: cn(
914
+ "rounded-md px-3 py-1.5 text-sm font-medium",
915
+ l.active ? "bg-[rgba(127,127,127,0.14)]" : "opacity-75 hover:opacity-100"
916
+ ),
917
+ children: l.label
918
+ },
919
+ l.href
920
+ )) }) : null,
921
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center justify-end gap-1", children: [
922
+ children,
923
+ settings ? /* @__PURE__ */ jsx(SettingsMenu, { items: settings }) : null,
924
+ /* @__PURE__ */ jsx(UserMenu, { items: userItems })
925
+ ] })
926
+ ] })
927
+ }
928
+ );
929
+ };
930
+
931
+ export { AppNav, OrgSwitcher, ProjectSwitcher, SettingsMenu, Switcher, UserMenu, initials };