@tailor-platform/app-shell 0.18.0 → 0.20.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/app-shell.js CHANGED
@@ -1,24 +1,25 @@
1
- import { jsx as a, jsxs as c, Fragment as N } from "react/jsx-runtime";
2
- import { AlertCircle as Y, Table as ft, XIcon as vt, PanelLeftIcon as xt, ChevronRight as D, SunIcon as yt } from "lucide-react";
3
- import * as b from "react";
4
- import { createContext as $, useContext as F, useState as K, useMemo as H, useEffect as U, useCallback as Q } from "react";
5
- import { useRouteError as Tt, isRouteErrorResponse as St, Outlet as W, NavLink as Ct, redirect as ot, Navigate as Nt, createMemoryRouter as kt, createBrowserRouter as Bt, RouterProvider as Pt, useHref as Rt, Link as _t, useLocation as it, useMatch as Et } from "react-router";
6
- import { Link as sa, useLocation as ra, useNavigate as na, useParams as oa, useRouteError as ia, useSearchParams as la } from "react-router";
7
- import { Slot as P } from "@radix-ui/react-slot";
8
- import { cva as lt } from "class-variance-authority";
9
- import { clsx as It } from "clsx";
10
- import { twMerge as At } from "tailwind-merge";
11
- import { capitalCase as k } from "change-case";
12
- import { Toaster as Lt } from "sonner";
13
- import * as V from "@radix-ui/react-collapsible";
1
+ import { jsx as a, jsxs as c, Fragment as B } from "react/jsx-runtime";
2
+ import { AlertCircle as q, Table as gt, XIcon as rt, PanelLeftIcon as bt, ChevronRight as z, SunIcon as pt, SearchIcon as vt } from "lucide-react";
3
+ import * as y from "react";
4
+ import { createContext as j, useContext as U, useState as T, useMemo as A, useEffect as C, useRef as xt, useCallback as O } from "react";
5
+ import { useRouteError as yt, isRouteErrorResponse as Nt, Outlet as W, NavLink as Ct, redirect as nt, Navigate as St, createMemoryRouter as Tt, createBrowserRouter as kt, RouterProvider as Rt, useHref as Et, Link as Bt, useLocation as ot, useMatch as At, useNavigate as Pt } from "react-router";
6
+ import { Link as ma, useLocation as ha, useNavigate as fa, useParams as ga, useRouteError as ba, useSearchParams as pa } from "react-router";
7
+ import { Slot as D } from "@radix-ui/react-slot";
8
+ import { cva as it } from "class-variance-authority";
9
+ import { clsx as Lt } from "clsx";
10
+ import { twMerge as Dt } from "tailwind-merge";
11
+ import { capitalCase as P } from "change-case";
12
+ import { Toaster as It } from "sonner";
13
+ import * as H from "@radix-ui/react-collapsible";
14
14
  import "@radix-ui/react-separator";
15
- import * as x from "@radix-ui/react-dialog";
16
- import * as S from "@radix-ui/react-tooltip";
17
- import * as M from "oauth4webapi";
15
+ import * as v from "@radix-ui/react-dialog";
16
+ import * as k from "@radix-ui/react-tooltip";
17
+ import { print as _t } from "graphql";
18
+ import { createAuthClient as Mt } from "@tailor-platform/auth-browser-client";
18
19
  function u(...t) {
19
- return At(It(t));
20
+ return Dt(Lt(t));
20
21
  }
