@nswds/app 1.60.0 → 1.61.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.
package/dist/index.cjs CHANGED
@@ -12,11 +12,19 @@ var Link12 = require('next/link');
12
12
  var react = require('@remixicon/react');
13
13
  var RechartsPrimitive = require('recharts');
14
14
  var AspectRatioPrimitive = require('@radix-ui/react-aspect-ratio');
15
+ var client$1 = require('@libsql/client');
16
+ var libsql = require('drizzle-orm/libsql');
17
+ var sqliteCore = require('drizzle-orm/sqlite-core');
18
+ var drizzleAdapter = require('@auth/drizzle-adapter');
19
+ var drizzleOrm = require('drizzle-orm');
20
+ var NextAuth = require('next-auth');
21
+ var MicrosoftEntraID = require('next-auth/providers/microsoft-entra-id');
15
22
  var AvatarPrimitive = require('@radix-ui/react-avatar');
23
+ var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
24
+ var react$1 = require('next-auth/react');
16
25
  var culori = require('culori');
17
26
  var reactSlot = require('@radix-ui/react-slot');
18
27
  var navigation = require('next/navigation');
19
- var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
20
28
  var reactDayPicker = require('react-day-picker');
21
29
  var useEmblaCarousel = require('embla-carousel-react');
22
30
  var lucideReact = require('lucide-react');
@@ -89,9 +97,11 @@ var Headless4__namespace = /*#__PURE__*/_interopNamespace(Headless4);
89
97
  var Link12__default = /*#__PURE__*/_interopDefault(Link12);
90
98
  var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
91
99
  var AspectRatioPrimitive__namespace = /*#__PURE__*/_interopNamespace(AspectRatioPrimitive);
100
+ var NextAuth__default = /*#__PURE__*/_interopDefault(NextAuth);
101
+ var MicrosoftEntraID__default = /*#__PURE__*/_interopDefault(MicrosoftEntraID);
92
102
  var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
93
- var culori__namespace = /*#__PURE__*/_interopNamespace(culori);
94
103
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
104
+ var culori__namespace = /*#__PURE__*/_interopNamespace(culori);
95
105
  var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
96
106
  var TooltipPrimitives__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitives);
97
107
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
@@ -115,12 +125,17 @@ var ProgressPrimitive__namespace = /*#__PURE__*/_interopNamespace(ProgressPrimit
115
125
  var ResizablePrimitive__namespace = /*#__PURE__*/_interopNamespace(ResizablePrimitive);
116
126
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
117
127
 
128
+ var __defProp = Object.defineProperty;
118
129
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
119
130
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
120
131
  }) : x)(function(x) {
121
132
  if (typeof require !== "undefined") return require.apply(this, arguments);
122
133
  throw Error('Dynamic require of "' + x + '" is not supported');
123
134
  });