21
- const Mt = lt(
22
+ const zt = it(
22
23
  "astw:inline-flex astw:items-center astw:justify-center astw:gap-2 astw:whitespace-nowrap astw:rounded-md astw:text-sm astw:font-medium astw:transition-all astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:[&_svg]:pointer-events-none astw:[&_svg:not([class*='size-'])]:size-4 astw:shrink-0 astw:[&_svg]:shrink-0 astw:outline-none astw:focus-visible:border-ring astw:focus-visible:ring-ring/50 astw:focus-visible:ring-[3px] astw:aria-invalid:ring-destructive/20 astw:dark:aria-invalid:ring-destructive/40 astw:aria-invalid:border-destructive",
23
24
  {
24
25
  variants: {
@@ -43,7 +44,7 @@ const Mt = lt(
43
44
  }
44
45
  }
45
46
  );
46
- function B({
47
+ function L({
47
48
  className: t,
48
49
  variant: e,
49
50
  size: s,
@@ -51,31 +52,31 @@ function B({
51
52
  ...n
52
53
  }) {
53
54
  return /* @__PURE__ */ a(
54
- r ? P : "button",
55
+ r ? D : "button",
55
56
  {
56
57
  "data-slot": "button",
57
- className: u(Mt({ variant: e, size: s, className: t })),
58
+ className: u(zt({ variant: e, size: s, className: t })),
58
59
  ...n
59
60
  }
60
61
  );
61
62
  }
62
- const C = "en", zt = () => {
63
+ const E = "en", Ot = () => {
63
64
  try {
64
65
  if (typeof navigator > "u")
65
- return C;
66
+ return E;
66
67
  const t = navigator.languages?.[0] ?? navigator.language;
67
- return t ? new Intl.Locale(t).language : C;
68
+ return t ? new Intl.Locale(t).language : E;
68
69
  } catch {
69
- return C;
70
+ return E;
70
71
  }
71
- }, q = (t) => (e, s) => e ? typeof e == "string" ? e : e(t) ?? s : s, dt = (t) => {
72
- const e = q(t);
73
- return (s, r) => e(s, typeof s == "string" ? s : k(r));
74
- }, Dt = () => {
75
- const { configurations: t } = y(), e = q(t.locale);
72
+ }, F = (t) => (e, s) => e ? typeof e == "string" ? e : e(t) ?? s : s, Q = (t) => {
73
+ const e = F(t);
74
+ return (s, r) => e(s, typeof s == "string" ? s : P(r));
75
+ }, $t = () => {
76
+ const { configurations: t } = S(), e = F(t.locale);
76
77
  return (s, r) => e(s, r);
77
- }, Ot = (t) => {
78
- const e = (s) => (r) => t[s ?? C]?.[r] ?? t.en[r];
78
+ }, Kt = (t) => {
79
+ const e = (s) => (r) => t[s ?? E]?.[r] ?? t.en[r];
79
80
  return {
80
81
  /**
81
82
  * Hook to get the translated label resolver function.
@@ -97,7 +98,7 @@ const C = "en", zt = () => {
97
98
  * ```
98
99
  */
99
100
  useT: () => {
100
- const { configurations: s } = y(), r = e(s.locale);
101
+ const { configurations: s } = S(), r = e(s.locale);
101
102
  return ((n, ...o) => {
102
103
  const l = r(n);
103
104
  return typeof l == "function" ? l(o[0]) : l;
@@ -130,7 +131,7 @@ const C = "en", zt = () => {
130
131
  return typeof o == "function" ? o(r[0]) : o;
131
132
  }
132
133
  };
133
- }, jt = Ot({
134
+ }, jt = Kt({
134
135
  en: {
135
136
  error404Title: "404 Not Found",
136
137
  error404Body: "The page you requested could not be found.",
@@ -146,7 +147,9 @@ const C = "en", zt = () => {
146
147
  sidebar: "Sidebar",
147
148
  sidebarDesc: "Displays the mobile sidebar.",
148
149
  close: "Close",
149
- more: "More"
150
+ more: "More",
151
+ commandPaletteSearch: "Search pages...",
152
+ commandPaletteNoResults: "No results found"
150
153
  },
151
154
  ja: {
152
155
  error404Title: "404 ページが見つかりません",
@@ -163,21 +166,23 @@ const C = "en", zt = () => {
163
166
  sidebar: "サイドバー",
164
167
  sidebarDesc: "モバイル用サイドバーを表示します。",
165
168
  close: "閉じる",
166
- more: "その他"
169
+ more: "その他",
170
+ commandPaletteSearch: "ページを検索...",
171
+ commandPaletteNoResults: "結果が見つかりません"
167
172
  }
168
- }), R = jt.useT, E = () => {
169
- const t = Tt(), e = R(), s = {
173
+ }), R = jt.useT, I = () => {
174
+ const t = yt(), e = R(), s = {
170
175
  role: "alert",
171
176
  "aria-label": "default-error-boundary"
172
177
  };
173
- if (St(t) && t.status === 404)
178
+ if (Nt(t) && t.status === 404)
174
179
  return /* @__PURE__ */ a("div", { ...s, className: "astw:p-6", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:items-start astw:gap-4", children: [
175
- /* @__PURE__ */ a(Y, { className: "astw:h-5 astw:w-5 astw:text-destructive astw:flex-shrink-0 astw:mt-0.5" }),
180
+ /* @__PURE__ */ a(q, { className: "astw:h-5 astw:w-5 astw:text-destructive astw:flex-shrink-0 astw:mt-0.5" }),
176
181
  /* @__PURE__ */ c("div", { children: [
177
182
  /* @__PURE__ */ a("h1", { className: "astw:font-semibold astw:text-lg", children: e("error404Title") }),
178
183
  /* @__PURE__ */ a("p", { className: "astw:text-sm astw:text-muted-foreground astw:mt-1", children: e("error404Body") }),
179
184
  /* @__PURE__ */ a(
180
- B,
185
+ L,
181
186
  {
182
187
  variant: "outline",
183
188
  size: "sm",
@@ -190,12 +195,12 @@ const C = "en", zt = () => {
190
195
  ] }) });
191
196
  const r = t instanceof Error ? t.message : e("errorUnexpected");
192
197
  return /* @__PURE__ */ a("div", { ...s, className: "astw:p-6", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:items-start astw:gap-4", children: [
193
- /* @__PURE__ */ a(Y, { className: "astw:h-5 astw:w-5 astw:text-destructive astw:flex-shrink-0 astw:mt-0.5" }),
198
+ /* @__PURE__ */ a(q, { className: "astw:h-5 astw:w-5 astw:text-destructive astw:flex-shrink-0 astw:mt-0.5" }),
194
199
  /* @__PURE__ */ c("div", { children: [
195
200
  /* @__PURE__ */ a("h1", { className: "astw:font-semibold astw:text-lg", children: e("errorTitle") }),
196
201
  /* @__PURE__ */ a("p", { className: "astw:text-sm astw:text-muted-foreground astw:mt-1", children: r }),
197
202
  /* @__PURE__ */ a(
198
- B,
203
+ L,
199
204
  {
200
205
  variant: "outline",
201
206
  size: "sm",
@@ -206,36 +211,36 @@ const C = "en", zt = () => {
206
211
  )
207
212
  ] })
208
213
  ] }) });
209
- }, $t = (t) => ({
214
+ }, Ut = (t) => ({
210
215
  modules: t.modules,
211
216
  settingsResources: t.settingsResources ?? [],
212
- errorBoundary: t.errorBoundary ?? /* @__PURE__ */ a(E, {}),
217
+ errorBoundary: t.errorBoundary ?? /* @__PURE__ */ a(I, {}),
213
218
  basePath: t.basePath,
214
- locale: t.locale ?? zt()
215
- }), ct = $({
219
+ locale: t.locale ?? Ot()
220
+ }), lt = j({
216
221
  navItems: [],
217
222
  configurations: {
218
223
  modules: [],
219
224
  settingsResources: [],
220
- errorBoundary: /* @__PURE__ */ a(E, {}),
221
- locale: C
225
+ errorBoundary: /* @__PURE__ */ a(I, {}),
226
+ locale: E
222
227
  }
223
- }), y = () => F(ct), Ft = () => {
228
+ }), S = () => U(lt), Wt = () => {
224
229
  const t = R();
225
- return /* @__PURE__ */ c(N, { children: [
230
+ return /* @__PURE__ */ c(B, { children: [
226
231
  /* @__PURE__ */ a("p", { className: "astw:font-semibold astw:leading-none astw:tracking-tight", children: t("welcomeTitle") }),
227
232
  /* @__PURE__ */ a("p", { className: "pt-4", children: t("welcomeBody") })
228
233
  ] });
229
- }, J = () => /* @__PURE__ */ c(N, { children: [
234
+ }, X = () => /* @__PURE__ */ c(B, { children: [
230
235
  /* @__PURE__ */ a(W, {}),
231
- /* @__PURE__ */ a(Lt, {})
232
- ] }), Kt = () => {
233
- const { configurations: t } = y(), e = R(), s = Dt();
236
+ /* @__PURE__ */ a(It, {})
237
+ ] }), Ht = () => {
238
+ const { configurations: t } = S(), e = R(), s = $t();
234
239
  return /* @__PURE__ */ c("div", { className: "astw:mx-auto astw:flex-col astw:flex astw:md:flex-row astw:max-w-5xl astw:gap-[10px] astw:w-full", children: [
235
240
  /* @__PURE__ */ a("div", { children: /* @__PURE__ */ c("nav", { className: "astw:bg-card astw:md:w-xs astw:rounded-md astw:border astw:p-3 astw:shadow-xs", children: [
236
241
  /* @__PURE__ */ a("h2", { className: "astw:text-sm astw:leading-[36px] astw:mb-2 astw:font-bold ", children: e("settings") }),
237
242
  /* @__PURE__ */ a("ul", { className: "astw:flex astw:flex-col astw:gap-1", children: t.settingsResources.map((r) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(Ct, { to: `./${r.path}`, children: ({ isActive: n }) => /* @__PURE__ */ c(
238
- B,
243
+ L,
239
244
  {
240
245
  variant: n ? "secondary" : "ghost",
241
246
  className: "astw:w-full astw:justify-start",
@@ -249,26 +254,26 @@ const C = "en", zt = () => {
249
254
  /* @__PURE__ */ a("section", { className: "astw:bg-card astw:flex-1 astw:rounded-md astw:border astw:shadow-xs", children: /* @__PURE__ */ a(W, {}) })
250
255
  ] });
251
256
  };
252
- function qe(t) {
257
+ function sa(t) {
253
258
  return {
254
259
  redirectTo: t
255
260
  };
256
261
  }
257
- function O(t) {
262
+ function $(t) {
258
263
  return typeof t == "object" && t !== null && "redirectTo" in t;
259
264
  }
260
- const wt = (t, e) => () => {
261
- const { configurations: s } = y(), { metaTitle: r, fallbackTitle: n } = t, l = q(s.locale)(r, n);
265
+ const dt = (t, e) => () => {
266
+ const { configurations: s } = S(), { metaTitle: r, fallbackTitle: n } = t, l = F(s.locale)(r, n);
262
267
  return e(l);
263
268
  };
264
- function Ge(t) {
265
- const { path: e, meta: s, component: r, resources: n, errorBoundary: o } = t, l = s?.title ?? k(e), d = k(e), i = O(r) ? {
269
+ function ra(t) {
270
+ const { path: e, meta: s, component: r, resources: n, errorBoundary: o } = t, l = s?.title ?? P(e), d = P(e), i = $(r) ? {
266
271
  // Use loader for redirects
267
272
  component: () => null,
268
- loader: () => ot(r.redirectTo)
273
+ loader: () => nt(r.redirectTo)
269
274
  } : {
270
275
  // Regular component with locale-aware title
271
- component: wt(
276
+ component: dt(
272
277
  { metaTitle: l, fallbackTitle: d },
273
278
  (w) => r({ title: w, resources: n })
274
279
  )
@@ -282,15 +287,15 @@ function Ge(t) {
282
287
  title: l,
283
288
  ...s?.breadcrumbTitle !== void 0 ? { breadcrumbTitle: s.breadcrumbTitle } : {},
284
289
  ...s,
285
- menuItemClickable: !O(r),
290
+ menuItemClickable: !$(r),
286
291
  icon: t.meta?.icon
287
292
  },
288
293
  resources: n,
289
- errorBoundary: o || /* @__PURE__ */ a(E, {})
294
+ errorBoundary: o || /* @__PURE__ */ a(I, {})
290
295
  };
291
296
  }
292
- function Xe(t) {
293
- const { path: e, component: s, subResources: r, meta: n, errorBoundary: o } = t, l = n?.title ?? k(e), d = k(e);
297
+ function na(t) {
298
+ const { path: e, component: s, subResources: r, meta: n, errorBoundary: o } = t, l = n?.title ?? P(e), d = P(e);
294
299
  return {
295
300
  _type: "resource",
296
301
  type: "component",
@@ -300,15 +305,15 @@ function Xe(t) {
300
305
  icon: n?.icon,
301
306
  ...n?.breadcrumbTitle !== void 0 ? { breadcrumbTitle: n.breadcrumbTitle } : {}
302
307
  },
303
- component: wt(
308
+ component: dt(
304
309
  { metaTitle: l, fallbackTitle: d },
305
310
  (i) => s({ title: i, resources: r })
306
311
  ),
307
312
  subResources: r,
308
- errorBoundary: o ?? /* @__PURE__ */ a(E, {})
313
+ errorBoundary: o ?? /* @__PURE__ */ a(I, {})
309
314
  };
310
315
  }
311
- const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) => {
316
+ const G = (t) => () => /* @__PURE__ */ a(B, { children: t }), ct = (t, e, s) => {
312
317
  const r = t.errorBoundary || s, n = {
313
318
  index: !0,
314
319
  Component: t.component,
@@ -323,32 +328,32 @@ const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) =>
323
328
  children: [
324
329
  n,
325
330
  ...e.map(
326
- (o) => ut(o, o.subResources, r)
331
+ (o) => ct(o, o.subResources, r)
327
332
  )
328
333
  ]
329
334
  } : {
330
335
  children: [n]
331
336
  }
332
337
  };
333
- }, Ht = (t) => t.map(
334
- (e) => ut(e, e.resources, e.errorBoundary)
335
- ), Ut = ({
338
+ }, Ft = (t) => t.map(
339
+ (e) => ct(e, e.resources, e.errorBoundary)
340
+ ), Qt = ({
336
341
  modules: t,
337
342
  settingsResources: e,
338
343
  rootComponent: s
339
344
  }) => {
340
- const r = O(s) ? {
345
+ const r = $(s) ? {
341
346
  index: !0,
342
- loader: () => ot(s.redirectTo)
347
+ loader: () => nt(s.redirectTo)
343
348
  } : {
344
349
  index: !0,
345
- Component: s ?? Ft
350
+ Component: s ?? Wt
346
351
  }, n = e.length > 0 ? [
347
352
  {
348
353
  path: "settings",
349
354
  index: !0,
350
355
  Component: () => /* @__PURE__ */ a(
351
- Nt,
356
+ St,
352
357
  {
353
358
  to: e[0].path,
354
359
  relative: "path",
@@ -358,7 +363,7 @@ const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) =>
358
363
  },
359
364
  {
360
365
  path: "settings",
361
- Component: Kt,
366
+ Component: Ht,
362
367
  children: e.map((o) => ({
363
368
  path: o.path,
364
369
  Component: o.component,
@@ -371,7 +376,7 @@ const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) =>
371
376
  return [
372
377
  r,
373
378
  {
374
- children: Ht(t)
379
+ children: Ft(t)
375
380
  },
376
381
  ...n,
377
382
  {
@@ -381,8 +386,8 @@ const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) =>
381
386
  }
382
387
  }
383
388
  ];
384
- }, Wt = (t) => {
385
- const { configurations: e } = y(), { rootComponent: s, children: r } = t, n = Ut({
389
+ }, Gt = (t) => {
390
+ const { configurations: e } = S(), { rootComponent: s, children: r } = t, n = Qt({
386
391
  modules: e.modules,
387
392
  settingsResources: e.settingsResources,
388
393
  rootComponent: s
@@ -397,28 +402,28 @@ const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) =>
397
402
  }
398
403
  ] : n
399
404
  }
400
- ], d = e.basePath ? "/" + e.basePath : void 0, i = t.memory ? kt(l, {
405
+ ], d = e.basePath ? "/" + e.basePath : void 0, i = t.memory ? Tt(l, {
401
406
  basename: d,
402
407
  ...t.initialEntries ? { initialEntries: t.initialEntries } : {}
403
- }) : Bt(l, {
408
+ }) : kt(l, {
404
409
  basename: d
405
410
  });
406
- return /* @__PURE__ */ a(Pt, { router: i });
411
+ return /* @__PURE__ */ a(Rt, { router: i });
407
412
  }, Vt = {
408
413
  resolvedTheme: "light",
409
414
  theme: "system",
410
415
  setTheme: () => null
411
- }, mt = $(Vt);
416
+ }, wt = j(Vt);
412
417
  function qt({
413
418
  children: t,
414
419
  storageKey: e,
415
420
  defaultTheme: s = "system",
416
421
  ...r
417
422
  }) {
418
- const [n, o] = K(
423
+ const [n, o] = T(
419
424
  () => localStorage.getItem(e) || s
420
- ), l = H(() => n !== "system" ? n : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", [n]);
421
- U(() => {
425
+ ), l = A(() => n !== "system" ? n : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", [n]);
426
+ C(() => {
422
427
  const i = window.document.documentElement;
423
428
  i.classList.remove("light", "dark"), i.classList.add(l);
424
429
  }, [l]);
@@ -429,37 +434,37 @@ function qt({
429
434
  localStorage.setItem(e, i), o(i);
430
435
  }
431
436
  };
432
- return /* @__PURE__ */ a(mt.Provider, { ...r, value: d, children: t });
437
+ return /* @__PURE__ */ a(wt.Provider, { ...r, value: d, children: t });
433
438
  }
434
- const Gt = () => {
435
- const t = F(mt);
439
+ const Xt = () => {
440
+ const t = U(wt);
436
441
  if (t === void 0)
437
442
  throw new Error("useTheme must be used within a ThemeProvider");
438
443
  return t;
439
- }, Ye = (t) => {
440
- const [e, s] = K(!1);
441
- U(function() {
444
+ }, oa = (t) => {
445
+ const [e, s] = T(!1);
446
+ C(function() {
442
447
  s(!0);
443
448
  }, []);
444
- const r = $t(t), n = H(() => {
445
- const o = t.modules, l = dt(r.locale);
449
+ const r = Ut(t), n = A(() => {
450
+ const o = t.modules, l = Q(r.locale);
446
451
  return o.map((d) => {
447
- const i = l(d.meta.title, d.path), w = d.resources.map((m) => ({
448
- title: l(m.meta.title, m.path),
449
- url: `${d.path}/${m.path}`
452
+ const i = l(d.meta.title, d.path), w = d.resources.map((h) => ({
453
+ title: l(h.meta.title, h.path),
454
+ url: `${d.path}/${h.path}`
450
455
  }));
451
456
  return {
452
457
  title: i,
453
458
  url: d.meta.menuItemClickable ? d.path : void 0,
454
459
  clickable: d.component,
455
- icon: d.meta.icon || /* @__PURE__ */ a(ft, {}),
460
+ icon: d.meta.icon || /* @__PURE__ */ a(gt, {}),
456
461
  isActive: !0,
457
462
  items: w
458
463
  };
459
464
  });
460
465
  }, [t.modules, r.locale]);
461
466
  return e ? /* @__PURE__ */ a(
462
- ct.Provider,
467
+ lt.Provider,
463
468
  {
464
469
  value: {
465
470
  title: t.title,
@@ -467,63 +472,79 @@ const Gt = () => {
467
472
  configurations: r,
468
473
  navItems: n
469
474
  },
470
- children: /* @__PURE__ */ a(qt, { defaultTheme: "system", storageKey: "appshell-ui-theme", children: /* @__PURE__ */ a(Wt, { rootComponent: t.rootComponent, children: t.children }) })
475
+ children: /* @__PURE__ */ a(qt, { defaultTheme: "system", storageKey: "appshell-ui-theme", children: /* @__PURE__ */ a(Gt, { rootComponent: t.rootComponent, children: t.children }) })
471
476
  }
472
477
  ) : null;
473
478
  };
474
- function Xt({
479
+ function Yt({
475
480
  ...t
476
481
  }) {
477
- return /* @__PURE__ */ a(V.Root, { "data-slot": "collapsible", ...t });
482
+ return /* @__PURE__ */ a(H.Root, { "data-slot": "collapsible", ...t });
478
483
  }
479
- function Z({
484
+ function Y({
480
485
  ...t
481
486
  }) {
482
487
  return /* @__PURE__ */ a(
483
- V.CollapsibleTrigger,
488
+ H.CollapsibleTrigger,
484
489
  {
485
490
  "data-slot": "collapsible-trigger",
486
491
  ...t
487
492
  }
488
493
  );
489
494
  }
490
- function Yt({
495
+ function Jt({
491
496
  ...t
492
497
  }) {
493
498
  return /* @__PURE__ */ a(
494
- V.CollapsibleContent,
499
+ H.CollapsibleContent,
495
500
  {
496
501
  "data-slot": "collapsible-content",
497
502
  ...t
498
503
  }
499
504
  );
500
505
  }
501
- const z = 768;
502
- function Qt() {
503
- const [t, e] = b.useState(
506
+ const M = 768;
507
+ function Zt() {
508
+ const [t, e] = y.useState(
504
509
  void 0
505
510
  );
506
- return b.useEffect(() => {
507
- const s = window.matchMedia(`(max-width: ${z - 1}px)`), r = () => {
508
- e(window.innerWidth < z);
511
+ return y.useEffect(() => {
512
+ const s = window.matchMedia(`(max-width: ${M - 1}px)`), r = () => {
513
+ e(window.innerWidth < M);
509
514
  };
510
- return s.addEventListener("change", r), e(window.innerWidth < z), () => s.removeEventListener("change", r);
515
+ return s.addEventListener("change", r), e(window.innerWidth < M), () => s.removeEventListener("change", r);
511
516
  }, []), !!t;
512
517
  }
513
- function Jt({ ...t }) {
514
- return /* @__PURE__ */ a(x.Root, { "data-slot": "sheet", ...t });
518
+ function te({ className: t, type: e, ...s }) {
519
+ return /* @__PURE__ */ a(
520
+ "input",
521
+ {
522
+ type: e,
523
+ "data-slot": "input",
524
+ className: u(
525
+ "astw:file:text-foreground astw:placeholder:text-muted-foreground astw:selection:bg-primary astw:selection:text-primary-foreground astw:dark:bg-input/30 astw:border-input astw:flex astw:h-9 astw:w-full astw:min-w-0 astw:rounded-md astw:border astw:bg-transparent astw:px-3 astw:py-1 astw:text-base astw:shadow-xs astw:transition-[color,box-shadow] astw:outline-none astw:file:inline-flex astw:file:h-7 astw:file:border-0 astw:file:bg-transparent astw:file:text-sm astw:file:font-medium astw:disabled:pointer-events-none astw:disabled:cursor-not-allowed astw:disabled:opacity-50 astw:md:text-sm",
526
+ "astw:focus-visible:border-ring astw:focus-visible:ring-ring/50 astw:focus-visible:ring-[3px]",
527
+ "astw:aria-invalid:ring-destructive/20 astw:dark:aria-invalid:ring-destructive/40 astw:aria-invalid:border-destructive",
528
+ t
529
+ ),
530
+ ...s
531
+ }
532
+ );
533
+ }
534
+ function ee({ ...t }) {
535
+ return /* @__PURE__ */ a(v.Root, { "data-slot": "sheet", ...t });
515
536
  }
516
- function Zt({
537
+ function ae({
517
538
  ...t
518
539
  }) {
519
- return /* @__PURE__ */ a(x.Portal, { "data-slot": "sheet-portal", ...t });
540
+ return /* @__PURE__ */ a(v.Portal, { "data-slot": "sheet-portal", ...t });
520
541
  }
521
- function te({
542
+ function se({
522
543
  className: t,
523
544
  ...e
524
545
  }) {
525
546
  return /* @__PURE__ */ a(
526
- x.Overlay,
547
+ v.Overlay,
527
548
  {
528
549
  "data-slot": "sheet-overlay",
529
550
  className: u(
@@ -534,16 +555,16 @@ function te({
534
555
  }
535
556
  );
536
557
  }
537
- function ee({
558
+ function re({
538
559
  className: t,
539
560
  children: e,
540
561
  side: s = "right",
541
562
  ...r
542
563
  }) {
543
- return /* @__PURE__ */ c(Zt, { children: [
544
- /* @__PURE__ */ a(te, {}),
564
+ return /* @__PURE__ */ c(ae, { children: [
565
+ /* @__PURE__ */ a(se, {}),
545
566
  /* @__PURE__ */ c(
546
- x.Content,
567
+ v.Content,
547
568
  {
548
569
  "data-slot": "sheet-content",
549
570
  className: u(
@@ -557,8 +578,8 @@ function ee({
557
578
  ...r,
558
579
  children: [
559
580
  e,
560
- /* @__PURE__ */ c(x.Close, { className: "astw:ring-offset-bg astw:focus:ring-ring astw:data-[state=open]:bg-secondary astw:absolute astw:top-4 astw:right-4 astw:rounded-xs astw:opacity-70 astw:transition-opacity astw:hover:opacity-100 astw:focus:ring-2 astw:focus:ring-offset-2 astw:focus:outline-hidden astw:disabled:pointer-events-none", children: [
561
- /* @__PURE__ */ a(vt, { className: "astw:size-4" }),
581
+ /* @__PURE__ */ c(v.Close, { className: "astw:ring-offset-bg astw:focus:ring-ring astw:data-[state=open]:bg-secondary astw:absolute astw:top-4 astw:right-4 astw:rounded-xs astw:opacity-70 astw:transition-opacity astw:hover:opacity-100 astw:focus:ring-2 astw:focus:ring-offset-2 astw:focus:outline-hidden astw:disabled:pointer-events-none", children: [
582
+ /* @__PURE__ */ a(rt, { className: "astw:size-4" }),
562
583
  /* @__PURE__ */ a("span", { className: "astw:sr-only", children: "Close" })
563
584
  ] })
564
585
  ]
@@ -566,7 +587,7 @@ function ee({
566
587
  )
567
588
  ] });
568
589
  }
569
- function ae({ className: t, ...e }) {
590
+ function ne({ className: t, ...e }) {
570
591
  return /* @__PURE__ */ a(
571
592
  "div",
572
593
  {
@@ -576,12 +597,12 @@ function ae({ className: t, ...e }) {
576
597
  }
577
598
  );
578
599
  }
579
- function se({
600
+ function oe({
580
601
  className: t,
581
602
  ...e
582
603
  }) {
583
604
  return /* @__PURE__ */ a(
584
- x.Title,
605
+ v.Title,
585
606
  {
586
607
  "data-slot": "sheet-title",
587
608
  className: u("astw:text-foreground astw:font-semibold", t),
@@ -589,12 +610,12 @@ function se({
589
610
  }
590
611
  );
591
612
  }
592
- function re({
613
+ function ie({
593
614
  className: t,
594
615
  ...e
595
616
  }) {
596
617
  return /* @__PURE__ */ a(
597
- x.Description,
618
+ v.Description,
598
619
  {
599
620
  "data-slot": "sheet-description",
600
621
  className: u("astw:text-muted-foreground astw:text-sm", t),
@@ -602,12 +623,12 @@ function re({
602
623
  }
603
624
  );
604
625
  }
605
- function ht({
626
+ function ut({
606
627
  delayDuration: t = 0,
607
628
  ...e
608
629
  }) {
609
630
  return /* @__PURE__ */ a(
610
- S.Provider,
631
+ k.Provider,
611
632
  {
612
633
  "data-slot": "tooltip-provider",
613
634
  delayDuration: t,
@@ -615,24 +636,24 @@ function ht({
615
636
  }
616
637
  );
617
638
  }
618
- function ne({
639
+ function le({
619
640
  ...t
620
641
  }) {
621
- return /* @__PURE__ */ a(ht, { children: /* @__PURE__ */ a(S.Root, { "data-slot": "tooltip", ...t }) });
642
+ return /* @__PURE__ */ a(ut, { children: /* @__PURE__ */ a(k.Root, { "data-slot": "tooltip", ...t }) });
622
643
  }
623
- function oe({
644
+ function de({
624
645
  ...t
625
646
  }) {
626
- return /* @__PURE__ */ a(S.Trigger, { "data-slot": "tooltip-trigger", ...t });
647
+ return /* @__PURE__ */ a(k.Trigger, { "data-slot": "tooltip-trigger", ...t });
627
648
  }
628
- function ie({
649
+ function ce({
629
650
  className: t,
630
651
  sideOffset: e = 0,
631
652
  children: s,
632
653
  ...r
633
654
  }) {
634
- return /* @__PURE__ */ a(S.Portal, { children: /* @__PURE__ */ c(
635
- S.Content,
655
+ return /* @__PURE__ */ a(k.Portal, { children: /* @__PURE__ */ c(
656
+ k.Content,
636
657
  {
637
658
  "data-slot": "tooltip-content",
638
659
  sideOffset: e,
@@ -643,19 +664,19 @@ function ie({
643
664
  ...r,
644
665
  children: [
645
666
  s,
646
- /* @__PURE__ */ a(S.Arrow, { className: "astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]" })
667
+ /* @__PURE__ */ a(k.Arrow, { className: "astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]" })
647
668
  ]
648
669
  }
649
670
  ) });
650
671
  }
651
- const le = "sidebar_state", de = 3600 * 24 * 7, ce = "16rem", we = "18rem", ue = "3rem", me = "b", pt = b.createContext(null);
652
- function I() {
653
- const t = b.useContext(pt);
672
+ const we = "sidebar_state", ue = 3600 * 24 * 7, me = "16rem", he = "18rem", fe = "3rem", ge = "b", mt = y.createContext(null);
673
+ function _() {
674
+ const t = y.useContext(mt);
654
675
  if (!t)
655
676
  throw new Error("useSidebar must be used within a SidebarProvider.");
656
677
  return t;
657
678
  }
658
- function he({
679
+ function be({
659
680
  defaultOpen: t = !0,
660
681
  open: e,
661
682
  onOpenChange: s,
@@ -664,38 +685,38 @@ function he({
664
685
  children: o,
665
686
  ...l
666
687
  }) {
667
- const d = Qt(), [i, w] = b.useState(!1), [m, h] = b.useState(t), g = e ?? m, v = b.useCallback(
688
+ const d = Zt(), [i, w] = y.useState(!1), [h, f] = y.useState(t), b = e ?? h, m = y.useCallback(
668
689
  (p) => {
669
- const f = typeof p == "function" ? p(g) : p;
670
- s ? s(f) : h(f), document.cookie = `${le}=${f}; path=/; max-age=${de}`;
690
+ const N = typeof p == "function" ? p(b) : p;
691
+ s ? s(N) : f(N), document.cookie = `${we}=${N}; path=/; max-age=${ue}`;
671
692
  },
672
- [s, g]
673
- ), T = b.useCallback(() => d ? w((p) => !p) : v((p) => !p), [d, v, w]);
674
- b.useEffect(() => {
675
- const p = (f) => {
676
- f.key === me && (f.metaKey || f.ctrlKey) && (f.preventDefault(), T());
693
+ [s, b]
694
+ ), g = y.useCallback(() => d ? w((p) => !p) : m((p) => !p), [d, m, w]);
695
+ y.useEffect(() => {
696
+ const p = (N) => {
697
+ N.key === ge && (N.metaKey || N.ctrlKey) && (N.preventDefault(), g());
677
698
  };
678
699
  return window.addEventListener("keydown", p), () => window.removeEventListener("keydown", p);
679
- }, [T]);
680
- const _ = g ? "expanded" : "collapsed", X = b.useMemo(
700
+ }, [g]);
701
+ const x = b ? "expanded" : "collapsed", V = y.useMemo(
681
702
  () => ({
682
- state: _,
683
- open: g,
684
- setOpen: v,
703
+ state: x,
704
+ open: b,
705
+ setOpen: m,
685
706
  isMobile: d,
686
707
  openMobile: i,
687
708
  setOpenMobile: w,
688
- toggleSidebar: T
709
+ toggleSidebar: g
689
710
  }),
690
- [_, g, v, d, i, w, T]
711
+ [x, b, m, d, i, w, g]
691
712
  );
692
- return /* @__PURE__ */ a(pt.Provider, { value: X, children: /* @__PURE__ */ a(ht, { delayDuration: 0, children: /* @__PURE__ */ a(
713
+ return /* @__PURE__ */ a(mt.Provider, { value: V, children: /* @__PURE__ */ a(ut, { delayDuration: 0, children: /* @__PURE__ */ a(
693
714
  "div",
694
715
  {
695
716
  "data-slot": "sidebar-wrapper",
696
717
  style: {
697
- "--sidebar-width": ce,
698
- "--sidebar-width-icon": ue,
718
+ "--sidebar-width": me,
719
+ "--sidebar-width-icon": fe,
699
720
  ...n
700
721
  },
701
722
  className: u(
@@ -715,7 +736,7 @@ function pe({
715
736
  children: n,
716
737
  ...o
717
738
  }) {
718
- const { isMobile: l, state: d, openMobile: i, setOpenMobile: w } = I();
739
+ const { isMobile: l, state: d, openMobile: i, setOpenMobile: w } = _();
719
740
  return s === "none" ? /* @__PURE__ */ a(
720
741
  "div",
721
742
  {
@@ -727,21 +748,21 @@ function pe({
727
748
  ...o,
728
749
  children: n
729
750
  }
730
- ) : l ? /* @__PURE__ */ a(Jt, { open: i, onOpenChange: w, ...o, children: /* @__PURE__ */ c(
731
- ee,
751
+ ) : l ? /* @__PURE__ */ a(ee, { open: i, onOpenChange: w, ...o, children: /* @__PURE__ */ c(
752
+ re,
732
753
  {
733
754
  "data-sidebar": "sidebar",
734
755
  "data-slot": "sidebar",
735
756
  "data-mobile": "true",
736
757
  className: "astw:bg-sidebar astw:text-sidebar-foreground astw:w-(--sidebar-width) astw:p-0 astw:[&>button]:hidden",
737
758
  style: {
738
- "--sidebar-width": we
759
+ "--sidebar-width": he
739
760
  },
740
761
  side: t,
741
762
  children: [
742
- /* @__PURE__ */ c(ae, { className: "astw:sr-only", children: [
743
- /* @__PURE__ */ a(se, { children: "Sidebar" }),
744
- /* @__PURE__ */ a(re, { children: "Displays the mobile sidebar." })
763
+ /* @__PURE__ */ c(ne, { className: "astw:sr-only", children: [
764
+ /* @__PURE__ */ a(oe, { children: "Sidebar" }),
765
+ /* @__PURE__ */ a(ie, { children: "Displays the mobile sidebar." })
745
766
  ] }),
746
767
  /* @__PURE__ */ a("div", { className: "flex h-full w-full flex-col", children: n })
747
768
  ]
@@ -796,14 +817,14 @@ function pe({
796
817
  }
797
818
  );
798
819
  }
799
- function gt({
820
+ function ht({
800
821
  className: t,
801
822
  onClick: e,
802
823
  ...s
803
824
  }) {
804
- const { toggleSidebar: r } = I();
825
+ const { toggleSidebar: r } = _();
805
826
  return /* @__PURE__ */ c(
806
- B,
827
+ L,
807
828
  {
808
829
  "data-sidebar": "trigger",
809
830
  "data-slot": "sidebar-trigger",
@@ -815,13 +836,13 @@ function gt({
815
836
  },
816
837
  ...s,
817
838
  children: [
818
- /* @__PURE__ */ a(xt, { className: "astw:size-4.5" }),
839
+ /* @__PURE__ */ a(bt, { className: "astw:size-4.5" }),
819
840
  /* @__PURE__ */ a("span", { className: "astw:sr-only", children: "Toggle Sidebar" })
820
841
  ]
821
842
  }
822
843
  );
823
844
  }
824
- function ge({ className: t, ...e }) {
845
+ function ve({ className: t, ...e }) {
825
846
  return /* @__PURE__ */ a(
826
847
  "main",
827
848
  {
@@ -836,7 +857,7 @@ function ge({ className: t, ...e }) {
836
857
  }
837
858
  );
838
859
  }
839
- function be({ className: t, ...e }) {
860
+ function xe({ className: t, ...e }) {
840
861
  return /* @__PURE__ */ a(
841
862
  "div",
842
863
  {
@@ -847,7 +868,7 @@ function be({ className: t, ...e }) {
847
868
  }
848
869
  );
849
870
  }
850
- function fe({ className: t, ...e }) {
871
+ function ye({ className: t, ...e }) {
851
872
  return /* @__PURE__ */ a(
852
873
  "div",
853
874
  {
@@ -861,7 +882,7 @@ function fe({ className: t, ...e }) {
861
882
  }
862
883
  );
863
884
  }
864
- function ve({ className: t, ...e }) {
885
+ function Ne({ className: t, ...e }) {
865
886
  return /* @__PURE__ */ a(
866
887
  "div",
867
888
  {
@@ -872,7 +893,7 @@ function ve({ className: t, ...e }) {
872
893
  }
873
894
  );
874
895
  }
875
- function xe({ className: t, ...e }) {
896
+ function Ce({ className: t, ...e }) {
876
897
  return /* @__PURE__ */ a(
877
898
  "ul",
878
899
  {
@@ -883,7 +904,7 @@ function xe({ className: t, ...e }) {
883
904
  }
884
905
  );
885
906
  }
886
- function ye({ className: t, ...e }) {
907
+ function Se({ className: t, ...e }) {
887
908
  return /* @__PURE__ */ a(
888
909
  "li",
889
910
  {
@@ -894,7 +915,7 @@ function ye({ className: t, ...e }) {
894
915
  }
895
916
  );
896
917
  }
897
- const Te = lt(
918
+ const Te = it(
898
919
  "astw:peer/menu-button astw:flex astw:w-full astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:p-2 astw:text-left astw:text-sm astw:outline-hidden astw:ring-sidebar-ring astw:transition-[width,height,padding] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:focus-visible:ring-2 astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:group-has-data-[sidebar=menu-action]/menu-item:pr-8 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:font-medium astw:data-[active=true]:text-sidebar-accent-foreground astw:data-[state=open]:hover:bg-sidebar-accent astw:data-[state=open]:hover:text-sidebar-accent-foreground astw:group-data-[collapsible=icon]:size-8! astw:group-data-[collapsible=icon]:p-2! astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0",
899
920
  {
900
921
  variants: {
@@ -914,7 +935,7 @@ const Te = lt(
914
935
  }
915
936
  }
916
937
  );
917
- function tt({
938
+ function J({
918
939
  asChild: t = !1,
919
940
  isActive: e = !1,
920
941
  variant: s = "default",
@@ -923,7 +944,7 @@ function tt({
923
944
  className: o,
924
945
  ...l
925
946
  }) {
926
- const d = t ? P : "button", { isMobile: i, state: w } = I(), m = /* @__PURE__ */ a(
947
+ const d = t ? D : "button", { isMobile: i, state: w } = _(), h = /* @__PURE__ */ a(
927
948
  d,
928
949
  {
929
950
  "data-slot": "sidebar-menu-button",
@@ -936,10 +957,10 @@ function tt({
936
957
  );
937
958
  return n ? (typeof n == "string" && (n = {
938
959
  children: n
939
- }), /* @__PURE__ */ c(ne, { children: [
940
- /* @__PURE__ */ a(oe, { asChild: !0, children: m }),
960
+ }), /* @__PURE__ */ c(le, { children: [
961
+ /* @__PURE__ */ a(de, { asChild: !0, children: h }),
941
962
  /* @__PURE__ */ a(
942
- ie,
963
+ ce,
943
964
  {
944
965
  side: "right",
945
966
  align: "center",
@@ -947,16 +968,16 @@ function tt({
947
968
  ...n
948
969
  }
949
970
  )
950
- ] })) : m;
971
+ ] })) : h;
951
972
  }
952
- function et({
973
+ function Z({
953
974
  className: t,
954
975
  asChild: e = !1,
955
976
  showOnHover: s = !1,
956
977
  ...r
957
978
  }) {
958
979
  return /* @__PURE__ */ a(
959
- e ? P : "button",
980
+ e ? D : "button",
960
981
  {
961
982
  "data-slot": "sidebar-menu-action",
962
983
  "data-sidebar": "menu-action",
@@ -975,7 +996,7 @@ function et({
975
996
  }
976
997
  );
977
998
  }
978
- function Se({ className: t, ...e }) {
999
+ function ke({ className: t, ...e }) {
979
1000
  return /* @__PURE__ */ a(
980
1001
  "ul",
981
1002
  {
@@ -990,7 +1011,7 @@ function Se({ className: t, ...e }) {
990
1011
  }
991
1012
  );
992
1013
  }
993
- function Ce({
1014
+ function Re({
994
1015
  className: t,
995
1016
  ...e
996
1017
  }) {
@@ -1004,7 +1025,7 @@ function Ce({
1004
1025
  }
1005
1026
  );
1006
1027
  }
1007
- function Ne({
1028
+ function Ee({
1008
1029
  asChild: t = !1,
1009
1030
  size: e = "md",
1010
1031
  isActive: s = !1,
@@ -1012,7 +1033,7 @@ function Ne({
1012
1033
  ...n
1013
1034
  }) {
1014
1035
  return /* @__PURE__ */ a(
1015
- t ? P : "a",
1036
+ t ? D : "a",
1016
1037
  {
1017
1038
  "data-slot": "sidebar-menu-sub-button",
1018
1039
  "data-sidebar": "menu-sub-button",
@@ -1030,17 +1051,17 @@ function Ne({
1030
1051
  }
1031
1052
  );
1032
1053
  }
1033
- function j({ to: t, children: e, ...s }) {
1054
+ function K({ to: t, children: e, ...s }) {
1034
1055
  try {
1035
- return Rt(t), /* @__PURE__ */ a(_t, { to: t, ...s, children: e });
1056
+ return Et(t), /* @__PURE__ */ a(Bt, { to: t, ...s, children: e });
1036
1057
  } catch {
1037
1058
  return /* @__PURE__ */ a("a", { href: t, ...s, children: e });
1038
1059
  }
1039
1060
  }
1040
- function at({ ...t }) {
1061
+ function tt({ ...t }) {
1041
1062
  return /* @__PURE__ */ a("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...t });
1042
1063
  }
1043
- function st({ className: t, ...e }) {
1064
+ function et({ className: t, ...e }) {
1044
1065
  return /* @__PURE__ */ a(
1045
1066
  "ol",
1046
1067
  {
@@ -1053,7 +1074,7 @@ function st({ className: t, ...e }) {
1053
1074
  }
1054
1075
  );
1055
1076
  }
1056
- function rt({ className: t, ...e }) {
1077
+ function at({ className: t, ...e }) {
1057
1078
  return /* @__PURE__ */ a(
1058
1079
  "li",
1059
1080
  {
@@ -1063,14 +1084,14 @@ function rt({ className: t, ...e }) {
1063
1084
  }
1064
1085
  );
1065
1086
  }
1066
- function nt({
1087
+ function st({
1067
1088
  asChild: t,
1068
1089
  className: e,
1069
1090
  children: s,
1070
1091
  ...r
1071
1092
  }) {
1072
1093
  return /* @__PURE__ */ a(
1073
- t ? P : j,
1094
+ t ? D : K,
1074
1095
  {
1075
1096
  "data-slot": "breadcrumb-link",
1076
1097
  className: u("astw:hover:text-foreground astw:transition-colors", e),
@@ -1079,7 +1100,7 @@ function nt({
1079
1100
  }
1080
1101
  );
1081
1102
  }
1082
- function ke({
1103
+ function Be({
1083
1104
  children: t,
1084
1105
  className: e,
1085
1106
  ...s
@@ -1092,12 +1113,39 @@ function ke({
1092
1113
  "aria-hidden": "true",
1093
1114
  className: u("astw:[&>svg]:size-3.5", e),
1094
1115
  ...s,
1095
- children: t ?? /* @__PURE__ */ a(D, {})
1116
+ children: t ?? /* @__PURE__ */ a(z, {})
1096
1117
  }
1097
1118
  );
1098
1119
  }
1099
- const Be = (t, e) => {
1100
- const s = dt(e);
1120
+ function Ae(t, e) {
1121
+ const s = Q(e), r = [], n = (o, l) => {
1122
+ if (o.path.startsWith(":")) return;
1123
+ const d = `${l}/${o.path}`;
1124
+ r.push({
1125
+ path: d,
1126
+ title: s(o.meta.title, o.path),
1127
+ icon: o.meta.icon
1128
+ }), o.subResources && o.subResources.forEach((i) => n(i, d));
1129
+ };
1130
+ return t.forEach((o) => {
1131
+ o.path.startsWith(":") || (o.meta.menuItemClickable && r.push({
1132
+ path: o.path,
1133
+ title: s(o.meta.title, o.path),
1134
+ icon: o.meta.icon
1135
+ }), o.resources.forEach(
1136
+ (l) => n(l, o.path)
1137
+ ));
1138
+ }), r;
1139
+ }
1140
+ function Pe(t, e) {
1141
+ if (!e.trim()) return t;
1142
+ const s = e.toLowerCase();
1143
+ return t.filter(
1144
+ (r) => r.title.toLowerCase().includes(s) || r.path.toLowerCase().includes(s)
1145
+ );
1146
+ }
1147
+ const Le = (t, e) => {
1148
+ const s = Q(e);
1101
1149
  return t.reduce(
1102
1150
  (r, n) => {
1103
1151
  const o = s(n.meta.title, n.path);
@@ -1107,16 +1155,16 @@ const Be = (t, e) => {
1107
1155
  };
1108
1156
  const l = (d, i) => {
1109
1157
  !d || d.length === 0 || d.forEach((w) => {
1110
- const m = `${i}/${w.path}`, h = s(
1158
+ const h = `${i}/${w.path}`, f = s(
1111
1159
  w.meta.title,
1112
1160
  w.path
1113
1161
  );
1114
- r[m] = {
1115
- title: h,
1162
+ r[h] = {
1163
+ title: f,
1116
1164
  breadcrumbTitle: w.meta.breadcrumbTitle
1117
1165
  }, w.subResources && w.subResources.length > 0 && l(
1118
1166
  w.subResources,
1119
- m
1167
+ h
1120
1168
  );
1121
1169
  });
1122
1170
  };
@@ -1125,24 +1173,24 @@ const Be = (t, e) => {
1125
1173
  {}
1126
1174
  );
1127
1175
  };
1128
- function Pe(t, e, s, r) {
1129
- const n = t.split("/").filter((i) => i !== ""), o = e && n[0] === e ? n.slice(1) : n, l = Be(s, r), d = o.map((i, w) => {
1130
- const m = o.slice(0, w + 1).join("/");
1131
- let h = l[m];
1132
- if (!h) {
1133
- const v = Object.entries(l).find(
1134
- ([T]) => {
1135
- const _ = T.split("/").map((p) => p.startsWith(":") ? "[^/]+" : p).join("/");
1136
- return new RegExp(`^${_}$`).test(m);
1176
+ function De(t, e, s, r) {
1177
+ const n = t.split("/").filter((i) => i !== ""), o = e && n[0] === e ? n.slice(1) : n, l = Le(s, r), d = o.map((i, w) => {
1178
+ const h = o.slice(0, w + 1).join("/");
1179
+ let f = l[h];
1180
+ if (!f) {
1181
+ const m = Object.entries(l).find(
1182
+ ([g]) => {
1183
+ const x = g.split("/").map((p) => p.startsWith(":") ? "[^/]+" : p).join("/");
1184
+ return new RegExp(`^${x}$`).test(h);
1137
1185
  }
1138
1186
  )?.[1];
1139
- v && (h = v);
1187
+ m && (f = m);
1140
1188
  }
1141
- let g;
1142
- return h ? typeof h.breadcrumbTitle == "function" ? g = h.breadcrumbTitle(i) : typeof h.breadcrumbTitle == "string" ? g = h.breadcrumbTitle : g = h.title : g = decodeURIComponent(i), {
1189
+ let b;
1190
+ return f ? typeof f.breadcrumbTitle == "function" ? b = f.breadcrumbTitle(i) : typeof f.breadcrumbTitle == "string" ? b = f.breadcrumbTitle : b = f.title : b = decodeURIComponent(i), {
1143
1191
  segment: i,
1144
- path: m,
1145
- title: g
1192
+ path: h,
1193
+ title: b
1146
1194
  };
1147
1195
  });
1148
1196
  return {
@@ -1150,45 +1198,45 @@ function Pe(t, e, s, r) {
1150
1198
  segments: d
1151
1199
  };
1152
1200
  }
1153
- const Re = () => {
1154
- const { open: t } = I();
1155
- return /* @__PURE__ */ a("div", { className: t ? "astw:md:hidden" : void 0, children: /* @__PURE__ */ a(gt, { className: "astw:-ml-2.5" }) });
1156
- }, Qe = (t) => {
1157
- const e = t.children ? t.children({ Outlet: J }) : null, s = Gt(), r = () => {
1201
+ const Ie = () => {
1202
+ const { open: t } = _();
1203
+ return /* @__PURE__ */ a("div", { className: t ? "astw:md:hidden" : void 0, children: /* @__PURE__ */ a(ht, { className: "astw:-ml-2.5" }) });
1204
+ }, ia = (t) => {
1205
+ const e = t.children ? t.children({ Outlet: X }) : null, s = Xt(), r = () => {
1158
1206
  s.setTheme(s.theme === "dark" ? "light" : "dark");
1159
1207
  };
1160
- return /* @__PURE__ */ a(he, { className: "astw:flex astw:flex-col", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:flex-1", children: [
1208
+ return /* @__PURE__ */ a(be, { className: "astw:flex astw:flex-col", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:flex-1", children: [
1161
1209
  t.sidebar ?? /* @__PURE__ */ a(_e, {}),
1162
- /* @__PURE__ */ c(ge, { className: "astw:w-[calc(100%-var(--sidebar-width))]", children: [
1210
+ /* @__PURE__ */ c(ve, { className: "astw:w-[calc(100%-var(--sidebar-width))]", children: [
1163
1211
  /* @__PURE__ */ a("header", { className: "astw:flex astw:h-14 astw:shrink-0 astw:items-center astw:gap-2 astw:transition-[width,height] astw:ease-linear astw:group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:w-full astw:items-center astw:justify-between", children: [
1164
1212
  /* @__PURE__ */ c("div", { className: "astw:flex astw:items-center astw:gap-2", children: [
1165
- /* @__PURE__ */ a(Re, {}),
1166
- /* @__PURE__ */ a(Ie, {})
1213
+ /* @__PURE__ */ a(Ie, {}),
1214
+ /* @__PURE__ */ a(ze, {})
1167
1215
  ] }),
1168
- /* @__PURE__ */ a("div", { className: "astw:flex astw:items-center astw:gap-2", children: /* @__PURE__ */ a(B, { variant: "outline", size: "icon", onClick: r, children: /* @__PURE__ */ a(yt, {}) }) })
1216
+ /* @__PURE__ */ a("div", { className: "astw:flex astw:items-center astw:gap-2", children: /* @__PURE__ */ a(L, { variant: "outline", size: "icon", onClick: r, children: /* @__PURE__ */ a(pt, {}) }) })
1169
1217
  ] }) }),
1170
- /* @__PURE__ */ a("div", { className: "astw:flex astw:flex-col astw:gap-4", children: e ?? /* @__PURE__ */ a(J, {}) })
1218
+ /* @__PURE__ */ a("div", { className: "astw:flex astw:flex-col astw:gap-4", children: e ?? /* @__PURE__ */ a(X, {}) })
1171
1219
  ] })
1172
1220
  ] }) });
1173
1221
  }, _e = (t) => {
1174
- const { title: e, icon: s, navItems: r } = y(), { pathname: n } = it(), o = R(), l = /* @__PURE__ */ c(be, { children: [
1222
+ const { title: e, icon: s, navItems: r } = S(), { pathname: n } = ot(), o = R(), l = /* @__PURE__ */ c(xe, { children: [
1175
1223
  s,
1176
1224
  /* @__PURE__ */ a("h1", { className: "astw:text-sm astw:mb-2 astw:mt-2 astw:px-2", children: e })
1177
1225
  ] });
1178
1226
  return /* @__PURE__ */ c(pe, { variant: "inset", children: [
1179
1227
  /* @__PURE__ */ c("div", { className: "astw:flex astw:justify-between astw:items-center", children: [
1180
1228
  t.header ?? l,
1181
- /* @__PURE__ */ a("div", { className: "astw:hidden astw:md:block", children: /* @__PURE__ */ a(gt, { className: "astw:-ml-1" }) })
1229
+ /* @__PURE__ */ a("div", { className: "astw:hidden astw:md:block", children: /* @__PURE__ */ a(ht, { className: "astw:-ml-1" }) })
1182
1230
  ] }),
1183
- /* @__PURE__ */ a(fe, { children: /* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(xe, { children: r.map((i) => /* @__PURE__ */ a(
1184
- Xt,
1231
+ /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ne, { children: /* @__PURE__ */ a(Ce, { children: r.map((i) => /* @__PURE__ */ a(
1232
+ Yt,
1185
1233
  {
1186
1234
  asChild: !0,
1187
1235
  defaultOpen: i.isActive,
1188
- children: /* @__PURE__ */ c(ye, { children: [
1189
- i.url ? /* @__PURE__ */ c(N, { children: [
1190
- /* @__PURE__ */ a(tt, { asChild: !0, tooltip: i.title, children: /* @__PURE__ */ c(
1191
- j,
1236
+ children: /* @__PURE__ */ c(Se, { children: [
1237
+ i.url ? /* @__PURE__ */ c(B, { children: [
1238
+ /* @__PURE__ */ a(J, { asChild: !0, tooltip: i.title, children: /* @__PURE__ */ c(
1239
+ K,
1192
1240
  {
1193
1241
  to: i.url,
1194
1242
  className: i.url === n ? "astw:bg-sidebar-accent astw:font-medium" : void 0,
@@ -1198,29 +1246,29 @@ const Re = () => {
1198
1246
  ]
1199
1247
  }
1200
1248
  ) }),
1201
- !!i.items?.length && /* @__PURE__ */ a(Z, { asChild: !0, children: /* @__PURE__ */ c(et, { className: "astw:data-[state=open]:rotate-90", children: [
1202
- /* @__PURE__ */ a(D, {}),
1249
+ !!i.items?.length && /* @__PURE__ */ a(Y, { asChild: !0, children: /* @__PURE__ */ c(Z, { className: "astw:data-[state=open]:rotate-90", children: [
1250
+ /* @__PURE__ */ a(z, {}),
1203
1251
  /* @__PURE__ */ a("span", { className: "astw:sr-only", children: o("toggle") })
1204
1252
  ] }) })
1205
- ] }) : /* @__PURE__ */ a(N, { children: /* @__PURE__ */ c(Z, { className: "astw:flex astw:w-[100%] astw:[&[data-state=open]_.astw-rotate-target]:rotate-90", children: [
1206
- /* @__PURE__ */ a(tt, { asChild: !0, tooltip: i.title, children: /* @__PURE__ */ c("span", { className: "astw:flex astw:w-[100%]", children: [
1253
+ ] }) : /* @__PURE__ */ a(B, { children: /* @__PURE__ */ c(Y, { className: "astw:flex astw:w-[100%] astw:[&[data-state=open]_.astw-rotate-target]:rotate-90", children: [
1254
+ /* @__PURE__ */ a(J, { asChild: !0, tooltip: i.title, children: /* @__PURE__ */ c("span", { className: "astw:flex astw:w-[100%]", children: [
1207
1255
  i.icon,
1208
1256
  /* @__PURE__ */ a("span", { children: i.title })
1209
1257
  ] }) }),
1210
1258
  !!i.items?.length && /* @__PURE__ */ a(
1211
- et,
1259
+ Z,
1212
1260
  {
1213
1261
  className: "astw-rotate-target",
1214
1262
  asChild: !0,
1215
1263
  children: /* @__PURE__ */ c("span", { children: [
1216
- /* @__PURE__ */ a(D, {}),
1264
+ /* @__PURE__ */ a(z, {}),
1217
1265
  /* @__PURE__ */ a("span", { className: "astw:sr-only", children: o("toggle") })
1218
1266
  ] })
1219
1267
  }
1220
1268
  )
1221
1269
  ] }) }),
1222
- !!i.items?.length && /* @__PURE__ */ a(Yt, { children: /* @__PURE__ */ a(Se, { children: i.items?.map((w) => /* @__PURE__ */ a(Ce, { children: /* @__PURE__ */ a(Ne, { asChild: !0, children: /* @__PURE__ */ a(
1223
- j,
1270
+ !!i.items?.length && /* @__PURE__ */ a(Jt, { children: /* @__PURE__ */ a(ke, { children: i.items?.map((w) => /* @__PURE__ */ a(Re, { children: /* @__PURE__ */ a(Ee, { asChild: !0, children: /* @__PURE__ */ a(
1271
+ K,
1224
1272
  {
1225
1273
  to: w.url,
1226
1274
  className: w.url === n ? "astw:bg-sidebar-accent astw:font-medium" : void 0,
@@ -1233,189 +1281,286 @@ const Re = () => {
1233
1281
  )) }) }) }),
1234
1282
  t.footer ?? null
1235
1283
  ] });
1236
- }, Ee = () => {
1237
- const { configurations: t } = y(), e = it();
1238
- return Pe(
1284
+ }, Me = () => {
1285
+ const { configurations: t } = S(), e = ot();
1286
+ return De(
1239
1287
  e.pathname,
1240
1288
  t.basePath,
1241
1289
  t.modules,
1242
1290
  t.locale
1243
1291
  );
1244
- }, Ie = () => {
1245
- const { segments: t } = Ee(), e = Et("/:prefix/settings/:suffix"), s = R();
1246
- return e ? /* @__PURE__ */ a(at, { children: /* @__PURE__ */ a(st, { children: /* @__PURE__ */ a("div", { className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground", children: /* @__PURE__ */ a(rt, { children: /* @__PURE__ */ a(nt, { to: `/${e.params.prefix}/settings`, children: s("settings") }) }) }) }) }) : /* @__PURE__ */ a(at, { children: /* @__PURE__ */ a(st, { children: t.map((r, n) => /* @__PURE__ */ c(
1292
+ }, ze = () => {
1293
+ const { segments: t } = Me(), e = At("/:prefix/settings/:suffix"), s = R();
1294
+ return e ? /* @__PURE__ */ a(tt, { children: /* @__PURE__ */ a(et, { children: /* @__PURE__ */ a("div", { className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground", children: /* @__PURE__ */ a(at, { children: /* @__PURE__ */ a(st, { to: `/${e.params.prefix}/settings`, children: s("settings") }) }) }) }) }) : /* @__PURE__ */ a(tt, { children: /* @__PURE__ */ a(et, { children: t.map((r, n) => /* @__PURE__ */ c(
1247
1295
  "div",
1248
1296
  {
1249
1297
  className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground",
1250
1298
  children: [
1251
- /* @__PURE__ */ a(rt, { children: /* @__PURE__ */ a(nt, { to: r.path, children: r.title }) }),
1252
- n < t.length - 1 && /* @__PURE__ */ a(ke, {})
1299
+ /* @__PURE__ */ a(at, { children: /* @__PURE__ */ a(st, { to: r.path, children: r.title }) }),
1300
+ n < t.length - 1 && /* @__PURE__ */ a(Be, {})
1253
1301
  ]
1254
1302
  },
1255
1303
  n
1256
1304
  )) }) });
1257
- }, A = "oauth_pkce_verifier", L = "oauth_state", Ae = ({
1258
- apiEndpoint: t,
1259
- clientId: e,
1260
- state: s,
1261
- codeChallenge: r,
1262
- redirectUri: n
1263
- }) => {
1264
- const o = new URL(`${t}/oauth2/authorize`);
1265
- return o.searchParams.set("response_type", "code"), o.searchParams.set("client_id", e), o.searchParams.set(
1266
- "redirect_uri",
1267
- n ?? window.location.origin
1268
- ), o.searchParams.set("scope", "openid profile email"), o.searchParams.set("state", s), o.searchParams.set("code_challenge", r), o.searchParams.set("code_challenge_method", "S256"), o.toString();
1269
- }, Le = async ({
1270
- code: t,
1271
- returnedState: e,
1272
- apiEndpoint: s,
1273
- clientId: r,
1274
- redirectUri: n
1275
- }) => {
1276
- const o = sessionStorage.getItem(A), l = sessionStorage.getItem(L);
1277
- if (!t || !e || !o || !l) {
1278
- const i = [];
1279
- throw t || i.push("code"), e || i.push("returnedState"), o || i.push("code_verifier"), l || i.push("expectedState"), new Error(`Missing params: ${i.join(", ")}`);
1280
- }
1281
- if (e !== l)
1282
- throw new Error("State mismatch: possible CSRF attack");
1283
- const d = new URLSearchParams({
1284
- grant_type: "authorization_code",
1285
- client_id: r,
1286
- code: t,
1287
- redirect_uri: n ?? window.location.origin,
1288
- code_verifier: o
1305
+ };
1306
+ function Oe({
1307
+ ...t
1308
+ }) {
1309
+ return /* @__PURE__ */ a(v.Root, { "data-slot": "dialog", ...t });
1310
+ }
1311
+ function $e({
1312
+ ...t
1313
+ }) {
1314
+ return /* @__PURE__ */ a(v.Portal, { "data-slot": "dialog-portal", ...t });
1315
+ }
1316
+ function Ke({
1317
+ className: t,
1318
+ ...e
1319
+ }) {
1320
+ return /* @__PURE__ */ a(
1321
+ v.Overlay,
1322
+ {
1323
+ "data-slot": "dialog-overlay",
1324
+ className: u(
1325
+ "astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=open]:fade-in-0 astw:fixed astw:inset-0 astw:z-50 astw:bg-black/50",
1326
+ t
1327
+ ),
1328
+ ...e
1329
+ }
1330
+ );
1331
+ }
1332
+ function je({
1333
+ className: t,
1334
+ children: e,
1335
+ ...s
1336
+ }) {
1337
+ return /* @__PURE__ */ c($e, { "data-slot": "dialog-portal", children: [
1338
+ /* @__PURE__ */ a(Ke, {}),
1339
+ /* @__PURE__ */ c(
1340
+ v.Content,
1341
+ {
1342
+ "data-slot": "dialog-content",
1343
+ className: u(
1344
+ "astw:bg-background astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=open]:fade-in-0 astw:data-[state=closed]:zoom-out-95 astw:data-[state=open]:zoom-in-95 astw:fixed astw:top-[50%] astw:left-[50%] astw:z-50 astw:grid astw:w-full astw:max-w-[calc(100%-2rem)] astw:translate-x-[-50%] astw:translate-y-[-50%] astw:gap-4 astw:rounded-lg astw:border astw:p-6 astw:shadow-lg astw:duration-200 astw:sm:max-w-lg",
1345
+ t
1346
+ ),
1347
+ ...s,
1348
+ children: [
1349
+ e,
1350
+ /* @__PURE__ */ c(v.Close, { className: "astw:ring-offset-bg astw:focus:ring-ring astw:data-[state=open]:bg-accent astw:data-[state=open]:text-muted-foreground astw:absolute astw:top-4 astw:right-4 astw:rounded-xs astw:opacity-70 astw:transition-opacity astw:hover:opacity-100 astw:focus:ring-2 astw:focus:ring-offset-2 astw:focus:outline-hidden astw:disabled:pointer-events-none astw:[&_svg]:pointer-events-none astw:[&_svg]:shrink-0 astw:[&_svg:not([class*='size-'])]:size-4", children: [
1351
+ /* @__PURE__ */ a(rt, {}),
1352
+ /* @__PURE__ */ a("span", { className: "astw:sr-only", children: "Close" })
1353
+ ] })
1354
+ ]
1355
+ }
1356
+ )
1357
+ ] });
1358
+ }
1359
+ function Ue({
1360
+ className: t,
1361
+ ...e
1362
+ }) {
1363
+ return /* @__PURE__ */ a(
1364
+ v.Title,
1365
+ {
1366
+ "data-slot": "dialog-title",
1367
+ className: u("astw:text-lg astw:leading-none astw:font-semibold", t),
1368
+ ...e
1369
+ }
1370
+ );
1371
+ }
1372
+ function We({
1373
+ modules: t,
1374
+ locale: e,
1375
+ onNavigate: s
1376
+ }) {
1377
+ const [r, n] = T(!1), [o, l] = T(""), [d, i] = T(0), w = A(
1378
+ () => Ae(t, e),
1379
+ [t, e]
1380
+ ), h = A(
1381
+ () => Pe(w, o),
1382
+ [w, o]
1383
+ );
1384
+ C(() => {
1385
+ i(0);
1386
+ }, [h]), C(() => {
1387
+ r || (l(""), i(0));
1388
+ }, [r]);
1389
+ const f = O(
1390
+ (m) => {
1391
+ s(m.path), n(!1), l("");
1392
+ },
1393
+ [s]
1394
+ ), b = O(
1395
+ (m, g) => {
1396
+ if (!g)
1397
+ switch (m) {
1398
+ case "ArrowDown":
1399
+ i(
1400
+ (x) => x < h.length - 1 ? x + 1 : x
1401
+ );
1402
+ break;
1403
+ case "ArrowUp":
1404
+ i((x) => x > 0 ? x - 1 : x);
1405
+ break;
1406
+ case "Enter":
1407
+ h[d] && f(h[d]);
1408
+ break;
1409
+ }
1410
+ },
1411
+ [h, d, f]
1412
+ );
1413
+ return {
1414
+ open: r,
1415
+ setOpen: n,
1416
+ search: o,
1417
+ setSearch: l,
1418
+ selectedIndex: d,
1419
+ filteredRoutes: h,
1420
+ handleSelect: f,
1421
+ handleKeyDown: b
1422
+ };
1423
+ }
1424
+ function la() {
1425
+ const t = xt(null), { configurations: e } = S(), s = Pt(), r = R(), {
1426
+ open: n,
1427
+ setOpen: o,
1428
+ search: l,
1429
+ setSearch: d,
1430
+ selectedIndex: i,
1431
+ filteredRoutes: w,
1432
+ handleSelect: h,
1433
+ handleKeyDown: f
1434
+ } = We({
1435
+ modules: e.modules,
1436
+ locale: e.locale,
1437
+ onNavigate: s
1289
1438
  });
1290
- try {
1291
- const i = await fetch(`${s}/oauth2/token`, {
1292
- method: "POST",
1293
- headers: {
1294
- "Content-Type": "application/x-www-form-urlencoded",
1295
- Accept: "application/json",
1296
- "X-Tailor-Nonce": crypto.randomUUID()
1297
- },
1298
- credentials: "include",
1299
- body: d.toString()
1300
- }), { access_token: w } = await i.json();
1301
- return w;
1302
- } catch (i) {
1303
- throw new Error(
1304
- `Token exchange failed: ${i instanceof Error ? i.message : String(i)}`
1305
- );
1306
- }
1307
- }, Me = async () => {
1308
- const t = M.generateRandomCodeVerifier(), e = await M.calculatePKCECodeChallenge(t), s = M.generateRandomState();
1309
- return sessionStorage.setItem(A, t), sessionStorage.setItem(L, s), { codeChallenge: e, state: s };
1310
- }, Je = async ({
1311
- currentUrl: t,
1312
- apiEndpoint: e,
1313
- clientId: s,
1314
- redirectUri: r
1315
- }) => {
1316
- try {
1317
- const n = t.searchParams.get("code"), o = t.searchParams.get("state");
1318
- await Le({
1319
- apiEndpoint: e,
1320
- clientId: s,
1321
- code: n,
1322
- returnedState: o,
1323
- redirectUri: r
1324
- });
1325
- } catch (n) {
1326
- console.error(n);
1327
- } finally {
1328
- sessionStorage.removeItem(A), sessionStorage.removeItem(L), t.searchParams.delete("code"), t.searchParams.delete("state"), t.searchParams.delete("error"), t.searchParams.delete("error_description"), window.history.replaceState({}, document.title, t.toString());
1329
- }
1330
- }, bt = $(void 0), Ze = () => {
1331
- const t = F(bt);
1332
- if (t === void 0)
1333
- throw new Error(
1334
- "useBuiltinIdpAuth must be used within an BuiltinIdPAuthContextProvider"
1335
- );
1336
- return t;
1337
- }, ta = ({
1338
- apiEndpoint: t,
1339
- clientId: e,
1340
- redirectUri: s,
1341
- children: r
1342
- }) => {
1343
- const [n, o] = K(!1), l = Q(async () => {
1344
- const { codeChallenge: i, state: w } = await Me(), m = Ae({
1345
- apiEndpoint: t,
1346
- clientId: e,
1347
- codeChallenge: i,
1348
- state: w,
1349
- redirectUri: s
1350
- });
1351
- window.location.href = m;
1352
- }, [t, e, s]);
1353
- U(() => {
1354
- (async () => (await (await fetch(`${t}/query`, {
1355
- method: "POST",
1356
- headers: {
1357
- "Content-Type": "application/json",
1358
- "X-Tailor-Nonce": crypto.randomUUID()
1359
- },
1360
- credentials: "include",
1361
- // Include HTTP-only cookies
1362
- body: JSON.stringify({
1363
- query: "query Myself(){ me { id }}"
1364
- })
1365
- })).json()).data.me ? o(!0) : l())();
1366
- }, [t, l]);
1367
- const d = Q(async () => {
1368
- sessionStorage.removeItem(A), sessionStorage.removeItem(L);
1369
- try {
1370
- await fetch(`${t}/oauth2/revoke`, {
1371
- method: "POST",
1372
- headers: {
1373
- "Content-Type": "application/x-www-form-urlencoded",
1374
- "X-Tailor-Nonce": crypto.randomUUID()
1375
- },
1376
- credentials: "include",
1377
- body: ""
1378
- }), window.location.href = "/";
1379
- } catch (i) {
1380
- console.error(i);
1439
+ C(() => {
1440
+ t.current && t.current.querySelector(
1441
+ `[data-index="${i}"]`
1442
+ )?.scrollIntoView({ block: "nearest" });
1443
+ }, [i]);
1444
+ const b = O(
1445
+ (m) => {
1446
+ ["ArrowDown", "ArrowUp", "Enter"].includes(m.key) && m.preventDefault(), f(m.key, m.nativeEvent.isComposing);
1447
+ },
1448
+ [f]
1449
+ );
1450
+ return C(() => {
1451
+ const m = (g) => {
1452
+ (g.metaKey || g.ctrlKey) && g.key === "k" && (g.preventDefault(), o(!n));
1453
+ };
1454
+ return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
1455
+ }, [n, o]), /* @__PURE__ */ a(Oe, { open: n, onOpenChange: o, children: /* @__PURE__ */ c(
1456
+ je,
1457
+ {
1458
+ className: "astw:p-0 astw:gap-0 astw:max-w-lg astw:overflow-hidden",
1459
+ onKeyDown: b,
1460
+ "aria-describedby": void 0,
1461
+ children: [
1462
+ /* @__PURE__ */ a(Ue, { className: "astw:sr-only", children: r("commandPaletteSearch") }),
1463
+ /* @__PURE__ */ c("div", { className: "astw:flex astw:items-center astw:border-b astw:px-3", children: [
1464
+ /* @__PURE__ */ a(vt, { className: "astw:mr-2 astw:h-4 astw:w-4 astw:shrink-0 astw:opacity-50" }),
1465
+ /* @__PURE__ */ a(
1466
+ te,
1467
+ {
1468
+ value: l,
1469
+ onChange: (m) => d(m.target.value),
1470
+ placeholder: r("commandPaletteSearch"),
1471
+ className: "astw:flex astw:h-11 astw:w-full astw:rounded-md astw:bg-transparent astw:py-3 astw:text-sm astw:outline-none astw:border-0 astw:shadow-none astw:focus-visible:ring-0 astw:placeholder:text-muted-foreground astw:disabled:cursor-not-allowed astw:disabled:opacity-50",
1472
+ autoFocus: !0
1473
+ }
1474
+ )
1475
+ ] }),
1476
+ /* @__PURE__ */ a(
1477
+ "div",
1478
+ {
1479
+ ref: t,
1480
+ className: "astw:max-h-[300px] astw:overflow-y-auto astw:overflow-x-hidden",
1481
+ children: w.length === 0 ? /* @__PURE__ */ a("div", { className: "astw:py-6 astw:text-center astw:text-sm astw:text-muted-foreground", children: r("commandPaletteNoResults") }) : /* @__PURE__ */ a("div", { className: "astw:p-1", children: w.map((m, g) => /* @__PURE__ */ c(
1482
+ "button",
1483
+ {
1484
+ "data-index": g,
1485
+ onClick: () => h(m),
1486
+ className: u(
1487
+ "astw:relative astw:flex astw:w-full astw:cursor-pointer astw:select-none astw:items-center astw:gap-2 astw:rounded-sm astw:px-2 astw:py-1.5 astw:text-sm astw:outline-none",
1488
+ g === i ? "astw:bg-accent astw:text-accent-foreground" : "astw:hover:bg-accent astw:hover:text-accent-foreground"
1489
+ ),
1490
+ children: [
1491
+ m.icon && /* @__PURE__ */ a("span", { className: "astw:flex astw:h-4 astw:w-4 astw:items-center astw:justify-center astw:shrink-0 astw:[&_svg]:h-4 astw:[&_svg]:w-4", children: m.icon }),
1492
+ /* @__PURE__ */ a("span", { className: "astw:flex-1 astw:text-left astw:truncate", children: m.title }),
1493
+ /* @__PURE__ */ c("span", { className: "astw:text-xs astw:text-muted-foreground astw:truncate astw:max-w-[200px]", children: [
1494
+ "/",
1495
+ m.path
1496
+ ] })
1497
+ ]
1498
+ },
1499
+ m.path
1500
+ )) })
1501
+ }
1502
+ )
1503
+ ]
1381
1504
  }
1382
- }, [t]);
1505
+ ) });
1506
+ }
1507
+ const ft = j(null), da = (t) => {
1508
+ const e = A(
1509
+ () => Mt({
1510
+ clientId: t.clientId,
1511
+ appUri: t.apiEndpoint,
1512
+ redirectUri: t.redirectUri,
1513
+ meQuery: t.meQuery && (typeof t.meQuery == "string" ? t.meQuery : _t(t.meQuery))
1514
+ }),
1515
+ [t.clientId, t.apiEndpoint, t.redirectUri, t.meQuery]
1516
+ ), [s, r] = T(
1517
+ () => e.getState()
1518
+ );
1519
+ C(() => {
1520
+ t.autoLogin && (s.isLoading || s.isAuthenticated || (async () => await e.login())());
1521
+ }, [s.isLoading, s.isAuthenticated, t.autoLogin]), C(
1522
+ () => e.addEventListener((o) => {
1523
+ o.type === "auth_state_changed" && r(o.data);
1524
+ }),
1525
+ [e]
1526
+ );
1527
+ const n = t.guardComponent && (s.isLoading || !s.isAuthenticated) ? /* @__PURE__ */ a(t.guardComponent, {}) : t.children;
1383
1528
  return /* @__PURE__ */ a(
1384
- bt.Provider,
1529
+ ft.Provider,
1385
1530
  {
1386
- value: H(
1387
- () => ({
1388
- login: l,
1389
- logout: d
1390
- }),
1391
- [l, d]
1392
- ),
1393
- children: n ? r : null
1531
+ value: {
1532
+ authState: s,
1533
+ login: async () => e.login(),
1534
+ logout: async () => e.logout(),
1535
+ checkAuthStatus: async () => e.checkAuthStatus(),
1536
+ handleCallback: async () => e.handleCallback()
1537
+ },
1538
+ children: n
1394
1539
  }
1395
1540
  );
1541
+ }, ca = () => {
1542
+ const t = U(ft);
1543
+ if (!t)
1544
+ throw new Error("useAuth must be used within an AuthProvider");
1545
+ return t;
1396
1546
  };
1397
1547
  export {
1398
- Ye as AppShell,
1399
- ta as BuiltinIdPAuthProvider,
1548
+ oa as AppShell,
1549
+ da as AuthProvider,
1550
+ la as CommandPalette,
1400
1551
  _e as DefaultSidebar,
1401
- sa as Link,
1402
- L as OAUTH_STATE_KEY,
1403
- A as PKCE_VERIFIER_KEY,
1404
- Qe as SidebarLayout,
1405
- Ae as buildAuthorizationUrl,
1406
- Ot as defineI18nLabels,
1407
- Ge as defineModule,
1408
- Xe as defineResource,
1409
- Le as exchangeCodeForToken,
1410
- Je as handleOAuthCallback,
1411
- Me as prepareLogin,
1412
- qe as redirectToResource,
1413
- y as useAppShell,
1414
- Ze as useBuiltinIdpAuth,
1415
- ra as useLocation,
1416
- na as useNavigate,
1417
- oa as useParams,
1418
- ia as useRouteError,
1419
- la as useSearchParams,
1420
- Gt as useTheme
1552
+ ma as Link,
1553
+ ia as SidebarLayout,
1554
+ Kt as defineI18nLabels,
1555
+ ra as defineModule,
1556
+ na as defineResource,
1557
+ sa as redirectToResource,
1558
+ S as useAppShell,
1559
+ ca as useAuth,
1560
+ ha as useLocation,
1561
+ fa as useNavigate,
1562
+ ga as useParams,
1563
+ ba as useRouteError,
1564
+ pa as useSearchParams,
1565
+ Xt as useTheme
1421
1566
  };