135
+ var __export = (target, all) => {
136
+ for (var name in all)
137
+ __defProp(target, name, { get: all[name], enumerable: true });
138
+ };
124
139
  var Icons = {
125
140
  account_circle: (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { fill: "currentColor", "data-slot": "icon", viewBox: "0 -960 960 960", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M234-276q51-39 114-61.5T480-360q69 0 132 22.5T726-276q35-41 54.5-93T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 59 19.5 111t54.5 93Zm246-164q-59 0-99.5-40.5T340-580q0-59 40.5-99.5T480-720q59 0 99.5 40.5T620-580q0 59-40.5 99.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q53 0 100-15.5t86-44.5q-39-29-86-44.5T480-280q-53 0-100 15.5T294-220q39 29 86 44.5T480-160Zm0-360q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm0-60Zm0 360Z" }) }),
126
141
  add_circle: (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { fill: "currentColor", "data-slot": "icon", viewBox: "0 -960 960 960", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M440-440v120q0 17 11.5 28.5T480-280q17 0 28.5-11.5T520-320v-120h120q17 0 28.5-11.5T680-480q0-17-11.5-28.5T640-520H520v-120q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640v120H320q-17 0-28.5 11.5T280-480q0 17 11.5 28.5T320-440h120Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z" }) }),
@@ -246,11 +261,11 @@ var Icons = {
246
261
  function cn(...inputs) {
247
262
  return tailwindMerge.twMerge(clsx12.clsx(inputs));
248
263
  }
249
- function truncate(text, maxLength) {
250
- if (text.length <= maxLength) {
251
- return text;
264
+ function truncate(text4, maxLength) {
265
+ if (text4.length <= maxLength) {
266
+ return text4;
252
267
  }
253
- return text.slice(0, maxLength) + "...";
268
+ return text4.slice(0, maxLength) + "...";
254
269
  }
255
270
  function kebabCase(str) {
256
271
  return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
@@ -1661,8 +1676,162 @@ AreaChart.displayName = "AreaChart";
1661
1676
  function AspectRatio({ ...props }) {
1662
1677
  return /* @__PURE__ */ jsxRuntime.jsx(AspectRatioPrimitive__namespace.Root, { "data-slot": "aspect-ratio", ...props });
1663
1678
  }
1664
- function AuthLayout({ children }) {
1665
- return /* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex min-h-dvh flex-col p-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex grow items-center justify-center p-6 lg:rounded-sm lg:bg-white lg:p-10 lg:shadow-xs lg:ring-1 lg:ring-grey-950/5 dark:lg:bg-grey-900 dark:lg:ring-white/10", children }) });
1679
+
1680
+ // src/db/schema/accounts.ts
1681
+ var accounts_exports = {};
1682
+ __export(accounts_exports, {
1683
+ accounts: () => accounts
1684
+ });
1685
+
1686
+ // src/db/schema/users.ts
1687
+ var users_exports = {};
1688
+ __export(users_exports, {
1689
+ users: () => users
1690
+ });
1691
+ var users = sqliteCore.sqliteTable("user", {
1692
+ id: sqliteCore.text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
1693
+ name: sqliteCore.text("name"),
1694
+ email: sqliteCore.text("email").unique(),
1695
+ emailVerified: sqliteCore.integer("emailVerified", { mode: "timestamp_ms" }),
1696
+ image: sqliteCore.text("image"),
1697
+ role: sqliteCore.text("role", { enum: ["ADMIN", "USER"] }).default("USER")
1698
+ });
1699
+
1700
+ // src/db/schema/accounts.ts
1701
+ var accounts = sqliteCore.sqliteTable(
1702
+ "account",
1703
+ {
1704
+ userId: sqliteCore.text("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
1705
+ type: sqliteCore.text("type").$type().notNull(),
1706
+ provider: sqliteCore.text("provider").notNull(),
1707
+ providerAccountId: sqliteCore.text("providerAccountId").notNull(),
1708
+ refresh_token: sqliteCore.text("refresh_token"),
1709
+ access_token: sqliteCore.text("access_token"),
1710
+ expires_at: sqliteCore.integer("expires_at"),
1711
+ token_type: sqliteCore.text("token_type"),
1712
+ scope: sqliteCore.text("scope"),
1713
+ id_token: sqliteCore.text("id_token"),
1714
+ session_state: sqliteCore.text("session_state")
1715
+ },
1716
+ (table) => [
1717
+ sqliteCore.primaryKey({
1718
+ columns: [table.provider, table.providerAccountId],
1719
+ name: "accounts_pk"
1720
+ })
1721
+ ]
1722
+ );
1723
+
1724
+ // src/db/schema/sessions.ts
1725
+ var sessions_exports = {};
1726
+ __export(sessions_exports, {
1727
+ sessions: () => sessions
1728
+ });
1729
+ var sessions = sqliteCore.sqliteTable("session", {
1730
+ sessionToken: sqliteCore.text("sessionToken").primaryKey(),
1731
+ userId: sqliteCore.text("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
1732
+ expires: sqliteCore.integer("expires", { mode: "timestamp_ms" }).notNull()
1733
+ });
1734
+
1735
+ // src/db/index.ts
1736
+ var client = client$1.createClient({
1737
+ url: process.env.TURSO_DATABASE_URL,
1738
+ authToken: process.env.TURSO_AUTH_TOKEN
1739
+ });
1740
+ var db = libsql.drizzle(client, {
1741
+ schema: {
1742
+ ...users_exports,
1743
+ ...accounts_exports,
1744
+ ...sessions_exports
1745
+ }
1746
+ });
1747
+ var { handlers, signIn, signOut, auth } = NextAuth__default.default({
1748
+ adapter: drizzleAdapter.DrizzleAdapter(db),
1749
+ pages: {
1750
+ signIn: "/api/auth/signin-microsoft"
1751
+ },
1752
+ providers: [
1753
+ MicrosoftEntraID__default.default({
1754
+ clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID,
1755
+ clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
1756
+ issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER,
1757
+ authorization: {
1758
+ params: {
1759
+ scope: "openid profile email User.Read offline_access",
1760
+ tenant: process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT_ID
1761
+ }
1762
+ }
1763
+ })
1764
+ ],
1765
+ callbacks: {
1766
+ authorized: async ({ auth: auth2, request }) => {
1767
+ const nonPublicPaths = ["/tests", "/dashboard"];
1768
+ const path = request.nextUrl.pathname;
1769
+ const isNonPublic = nonPublicPaths.some((prefix) => path.startsWith(prefix));
1770
+ if (isNonPublic) {
1771
+ return !!auth2;
1772
+ }
1773
+ return true;
1774
+ },
1775
+ jwt({ token, user }) {
1776
+ if (user) {
1777
+ token.id = user.id;
1778
+ }
1779
+ return token;
1780
+ },
1781
+ async session({ session, user }) {
1782
+ session.user.id = user.id;
1783
+ const [microsoftAccount] = await db.select().from(accounts).where(drizzleOrm.and(drizzleOrm.eq(accounts.userId, user.id), drizzleOrm.eq(accounts.provider, "microsoft-entra-id"))).limit(1);
1784
+ if (microsoftAccount && microsoftAccount.expires_at && microsoftAccount.expires_at * 1e3 < Date.now()) {
1785
+ try {
1786
+ const tokenEndpoint = `https://login.microsoftonline.com/${process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT_ID}/oauth2/v2.0/token`;
1787
+ const response = await fetch(tokenEndpoint, {
1788
+ method: "POST",
1789
+ headers: {
1790
+ "Content-Type": "application/x-www-form-urlencoded"
1791
+ },
1792
+ body: new URLSearchParams({
1793
+ client_id: process.env.AUTH_MICROSOFT_ENTRA_ID_ID,
1794
+ client_secret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
1795
+ grant_type: "refresh_token",
1796
+ refresh_token: microsoftAccount.refresh_token,
1797
+ scope: "openid profile email offline_access"
1798
+ })
1799
+ });
1800
+ const tokensOrError = await response.json();
1801
+ if (!response.ok) throw tokensOrError;
1802
+ const newTokens = tokensOrError;
1803
+ await db.update(accounts).set({
1804
+ access_token: newTokens.access_token,
1805
+ expires_at: Math.floor(Date.now() / 1e3 + newTokens.expires_in),
1806
+ refresh_token: newTokens.refresh_token ?? microsoftAccount.refresh_token,
1807
+ id_token: newTokens.id_token ?? microsoftAccount.id_token
1808
+ }).where(
1809
+ drizzleOrm.and(
1810
+ drizzleOrm.eq(accounts.provider, "microsoft-entra-id"),
1811
+ drizzleOrm.eq(accounts.providerAccountId, microsoftAccount.providerAccountId)
1812
+ )
1813
+ );
1814
+ } catch (error) {
1815
+ console.error("Error refreshing access_token", error);
1816
+ session.error = "RefreshTokenError";
1817
+ }
1818
+ }
1819
+ return session;
1820
+ }
1821
+ }
1822
+ });
1823
+
1824
+ // src/actions/auth-actions.ts
1825
+ async function signInWithEntra(formData) {
1826
+ const redirect = formData.get("redirect")?.toString() || "/dashboard";
1827
+ await signIn("microsoft-entra-id", { redirectTo: redirect });
1828
+ }
1829
+ async function signInGeneric(formData) {
1830
+ const redirect = formData.get("redirect")?.toString() || "/dashboard";
1831
+ await signIn(void 0, { redirectTo: redirect });
1832
+ }
1833
+ async function signOutAction() {
1834
+ await signOut();
1666
1835
  }
1667
1836
  function Avatar({ className, ...props }) {
1668
1837
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -1697,6 +1866,254 @@ function AvatarFallback({
1697
1866
  }
1698
1867
  );
1699
1868
  }
1869
+ function DropdownMenu({ ...props }) {
1870
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
1871
+ }
1872
+ function DropdownMenuPortal({
1873
+ ...props
1874
+ }) {
1875
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { "data-slot": "dropdown-menu-portal", ...props });
1876
+ }
1877
+ function DropdownMenuTrigger({
1878
+ ...props
1879
+ }) {
1880
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
1881
+ }
1882
+ function DropdownMenuContent({
1883
+ className,
1884
+ sideOffset = 4,
1885
+ ...props
1886
+ }) {
1887
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
1888
+ DropdownMenuPrimitive__namespace.Content,
1889
+ {
1890
+ "data-slot": "dropdown-menu-content",
1891
+ sideOffset,
1892
+ className: cn(
1893
+ [
1894
+ // Base
1895
+ "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border bg-background p-1 text-foreground shadow-md",
1896
+ // Open
1897
+ "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
1898
+ // Closed
1899
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
1900
+ // Side
1901
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1902
+ // Hover
1903
+ "",
1904
+ // Focus
1905
+ "",
1906
+ // Active
1907
+ ""
1908
+ ],
1909
+ className
1910
+ ),
1911
+ ...props
1912
+ }
1913
+ ) });
1914
+ }
1915
+ function DropdownMenuGroup({ ...props }) {
1916
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Group, { "data-slot": "dropdown-menu-group", ...props });
1917
+ }
1918
+ function DropdownMenuItem({
1919
+ className,
1920
+ inset,
1921
+ variant = "default",
1922
+ ...props
1923
+ }) {
1924
+ return /* @__PURE__ */ jsxRuntime.jsx(
1925
+ DropdownMenuPrimitive__namespace.Item,
1926
+ {
1927
+ "data-slot": "dropdown-menu-item",
1928
+ "data-inset": inset,
1929
+ "data-variant": variant,
1930
+ className: cn(
1931
+ [
1932
+ // Base
1933
+ ""
1934
+ ],
1935
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:!text-destructive",
1936
+ className
1937
+ ),
1938
+ ...props
1939
+ }
1940
+ );
1941
+ }
1942
+ function DropdownMenuCheckboxItem({
1943
+ className,
1944
+ children,
1945
+ checked,
1946
+ ...props
1947
+ }) {
1948
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1949
+ DropdownMenuPrimitive__namespace.CheckboxItem,
1950
+ {
1951
+ "data-slot": "dropdown-menu-checkbox-item",
1952
+ className: cn(
1953
+ [
1954
+ // Base
1955
+ ""
1956
+ ],
1957
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1958
+ className
1959
+ ),
1960
+ checked,
1961
+ ...props,
1962
+ children: [
1963
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(Icons.check, { className: "size-4" }) }) }),
1964
+ children
1965
+ ]
1966
+ }
1967
+ );
1968
+ }
1969
+ function DropdownMenuRadioGroup({
1970
+ ...props
1971
+ }) {
1972
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
1973
+ }
1974
+ function DropdownMenuRadioItem({
1975
+ className,
1976
+ children,
1977
+ ...props
1978
+ }) {
1979
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1980
+ DropdownMenuPrimitive__namespace.RadioItem,
1981
+ {
1982
+ "data-slot": "dropdown-menu-radio-item",
1983
+ className: cn(
1984
+ [
1985
+ // Base
1986
+ ""
1987
+ ],
1988
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1989
+ className
1990
+ ),
1991
+ ...props,
1992
+ children: [
1993
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(Icons.circle, { className: "size-2 fill-current" }) }) }),
1994
+ children
1995
+ ]
1996
+ }
1997
+ );
1998
+ }
1999
+ function DropdownMenuLabel({
2000
+ className,
2001
+ inset,
2002
+ ...props
2003
+ }) {
2004
+ return /* @__PURE__ */ jsxRuntime.jsx(
2005
+ DropdownMenuPrimitive__namespace.Label,
2006
+ {
2007
+ "data-slot": "dropdown-menu-label",
2008
+ "data-inset": inset,
2009
+ className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
2010
+ ...props
2011
+ }
2012
+ );
2013
+ }
2014
+ function DropdownMenuSeparator({
2015
+ className,
2016
+ ...props
2017
+ }) {
2018
+ return /* @__PURE__ */ jsxRuntime.jsx(
2019
+ DropdownMenuPrimitive__namespace.Separator,
2020
+ {
2021
+ "data-slot": "dropdown-menu-separator",
2022
+ className: cn("-mx-1 my-1 h-px bg-border", className),
2023
+ ...props
2024
+ }
2025
+ );
2026
+ }
2027
+ function DropdownMenuShortcut({ className, ...props }) {
2028
+ return /* @__PURE__ */ jsxRuntime.jsx(
2029
+ "span",
2030
+ {
2031
+ "data-slot": "dropdown-menu-shortcut",
2032
+ className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
2033
+ ...props
2034
+ }
2035
+ );
2036
+ }
2037
+ function DropdownMenuSub({ ...props }) {
2038
+ return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Sub, { "data-slot": "dropdown-menu-sub", ...props });
2039
+ }
2040
+ function DropdownMenuSubTrigger({
2041
+ className,
2042
+ inset,
2043
+ children,
2044
+ ...props
2045
+ }) {
2046
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2047
+ DropdownMenuPrimitive__namespace.SubTrigger,
2048
+ {
2049
+ "data-slot": "dropdown-menu-sub-trigger",
2050
+ "data-inset": inset,
2051
+ className: cn(
2052
+ [
2053
+ // Base
2054
+ ""
2055
+ ],
2056
+ "flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-primary-800/10 data-[state=open]:text-accent-foreground",
2057
+ className
2058
+ ),
2059
+ ...props,
2060
+ children: [
2061
+ children,
2062
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_right, { className: "ml-auto size-4" })
2063
+ ]
2064
+ }
2065
+ );
2066
+ }
2067
+ function DropdownMenuSubContent({
2068
+ className,
2069
+ ...props
2070
+ }) {
2071
+ return /* @__PURE__ */ jsxRuntime.jsx(
2072
+ DropdownMenuPrimitive__namespace.SubContent,
2073
+ {
2074
+ "data-slot": "dropdown-menu-sub-content",
2075
+ className: cn(
2076
+ [
2077
+ // Base
2078
+ ""
2079
+ ],
2080
+ "z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
2081
+ className
2082
+ ),
2083
+ ...props
2084
+ }
2085
+ );
2086
+ }
2087
+ function AuthButton({ user, children }) {
2088
+ if (!user) {
2089
+ return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signInWithEntra, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", variant: "surface", color: "light", children: "Sign In" }) });
2090
+ }
2091
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
2092
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button2, { variant: "surface", color: "light", className: "flex items-center gap-2", children: [
2093
+ /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "h-5 w-5", children: [
2094
+ user.image && /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image, alt: user.name || "User" }),
2095
+ /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-xs", children: user.name?.split(" ").map((n) => n[0]).join("") || "U" })
2096
+ ] }),
2097
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-start text-sm", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: user.name }) }),
2098
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_down, { className: "h-4 w-4 opacity-70" })
2099
+ ] }) }),
2100
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { className: "w-56", align: "start", children: [
2101
+ children,
2102
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
2103
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "cursor-pointer", children: /* @__PURE__ */ jsxRuntime.jsx("form", { action: signOutAction, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "submit", className: "flex w-full cursor-pointer items-center", children: [
2104
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.logout, { className: "mr-2 h-4 w-4" }),
2105
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Sign out" })
2106
+ ] }) }) })
2107
+ ] })
2108
+ ] });
2109
+ }
2110
+ function AuthButtonWrapper() {
2111
+ const { data: session } = react$1.useSession();
2112
+ return /* @__PURE__ */ jsxRuntime.jsx(AuthButton, { user: session?.user });
2113
+ }
2114
+ function AuthLayout({ children }) {
2115
+ return /* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex min-h-dvh flex-col p-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex grow items-center justify-center p-6 lg:rounded-sm lg:bg-white lg:p-10 lg:shadow-xs lg:ring-1 lg:ring-grey-950/5 dark:lg:bg-grey-900 dark:lg:ring-white/10", children }) });
2116
+ }
1700
2117
  var focusOutline = {
1701
2118
  "primary/grey": [
1702
2119
  // Base
@@ -3353,224 +3770,6 @@ function BreadcrumbEllipsis({ className, ...props }) {
3353
3770
  }
3354
3771
  );
3355
3772
  }
3356
- function DropdownMenu({ ...props }) {
3357
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Root, { "data-slot": "dropdown-menu", ...props });
3358
- }
3359
- function DropdownMenuPortal({
3360
- ...props
3361
- }) {
3362
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { "data-slot": "dropdown-menu-portal", ...props });
3363
- }
3364
- function DropdownMenuTrigger({
3365
- ...props
3366
- }) {
3367
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
3368
- }
3369
- function DropdownMenuContent({
3370
- className,
3371
- sideOffset = 4,
3372
- ...props
3373
- }) {
3374
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3375
- DropdownMenuPrimitive__namespace.Content,
3376
- {
3377
- "data-slot": "dropdown-menu-content",
3378
- sideOffset,
3379
- className: cn(
3380
- [
3381
- // Base
3382
- "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border bg-background p-1 text-foreground shadow-md",
3383
- // Open
3384
- "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
3385
- // Closed
3386
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
3387
- // Side
3388
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
3389
- // Hover
3390
- "",
3391
- // Focus
3392
- "",
3393
- // Active
3394
- ""
3395
- ],
3396
- className
3397
- ),
3398
- ...props
3399
- }
3400
- ) });
3401
- }
3402
- function DropdownMenuGroup({ ...props }) {
3403
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Group, { "data-slot": "dropdown-menu-group", ...props });
3404
- }
3405
- function DropdownMenuItem({
3406
- className,
3407
- inset,
3408
- variant = "default",
3409
- ...props
3410
- }) {
3411
- return /* @__PURE__ */ jsxRuntime.jsx(
3412
- DropdownMenuPrimitive__namespace.Item,
3413
- {
3414
- "data-slot": "dropdown-menu-item",
3415
- "data-inset": inset,
3416
- "data-variant": variant,
3417
- className: cn(
3418
- [
3419
- // Base
3420
- ""
3421
- ],
3422
- "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:!text-destructive",
3423
- className
3424
- ),
3425
- ...props
3426
- }
3427
- );
3428
- }
3429
- function DropdownMenuCheckboxItem({
3430
- className,
3431
- children,
3432
- checked,
3433
- ...props
3434
- }) {
3435
- return /* @__PURE__ */ jsxRuntime.jsxs(
3436
- DropdownMenuPrimitive__namespace.CheckboxItem,
3437
- {
3438
- "data-slot": "dropdown-menu-checkbox-item",
3439
- className: cn(
3440
- [
3441
- // Base
3442
- ""
3443
- ],
3444
- "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3445
- className
3446
- ),
3447
- checked,
3448
- ...props,
3449
- children: [
3450
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(Icons.check, { className: "size-4" }) }) }),
3451
- children
3452
- ]
3453
- }
3454
- );
3455
- }
3456
- function DropdownMenuRadioGroup({
3457
- ...props
3458
- }) {
3459
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
3460
- }
3461
- function DropdownMenuRadioItem({
3462
- className,
3463
- children,
3464
- ...props
3465
- }) {
3466
- return /* @__PURE__ */ jsxRuntime.jsxs(
3467
- DropdownMenuPrimitive__namespace.RadioItem,
3468
- {
3469
- "data-slot": "dropdown-menu-radio-item",
3470
- className: cn(
3471
- [
3472
- // Base
3473
- ""
3474
- ],
3475
- "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3476
- className
3477
- ),
3478
- ...props,
3479
- children: [
3480
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(Icons.circle, { className: "size-2 fill-current" }) }) }),
3481
- children
3482
- ]
3483
- }
3484
- );
3485
- }
3486
- function DropdownMenuLabel({
3487
- className,
3488
- inset,
3489
- ...props
3490
- }) {
3491
- return /* @__PURE__ */ jsxRuntime.jsx(
3492
- DropdownMenuPrimitive__namespace.Label,
3493
- {
3494
- "data-slot": "dropdown-menu-label",
3495
- "data-inset": inset,
3496
- className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
3497
- ...props
3498
- }
3499
- );
3500
- }
3501
- function DropdownMenuSeparator({
3502
- className,
3503
- ...props
3504
- }) {
3505
- return /* @__PURE__ */ jsxRuntime.jsx(
3506
- DropdownMenuPrimitive__namespace.Separator,
3507
- {
3508
- "data-slot": "dropdown-menu-separator",
3509
- className: cn("-mx-1 my-1 h-px bg-border", className),
3510
- ...props
3511
- }
3512
- );
3513
- }
3514
- function DropdownMenuShortcut({ className, ...props }) {
3515
- return /* @__PURE__ */ jsxRuntime.jsx(
3516
- "span",
3517
- {
3518
- "data-slot": "dropdown-menu-shortcut",
3519
- className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
3520
- ...props
3521
- }
3522
- );
3523
- }
3524
- function DropdownMenuSub({ ...props }) {
3525
- return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Sub, { "data-slot": "dropdown-menu-sub", ...props });
3526
- }
3527
- function DropdownMenuSubTrigger({
3528
- className,
3529
- inset,
3530
- children,
3531
- ...props
3532
- }) {
3533
- return /* @__PURE__ */ jsxRuntime.jsxs(
3534
- DropdownMenuPrimitive__namespace.SubTrigger,
3535
- {
3536
- "data-slot": "dropdown-menu-sub-trigger",
3537
- "data-inset": inset,
3538
- className: cn(
3539
- [
3540
- // Base
3541
- ""
3542
- ],
3543
- "flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-primary-800/10 focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-primary-800/10 data-[state=open]:text-accent-foreground",
3544
- className
3545
- ),
3546
- ...props,
3547
- children: [
3548
- children,
3549
- /* @__PURE__ */ jsxRuntime.jsx(Icons.chevron_right, { className: "ml-auto size-4" })
3550
- ]
3551
- }
3552
- );
3553
- }
3554
- function DropdownMenuSubContent({
3555
- className,
3556
- ...props
3557
- }) {
3558
- return /* @__PURE__ */ jsxRuntime.jsx(
3559
- DropdownMenuPrimitive__namespace.SubContent,
3560
- {
3561
- "data-slot": "dropdown-menu-sub-content",
3562
- className: cn(
3563
- [
3564
- // Base
3565
- ""
3566
- ],
3567
- "z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
3568
- className
3569
- ),
3570
- ...props
3571
- }
3572
- );
3573
- }
3574
3773
  function Breadcrumbs({
3575
3774
  homeLabel = "Home",
3576
3775
  pathLabels = {},
@@ -11980,7 +12179,7 @@ function FormatToggle({ format, setFormat }) {
11980
12179
 
11981
12180
  // package.json
11982
12181
  var package_default = {
11983
- version: "1.59.0"};
12182
+ version: "1.60.0"};
11984
12183
  function Heading({
11985
12184
  className,
11986
12185
  trim = "normal",
@@ -18728,7 +18927,7 @@ function distance2D(a, b) {
18728
18927
 
18729
18928
  // node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs
18730
18929
  var PanSession = class {
18731
- constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3 } = {}) {
18930
+ constructor(event, handlers2, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3 } = {}) {
18732
18931
  this.startEvent = null;
18733
18932
  this.lastMoveEvent = null;
18734
18933
  this.lastMoveEventInfo = null;
@@ -18773,7 +18972,7 @@ var PanSession = class {
18773
18972
  if (!isPrimaryPointer(event))
18774
18973
  return;
18775
18974
  this.dragSnapToOrigin = dragSnapToOrigin;
18776
- this.handlers = handlers;
18975
+ this.handlers = handlers2;
18777
18976
  this.transformPagePoint = transformPagePoint;
18778
18977
  this.distanceThreshold = distanceThreshold;
18779
18978
  this.contextWindow = contextWindow || window;
@@ -18782,12 +18981,12 @@ var PanSession = class {
18782
18981
  const { point } = initialInfo;
18783
18982
  const { timestamp } = frameData;
18784
18983
  this.history = [{ ...point, timestamp }];
18785
- const { onSessionStart } = handlers;
18984
+ const { onSessionStart } = handlers2;
18786
18985
  onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
18787
18986
  this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
18788
18987
  }
18789
- updateHandlers(handlers) {
18790
- this.handlers = handlers;
18988
+ updateHandlers(handlers2) {
18989
+ this.handlers = handlers2;
18791
18990
  }
18792
18991
  end() {
18793
18992
  this.removeListeners && this.removeListeners();
@@ -23807,6 +24006,23 @@ function StepNavigation({
23807
24006
  /* @__PURE__ */ jsxRuntime.jsx(StepIndicator, { className: "mt-2 lg:mt-4", array: section.links })
23808
24007
  ] }, section.title)) }) });
23809
24008
  }
24009
+ function SubmitButton({
24010
+ submitText = "Submit",
24011
+ activeSubmitText = "Submitting...",
24012
+ disabled,
24013
+ isSubmitting = false,
24014
+ icon,
24015
+ ...props
24016
+ }) {
24017
+ const IconComponent = icon ? Icons[icon] : null;
24018
+ return /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", disabled, ...props, children: !isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24019
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "mr-2" }),
24020
+ submitText
24021
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24022
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, { "aria-label": activeSubmitText, size: "sm", className: "mr-2" }),
24023
+ activeSubmitText
24024
+ ] }) });
24025
+ }
23810
24026
  function SwitchGroup({ className, ...props }) {
23811
24027
  return /* @__PURE__ */ jsxRuntime.jsx(
23812
24028
  "div",
@@ -24636,6 +24852,15 @@ var Tracker = React5__namespace.default.forwardRef(
24636
24852
  }
24637
24853
  );
24638
24854
  Tracker.displayName = "Tracker";
24855
+ function SignInButton() {
24856
+ return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signInGeneric, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", variant: "outline", children: "Sign in" }) });
24857
+ }
24858
+ function SignInWithEntraButton() {
24859
+ return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signInWithEntra, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", children: "Sign in with Entra" }) });
24860
+ }
24861
+ function SignOutButton() {
24862
+ return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signOutAction, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", color: "danger", children: "Sign Out" }) });
24863
+ }
24639
24864
  var useIsomorphicLayoutEffect2 = typeof window !== "undefined" ? React5.useLayoutEffect : React5.useEffect;
24640
24865
  function useDisableToc() {
24641
24866
  const { setToc } = useToc();
@@ -24652,15 +24877,15 @@ function useDisableToc() {
24652
24877
  }, [setToc]);
24653
24878
  }
24654
24879
  function getNodeText(node) {
24655
- let text = "";
24880
+ let text4 = "";
24656
24881
  for (const child of node.children ?? []) {
24657
24882
  if ("type" in child && child.type === "text") {
24658
- text += child.attributes?.content ?? "";
24883
+ text4 += child.attributes?.content ?? "";
24659
24884
  } else if (child instanceof HTMLElement) {
24660
- text += getNodeText(child);
24885
+ text4 += getNodeText(child);
24661
24886
  }
24662
24887
  }
24663
- return text;
24888
+ return text4;
24664
24889
  }
24665
24890
  function domToSimple(node) {
24666
24891
  if (node.nodeType === Node.TEXT_NODE) {
@@ -24795,6 +25020,8 @@ exports.AlertDialogTrigger = AlertDialogTrigger;
24795
25020
  exports.AlertTitle = AlertTitle;
24796
25021
  exports.AreaChart = AreaChart;
24797
25022
  exports.AspectRatio = AspectRatio;
25023
+ exports.AuthButton = AuthButton;
25024
+ exports.AuthButtonWrapper = AuthButtonWrapper;
24798
25025
  exports.AuthLayout = AuthLayout;
24799
25026
  exports.AvailableChartColors = AvailableChartColors;
24800
25027
  exports.Avatar = Avatar;
@@ -25067,6 +25294,9 @@ exports.SidebarProvider = SidebarProvider;
25067
25294
  exports.SidebarRail = SidebarRail;
25068
25295
  exports.SidebarSeparator = SidebarSeparator;
25069
25296
  exports.SidebarTrigger = SidebarTrigger;
25297
+ exports.SignInButton = SignInButton;
25298
+ exports.SignInWithEntraButton = SignInWithEntraButton;
25299
+ exports.SignOutButton = SignOutButton;
25070
25300
  exports.SiteSearch = SiteSearch;
25071
25301
  exports.Skeleton = Skeleton;
25072
25302
  exports.Slider = Slider;
@@ -25078,6 +25308,7 @@ exports.Spinner = Spinner;
25078
25308
  exports.StepIndicator = StepIndicator;
25079
25309
  exports.StepNavigation = StepNavigation;
25080
25310
  exports.Strong = Strong;
25311
+ exports.SubmitButton = SubmitButton;
25081
25312
  exports.Switch = Switch2;
25082
25313
  exports.SwitchField = SwitchField;
25083
25314
  exports.SwitchGroup = SwitchGroup;